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


Python Window.getLocation方法代码示例

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


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

示例1: replaceLinks

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getLocation [as 别名]
 def replaceLinks(self, tagname="a"):
     """ replaces <tag href="#pagename">sometext</tag> with:
         Hyperlink("sometext", "pagename")
     """
     tags = self.findTags(tagname)
     pageloc = Window.getLocation()
     pagehref = pageloc.getPageHref()
     for el in tags:
         href = el.href
         l = href.split("#")
         if len(l) != 2:
             continue
         if l[0] != pagehref:
             continue
         token = l[1]
         if not token:
             continue
         html = DOM.getInnerHTML(el)
         parent = DOM.getParent(el)
         index = DOM.getChildIndex(parent, el)
         hl = Hyperlink(TargetHistoryToken=token,
                        HTML=html,
                        Element=DOM.createSpan())
         DOM.insertChild(parent, hl.getElement(), index)
         self.children.insert(index, hl)
         parent.removeChild(el)
开发者ID:Afey,项目名称:pyjs,代码行数:28,代码来源:HTMLLinkPanel.py

示例2: __init__

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getLocation [as 别名]
    def __init__(self, topPanel):
        TickeryTab.__init__(self, topPanel)
        # Get query names (if they exist) from the request. We don't check
        # that we're the wanted tab: if 2 names are given, just use them.
        args = Window.getLocation().getSearchDict()
        name1 = args.get("name1")
        name2 = args.get("name2")

        if name1 and name2:
            self.autoActivate = True

        if name1:
            name1 = urllib.unquote_plus(name1)
        else:
            name1 = _defaultName1

        if name2:
            name2 = urllib.unquote_plus(name2)
        else:
            name2 = _defaultName2

        v1 = VerticalPanel()
        self.name1 = text.TextBoxFocusHighlight(
            Text=name1, MaxLength=self.textBoxLength, VisibleLength=self.textBoxLength, StyleName="simple-query-box"
        )
        v1.add(self.name1)
        self.followResult1 = HorizontalPanel(Spacing=4)
        v1.add(self.followResult1)

        v2 = VerticalPanel()
        self.name2 = text.TextBoxFocusHighlight(
            Text=name2, MaxLength=self.textBoxLength, VisibleLength=self.textBoxLength, StyleName="simple-query-box"
        )
        v2.add(self.name2)
        self.followResult2 = HorizontalPanel(Spacing=4)
        v2.add(self.followResult2)

        self.goButton = go.GoButton(self)

        v = VerticalPanel(Spacing=2, StyleName="help-panel")
        v.add(HTML("Enter two Twitter usernames", StyleName="simple-instructions"))
        v.add(v1)
        h = HorizontalPanel()
        h.add(v2)
        h.add(self.goButton)
        v.add(h)

        self.topGrid.setWidget(0, 1, v)
        formatter = self.topGrid.getCellFormatter()
        formatter.setHorizontalAlignment(0, 1, "left")

        self.checkResult = HorizontalPanel()
        self.add(self.checkResult)

        self.results = userlist.UserListPanel(self, topPanel)
        self.add(self.results)

        # allow keypress ENTER reaction
        self.name1.addKeyboardListener(self)
        self.name2.addKeyboardListener(self)
开发者ID:jdunck,项目名称:Tickery,代码行数:62,代码来源:simple.py

示例3: onModuleLoad

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getLocation [as 别名]
	def onModuleLoad(self):
		#Setup JSON RPC
                self.app_info = {}
		self.remote = DataService()

                # parse get data
		self.location = Window.getLocation().getHref()
		self.locLabel = Label(str(self.location))
		self.getData = self.location.split('?')
		self.getData = self.getData[len(self.getData)-1].split('&') #now an array of get data
		self.table_width = 800
		
		self.query = self.getData[1].split('=')[1]
		self.cat = self.getData[0].split('=')[1]

		#s = self.remote.testT()
		self.mainPanel = VerticalPanel()
		self.html_title = HTML("<h1>Search Results for books with %s containing \"%s\"</h1>" % (self.cat, self.query))
		self.SellList = FlexTable()
		
		#self.mainPanel.add(self.SellList)
		self.mainPanel.add(self.html_title)
		#self.mainPanel.add(self.locLabel)
		self.results = []
		self.remote.get_search_results(self,self.cat, self.query)
		RootPanel("results").add(self.mainPanel)
开发者ID:cy245,项目名称:TextbookConnect,代码行数:28,代码来源:search_resultst.py

示例4: onModuleLoad

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

        img_url = Window.getLocation().getSearchVar("img")
        if not img_url:
            img_url = 'images/chrome_clock.png'
        self.solar = SolarCanvas(img_url)
        
        RootPanel().add(self.solar)
        self.onShow()
开发者ID:anandology,项目名称:pyjamas,代码行数:11,代码来源:Widgets.py

