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


Python RootPanel.RootPanel类代码示例

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


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

示例1: work

class FlowPanelDemo:
    """Demos the flow panel. Because of how the Flow Panel works, all elements have to be inline elements.
        Divs, tables, etc. can't be used, unless specified with CSS that they are inline or inline-block.

        Because of how Vertical Panels work (with tables), we use CSS to display tables as inline-blocks.
        IE, excluding IE8, doesn't support inline-blocks, so we have to use a CSS hack
        (see http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/ for more on the hack)
        However, we use spans instead of divs for the Label by providing an 'element' argument."""
       
    def __init__(self):
        self.root = RootPanel()
        #Flow panel taking up 70% of the page.  CSS centers it.
        self.flow = FlowPanel(Width="70%", StyleName='flow-panel')
       
       
        for x in range(0, 10):
            self.panel = VerticalPanel()
            #Label each image with its number in the sequence
            title = Label("Item %s" % x, element=DOM.createElement('span'), StyleName="title item")
            #Add a neat-o image.
            image = Image('images/pyjamas.png', Width="200px", Height="200px", StyleName="cat-image cat-item")
            #Add to the Vertical Panel the image title
            self.panel.add(title)
            self.panel.add(image)

            self.flow.add(self.panel)

        self.root.add(self.flow)
开发者ID:certik,项目名称:pyjamas,代码行数:28,代码来源:FlowPanel.py

示例2: newPositioner

 def newPositioner(self, context):
     
     # Use two widgets so that setPixelSize() consistently affects dimensions
     outer = SimplePanel() 
     outer.addStyleName(CSS_DRAGDROP_POSITIONER)
     
     # place off screen for border calculation
     RootPanel.get().add(outer, -500, -500) 
     
     # Ensure IE quirks mode returns valid outer.offsetHeight, and thus valid
     outer.setWidget(self.DUMMY_LABEL_IE_QUIRKS_MODE_OFFSET_HEIGHT)
     width = 0
     height = 0
     if isinstance(self.dropTarget,HorizontalPanel):
         for widget in context.selectedWidgets:
             width += widget.getOffsetWidth()
             height = Math.max(height, widget.getOffsetHeight())
     else:
         for widget in context.selectedWidgets:
             width = Math.max(width, widget.getOffsetWidth())
             height += widget.getOffsetHeight()
     inner = SimplePanel()
     inner.setPixelSize(
         width - DOMUtil.getHorizontalBorders(outer), height - DOMUtil.getVerticalBorders(outer))
     outer.setWidget(inner)
     return outer
开发者ID:pombredanne,项目名称:pyjamas-dnd,代码行数:26,代码来源:IndexedDropController.py

示例3: main

def main(init):
    root = RootPanel()
    container = FocusPanel()
    DeferredCommand.add(Focus(container))
    root.add(container)
    container.setSize(21*15,21*15)
    init(container)
开发者ID:bhuztez,项目名称:canvas-snake,代码行数:7,代码来源:webutils.py

示例4: main

def main():
    root = RootPanel()
    tree = Tree()
    cb1 = CheckBox('test 1')
    cb1.addClickListener(onCb1)
    root.add(cb1)
    cb2 = CheckBox('test 2')
    cb2.addClickListener(onCb2)
    item = TreeItem(cb2)
    tree.addItem(item)
    root.add(tree)
开发者ID:brodybits,项目名称:pyjs,代码行数:11,代码来源:TreeItemTest.py

示例5: makePositioner

 def makePositioner(self, reference):
     outer = SimplePanel() # Use two widgets so that setPixelSize() consistently affects dimensions
     outer.addStyleName(CSS_DRAGDROP_POSITIONER)
     outer.getElement().getStyle().setProperty("margin", "0px")
     RootPanel.get().add(outer, -500, -500) # place off screen for border calculation
     outer.setWidget(DUMMY_LABEL_IE_QUIRKS_MODE_OFFSET_HEIGHT) # Ensure IE quirks mode returns valid outer.offsetHeight, and thus valid
     inner = SimplePanel()
     inner.getElement().getStyle().setProperty("margin", "0px")
     inner.getElement().getStyle().setProperty("border", "none")
     offsetWidth = reference.getOffsetWidth() - DOMUtil.getHorizontalBorders(outer)
     offsetHeight = reference.getOffsetHeight() - DOMUtil.getVerticalBorders(outer)
     inner.setPixelSize(offsetWidth, offsetHeight)
     outer.setWidget(inner)
     return outer
开发者ID:pombredanne,项目名称:pyjamas-dnd,代码行数:14,代码来源:AbsolutePositionDropController.py

示例6: onModuleLoad

