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


Python pyjamas.Window类代码示例

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


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

示例1: createRightPanel

    def createRightPanel(self):
        span = self.stabPanel = SimplePanel(Height="100%")
        
        tabs = self.tabPanel = TabPanel(Width="100%", Border=1,Height="100%")
        
        
        adgui = self.adinfoPanel = AdinfoIFACE(self)
        tabs.add(adgui.panel, "AstroData Viewer")
        
        calsgui = self.calsPanel = CalsIFACE(self)
        tabs.add(calsgui.panel, "Calibrations")
        
        
        rsgui = RecipeSystemIFACE.ReducePanelIFACE(self)
        tabs.add(rsgui.panel, "Execute Reduce")

        rogui = RecipeSystemIFACE.ReduceOutputIFACE(self)
        tabs.add(rogui.panel, "Reduce Output")
        Window.addWindowResizeListener(rogui)
        
        tifs = self.tabIFACEs = [adgui, calsgui, rsgui, rogui]
        self.tabIFACEdict = {"adgui": tifs.index(adgui),
                            "calsgui": tifs.index(calsgui),
                            "rsgui": tifs.index(rsgui),
                            "rogui": tifs.index(rogui)}
        self.curTabIFACE = tifs[0]
        tabs.selectTab(0)
        
        span.add(tabs)
        
        
        tabs.addTabListener(self, getattr(self, "onTabSelected"))
        
        return span
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:34,代码来源:ADViewerIFACE.py

示例2: jumpsFromGregorian

	def jumpsFromGregorian(self, gregorianDate):
		"""
    	-   Obtention of Number of seconds ahead or before reference point
    	-   Calculation*:
        	-   Calculation of _Number of Cycle Jumps_ from reference point in number of seconds
		"""
		Window.alert(gregorianDate)
		gregorianDate = datetime.datetime(gregorianDate)
		Window.alert(isinstance(gregorianDate, datetime.datetime))
		Window.alert(gregorianDate)
		jumps = 0
		diff = datetime.datetime(gregorianDate) - datetime.datetime(self.referencePoint.START_DATE)
		Window.alert(diff.days)
		f = diff>0

		diff = math.abs(diff)
		while diff>0:
			jumps = jumps+1
			Window.alert(float(self.referencePoint.CREATION_SPEED))
			if f:
				"""original formula: (1*13/(self.referencePoint.SPEED*13^jumps))"""
				diff = diff - (1/(self.referencePoint.CREATION_SPEED*13^(jumps-1)))
			else:
				"""original formula: (1*13/(self.referencePoint.SPEED/13^jumps))"""
				diff = diff - (1/(self.referencePoint.CREATION_SPEED/13^(jumps+1)))

		return jumps
开发者ID:molhokwai,项目名称:libraries,代码行数:27,代码来源:Cycle.py

示例3: setPopupPosition

    def setPopupPosition(self, left, top):
        if isinstance(left, basestring):
            if left.endswith('%'):
                left = int(left[:-1])
                left = int(left * Window.getClientWidth() / 100)
            elif left.lower().endswith('px'):
                left = int(left[:-2])
        if isinstance(top, basestring):
            if top.lower().endswith('%'):
                top = int(top[:-1])
                top = int(top * Window.getClientHeight() / 100)
            elif top.endswith('px'):
                top = int(top[:-2])

        left = max(left, 0)
        top = max(top, 0)

        # Account for the difference between absolute position and the
        # body's positioning context.
        left -= DOM.getBodyOffsetLeft()
        top -= DOM.getBodyOffsetTop()

        element = self.getElement()
        DOM.setStyleAttribute(element, "left", "%dpx" % left)
        DOM.setStyleAttribute(element, "top", "%dpx" % top)
开发者ID:Afey,项目名称:pyjs,代码行数:25,代码来源:PopupPanel.py

示例4: onTitlesChanged

    def onTitlesChanged(self, titles):
        browser_title = ''
        for title in reversed(titles):
            browser_title += title + ' - '

        browser_title = browser_title[:-3]
        Window.setTitle(browser_title)
开发者ID:anandology,项目名称:pyjamas,代码行数:7,代码来源:Navigate.py

示例5: __init__

    def __init__(self, parent=None):

        Sink.__init__(self, parent)

        self.frame = Frame("/summary", Size=("100%",rccutil.getHeight()))
        self.initWidget(self.frame)
        Window.addWindowResizeListener(self)
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:7,代码来源:FITSStoreFACE.py

示例6: onModuleLoad

    def onModuleLoad(self):

        dock = DockPanel(Width="100%")
        self.header = HTML(Width="100%", Height="220px")
        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, "220px")
        dock.setCellWidth(self.footer, "100%")
        dock.setCellWidth(self.sidebar, "200px")

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

        self.loadPageList()

        Window.addWindowResizeListener(self)

        DeferredCommand.add(self)
开发者ID:brodybits,项目名称:pyjs.org,代码行数:31,代码来源:website.py

示例7: onError

 def onError(self, text):
     obj = JSONParser().decode(text)
     # Hack for 201 being seen as error
     if not obj['ok']:
         Window.alert(text)
     else:
         self.editor.reloadDocument()
开发者ID:CodeSturgeon,项目名称:slipcover,代码行数:7,代码来源:editor.py

示例8: onDrop

    def onDrop(self, event):
        dt = event.dataTransfer
        text = dt.getData('text')
        package = json.decode(text)
        x = DOM.eventGetClientX(event)
        y = DOM.eventGetClientY(event)
        scrollY = Window.getScrollTop()
        scrollX = Window.getScrollLeft()
        offsetX = int(package['offsetX'])
        offsetY = int(package['offsetY'])
        at = self.getAbsoluteTop()
        al = self.getAbsoluteLeft()
        posX, posY = x - (al - scrollX), y - (at - scrollY)
        w = DragWidget6(package['text'])
        self.add(w)
        makeDraggable(w)
        # firefox seems to be off-by-one in x.
        # firefox-specific code?
        #w.setStyleAttribute('left', posX - offsetX -1)
        w.setStyleAttribute('left', posX - offsetX)
        w.setStyleAttribute('top', posY - offsetY)
        w.removeStyleName('invisible')
        self.addMessage(
            "top:%s, left:%s, cy:%s cx:%s, sy:%s sx:%s dropy:%s dropx:%s" % (
            at, al, y, x, scrollY, scrollX, posY, posX))

        DOM.eventPreventDefault(event)
开发者ID:anandology,项目名称:pyjamas,代码行数:27,代码来源:DNDTest.py

示例9: onClick

    def onClick(self):

        if not self.survey.is_cookie_set() and self.mturk_input.accepted == True:
             if not self.survey.survey_filledout():
                 Window.alert("Please fill out the survey")
             else:

                 self.survey.set_cookie()

                 encoded_answers = []
                 for i,answer in enumerate(self.survey.get_answers()):
                     encoded_answers.append(("survey_answer%d" % i,answer))

                     

                 self.mturk_output.add_data(encoded_answers)
                 self.mturk_output.add_data(self.sentence_set.get_sentences())
                 self.mturk_output.add_data(self.sentence_set.get_masks())
                 self.mturk_output.add_data(self.sentence_set.get_annotations())
                 self.mturk_output.mturk_form.submit()
        else:
             self.mturk_output.add_data(self.sentence_set.get_sentences())
             self.mturk_output.add_data(self.sentence_set.get_masks())
             self.mturk_output.add_data(self.sentence_set.get_annotations())
             self.mturk_output.mturk_form.submit()
开发者ID:lukeorland,项目名称:Choban,代码行数:25,代码来源:Sentiment.py

示例10: onSubmit

 def onSubmit(self, event):
     # This event is fired just before the form is submitted. We can take
     # this opportunity to perform validation.
     print "onSubmit", event
     if (len(self.tb.getText()) == 0):
         Window.alert("The text box must not be empty")
         event.setCancelled()
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:7,代码来源:FormPanelExample.py

示例11: show_custom

    def show_custom(self):
        self.dialog = DialogBox(StyleName='custom-dialog')
        self.dialog.setHTML('Custom Settings')

        contents = VerticalPanel(StyleName='contents')
        self.dialog.setWidget(contents)

        # contents of contents
        rows = HorizontalPanel()
        columns = HorizontalPanel()
        bombs = HorizontalPanel()
        buttons = HorizontalPanel()

        ADD(contents, rows, columns, bombs, buttons)

        self.row = TextBox()
        ADD(rows, Label('Rows:'), self.row)

        self.column = TextBox()
        ADD(columns, Label('Columns:'), self.column)

        self.bomb = TextBox()
        ADD(bombs, Label('Bombs:'), self.bomb)

        ADD(buttons, Button("OK", getattr(self, 'new_game')), \
                     Button("Cancel", getattr(self, 'close_dialog')))

        left = (Window.getClientWidth() - 201) / 2
        top = (Window.getClientHeight() - 190) / 2
        self.dialog.setPopupPosition(left, top)

        self.dialog.show()