示例5: onTimer

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getLocation [as 别名]
 def onTimer(self):
     print "hello"
     loc = Window.getLocation()
     print loc.getHash()
     print loc.getHost()
     print loc.getPageHref()
     print loc.getPathname()
     print loc.getSearchDict()
     Window.resize(300.0, 200.0)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:11,代码来源:Hello.py

示例6: AppInit

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getLocation [as 别名]
def AppInit():

    img_url = Window.getLocation().getSearchVar("img")
    if not img_url:
        img_url = 'images/chrome_clock.png'
    solar = SolarCanvas(img_url)
    
    solar.isActive = True
    solar.onTimer()

    return solar
开发者ID:anandology,项目名称:pyjamas,代码行数:13,代码来源:Widgets.py

示例7: onSave

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getLocation [as 别名]
 def onSave(self):
     """
     Handle the save click and pass it onto the listeners.
     """
     log.writebr("onSave() in %s", Window.getLocation().getHref())
     for listener in self.saveListeners:
         if hasattr(listener, "onSave"):
             listener.onSave(self)
         else:
             listener(self)
     return False
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:13,代码来源:RichTextEditor.py

示例8: setDefaultTab

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getLocation [as 别名]
 def setDefaultTab(self):
     args = Window.getLocation().getSearchDict()
     wantedTab = args.get('tab', self.simple.tabName).lower()
         
     if wantedTab == self.intermediate.tabName:
         self.selectTab(1)
     elif wantedTab == self.advanced.tabName:
         self.selectTab(2)
     elif wantedTab == self.about.tabName:
         self.selectTab(3)
     else:
         self.selectTab(0)
开发者ID:jdunck,项目名称:Tickery,代码行数:14,代码来源:tabs.py

示例9: __init__

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getLocation [as 别名]
    def __init__(self):
        SimplePanel.__init__(self, StyleName='main-panel')
        self.setWidth('100%')
        self.tabs = tabs.Tabs()
        self.tabs.addTabListener(self)
        self.add(self.tabs)
        
        Window.addWindowResizeListener(self)
        DeferredCommand.add(self)

        args = Window.getLocation().getSearchDict()
        userlist.setSortKey(args.get('sort'))        
        userlist.setIconSize(args.get('icons'))        
开发者ID:jdunck,项目名称:Tickery,代码行数:15,代码来源:index.py

示例10: __init__

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getLocation [as 别名]
    def __init__(self, topPanel):
        TickeryTab.__init__(self, topPanel)
        # Get the query string and wanted tab, if any, from URL args.
        args = Window.getLocation().getSearchDict()
        query = args.get('query')
        wantedTab = args.get('tab')
        if wantedTab:
            wantedTab = wantedTab.lower()
        if query and wantedTab == self.tabName.lower():
            query = urllib.unquote_plus(query)
            self.autoActivate = True
        else:
            query = self.defaultQuery
            
        self.instructions.setHorizontalAlignment(HasAlignment.ALIGN_LEFT)
        self.instructions.setStyleName('instructions-popup')
        self.popup = InstructionBox(
            self.__class__.__name__, self.instructions)
        self.popup.setText(self.instructionsTitle)
        self.db = Button(HELP_TEXT, StyleName='help-button')
        self.db.addClickListener(self)

        huhId = HTMLPanel.createUniqueId()
        help = HTMLPanel('%s <span id="%s"></span>' %
                             (SHORT_INSTRUCTIONS[self.tabName], huhId),
                             StyleName='simple-instructions')
        help.add(self.db, huhId)
        
        self.goButton = go.GoButton(self)
        self.query = text.TextAreaFocusHighlight(Text=query,
                                                 VisibleLines=3,
                                                 StyleName='large-query-area')
        self.checkResult = HorizontalPanel(Spacing=4)
        
        mainGrid = Grid(2, 2, StyleName='tickery-tab-panel',
                        HorizontalAlignment=HasAlignment.ALIGN_LEFT)
        formatter = mainGrid.getCellFormatter()
        mainGrid.setWidget(0, 0, help)
        mainGrid.setWidget(1, 0, self.query)
        mainGrid.setWidget(1, 1, self.goButton)
        formatter.setHorizontalAlignment(0, 0, 'left')
        formatter.setHorizontalAlignment(1, 0, 'left')
        formatter.setAlignment(1, 1, 'left', 'bottom')
        self.topGrid.setWidget(0, 1, mainGrid)
        
        self.add(self.checkResult)
        self.results = userlist.UserListPanel(self, topPanel,
            HorizontalAlignment=HasAlignment.ALIGN_LEFT)
        self.add(self.results)
开发者ID:jdunck,项目名称:Tickery,代码行数:51,代码来源:tickerytab.py

示例11: __init_UI

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getLocation [as 别名]
    def __init_UI(self):
        ## Two-phase to mimic flex_ui class
        Window.addWindowCloseListener(self)

        self.ws_dh = WSdataHandler(self, self.callback)
        location = Window.getLocation()
        search = location.getSearch()[1:]
        params = '/'.join(search.split('&'))
        full_resource = self.resource + '/' + params
        self.ws = websocketclient.WebSocketClient(full_resource, self.ws_dh,
                                                  fallback=bool(self.fallback))
        self.ws.connect(self.server)

        self.php_dh = PHPdataHandler(self, self.callback)
        self.php_script = self.resource + '.php'
        if not isinstance(self.fallback, bool):
            self.php_script = self.fallback
开发者ID:sean-m-brennan,项目名称:pysysdevel,代码行数:19,代码来源:web_ui.py

示例12: __init__

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getLocation [as 别名]
    def __init__(self):
        url = Window.getLocation().getHref()

        variables = self.parse_url(url)

        if "assignmentId" not in variables.keys() or variables["assignmentId"] == "ASSIGNMENT_ID_NOT_AVAILABLE":
            self.accepted = False
        else:
            self.accepted = True

        # adds class variables if the hit is accepted

        if self.accepted == True:
            self.assignmentId = variables["assignmentId"]
            self.workerId = variables["workerId"]
            self.hitId = variables["hitId"]

        def is_standard_param(param):
            standard_params = ["assignmentId", "hitId", "workerId", "turkSubmitTo"]
            return param in standard_params

        self.params = dict((k, variables[k]) for k in variables.keys() if not is_standard_param(k))
开发者ID:ryancotterell,项目名称:Choban,代码行数:24,代码来源:MTurk.py

示例13: onModuleLoad

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getLocation [as 别名]
    def onModuleLoad(self):
        self.remote = DataService()

        # do JSON RPC calls
        self.remote.get_facebook_user(self)
        self.remote.get_app_info(self, "verify")

        # labels and banners
        self.html_verify_banner = HTML("<h1>Verify your NetID</h1>")
        self.html_confirm_banner = HTML("<h1>Confirming your NetID...</h1>")

        self.lbl_verify_text = Label("Please verify your account.")
        self.lbl_confirm_text = Label("Confirming Acount...")
        self.lbl_confirm_result = Label()

        # textboxes
        self.tb_verify_netid = TextBox()

        # hook up keyboard events
        send_confirmation_email = self.send_confirmation_email
        class Add_KeyboardHandler():
            def onKeyPress(self, sender, keycode, modifiers):
                if keycode == KEY_ENTER:
                    send_confirmation_email()
            def onKeyDown(self, sender, keycode, modifiers): return
            def onKeyUp(self, sender, keycode, modifiers): return
        self.kbh = Add_KeyboardHandler()
        self.tb_verify_netid.addKeyboardListener(self.kbh)

        # buttons
        self.btn_verify = Button("Verify!", self.send_confirmation_email)

        # NetID information form
        self.table_verify_netid = FlexTable()
        self.table_verify_netid.setText(0, 0, "NetID:")
        self.table_verify_netid.setWidget(0, 1, self.tb_verify_netid)
        self.table_verify_netid.setWidget(1, 1, self.btn_verify)

        # panels
        self.main_panel = VerticalPanel()

        # check get information, if present, verify, if not request form
        self.location = Window.getLocation().getHref()
        self.tmp = self.location.split('?')
        self.tmp = self.tmp[len(self.tmp) - 1].split("&")
        for e in self.tmp:
            get_var = e.split("=")
            if len(get_var) == 2:
                PageVerify.get_data[get_var[0]] = get_var[1]

        if "vk" in PageVerify.get_data:
            # we have request from verification email
            self.main_panel.add(self.html_confirm_banner)
            self.main_panel.add(self.lbl_confirm_text)
            self.main_panel.add(self.lbl_confirm_result)
            self.verify_user()
        else:
            self.main_panel.add(self.html_verify_banner)
            self.main_panel.add(self.lbl_verify_text)
            self.main_panel.add(self.table_verify_netid)
            
        self.main_panel.addStyleName("verify_panel")

        # add everything to root panel
        RootPanel("page_verify").add(self.main_panel)
开发者ID:cy245,项目名称:TextbookConnect,代码行数:67,代码来源:page_verify.py

示例14: onClose

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getLocation [as 别名]
 def onClose(self,env):
     Window.getLocation().setHref("http://www.google.com")
开发者ID:antialize,项目名称:djudge,代码行数:4,代码来源:main.py

示例15: onModuleLoad

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import getLocation [as 别名]
 def onModuleLoad(self):
     section = Window.getLocation().getSearchVar("section")
     if not section:
         self.loadChapters()
     else:
         loadSection(section)
开发者ID:Afey,项目名称:pyjs,代码行数:8,代码来源:Bookreader.py


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