class MapProgram:
    def onModuleLoad( self ):
        self.setUpInstanceVariables()
        self.assemblePanels()
        self.setUpListeners()
        self.service.usernames( self.userNameReceiver )
        self.controlPanel.numPointsListBox.setSelectedIndex( 1 )
        self.service.shakeevents( 'Last Week', self.controlPanel.nameListBox.getValue( self.controlPanel.nameListBox.getSelectedIndex() ), self.shakeEventPointReceiver )


    def setUpInstanceVariables( self ):
        self.service = MapService()
        self.root = RootPanel()
        self.controlPanel = TopPanel()
        self.mapPanel = MapPanel()
        self.userNameReceiver = UserNameReceiver( self )
        #self.usgsPointReceiver = USGSPointReceiver(self)
        self.shakeEventPointReceiver = ShakeEventPointReceiver( self )
        self.markers = []

    def assemblePanels( self ):
        vp = VerticalPanel()
        vp.add( self.controlPanel )
        vp.add( self.mapPanel )
        self.root.add( vp )

    def setUpListeners( self ):
        npBox = self.controlPanel.numPointsListBox
        unBox = self.controlPanel.nameListBox
        def npFn():
            #self.service.points(npBox.getValue(npBox.getSelectedIndex()),self.usgsPointReceiver)
            self.controlPanel.statusHTML.setHTML( 'Fetching Points...' )
            self.service.shakeevents( npBox.getValue( npBox.getSelectedIndex() ), unBox.getValue( unBox.getSelectedIndex() ), self.shakeEventPointReceiver )
        npBox.addChangeListener( npFn )
        unBox.addChangeListener( npFn )

    def mouseOverMarker( self,ind ):
        Window.alert('test1')
        marker = self.markers[ind]
        iwo = InfoWindowOptions()
        iwo.position = marker['latlng']
        iwo.content = marker['title']
        Window.alert('test2')
        self.iw = InfoWindow( iwo )
        self.iw.open( self.mapPanel.map )

    def mouseOutMarker( self ):
        self.iw.close()
开发者ID:jackdreilly,项目名称:iShakeBackend,代码行数:48,代码来源:EventSimple.py

示例7: internalSetWidget

 def internalSetWidget(self, widget):
     # this.widget = widget;
     if widget == None or widget == RootPanel.get():
         self.widgetLeft = 0
         self.widgetTop = 0
     else:
         self.widgetLeft = widget.getAbsoluteLeft() - widget.getElement().getScrollLeft()
         self.widgetTop = widget.getAbsoluteTop() - widget.getElement().getScrollTop()
开发者ID:pombredanne,项目名称:pyjamas-dnd,代码行数:8,代码来源:WidgetLocation.py

示例8: onModuleLoad

class PanelApp:
    """ A generic multiple-panel web application.

        This class makes it easy to handle multiple panels within a web
        application.  Panels are shown as they are required.
    """
    def onModuleLoad(self):
        """ Dynamically build our user interface when the web page is loaded.
        """
        self._curPanelID = None # ID of currently-shown panel.
        self._root       = RootPanel()

        self._panels = self.createPanels()
        self.showPanel(self.getDefaultPanel())


    def showPanel(self, panelID):
        """ Show the panel with the given ID.
        """
        if panelID == self._curPanelID: return

        if self._curPanelID is not None:
            self._root.remove(self._panels[self._curPanelID])

        self._root.add(self._panels[panelID])
        self._curPanelID = panelID

    # ==============================
    # == METHODS TO BE OVERRIDDEN ==
    # ==============================

    def createPanels(self):
        """ Create the various panels to be used by this application.

            This should be overridden by the subclass to create the various
            panels the application will use.  Upon completion, the subclass
            should return a dictionary mapping the ID to use for each panel to
            the panel to be displayed.
        """
        Window.alert("Must be overridden.")


    def getDefaultPanel(self):
        """ Return the ID of the panel to show on system startup.
        """
        Window.alert("Must be overridden.")
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:46,代码来源:uiHelpers.py

示例9: newPositioner

 def newPositioner(self, context):
     # Use two widgets so that setPixelSize() consistently affects dimensions
     # excluding positioner border in quirks and strict modes
     SimplePanel outer = SimplePanel()
     outer.addStyleName(CSS_DRAGDROP_POSITIONER)
     
     # place off screen for border calculation
     RootPanel.get().add(outer, -500, -500)
     
     # Ensure IE quirks mode returns valid outer.offsetHeight, and thus valid
     # DOMUtil.getVerticalBorders(outer)
     outer.setWidget(DUMMY_LABEL_IE_QUIRKS_MODE_OFFSET_HEIGHT)
     
     int width = 0
     int height = 0
     if dropTarget instanceof HorizontalPanel:
         for Iterator iterator = context.selectedWidgets.iterator(); iterator.hasNext();:
开发者ID:jaredly,项目名称:pyjamas,代码行数:17,代码来源:IndexedDropController.py

示例10: setUpInstanceVariables

 def setUpInstanceVariables( self ):
     self.service = MapService()
     self.root = RootPanel()
     self.controlPanel = TopPanel()
     self.mapPanel = MapPanel()
     self.userNameReceiver = UserNameReceiver( self )
     #self.usgsPointReceiver = USGSPointReceiver(self)
     self.shakeEventPointReceiver = ShakeEventPointReceiver( self )
     self.markers = []
开发者ID:jackdreilly,项目名称:iShakeBackend,代码行数:9,代码来源:EventSimple.py

