当前位置: 首页>>代码示例>>Python>>正文


Python History.addHistoryListener方法代码示例

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


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

示例1: onTimer

# 需要导入模块: from pyjamas import History [as 别名]
# 或者: from pyjamas.History import addHistoryListener [as 别名]
 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,代码行数:9,代码来源:buoy.py

示例2: onModuleLoad

# 需要导入模块: from pyjamas import History [as 别名]
# 或者: from pyjamas.History import addHistoryListener [as 别名]
    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,代码行数:36,代码来源:KitchenSink.py

示例3: createPage

# 需要导入模块: from pyjamas import History [as 别名]
# 或者: from pyjamas.History import addHistoryListener [as 别名]
    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,代码行数:60,代码来源:website.py

示例4: onLoad

# 需要导入模块: from pyjamas import History [as 别名]
# 或者: from pyjamas.History import addHistoryListener [as 别名]
 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,代码行数:12,代码来源:Aur.py

示例5: __init__

# 需要导入模块: from pyjamas import History [as 别名]
# 或者: from pyjamas.History import addHistoryListener [as 别名]
    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,代码行数:18,代码来源:hyperlink.py

示例6: loadChapters

# 需要导入模块: from pyjamas import History [as 别名]
# 或者: from pyjamas.History import addHistoryListener [as 别名]
    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,代码行数:49,代码来源:Bookreader.py

示例7: __init__

# 需要导入模块: from pyjamas import History [as 别名]
# 或者: from pyjamas.History import addHistoryListener [as 别名]
    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,代码行数:19,代码来源:Wiki.py

示例8: onModuleLoad

# 需要导入模块: from pyjamas import History [as 别名]
# 或者: from pyjamas.History import addHistoryListener [as 别名]
    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,代码行数:23,代码来源:WebPage.py

示例9: drawControl

# 需要导入模块: from pyjamas import History [as 别名]
# 或者: from pyjamas.History import addHistoryListener [as 别名]
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,代码行数:42,代码来源:Search.py

示例10: onModuleLoad

# 需要导入模块: from pyjamas import History [as 别名]
# 或者: from pyjamas.History import addHistoryListener [as 别名]
    def onModuleLoad(self):

        dock = DockPanel()
        self.header = HTML(Width="100%", Height="270px")
        self.footer = HTML(Width="100%")
        self.sidebar = HTML(Width="200px", Height="100%", StyleName="sidebar")
        self.fTabs = DecoratedTabPanel(Size=("100%", "100%"),
                                       StyleName="tabs")

        #dp = DecoratorTitledPanel("Tabs", "bluetitle", "bluetitleicon",
        #              ["bluetop", "bluetop2", "bluemiddle", "bluebottom"])
        #dp.add(self.fTabs)

        dock.add(self.header, DockPanel.NORTH)
        dock.add(self.footer, DockPanel.SOUTH)
        dock.add(self.sidebar, DockPanel.EAST)
        dock.add(self.fTabs, DockPanel.CENTER)
        dock.setCellVerticalAlignment(self.fTabs, HasAlignment.ALIGN_TOP)
        #dock.setCellHorizontalAlignment(self.fTabs, HasAlignment.ALIGN_CENTER)
        dock.setCellWidth(self.header, "100%")
        dock.setCellHeight(self.header, "270px")
        dock.setCellWidth(self.footer, "100%")
        dock.setCellWidth(self.sidebar, "200px")

        History.addHistoryListener(self)
        initToken = History.getToken()
        #print "initial token", initToken

        RootPanel().add(dock)
        self.dock = dock

        self.loadPageList()

        Window.addWindowResizeListener(self)

        DeferredCommand.add(self)
开发者ID:anandology,项目名称:pyjamas,代码行数:38,代码来源:index.py

示例11: loadChapters

# 需要导入模块: from pyjamas import History [as 别名]
# 或者: from pyjamas.History import addHistoryListener [as 别名]
    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")

        self.sp = ScrollPanel(self.sinkContainer)
        #self.sp = VerticalSplitPanel()
        self.sp.setWidth("100%")
        self.sp.setHeight("100%")

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

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

        authors = [
            ("2008, 2009", "Kenneth Casson Leighton", "[email protected]")
        ]
        for years, name, email in authors:
            authors_html = \
            '&copy; %s <a href="mailto:%s">%s</a><br />' %\
            (years, email, name)
        authors_panel = HTML()
        authors_panel.setStyleName("ks-Authors")
        authors_panel.setHTML(authors_html[:-6])

        left_panel = DockPanel(Height="100%")
        left_panel.add(self.sink_list, DockPanel.NORTH)
        left_panel.add(authors_panel, DockPanel.SOUTH)

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

        self.panel.add(left_panel, 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)

        self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
开发者ID:Afey,项目名称:pyjs,代码行数:64,代码来源:Bookreader.py


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