本文整理汇总了Python中pyjamas.ui.VerticalPanel.VerticalPanel.add方法的典型用法代码示例。如果您正苦于以下问题:Python VerticalPanel.add方法的具体用法?Python VerticalPanel.add怎么用?Python VerticalPanel.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.VerticalPanel.VerticalPanel
的用法示例。
在下文中一共展示了VerticalPanel.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import add [as 别名]
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: get_case_panel
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import add [as 别名]
def get_case_panel(self):
panel = VerticalPanel()
title = HTML("""Case""")
panel.add(title)
tree = self.get_case_tree()
panel.add(tree)
return panel
示例3: onModuleLoad
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import add [as 别名]
def onModuleLoad(self):
self.TEXT_WAITING = "Waiting for response..."
self.TEXT_ERROR = "Server Error"
self.METHOD_ECHO = "Echo"
self.METHOD_REVERSE = "Reverse"
self.METHOD_UPPERCASE = "UPPERCASE"
self.METHOD_LOWERCASE = "lowercase"
self.methods = [self.METHOD_ECHO, self.METHOD_REVERSE, self.METHOD_UPPERCASE, self.METHOD_LOWERCASE]
self.remote_php = EchoServicePHP()
self.remote_py = EchoServicePython()
self.status=Label()
self.text_area = TextArea()
self.text_area.setText("""{'Test'} [\"String\"]
\tTest Tab
Test Newline\n
after newline
""" + r"""Literal String:
{'Test'} [\"String\"]
""")
self.text_area.setCharacterWidth(80)
self.text_area.setVisibleLines(8)
self.method_list = ListBox()
self.method_list.setName("hello")
self.method_list.setVisibleItemCount(1)
for method in self.methods:
self.method_list.addItem(method)
self.method_list.setSelectedIndex(0)
method_panel = HorizontalPanel()
method_panel.add(HTML("Remote string method to call: "))
method_panel.add(self.method_list)
method_panel.setSpacing(8)
self.button_php = Button("Send to PHP Service", self)
self.button_py = Button("Send to Python Service", self)
buttons = HorizontalPanel()
buttons.add(self.button_php)
buttons.add(self.button_py)
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 some text below, and press a button to send the text
to an Echo service on your server. An echo service simply sends the exact same text back that it receives.
</p>"""
panel = VerticalPanel()
panel.add(HTML(info))
panel.add(self.text_area)
panel.add(method_panel)
panel.add(buttons)
panel.add(self.status)
RootPanel().add(panel)
示例4: __init__
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import add [as 别名]
def __init__(self):
self.form = FormPanel()
self.form.setAction("/Accession/searchByName/")
# Because we're going to add a FileUpload widget, we'll need to set the
# form to use the POST method, and multipart MIME encoding.
self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
self.form.setMethod(FormPanel.METHOD_POST)
# Create a panel to hold all of the form widgets.
vpanel = VerticalPanel()
self.form.setWidget(vpanel)
self.colour_input = AutoCompleteByURLTextBox('/Accession/autoComplete')
hpanel = HorizontalPanel()
hpanel.add(HTML("Enter an ecotype name: "))
hpanel.add(self.colour_input)
hpanel.setSpacing(8)
# Add a 'submit' button.
hpanel.add(Button("Submit", self))
vpanel.add(hpanel)
# Add an event handler to the form.
self.form.addFormHandler(self)
self.setWidget(self.form)
示例5: SinkList
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import add [as 别名]
class SinkList(Composite):
def __init__(self):
Composite.__init__(self)
self.vp_list=VerticalPanel()
self.sinks=[]
self.selectedSink=-1
self.initWidget(self.vp_list)
self.setStyleName("ks-List")
def addSink(self, info):
name = info.getName()
link = Hyperlink(name, False, TargetHistoryToken=name)
link.setStyleName("ks-SinkItem")
self.vp_list.add(link)
self.sinks.append(info)
def find(self, sinkName):
for info in self.sinks:
if info.getName()==sinkName:
return info
return None
def setSinkSelection(self, name):
if self.selectedSink <> -1:
self.vp_list.getWidget(self.selectedSink).removeStyleName("ks-SinkItem-selected")
for i in range(len(self.sinks)):
info = self.sinks[i]
if (info.getName()==name):
self.selectedSink = i
widget=self.vp_list.getWidget(self.selectedSink)
widget.addStyleName("ks-SinkItem-selected")
return
示例6: __init__
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import add [as 别名]
def __init__(self):
Sink.__init__(self)
colour_grid = ColourGridCanvas()
rotated = RotatedCanvas()
spheres = SpheresCanvas()
#pattern = PatternCanvas()
spiro = SpiroCanvas()
self.solar = SolarCanvas()
row0 = HorizontalPanel()
row0.setSpacing(8)
row0.add(colour_grid)
row0.add(rotated)
row0.add(spheres)
#row0.add(pattern)
row1 = HorizontalPanel()
row1.setSpacing(8)
row1.add(self.solar)
row1.add(spiro)
panel = VerticalPanel()
panel.add(row0)
panel.add(row1)
self.setWidget(panel)
示例7: drawFull
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import add [as 别名]
def drawFull(self, month, year):
# should be called only once when we draw the calendar for
# the first time
self.vp = VerticalPanel()
self.vp.setSpacing(2)
self.vp.addStyleName("calendarbox calendar-module calendar")
self.setWidget(self.vp)
self.setVisible(False)
#
mth = int(month)
yr = int(year)
tp = HorizontalPanel()
tp.addStyleName("calendar-top-panel")
tp.setSpacing(5)
h1 = Hyperlink('<<')
h1.addClickListener(getattr(self, 'onPreviousYear'))
h2 = Hyperlink('<')
h2.addClickListener(getattr(self, 'onPreviousMonth'))
h4 = Hyperlink('>')
h4.addClickListener(getattr(self, 'onNextMonth'))
h5 = Hyperlink('>>')
h5.addClickListener(getattr(self, 'onNextYear'))
tp.add(h1)
tp.add(h2)
# titlePanel can be changed, whenever we draw, so keep the reference
txt = "<b>"
txt += self.getMonthsOfYear()[mth-1] + " " + str(yr)
txt += "</b>"
self.titlePanel = SimplePanel()
self.titlePanel.setWidget(HTML(txt))
self.titlePanel.setStyleName("calendar-center")
tp.add(self.titlePanel)
tp.add(h4)
tp.add(h5)
tvp = VerticalPanel()
tvp.setSpacing(10)
tvp.add(tp)
self.vp.add(tvp)
# done with top panel
self.middlePanel = SimplePanel()
grid = self.drawGrid(mth, yr)
self.middlePanel.setWidget(grid)
self.vp.add(self.middlePanel)
self.defaultGrid = grid
self._gridShortcutsLinks()
self._gridCancelLink()
#
# add code to test another way of doing the layout
#
self.setVisible(True)
return
示例8: __init__
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import add [as 别名]
def __init__(self):
SimplePanel.__init__(self)
panel = VerticalPanel(BorderWidth=1,
HorizontalAlignment=HasAlignment.ALIGN_CENTER,
VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
Width="50%",
Height="300px")
part1 = Label("Part 1")
part2 = Label("Part 2")
part3 = Label("Part 3")
part4 = Label("Part 4")
panel.add(part1)
panel.add(part2)
panel.add(part3)
panel.add(part4)
panel.setCellHeight(part1, "10%")
panel.setCellHeight(part2, "70%")
panel.setCellHeight(part3, "10%")
panel.setCellHeight(part4, "10%")
panel.setCellHorizontalAlignment(part3, HasAlignment.ALIGN_RIGHT)
self.add(panel)
示例9: onModuleLoad
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import add [as 别名]
def onModuleLoad(self):
self.remote = DataService()
vPanel = VerticalPanel()
# create div to hold map
mapPanel = SimplePanel()
mapPanel.setSize('700px','400px')
# initiate getting gps data from web2py
self.remote.getPoints(self)
# create slider div
slider = SimplePanel()
self.slider = slider
# add map and slide to main panel
vPanel.add(mapPanel)
vPanel.add(slider)
# add everything to page's GreedyPyJs div
root = RootPanelCls(DOM.getElementById("GreedPyJs"))
root.add(vPanel)
# Create initial google map
self.map = GMap2(mapPanel.getElement())
self.map.setCenter(GLatLng(37.4419, -122.1419), 13)
# create place to hold gps positions
# these will be in tuples: (date, latitude, longitude)
self.positions=[]
示例10: themesPanel
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import add [as 别名]
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
示例11: InitialiseScreen
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import add [as 别名]
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()
示例12: __init__
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import add [as 别名]
def __init__(self):
SimplePanel.__init__(self)
self.form = FormPanel()
self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
self.form.setMethod(FormPanel.METHOD_POST)
self.form.setAction("http://nonexistent.com")
self.form.setTarget("results")
vPanel = VerticalPanel()
hPanel = HorizontalPanel()
hPanel.setSpacing(5)
hPanel.add(Label("Upload file:"))
self.field = FileUpload()
self.field.setName("file")
hPanel.add(self.field)
hPanel.add(Button("Submit", getattr(self, "onBtnClick")))
vPanel.add(hPanel)
results = NamedFrame("results")
vPanel.add(results)
self.form.add(vPanel)
self.add(self.form)
示例13: onModuleLoad
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import add [as 别名]
def onModuleLoad(self):
self.curInfo=''
self.curSink=None
self.description=HTML()
self.sink_list=SinkList()
self.panel=DockPanel()
self.loadSinks()
self.sinkContainer = DockPanel()
self.sinkContainer.setStyleName("ks-Sink")
vp=VerticalPanel()
vp.setWidth("100%")
vp.add(self.description)
vp.add(self.sinkContainer)
self.description.setStyleName("ks-Info")
self.panel.add(self.sink_list, DockPanel.WEST)
self.panel.add(vp, DockPanel.CENTER)
self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP)
self.panel.setCellWidth(vp, "100%")
History.addHistoryListener(self)
RootPanel().add(self.panel)
RootPanel().add(Logger())
#Show the initial screen.
initToken = History.getToken()
if len(initToken):
self.onHistoryChanged(initToken)
else:
self.showInfo()
示例14: __init__
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import add [as 别名]
def __init__(self,parent):
AbsolutePanel.__init__(self)
self.roleList = ListBox()
self.roleList.setWidth('300px')
self.roleList.setVisibleItemCount(6)
self.roleList.addChangeListener(self.onListChange)
#self.roleList.addKeyboardListener(self)
self.roleCombo = ListBox()
self.roleCombo.addKeyboardListener(self)
self.roleCombo.addChangeListener(self.onComboChange)
self.addBtn = Button("Add")
self.addBtn.setEnabled(False)
self.removeBtn = Button("Remove")
self.removeBtn.setEnabled(False)
vpanel = VerticalPanel()
vpanel.add(self.roleList)
hpanel = HorizontalPanel()
hpanel.add(self.roleCombo)
hpanel.add(self.addBtn)
hpanel.add(self.removeBtn)
vpanel.add(hpanel)
self.add(vpanel)
self.clearForm()
return
示例15: Contacts
# 需要导入模块: from pyjamas.ui.VerticalPanel import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel.VerticalPanel import add [as 别名]
class Contacts(Composite):
def __init__(self):
Composite.__init__(self)
self.contacts = []
self.contacts.append(Contact("Benoit Mandelbrot", "[email protected]"))
self.contacts.append(Contact("Albert Einstein", "[email protected]"))
self.contacts.append(Contact("Rene Descartes", "[email protected]"))
self.contacts.append(Contact("Bob Saget", "[email protected]"))
self.contacts.append(Contact("Ludwig von Beethoven", "[email protected]"))
self.contacts.append(Contact("Richard Feynman", "[email protected]"))
self.contacts.append(Contact("Alan Turing", "[email protected]"))
self.contacts.append(Contact("John von Neumann", "[email protected]"))
self.panel = VerticalPanel()
# Add all the contacts to the list.
i = 0
while (i < len(self.contacts)):
self.addContact(self.contacts[i])
i = i + 1
self.initWidget(self.panel)
self.setStyleName("mail-Contacts")
def addContact(self, contact):
link = HTML("<a href='javascript:;'>" + contact.name + "</a>")
self.panel.add(link)
# Add a click listener that displays a ContactPopup when it is clicked.
listener = ContactListener(contact, link)
link.addClickListener(listener)