示例11: internalSetReference

 def internalSetReference(self, reference):
     # this.reference = reference;
     if reference == None or reference == RootPanel.get():
         self.referenceAdjustLeft = 0
         self.referenceAdjustTop = 0
     else:
         self.referenceAdjustLeft = \
             reference.getAbsoluteLeft() + DOMUtil.getBorderLeft(reference.getElement())
         self.referenceAdjustTop = \
             reference.getAbsoluteTop() + DOMUtil.getBorderTop(reference.getElement())
开发者ID:pombredanne,项目名称:pyjamas-dnd,代码行数:10,代码来源:WidgetLocation.py

示例12: onModuleLoad

 def onModuleLoad(self):
     slot = RootPanel("calendar")
     if slot is not None:
         calendar = SchoolCalendarWidget(15)
         slot.add(calendar)
         
         slot = RootPanel("days")
         if slot is not None:
             filterWidget = DayFilterWidget(calendar)
             slot.add(filterWidget)
开发者ID:anandology,项目名称:pyjamas,代码行数:10,代码来源:DynaTable.py

示例13: onModuleLoad

    def onModuleLoad(self):
        '''Create initial view of the panel.
        '''
        # Container that keeps everything
        self.panel = VerticalPanel()
        self.panel.setSpacing(10)

        # Create list of projects 
        proj_list = ListBox(Height='34px')
       
        proj_list.addItem('')
       
        proj_list.setVisibleItemCount(0)
        proj_list.addChangeListener(getattr(self, 'on_project_changed'))
        proj_list.setStyleName('form-control input-lg')
        
        self.proj_row = Form_Row('Select project',
                            proj_list,
                            help='project, status of which you want to report')
        
        # Project-specific container
        self.project_panel = VerticalPanel()

        # Submit report button
        self.submit_btn = Button('Submit report', getattr(self, 'send_data'))
        self.submit_btn.setStyleName('btn btn-primary btn-lg')
        self.submit_btn.setEnabled(False)

        self.msg_lbl = HTMLPanel('', Width='475px')

        # Add controls here
        self.panel.add(self.proj_row.panel())
        self.panel.add(self.project_panel)
        self.panel.add(Label(Height='20px'))
        self.panel.add(self.msg_lbl)
        btn_holder = HorizontalPanel()
        btn_holder.add(self.submit_btn)
        help_btn = HTMLPanel('')

        help_btn.setHTML(MODAL_PNL)
        btn_holder.add(Label(Width='10px'))
        btn_holder.add(help_btn)
        self.panel.add(btn_holder)
        
        self.root = RootPanel('report')
        self.root.add(self.panel)
开发者ID:mcsquaredjr,项目名称:Reports,代码行数:46,代码来源:form.py

示例14: onModuleLoad

    def onModuleLoad(self):
        '''Create initial view of the panel.
        '''
        # Container that keeps everything
        self.panel = VerticalPanel()
        self.panel.setSpacing(10)

        spacer1 = Label()
        spacer1.setHeight('10px')
        spacer2 = Label()
        spacer2.setHeight('10px')
        
        self.tbl_panel = VerticalPanel(Width='755px')
        # First is a row count
        self.grid = Reports_Grid()
        self.grid.create_grid(1, 4, ['Milestone Name', 'Milestone State', 'Start Date', 'End Date'])
        self.tbl_panel.add(self.grid)

        self.editor = Milestones_Editor()
        self.submit_btn = Button('Submit', getattr(self, 'send_data'))
        self.submit_btn.setStyleName('btn btn-primary btn-lg')

        hpanel = HorizontalPanel()
        hpanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
        hpanel.add(self.submit_btn)

        self.msg_lbl = HTMLPanel('', Width='755px')

        self.root = RootPanel('projects_')
        self.root.add(spacer1)
        self.root.add(self.editor.hpanel)
        self.root.add(spacer2)
        self.root.add(self.tbl_panel)

        spacer3 = Label()
        spacer3.setHeight('20px')

        self.root.add(self.msg_lbl)
        self.root.add(spacer3)
        self.root.add(hpanel)
        self.root.add(Label(Height='20px'))
        

        # Add listeners and initialize components
        self._add_listeners()
        self._iniate_states()
开发者ID:mcsquaredjr,项目名称:Reports,代码行数:46,代码来源:milestones.py

示例15: __init__

    def __init__(self):
        self.root = RootPanel()
        #Flow panel taking up 70% of the page.  CSS centers it.
        self.flow = FlowPanel(Width="70%", StyleName='flow-panel')
       
       
        for x in range(0, 10):
            self.panel = VerticalPanel()
            #Label each image with its number in the sequence
            title = Label("Item %s" % x, element=DOM.createElement('span'), StyleName="title item")
            #Add a neat-o image.
            image = Image('images/pyjamas.png', Width="200px", Height="200px", StyleName="cat-image cat-item")
            #Add to the Vertical Panel the image title
            self.panel.add(title)
            self.panel.add(image)

            self.flow.add(self.panel)

        self.root.add(self.flow)
开发者ID:certik,项目名称:pyjamas,代码行数:19,代码来源:FlowPanel.py


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