• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pyjamas.History类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyjamas.History的典型用法代码示例。如果您正苦于以下问题:Python History类的具体用法?Python History怎么用?Python History使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了History类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: onBrowserEvent

 def onBrowserEvent(self, event):
     Widget.onBrowserEvent(self, event)
     event_type = DOM.eventGetType(event)
     if event_type == "click":
         DOM.eventPreventDefault(event)
         if self.targetHistoryToken is not None:
             History.newItem(self.targetHistoryToken)
开发者ID:Afey,项目名称:pyjs,代码行数:7,代码来源:Hyperlink.py


示例2: __init__

 def __init__(self, ):
     self.__init__._super()
     """
     Create showcase client.
     """
     History.addValueChangeHandler(self)
     self.outer.getElement().setId(u"ShowcaseClient")
     self.showcaseWrapper.getElement().setId(u"ShowcaseWrapper")
     self.horizontalSplit.setSpacing(10)
     self.showcaseWrapper.setWidth(u"700px")
     self.showcaseWrapper.addStyleName(u"showcaseWrapper")
     self.treeMenu.addStyleName(u"treeMenu")
     token = Window.Location.getHash()
     if token == None or u"".equals(token):
         self.doDisplayShowcase(self.__class__.DEFAULT_SHOW)
         self.showcaseWrapper.insert(self.createDefaultFrontpage(), 0)
     else:
         self.doDisplayShowcase(token)
     treeMenuWrapper = VerticalPanel()
     treeMenuWrapper.addStyleName(u"treeMenuWrapper")
     treeMenuWrapper.add(HTML(u"<h4>Methods: </h4>"))
     treeMenuWrapper.add(self.treeMenu)
     self.horizontalSplit.add(treeMenuWrapper) #  Add left + right column
     self.horizontalSplit.add(self.decorate(self.showcaseWrapper))
     self.outer.add(self.horizontalSplit)
     Xfbml.parse(self.outer)
     self.initWidget(self.outer)
开发者ID:pombredanne,项目名称:pygwt-facebook,代码行数:27,代码来源:ShowcaseClient.py


