本文整理汇总了Python中pyjamas.ui.HorizontalPanel.HorizontalPanel类的典型用法代码示例。如果您正苦于以下问题:Python HorizontalPanel类的具体用法?Python HorizontalPanel怎么用?Python HorizontalPanel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HorizontalPanel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
class Site:
def __init__(self):
# Record the image url for easy access
self.IMAGES_URL = "http://www.cse.nd.edu/~cmc/teaching/cse30332_sp15/images"
# The title label is intially empty but will be filled with the top
# recommended movie by the time the page is viewed
self.title_l = Label("", StyleName="teststyle")
self.up_b = Button("UP", post_vote)
self.down_b = Button("DOWN", post_vote)
self.rating_l = Label("", StyleName="teststyle")
self.img = Image("")
# Construct three vertical panels to make he display slightly columnar
self.leftVertPanel = VerticalPanel()
self.midlVertPanel = VerticalPanel()
self.riteVertPanel = VerticalPanel()
self.horizontalizer = HorizontalPanel()
# Add the buttons to the correct vertical panels!!!
self.midlVertPanel.add(self.title_l)
self.midlVertPanel.add(self.img)
self.midlVertPanel.add(self.rating_l)
self.riteVertPanel.add(self.down_b)
self.leftVertPanel.add(self.up_b)
# Add all the panels to the horizontal panel
self.horizontalizer.add(self.leftVertPanel)
self.horizontalizer.add(self.midlVertPanel)
self.horizontalizer.add(self.riteVertPanel)
# Add the horizontal panel to the vertical one
RootPanel().add(self.horizontalizer)
# Get the first recommendation
get_recommendation()
示例2: __init__
def __init__(self, SW, SH):
HorizontalPanel.__init__(self)
self.SW = SW
self.SH = SH
self.context = GWTCanvas(SW, SH, SW, SH)
self.context.addStyleName("gwt-canvas")
self.add(self.context)
示例3: onModuleLoad
def onModuleLoad(self):
self.TEXT_WAITING = "Waiting for response..."
self.TEXT_ERROR = "Server Error"
self.remote = JSONProxy("../api", ["hello"])
self.status = Label()
self.text_box = TextBox()
self.button_send = Button("Send", self)
buttons = HorizontalPanel()
buttons.add(self.button_send)
buttons.setSpacing(8)
info = """<h2>JSON-RPC Example</h2>
<p>This example demonstrates the calling of server services with
<a href="http://json-rpc.org/">JSON-RPC</a>.
</p>
<p>Enter your name below.</p>"""
panel = VerticalPanel()
panel.add(HTML(info))
panel.add(self.text_box)
#panel.add(method_panel)
panel.add(buttons)
panel.add(self.status)
RootPanel().add(panel)
示例4: __init__
def __init__(self, tabBar=None, *kwargs):
TabPanel.__init__(self, tabBar, *kwargs)
self.parent_buoy = None
self.tabs = [{'hovertype' : ListBox(), 'name' : 'Cost'},
{'hovertype' : ListBox(), 'name' : 'Speed'}]
self.cost = self.tabs[0]['hovertype']
items = ['cheap','next to cheap','average','above average','expensive','if you have to ask']
self.cost.setVisibleItemCount(len(items))
for item in items:
self.cost.addItem(item)
self.cost.addChangeListener(self)
self.speed = self.tabs[1]['hovertype']
items = ['very slow','slow','average','above average','fast','quick','hyper','turbo','lightening','light']
self.speed.setVisibleItemCount(len(items))
for item in items:
self.speed.addItem(item)
self.speed.addChangeListener(self)
for tab in self.tabs:
h = HorizontalPanel()
h.add(tab['hovertype'])
self.add(h, tab['name'])
示例5: _createButtonPanel
def _createButtonPanel(self):
hp = HorizontalPanel()
self.okBtn = Button('OK', self.onOk, StyleName=self.baseStyleName + '-button')
self.cancelBtn = Button('Cancel', self.onCancel, StyleName=self.baseStyleName + '-button')
hp.add(self.okBtn)
hp.add(self.cancelBtn)
return hp
示例6: __init__
def __init__(self):
""" Constructs a new EditPanel.
"""
self.TEXT_WAITING = "Waiting for response..."
self.TEXT_ERROR = "Server Error"
# self.remote_py = RegionNamesServicePython()
self.panel = VerticalPanel()
top_panel = HorizontalPanel()
top_panel.setSpacing(8)
self.panel.add(top_panel)
refresh = Button("Refresh", self)
top_panel.add(refresh)
self.status = Label()
top_panel.add(self.status)
edit_panel = HorizontalPanel()
self.panel.add(edit_panel)
self.tree = Tree()
self.tree.addTreeListener(self)
edit_panel.add(self.tree)
upload_item = TreeItem("Upload")
self.tree.add(upload_item)
map_item = TreeItem("Map")
self.tree.add(map_item)
示例7: __init__
def __init__(self):
DockPanel.__init__(self)
self.setSize('100%', '100%')
self.geocoder = Geocoder()
# widgets
topPanel = HorizontalPanel()
self.add(topPanel, DockPanel.NORTH)
self.address = TextBox()
self.address.setText("Sydney, NSW")
self.address.addChangeListener(self.codeAddress)
topPanel.add(self.address)
button = Button("Geocode")
button.addClickListener(self.codeAddress)
topPanel.add(button)
# now, the map
mapPanel = SimplePanel()
mapPanel.setSize('600', '400')
self.add(mapPanel, DockPanel.CENTER)
options = MapOptions(zoom=8, center=LatLng(-34.397, 150.644),
mapTypeId=MapTypeId.ROADMAP)
self.map = Map(mapPanel.getElement(), options)
示例8: InitialiseScreen
def InitialiseScreen(self):
hpanel = HorizontalPanel()
self.add(hpanel)
vpanelMenu = VerticalPanel()
hpanel.add(vpanelMenu)
self.addbutton = Button("Add Triangle")
vpanelMenu.add(self.addbutton)
self.addbutton.addClickListener(getattr(self, "addtriangle"))
self.canvas = GWTCanvas(self.CANVAS_WIDTH, self.CANVAS_HEIGHT)
vpanelCanvas = VerticalPanel()
self.canvas.setWidth(self.CANVAS_WIDTH)
self.canvas.setHeight(self.CANVAS_HEIGHT)
hpanel.add(vpanelCanvas)
vpanelCanvas.add(self.canvas)
self.canvas.addMouseListener(self)
self.selecteditem = None
self.selectedhandle = None
self.mouseisdown = False
dc = DocumentCollection.documentcollection
DocumentCollection.documentcollection.edgelistener = self.EdgeListener
if len(dc.documentsbyclass[model.Drawing.__name__]) == 0:
drawing = model.Drawing(None)
dc.AddDocumentObject(drawing)
EdgePoster([a.asDict() for a in drawing.history.GetAllEdges()])
else:
for k,v in dc.documentsbyclass[model.Drawing.__name__].iteritems():
drawing = v
self.drawingid = drawing.id
self.Draw()
示例9: _add_statusbar
def _add_statusbar ( self ):
""" Adds a statusbar to the dialog.
"""
if self.ui.view.statusbar is not None:
control = HorizontalPanel()
# control.setSizeGripEnabled(self.ui.view.resizable)
listeners = []
for item in self.ui.view.statusbar:
# Create the status widget with initial text
name = item.name
item_control = Label()
item_control.setText(self.ui.get_extended_value(name))
# Add the widget to the control with correct size
# width = abs(item.width)
# stretch = 0
# if width <= 1.0:
# stretch = int(100 * width)
# else:
# item_control.setMinimumWidth(width)
control.add(item_control)
# Set up event listener for updating the status text
col = name.find('.')
obj = 'object'
if col >= 0:
obj = name[:col]
name = name[col+1:]
obj = self.ui.context[obj]
set_text = self._set_status_text(item_control)
obj.on_trait_change(set_text, name, dispatch='ui')
listeners.append((obj, set_text, name))
self.master.add(control)
self.ui._statusbar = listeners
示例10: __init__
def __init__(self, row, column=0):
super(Game, self).__init__(StyleName='game')
self.sinkEvents(Event.ONCONTEXTMENU) # to disable right click
self.row = row
self.column = column or row
self.level = 1
self.toppers = [[], [], []] # storage for top scorers for 3 levels.
self.remote = DataService()
self.remote_handler = RemoteHandler(self)
self.remote.get_scores(self.remote_handler)
# contents of Game
menubar = MineMenuBar(self)
score_board = HorizontalPanel(StyleName='score-board')
self.grid_panel = SimplePanel(StyleName='grid-panel')
self.add(menubar)
self.add(score_board)
self.add(self.grid_panel)
# contents of score_board
self.counter = Label('000', StyleName='digit counter')
self.face = Smiley(self)
self.timer = Label('000', StyleName='digit timer')
for one in (self.counter, self.face, self.timer):
score_board.add(one)
score_board.setCellWidth(self.face, '100%')
self.create_grid()
self.start()
示例11: __init__
def __init__(self, labelname, contenthtml, labelnamesuffix=': ', ensure_labelnamesuffix=True):
HorizontalPanel.__init__(self)
if ensure_labelnamesuffix and not labelname.endswith(labelnamesuffix):
labelname += labelnamesuffix
self.add(Label(labelname, StyleName=Styles.CONTENTITEM_COMPONENT_LABEL))
self.add(HTML(contenthtml, StyleName=Styles.CONTENTITEM_COMPONENT_CONTENT))
return
示例12: __init__
def __init__(self, chart):
self.chart = chart
self.canvas = chart.canvas
self.b2 = Button("Compositing", self)
self.b3 = Button("Paths & shapes", self)
self.b4 = Button("Arcs & circles", self)
self.b1 = Button("Bezier curves", self)
self.b6 = Button("Colors", self)
self.b7 = Button("Translating", self)
self.b8 = Button("Scaling", self)
self.b5 = Button("Rotating", self)
self.b10 = Button("Transparency", self)
self.b11 = Button("Lines", self)
self.b9 = Button("Animations", self)
hp = HorizontalPanel()
vp = VerticalPanel()
vp.setHorizontalAlignment(HasAlignment.ALIGN_LEFT)
vp.add(Label("MENU"))
vp.setSpacing(6)
vp.add(self.b2)
vp.add(self.b3)
vp.add(self.b4)
vp.add(self.b1)
vp.add(self.b6)
vp.add(self.b7)
vp.add(self.b8)
vp.add(self.b5)
vp.add(self.b10)
vp.add(self.b11)
vp.add(self.b9)
hp.add(vp)
Composite.__init__(self, hp)
示例13: HorizontalToolbar
class HorizontalToolbar(SimplePanel):
def __init__(self, onRequestMore=None, onCollapseAll=None, onExpandAll=None, onSort=None):
super(HorizontalToolbar, self).__init__(StyleName=Styles.TOOLBAR_HORIZONTAL)
self.content = HorizontalPanel()
self.requestMoreButton = Button('More', onRequestMore, StyleName=Styles.TOOLBAR_BUTTON)
self.content.add(self.requestMoreButton)
self.itemsShowingLabel = Label(StyleName=Styles.TOOLBAR_TEXT)
self.content.add(self.itemsShowingLabel)
self.setNumberOfItemsShowingText(0, 0)
self.collapseAllButton = Button('Collapse All', onCollapseAll, StyleName=Styles.TOOLBAR_BUTTON)
self.content.add(self.collapseAllButton)
self.expandAllButton = Button('Expand All', onExpandAll, StyleName=Styles.TOOLBAR_BUTTON)
self.content.add(self.expandAllButton)
if onSort:
self.content.add(SortPanel(onSort))
self.setWidget(self.content)
return
def setNumberOfItemsShowingText(self, number, total):
self.itemsShowingLabel.setText('Showing %s of %s total items.' % (number, total))
return
示例14: __init__
def __init__(self, theorem, **kwargs):
DialogWindow.__init__(self, modal=True, close=True)
self.theorem=theorem
v = VerticalPanel()
v.setWidth(300)
# v.setHeight(500)
self.setText("save")
self.setPopupPosition(100, 100)
self.setStyleAttribute("background-color", "#ffffff")
self.setStyleAttribute("color", "red")
self.setStyleAttribute("border-width", "5px")
self.setStyleAttribute("border-style", "solid")
self.im=Image()
self.im.setUrl(latex_to_url(self.theorem.formula.to_latex()))
v.add(self.im)
h=HorizontalPanel()
self.radio=RadioButton("group1", "Existing folder:")
h.add(self.radio)
self.list = ListBox()
self.list.setVisibleItemCount(1)
for f in Theorem.get_all_folders():
self.list.addItem(f)
h.add(self.list)
v.add(h)
h=HorizontalPanel()
h.add(RadioButton("group1", "New folder:"))
self.radio.setChecked(True)
self.textbox=TextBox()
h.add(self.textbox)
v.add(h)
v.add(Button("Done",self.done_click))
self.add(v)
示例15: __init__
def __init__(self, owner):
Composite.__init__(self)
self.owner = owner
self.bar = DockPanel()
self.gotoFirst = Button("<<", self)
self.gotoNext = Button(">", self)
self.gotoPrev = Button("<", self)
self.status = HTML()
self.initWidget(self.bar)
self.bar.setStyleName("navbar")
self.status.setStyleName("status")
buttons = HorizontalPanel()
buttons.add(self.gotoFirst)
buttons.add(self.gotoPrev)
buttons.add(self.gotoNext)
self.bar.add(buttons, DockPanel.EAST)
self.bar.setCellHorizontalAlignment(buttons, HasAlignment.ALIGN_RIGHT)
self.bar.add(self.status, DockPanel.CENTER)
self.bar.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
self.bar.setCellHorizontalAlignment(self.status, HasAlignment.ALIGN_RIGHT)
self.bar.setCellVerticalAlignment(self.status, HasAlignment.ALIGN_MIDDLE)
self.bar.setCellWidth(self.status, "100%")
self.gotoPrev.setEnabled(False)
self.gotoFirst.setEnabled(False)