本文整理汇总了Python中pyjamas.ui.ListBox.ListBox类的典型用法代码示例。如果您正苦于以下问题:Python ListBox类的具体用法?Python ListBox怎么用?Python ListBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ListBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, labelObjectPairs):
ListBox.__init__(self)
self.labelObjectPairs = labelObjectPairs
self.setVisibleItemCount(1); # makes it a drop-down list
# add each label as an item on the drop-down list
for i in range(len(labelObjectPairs)):
self.addItem( labelObjectPairs[i][LABEL_COL])
示例2: __init__
def __init__(self):
AbsolutePanel.__init__(self)
self.app = CompaniesApp()
self.history = []
self.save = Button("save", self)
self.selectDepartment = Button("select", self)
self.selectEmployee = Button("select", self)
self.edit = Button("edit", self)
self.cut = Button("cut", self)
self.back = Button("back", self)
self.name = TextBox()
self.address = TextBox()
self.manager = TextBox()
self.departments = ListBox(Size=("100%"), VisibleItemCount="5")
self.employees = ListBox(Size=("100%"), VisibleItemCount="5")
self.total = TextBox()
self.errors = VerticalPanel()
self.grid = Grid()
self.allPanels = VerticalPanel()
self.allPanels.add(self.grid)
self.allPanels.add(self.errors)
self.add(self.allPanels)
self.initCompanyGUI()
示例3: __init__
def __init__( self ):
ListBox.__init__( self )
self.setVisibleItemCount( 1 )
self.setMultipleSelect( False )
for type in ['Last Day', 'Last Week', 'Last Month']:
self.addItem( type )
self.setVisible( True )
示例4: __init__
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
示例5: editMovieButton_Click
def editMovieButton_Click(sender):
# Add textboxes and listbox
editMovieButton.setVisible(False)
cancelButton.setVisible(True)
saveButton.setVisible(True)
editCategory = TextBox()
editName = TextBox()
editRating = ListBox(False)
for i in range(self.MAX_RATING + 1):
editRating.addItem(str(i))
# Variable width textboxes
catlen = len(movie.category)
namelen = len(movie.name)
if (catlen > 8):
editCategory.setWidth(str(catlen*10) + "px")
else:
editCategory.setWidth("80px")
if (namelen > 8):
editName.setWidth(str(namelen*10) + "px")
else:
editName.setWidth("80px")
self.moviesFlexTable.setWidget(row, 1, editCategory)
self.moviesFlexTable.setWidget(row, 2, editName)
self.moviesFlexTable.setWidget(row, 3, editRating)
editCategory.setText(movie.category)
editName.setText(movie.name)
editRating.setSelectedIndex(movie.rating)
示例6: makeFileChooser
def makeFileChooser():
l = ListBox()
for i, tup in enumerate(files):
name, content = tup
l.addItem(name, i)
l.addChangeListener(loadFile)
return l
示例7: __init__
def __init__(self,app):
self.app=app
self.form = FormPanel()
self.form.setEncoding("multipart/form-data")
self.form.setMethod("post")
self.msg = HTML("<b>Uploading</b>")
self.table = FlexTable()
self.table.setText(0,0, "Problem")
self.table.setText(1,0, "Language")
self.table.setText(2,0, "Program File")
self.table.setText(3,0, "Program source")
self.problem = ListBox()
self.problem.insertItem("Detect",-1,-1)
self.problem.setName("problem")
self.table.setWidget(0,1,self.problem)
self.lang = ListBox()
self.lang.insertItem("Detect","",-1)
self.lang.insertItem("C/C++","cc",-1)
self.lang.insertItem("Java","Java",-1)
self.lang.insertItem("Python","Python",-1)
self.lang.setName("lang")
self.table.setWidget(1,1,self.lang)
self.cookie = Hidden()
self.cookie.setName("cookie")
self.table.setWidget(5,0,self.cookie)
self.file = FileUpload()
self.file.setName("file");
self.table.setWidget(2,1,self.file)
self.source = TextArea()
self.source.setName("source")
self.source.setWidth("600");
self.source.setHeight("400");
self.source.setText("""//$$problem: 1$$
//$$language: cc$$
#include <unistd.h>
#include <stdio.h>
int main() {
int a,b;
scanf("%d %d",&a,&b);
printf("%d\\n",a+b);
return 0;
}""")
self.source.addChangeListener(self.onChange)
self.table.setWidget(3,1,self.source)
self.button = Button("Submit",self)
self.table.setWidget(4,1, self.button)
self.table.setWidget(5,1, self.msg)
self.msg.setVisible(False)
self.form.setWidget(self.table)
self.form.setAction("../upload.py/submit")
self.form.addFormHandler(self)
示例8: create_combo_box
def create_combo_box(self):
""" Returns the QComboBox used for the editor control.
"""
control = ListBox()
control.setVisibleItemCount(0)
# control.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
# control.setSizePolicy(QtGui.QSizePolicy.Maximum,
# QtGui.QSizePolicy.Fixed)
return control
示例9: __init__
def __init__(self):
DockPanel.__init__(self)
self.setSize('100%', '100%')
# widgets
topPanel = HorizontalPanel()
self.add(topPanel, DockPanel.NORTH)
places = {
"chicago, il": "Chicago",
"st louis, mo": "St Louis",
"joplin, mo": "Joplin, MO",
"oklahoma city, ok": "Oklahoma City",
"amarillo, tx": "Amarillo",
"gallup, nm": "Gallup, NM",
"flagstaff, az": "Flagstaff, AZ",
"winona, az": "Winona",
"kingman, az": "Kingman",
"barstow, ca": "Barstow",
"san bernardino, ca": "San Bernardino",
"los angeles, ca": "Los Angeles"}
self.start = ListBox()
self.end = ListBox()
for value in places:
self.start.addItem(places[value], value)
self.end.addItem(places[value], value)
self.start.addChangeListener(self.calcRoute)
self.end.addChangeListener(self.calcRoute)
topPanel.add(self.start)
topPanel.add(self.end)
# now, the map
mapPanel = SimplePanel()
mapPanel.setSize('800', '500')
self.add(mapPanel, DockPanel.CENTER)
chigado = LatLng(41.850033, -87.6500523)
options = MapOptions(zoom=7, center=chigado,
mapTypeId=MapTypeId.ROADMAP)
self.map = Map(mapPanel.getElement(), options)
# initialize the renderer
self.directionsDisplay = DirectionsRenderer()
self.directionsDisplay.setMap(self.map)
self.directionsService = DirectionsService()
示例10: __init__
def __init__(self):
self.artist =''
self.start_date = ''
self.end_date = ''
self.period_search =''
self.search_option = 1
#declare the general interface widgets
self.panel = DockPanel(StyleName = 'background')
self.ret_area = TextArea()
self.ret_area.setWidth("350px")
self.ret_area.setHeight("90px")
self.options = ListBox()
self.search_button = Button("Search", getattr(self, "get_result"), StyleName = 'button')
#set up the date search panel; it has different text boxes for
#to and from search dates
self.date_search_panel = VerticalPanel()
self.date_search_start = TextBox()
self.date_search_start.addInputListener(self)
self.date_search_end = TextBox()
self.date_search_end.addInputListener(self)
self.date_search_panel.add(HTML("Enter as month/day/year", True, StyleName = 'text'))
self.date_search_panel.add(HTML("From:", True, StyleName = 'text'))
self.date_search_panel.add(self.date_search_start)
self.date_search_panel.add(HTML("To:", True, StyleName = 'text'))
self.date_search_panel.add(self.date_search_end)
#set up the artist search panel
self.artist_search = TextBox()
self.artist_search.addInputListener(self)
self.artist_search_panel = VerticalPanel()
self.artist_search_panel.add(HTML("Enter artist's name:",True,
StyleName = 'text'))
self.artist_search_panel.add(self.artist_search)
#Put together the list timespan search options
self.period_search_panel = VerticalPanel()
self.period_search_panel.add(HTML("Select a seach period:",True,
StyleName = 'text'))
self.period_search = ListBox()
self.period_search.setVisibleItemCount(1)
self.period_search.addItem("last week")
self.period_search.addItem("last month")
self.period_search.addItem("last year")
self.period_search.addItem("all time")
self.period_search_panel.add(self.period_search)
#add the listeners to the appropriate widgets
self.options.addChangeListener(self)
self.period_search.addChangeListener(self)
self.ret_area_scroll = ScrollPanel()
self.search_panel = HorizontalPanel()
self.options_panel = VerticalPanel()
示例11: SelectionBox
class SelectionBox(HorizontalPanel):
"""
This is a text box with the corresponding word that is to be normalized
"""
def __init__(self, token_index, target_word, options):
HorizontalPanel.__init__(self)
self.token_index = token_index
self.table = FlexTable()
self.label = Label(target_word + ":\t")
self.dropdown = ListBox()
for option in options:
self.dropdown.addItem(option)
self.add(self.label)
self.add(self.dropdown)
示例12: TheoremPanel
class TheoremPanel(ScrollPanel):
def __init__(self, after):
ScrollPanel.__init__(self, Size=("630px", "500px"))
self.after = after
self.pok = VerticalPanel()
self.add(self.pok)
self.images = list()
def onItemSelected():
item = self.list2.getItemText(self.list2.getSelectedIndex())
self.refresh_theorems(item)
self.list2 = ListBox()
self.list2.setVisibleItemCount(1)
for f in Theorem.get_all_folders():
self.list2.addItem(f)
self.pok.add(self.list2)
self.list2.addChangeListener(onItemSelected)
self.refresh_theorems(self.list2.getItemText(self.list2.getSelectedIndex()))
def remove_images(self):
for im in self.images:
self.pok.remove(im)
self.images = list()
def refresh_theorems(self, folder):
self.remove_images()
def onClick(theorem):
def name(n):
return "var" + str(n + 1)
def print_scheme(n):
return ["\\alpha", "\\beta", "\\gamma", "\\delta", "\\epsilon"][n]
def poas(sender):
if len(theorem.operations) == 1:
constants = [Operation("const" + str(i + 1), 0, print_scheme(i), name(i), Operation.EXPRESSION)
for i in range(theorem.operations[0].no_of_args)]
def after1(f):
self.after(
theorem.formula.substitute_definition(Formula([theorem.operations[0]] + constants), f),
predecessors=[], rule_name="insert")
request_formula([op for op in proof.get_operations()] + constants,
after1, type=('rel' if theorem.operations[0].type == Operation.RELATION else 'exp'))
else:
self.after(theorem.formula, predecessors=[], rule_name="insert")
return poas
for ax in [x for x in Theorem.theorems if x.folder == folder]:
im = Image()
im.addClickListener(onClick(ax))
im.setUrl(latex_to_url(ax.formula.to_latex()))
self.pok.add(im)
self.images.append(im)
示例13: __init__
def __init__(self):
# We need to use old form of inheritance because of pyjamas
SimplePanel.__init__(self)
self.hpanel = HorizontalPanel(Width='475px')
self.hpanel.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM)
self.name = TextBox()
self.name.setStyleName('form-control')
self.status = ListBox()
self.status.addItem('Active')
self.status.addItem('Inactive')
self.status.setVisibleItemCount(0)
self.status.setStyleName('form-control input-lg')
self.status.setSize('100px', '34px')
lbl = Label('', Width='10px')
self.add_btn = Button('Add')
self.add_btn.setStyleName('btn btn-primary')
self.del_btn = Button('Delete')
self.del_btn.setStyleName('btn btn-danger')
self.hpanel.add(self.name)
self.hpanel.add(lbl)
self.hpanel.add(self.status)
self.hpanel.add(self.add_btn)
self.hpanel.add(self.del_btn)
示例14: onModuleLoad
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)
示例15: __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)