本文整理匯總了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)
示例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
示例3: main
def main(init):
root = RootPanel()
container = FocusPanel()
DeferredCommand.add(Focus(container))
root.add(container)
container.setSize(21*15,21*15)
init(container)
示例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)
示例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
示例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()
示例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()
示例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.")
示例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();:
示例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 = []
示例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())
示例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)
示例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)
示例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()
示例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)