开发者ID:suzanshakya,项目名称:minesweeper,代码行数:32,代码来源:minesweeper.py

示例12: onClick

    def onClick(self, sender):
        if sender == self.newpage:
            self.todoId = None
            self.todoTextName.setText("")
            self.todoTextArea.setHTML("")
            return
        elif sender == self.view:
            name = self.todoTextName.getText()
            html = self.todoTextArea.getHTML()
            if not html:
                return
            p = HTMLDialog(name, html)
            p.setPopupPosition(10, 10)
            p.setWidth(Window.getClientWidth() - 40)
            p.setHeight(Window.getClientHeight() - 40)
            p.show()
            return
        elif sender == self.fDialogButton:
            Window.open(fileedit_url, "fileupload", "width=800,height=600")
            return
            dlg = FileDialog(fileedit_url)
            left = self.fDialogButton.getAbsoluteLeft() + 10
            top = self.fDialogButton.getAbsoluteTop() + 10
            dlg.setPopupPosition(left, top)
            dlg.show()

        id = self.remote.getPage(sender.getValue(sender.getSelectedIndex()), self)
        if id < 0:
            self.status.setHTML("Server Error or Invalid Response")
开发者ID:janjaapbos,项目名称:pyjs,代码行数:29,代码来源:WebPageEdit.py

示例13: __init__

    def __init__(self, app):
        DialogBox.__init__(self)
        self.app = app
        self.table=FlexTable()
        self.table.setText(0, 0, "Please enter username and password")
        self.table.getFlexCellFormatter().setColSpan(0, 0, 2)
        self.table.setText(1, 0, "Username")
        self.handle = TextBox()
        h = getCookie('handle')
        self.handle.setText(h)
        self.table.setWidget(1, 1, self.handle)
        self.table.setText(2, 0, "Password")
        self.pwd = PasswordTextBox()
        self.table.setWidget(2, 1, self.pwd)

        self.table.setHTML(3,0,"")
        self.table.getFlexCellFormatter().setColSpan(3, 0, 2)        
        h = HorizontalPanel()
        self.table.setWidget(4,0, h)
        self.table.getFlexCellFormatter().setColSpan(4, 0, 2)
        h.add(Button("Ok", getattr(self, "onOk")))
        h.add(Button("Cancel", getattr(self, "onClose")))
        h.setSpacing(4)
        self.setHTML("<b>Login</b>")
        self.setWidget(self.table)
        left = (Window.getClientWidth() - 200) / 2
        top = (Window.getClientHeight() - 100) / 2
        self.setPopupPosition(left,top)
开发者ID:antialize,项目名称:djudge,代码行数:28,代码来源:main.py

示例14: themesPanel

	def themesPanel(self, themes=None):
		Window.alert('line:111')
		themes = None
		if not themes: themes=['0','1', 'cms', 'pypress']

		vPanel = VerticalPanel()
		for i in range(len(themes)):
			"""
			a_n = location.getPathName().split('/')[1]
			lambda1 = lambda x: w_l.pathname.replace('/'+a_n+'/', '/'+x+'/')+'?theme='+x
        	lambda2 = lambda x: w_l.pathname.replace('/'+a_n+'/', '/a/')+'?theme='+x
			href = {
				'cms' : lambda1, 
				'pypress' : lambda1,
				'o' : lambda2, 
				'1' : lambda2 
			}.get(themes[i], lambda2)(themes[i])
			"""

			a=Button('theme '+themes[i], 
					lambda x: location.setSearchDict({'theme': x.getID()}), 
					StyleName='link')
			a.setID(themes[i])
			vPanel.add(a)
	
		return vPanel
开发者ID:molhokwai,项目名称:libraries,代码行数:26,代码来源:Index0.py

示例15: onRemoteResponse

    def onRemoteResponse(self, response, request_info):        
#        Window.alert(dir(request_info))
#        Window.alert(request_info.method)
#        Window.alert(request_info.handler)
#        time.sleep( 3 )
        Window.alert("inside MLAlgorithmService: compression is done")
        self.callback.loadImage(response)
开发者ID:aprovodi,项目名称:mlServerCalculations,代码行数:7,代码来源:MLAlgorithmService.py


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