示例3: onModuleLoad

    def onModuleLoad(self):
        self.curInfo=''
        self.curSink=None
        self.description=HTML()
        self.sink_list=SinkList()
        self.panel=DockPanel()
        
        self.loadSinks()
        self.sinkContainer = DockPanel()
        self.sinkContainer.setStyleName("ks-Sink")

        vp=VerticalPanel()
        vp.setWidth("100%")
        vp.add(self.description)
        vp.add(self.sinkContainer)

        self.description.setStyleName("ks-Info")

        self.panel.add(self.sink_list, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")

        History.addHistoryListener(self)
        RootPanel().add(self.panel)
        RootPanel().add(Logger())

        #Show the initial screen.
        initToken = History.getToken()
        if len(initToken):
            self.onHistoryChanged(initToken)
        else:
            self.showInfo()
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:34,代码来源:KitchenSink.py


示例4: onTimer

 def onTimer(self, id):
     '''
     turn history listener on once all 'off' periods have completed 
     '''
     self.timer_count += 1
     if self.timer_count == 1:
         History.addHistoryListener(self)
开发者ID:anandology,项目名称:pyjamas,代码行数:7,代码来源:buoy.py


示例5: onSelection

 def onSelection(self, event):
     clickedLink = event.getSelectedItem()
     if clickedLink.getChildCount() == 0:
         if not self.apiClient.isSessionValid():
             Window.alert(u"Your session has expired")
             self.showcaseWrapper.clear()
         else:
             History.newItem(clickedLink.getText())
开发者ID:pombredanne,项目名称:pygwt-facebook,代码行数:8,代码来源:ShowcaseClient.py


示例6: __init__

    def __init__(self):
        HorizontalPanel.__init__(self)

        History.newItem("test")
        show = Button("Show deep link", self.showDL)
        setDL = Button("Set deep link to 'pyjamas'", self.setDL)
        self.add(setDL)
        self.add(show)
开发者ID:Afey,项目名称:pyjs,代码行数:8,代码来源:deepLink.py


示例7: createPage

    def createPage(self, title, purpose, text):
        #log.debug("create page %s %s %s", title, purpose, text)
        if purpose == 'faq':
            self.faq_pages[title] = text
            log.debug("%d %d", len(self.faq_pages), len(self.faq_list))
            #log.debug(self.faq_pages.keys())
            #log.debug(self.faq_list)
            if len(self.faq_pages) != len(self.faq_list):
                return
            faq = self.page_widgets['FAQ']
            for l in self.faq_list:
                question = l[0]
                answer = self.faq_pages[question]
                html = faq.getHTML()
                html += "<h3>%s</h3>\n" % question
                html += "\n%s\n\n" % answer
                faq.setHTML(html)
            html = "<div class='faq'>\n%s</div>\n" % html
            faq.setHTML(html)
            faq.replaceLinks(use_page_href=False)
            return

        if title == 'header':
            self.header.setHTML(text)
            return
        elif title == 'footer':
            self.footer.setHTML(text)
            return
        elif title == 'sidebar':
            self.sidebar.setHTML(text)
            return
        
        # Main content case - tabs etc.
        
        self.pages[title] = text
        if len(self.pages) != len(self.page_list):
            return
        self.page_widgets = {}
        self.tab_index = {}
        for (idx, l) in enumerate(self.page_list):
            title = l[0]
            text = self.pages[title]
            self.tab_index[title] = idx
            widget = HTMLLinkPanel(text)
            self.fTabs.add(widget, title, True)
            self.page_widgets[title] = widget
            if title == 'FAQ':
                HTTPRequest().asyncGet("faq/questions.txt",
                                       PageListLoader(self, "faq"))
            else:
                widget.replaceLinks(use_page_href=False)
        self.fTabs.selectTab(0)

        History.addHistoryListener(self)
        initToken = History.getToken()
        log.debug("initial token: '%s'", initToken)
        self.onHistoryChanged(initToken)
        self.fTabs.addTabListener(self)
开发者ID:brodybits,项目名称:pyjs.org,代码行数:58,代码来源:website.py


示例8: onLoad

 def onLoad(self):
     History.addHistoryListener(self)
     self.setContentProvider(None, home.provider)
     self.setContentProvider("/home", home.provider)
     self.setContentProvider("/account", underConstruction.provider)
     self.setContentProvider("/package", underConstruction.provider)
     self.setContentProvider("/package/search", searchResults.provider)
     self.setContentProvider("/user", underConstruction.provider)
     self.setContentProvider("/submit", underConstruction.provider)
     self.draw()
开发者ID:anthonyrisinger,项目名称:aur-pyjs,代码行数:10,代码来源:Aur.py


示例9: __init__

    def __init__(self):
        SimplePanel.__init__(self)

        History.addHistoryListener(self)

        vPanel = VerticalPanel()

        self.stateDisplay = Label()
        vPanel.add(self.stateDisplay)

        hPanel = HorizontalPanel(Spacing=5)
        hPanel.add(Hyperlink("State 1", False, "state number 1"))
        hPanel.add(Hyperlink("State 2", False, "state number 2"))

        vPanel.add(hPanel)
        self.add(vPanel)
开发者ID:andreyvit,项目名称:pyjamas,代码行数:16,代码来源:hyperlink.py


示例10: loadChapters

    def loadChapters(self):

        self.curInfo = ''
        self.curSink = None
        self.description = HTML()
        self.sink_list = SinkList()
        self.panel = DockPanel()
        
        self.loadSinks()
        self.sinkContainer = DockPanel()
        self.sinkContainer.setStyleName("ks-Sink")

        #self.nf = NamedFrame("section")
        #self.nf.setWidth("100%")
        #self.nf.setHeight("10000")

        height = Window.getClientHeight()

        self.sp = ScrollPanel(self.sinkContainer)
        #self.sp = VerticalSplitPanel()
        self.sp.setWidth("100%")
        self.sp.setHeight("%dpx" % (height-110))

        #self.sp.setTopWidget(self.sinkContainer)
        #self.sp.setBottomWidget(self.nf)
        #self.sp.setSplitPosition(10000) # deliberately high - max out.

        vp = VerticalPanel()
        vp.setWidth("100%")
        vp.setHeight("100%")
        vp.add(self.description)
        vp.add(self.sp)

        self.description.setStyleName("ks-Intro")

        self.panel.add(self.sink_list, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.sink_list,
                                            HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")
        self.panel.setCellHeight(vp, "100%")

        Window.addWindowResizeListener(self)

        History.addHistoryListener(self)
        RootPanel().add(self.panel)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:47,代码来源:Bookreader.py


示例11: __init__

    def __init__(self):
        self.remote = DataService()

        self.title = Label()
        self.h = WikiBox()
        self.t = TextArea()
        self.t.addKeyboardListener(self)
        self.t.addChangeListener(self)
        RootPanel().add(self.title)
        RootPanel().add(self.h)
        RootPanel().add(self.t)
        History.addHistoryListener(self)
        self.name = None
        initToken = History.getToken()
        if not (initToken and len(initToken)):
            initToken = 'welcomepage'
        self.onHistoryChanged(initToken)
开发者ID:brodybits,项目名称:pyjs,代码行数:17,代码来源:Wiki.py


示例12: _set_history_listener

    def _set_history_listener(self, on, on_period=251):
        '''
        pyjamas/library/pyjamas/History.py is checking every 250ms if URL has changed
        
        By default, BuoyService checks every 250+1ms before turning its listener back on.
        An initial call in BuoyService() set-up needs to set on_period to 1 for immediate listening

        Rapid UI-interaction can lead to multiple nested calls.
        A count is kept to control when to add/remove the sole history listener.
        If a count wasn't kept then History will wobble
        '''
        if on:
            self.timer = Timer(on_period, self)
        else:
            if self.timer_count == 1:
                History.removeHistoryListener(self)
            self.timer_count -= 1
开发者ID:anandology,项目名称:pyjamas,代码行数:17,代码来源:buoy.py


示例13: new_item

    def new_item(self, token):
        '''
        updates the current URL's hash token. 
        disables the calling of BuoyService's onHistoryChanged() when a Buoy adds a new item

        @param token: hash token
        @type token: string

        when an app is placed in a state by user interaction it calls Buoy.drop_anchor()
        which calls BuoyService.new_item(). The subsequent call to History.newItem() will call
        BuoyService.onHistoryChanged() but as the app is already in the correct state
        there is such requirement. So we smoother it by disabling BuoyService's history listener
        until after the new item is added. 
        '''
        self._set_history_listener(False)
        History.newItem(token)
        self._set_history_listener(True)
开发者ID:anandology,项目名称:pyjamas,代码行数:17,代码来源:buoy.py


示例14: show

    def show(self, info, affectHistory=None):
        if info == self.curInfo: return
        self.curInfo = info

        if self.curSink <> None:
            self.curSink.onHide()
            self.sinkContainer.remove(self.curSink)

        self.curSink = info.getInstance()
        self.sink_list.setSinkSelection(info.getName())
        self.description.setHTML(info.getDescription())

        if (affectHistory):
            History.newItem(info.getName())

        self.sinkContainer.add(self.curSink, DockPanel.CENTER)
        self.sinkContainer.setCellWidth(self.curSink, "100%")
        self.sinkContainer.setCellHeight(self.curSink, "100%")
        self.sinkContainer.setCellVerticalAlignment(self.curSink, HasAlignment.ALIGN_TOP)
        self.curSink.onShow()
开发者ID:brodybits,项目名称:pyjs,代码行数:20,代码来源:AddonsGallery.py


示例15: __init__

    def __init__(self, format="%d-%m-%Y"):
        self.format = format
        self.tbox = TextBox()
        self.tbox.setVisibleLength(10)
        # assume valid sep is - / . or nothing
        if format.find("-") >= 0:
            self.sep = "-"
        elif format.find("/") >= 0:
            self.sep = "/"
        elif format.find(".") >= 0:
            self.sep = "."
        else:
            self.sep = ""
        # self.sep = format[2] # is this too presumptious?
        self.calendar = Calendar()
        self.img = Image(self.icon_img)
        self.img.addStyleName(self.icon_style)
        self.calendarLink = HyperlinkImage(self.img, targetHistoryToken=History.getToken())
        self.todayLink = Hyperlink(self.today_text, targetHistoryToken=History.getToken())
        self.todayLink.addStyleName(self.today_style)
        #
        # lay it out
        #
        hp = HorizontalPanel()
        hp.setSpacing(2)
        vp = VerticalPanel()
        hp.add(self.tbox)
        vp.add(self.calendarLink)
        vp.add(self.todayLink)
        # vp.add(self.calendar)
        hp.add(vp)

        Composite.__init__(self)
        self.initWidget(hp)
        #
        # done with layout, so now set up some listeners
        #
        self.tbox.addFocusListener(self)  # hook to onLostFocus
        self.calendar.addSelectedDateListener(getattr(self, "onDateSelected"))
        self.todayLink.addClickListener(getattr(self, "onTodayClicked"))
        self.calendarLink.addClickListener(getattr(self, "onShowCalendar"))
开发者ID:jaredly,项目名称:pyjamas,代码行数:41,代码来源:Calendar.py


示例16: onModuleLoad

    def onModuleLoad(self):

        self.remote = DataService()

        #Show the initial screen.
        initToken = History.getToken()
        if initToken and len(initToken):
            if initToken == 'admin':
                RootPanel().add(WebPageEdit(self))
                return
        else:
            initToken = 'index'

        self.dock = DockPanel()
        self.dock.setWidth("100%")
        self.pages = {}
        self.current_page = None
        RootPanel().add(self.dock)

        History.addHistoryListener(self)
        self.onHistoryChanged(initToken)
开发者ID:Afey,项目名称:pyjs,代码行数:21,代码来源:WebPage.py


示例17: setChapters

    def setChapters(self, chapters):
        for l in chapters:
            name = l[0]
            desc = l[1]
            self.sink_list.addSink(Chapter.init(name, desc))

        #Show the initial screen.
        initToken = History.getToken()
        if len(initToken):
            self.onHistoryChanged(initToken)
        else:
            self.showInfo()
开发者ID:Afey,项目名称:pyjs,代码行数:12,代码来源:Bookreader.py


示例18: cast_off

    def cast_off(self):
        '''
        sets up notifications to call App when page history changes.

        @note: set-up Application's listeners and then call cast_off()
        which will fire off the appropriate events to your app.
        '''
        self.timer_count = 0
        self._set_history_listener(True, on_period=1)
        token = History.getToken()
        if len(token):
            self.onHistoryChanged(token)
开发者ID:anandology,项目名称:pyjamas,代码行数:12,代码来源:buoy.py


示例19: drawControl

def drawControl(container):
    bar = HorizontalPanel(ID='aur-search-bar', VerticalAlignment='middle')
    adv = HorizontalPanel(ID='aur-search-advanced', Visible=False)
    adv_toggle = Hyperlink(Text='Advanced', StyleName='aur-link-stateless aur-search-bar-advanced', TargetHistoryToken=History.getToken())
    query = TextBox(Text='enter search term...', StyleName='aur-search-bar-query')
    go = Button(HTML='Go', StyleName='aur-search-bar-submit')

    container.add(bar)
    container.add(adv)

    # slight workaround to make sure the 'Advanced' toggle doesn't change the page
    def updateAdvToken(token):
        adv_toggle.setTargetHistoryToken(token)
    obj = object()
    setattr(obj, 'onHistoryChanged', updateAdvToken)
    History.addHistoryListener(obj)

    # clickListener to toggle the advanced section
    def toggleAdv(sender):
        if adv.isVisible():
            adv.setVisible(False)
            query.setEnabled(True)
            adv_toggle.setText('Advanced')
        else:
            adv.setVisible(True)
            query.setEnabled(False)
            adv_toggle.setText('Basic')
    adv_toggle.addClickListener(toggleAdv)

    def doGo():
        History.newItem('/package/search')
    go.addClickListener(doGo)

    bar.add(Label('Search Criteria', StyleName='aur-search-bar-label'))
    bar.add(query)
    bar.add(go)
    bar.add(Button(HTML='Orphans', StyleName='aur-search-bar-submit'))
    bar.add(adv_toggle)

    drawAdvanced(adv)
开发者ID:anthonyrisinger,项目名称:aur-pyjs,代码行数:40,代码来源:Search.py


示例20: show

    def show(self, info, affectHistory):
        if info == self.curInfo: return
        self.curInfo = info

        log.writebr("showing " + info.getName())
        if self.curAlgorithm is not None:
            log.writebr("removing " + str(self.curAlgorithm))
            self.curAlgorithm.onHide()
            self.AlgorithmContainer.remove(self.curAlgorithm)

        self.curAlgorithm = info.getInstance()
        self.Algorithm_list.setAlgorithmSelection(info.getName())
        self.description.setHTML(info.getDescription())

        if (affectHistory):
            History.newItem(info.getName())

        self.AlgorithmContainer.add(self.curAlgorithm, DockPanel.CENTER)
        self.AlgorithmContainer.setCellWidth(self.curAlgorithm, "100%")
        self.AlgorithmContainer.setCellHeight(self.curAlgorithm, "100%")
        self.AlgorithmContainer.setCellVerticalAlignment(self.curAlgorithm, HasAlignment.ALIGN_TOP)
        self.curAlgorithm.onShow()
开发者ID:aprovodi,项目名称:mlServerCalculations,代码行数:22,代码来源:MLAlgorithms.py



注:本文中的pyjamas.History类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyjamas.Window类代码示例发布时间:2022-05-25
下一篇:
Python pyjamas.Factory类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap