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


Python History.getToken方法代码示例

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


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

示例1: onModuleLoad

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

示例2: createPage

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

示例3: __init__

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

示例4: cast_off

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

示例5: setChapters

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

示例6: __init__

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

示例7: onModuleLoad

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

示例8: onModuleLoad

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

示例9: onHistoryChanged

# 需要导入模块: from pyjamas import History [as 别名]
# 或者: from pyjamas.History import getToken [as 别名]
 def onHistoryChanged(self):
     self.setContentActive(History.getToken())
开发者ID:anthonyrisinger,项目名称:aur-pyjs,代码行数:4,代码来源:Aur.py

示例10: onTabSelected

# 需要导入模块: from pyjamas import History [as 别名]
# 或者: from pyjamas.History import getToken [as 别名]
 def onTabSelected(self, sender, tabIndex):
     current_token = History.getToken()
     new_token = self.page_list[tabIndex][0]
     if current_token != new_token:
         History.newItem(new_token) 
开发者ID:brodybits,项目名称:pyjs.org,代码行数:7,代码来源:website.py

示例11: drawControl

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

示例12: drawFull

# 需要导入模块: from pyjamas import History [as 别名]
# 或者: from pyjamas.History import getToken [as 别名]
    def drawFull(self, month, year):
        # should be called only once when we draw the calendar for the first time
        #
        self.vp = VerticalPanel()
        self.vp.setSpacing(2)
        self.vp.addStyleName("calendarbox calendar-module calendar")
        self.setWidget(self.vp)
        self.setVisible(False)
        #
        mth = int(month)
        yr = int(year)

        tp = HorizontalPanel()
        tp.addStyleName("calendar-top-panel")
        tp.setSpacing(5)

        h1 = Hyperlink("<<", targetHistoryToken=History.getToken())
        h1.addClickListener(getattr(self, "onPreviousYear"))
        h2 = Hyperlink("<", targetHistoryToken=History.getToken())
        h2.addClickListener(getattr(self, "onPreviousMonth"))
        h4 = Hyperlink(">", targetHistoryToken=History.getToken())
        h4.addClickListener(getattr(self, "onNextMonth"))
        h5 = Hyperlink(">>", targetHistoryToken=History.getToken())
        h5.addClickListener(getattr(self, "onNextYear"))

        tp.add(h1)
        tp.add(h2)

        # titlePanel can be changed, whenever we draw, so keep the reference

        self.titlePanel = SimplePanel()
        self.titlePanel.setWidget(HTML("<b>" + self.getMonthsOfYear()[mth - 1] + " " + str(yr) + "</b>"))
        self.titlePanel.setStyleName("calendar-center")

        tp.add(self.titlePanel)
        tp.add(h4)
        tp.add(h5)
        tvp = VerticalPanel()
        tvp.setSpacing(10)
        tvp.add(tp)

        self.vp.add(tvp)

        # done with top panel

        self.middlePanel = SimplePanel()
        grid = self.drawGrid(mth, yr)
        self.middlePanel.setWidget(grid)
        self.vp.add(self.middlePanel)
        self.defaultGrid = grid
        #
        # some links & handlers
        #
        bh1 = Hyperlink(self.yesterday, targetHistoryToken=History.getToken())
        bh1.addClickListener(getattr(self, "onYesterday"))
        bh2 = Hyperlink(self.today, targetHistoryToken=History.getToken())
        bh2.addClickListener(getattr(self, "onToday"))
        bh3 = Hyperlink(self.tomorrow, targetHistoryToken=History.getToken())
        bh3.addClickListener(getattr(self, "onTomorrow"))
        bh4 = Hyperlink(self.cancel, targetHistoryToken=History.getToken())
        bh4.addClickListener(getattr(self, "onCancel"))
        #
        # add code to test another way of doing the layout
        #
        b = HorizontalPanel()
        b.add(bh1)
        b.add(bh2)
        b.add(bh3)
        b.addStyleName("calendar-shortcuts")
        self.vp.add(b)
        b2 = SimplePanel()
        b2.add(bh4)
        b2.addStyleName("calendar-cancel")
        self.vp.add(b2)

        self.setVisible(True)
        return
开发者ID:jaredly,项目名称:pyjamas,代码行数:79,代码来源:Calendar.py

示例13: showDL

# 需要导入模块: from pyjamas import History [as 别名]
# 或者: from pyjamas.History import getToken [as 别名]
 def showDL(self):
     Window.alert(History.getToken())
开发者ID:Afey,项目名称:pyjs,代码行数:4,代码来源:deepLink.py


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