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

Python pyjamas.Window类代码示例

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

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



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


示例16: reduceterm

def reduceterm(sender, maxlines):
    """When the Reduce button is pressed: call cc.runfile with our input.

    There is a maximum number of lines that we will output, to prevent a
    stalling browser and an overfull document. The user can raise this limit
    with a link.
    """

    input = inputArea.getText()
    output = ""
    nlines = 0

    def catchoutput(s, end="\n"):
        output += s + end
        nlines += 1
        if nlines > maxlines:
            raise OverlongOutput()

    cc._defs = dict()
    try:
        cc.runfile(inputfile=io.StringIO(input), verbose=False, printout=catchoutput, printerr=catchoutput)
    except OverlongOutput:
        extra = FlowPanel(StyleName="terminated")
        extra.add(InlineLabel("Reduction terminated after %s lines. " % (maxlines,)))
        extra.add(Button("Try longer", functools.partial(queuereduce, maxlines=nextmaxlines(maxlines))))
        showOutput(output, extra=extra)
    except Exception, e:
        Window.alert(e)
开发者ID:ThreeLetterNames,项目名称:continuation-calculus-paper,代码行数:28,代码来源:cc_eval.py


示例17: swap

    def swap(self, x1, y1):
        if self.base.control_panel.start_button.state == "up":
            return None
        blank_pos = self.getBlankPos()
        x2 = blank_pos[0]
        y2 = blank_pos[1]

        flag = False
        if x1 == x2:
            if (y1 - y2) in [1, -1]:
                flag = True
        elif y1 == y2:
            if (x1 - x2) in [1, -1]:
                flag = True
        if flag == True:
            w = self.getWidget(x1, y1)
            c = Cell(w.no, "images/button_%s.jpg" % w.no, "images/button_%s_down.jpg" % w.no)
            c.addMouseListener(CellListener())
            c.x = x2
            c.y = y2
            c.screen = self
            self.setWidget(x2, y2, c)
            self.clearCell(x1, y1)
            self.incrCount()

        if self.complete():
            Window.alert("Bingo!!!.. You won the game.. Congrats..")
开发者ID:vijayendra,项目名称:Puzzle-Game,代码行数:27,代码来源:Puzzle.py


示例18: __init__

 def __init__(self, key, title, content):
     AbsolutePanel.__init__(self)
     self.edit_header = Label("Edit a Post", StyleName="header_label")
     self.edit_title_label = Label("Title:")
     self.edit_title = TextBox()
     self.edit_title.setMaxLength(255)
     self.edit_content = TextArea()
     self.edit_content.setVisibleLines(2)
     self.edit_button = Button("Save")
     self.edit_cancel_button = Button("Cancel")
     self.edit_hidden_key = Hidden()
     self.error_message_label = Label("", StyleName="error_message_label")
     edit_contents = VerticalPanel(StyleName="Contents", Spacing=4)
     edit_contents.add(self.edit_header)
     edit_contents.add(self.edit_title_label)
     edit_contents.add(self.edit_title)
     edit_contents.add(self.edit_content)
     edit_contents.add(self.edit_button)
     edit_contents.add(self.edit_cancel_button)
     edit_contents.add(self.error_message_label)
     edit_contents.add(self.edit_hidden_key)
     self.edit_dialog = DialogBox(glass=True)
     self.edit_dialog.setHTML('<b>Blog Post Form</b>')
     self.edit_dialog.setWidget(edit_contents)
     left = (Window.getClientWidth() - 900) / 2 + Window.getScrollLeft()
     top = (Window.getClientHeight() - 600) / 2 + Window.getScrollTop()
     self.edit_dialog.setPopupPosition(left, top)
     self.edit_dialog.hide()
开发者ID:Afey,项目名称:pyjs,代码行数:28,代码来源:components.py


示例19: onMouseDown

 def onMouseDown(self, sender, x, y):
   rx = x + Window.getScrollLeft()
   ry = y + Window.getScrollTop()
   if self.classify:
     self.PointList.append( Point(rx, ry, -1 ) )
   else:
     self.PointList.append( Point(rx, ry, len(self.color)-1) )
开发者ID:victormatheus,项目名称:opf-gui,代码行数:7,代码来源:opf-gui.py


示例20: onClick

 def onClick(self, sender=None):
     self.setFocus(True);
     # work out the relative position of cursor
     event = DOM.eventGetCurrentEvent()
     mouse_x = DOM.eventGetClientX(event) + Window.getScrollLeft()
     mouse_y = DOM.eventGetClientY(event) + Window.getScrollTop()
     self.moveControl(mouse_x - self.getAbsoluteLeft(),
                      mouse_y - self.getAbsoluteTop())
开发者ID:emk,项目名称:pyjamas,代码行数:8,代码来源:Controls.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python JSONService.JSONProxy类代码示例发布时间:2022-05-25
下一篇:
Python pyjamas.History类代码示例发布时间: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