本文整理汇总了Python中pyjamas.ui.Label.Label类的典型用法代码示例。如果您正苦于以下问题:Python Label类的具体用法?Python Label怎么用?Python Label使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Label类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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
开发者ID:satyam07,项目名称:taoggregator,代码行数:25,代码来源:feedpublisherwebui.py
示例2: GettextExample
class GettextExample(object):
def __init__(self):
self.b = Button(_("Click me"), self.greet, StyleName='teststyle')
self.h = HTML(_("<b>Hello World</b> (html)"), StyleName='teststyle')
self.l = Label(_("Hello World (label)"), StyleName='teststyle')
self.base = HTML(_("Hello from %s") % pygwt.getModuleBaseURL(),
StyleName='teststyle')
RootPanel().add(self.b)
RootPanel().add(self.h)
RootPanel().add(self.l)
RootPanel().add(self.base)
def change_texts(self, text):
self.b.setText(_("Click me"))
self.h.setHTML(_("<b>Hello World</b> (html)"))
self.l.setText(_("Hello World (label)"))
text = [_("Hello from %s") % pygwt.getModuleBaseURL()]
for i in range(4):
text.append(ngettext('%(num)d single', '%(num)d plural', i) % dict(num=i))
text = '<br />'.join(text)
self.base.setHTML(text)
def greet(self, fred):
fred.setText(_("No, really click me!"))
Window.alert(_("Hello, there!"))
i18n.load(lang=lang[0], onCompletion=self.change_texts)
lang.append(lang.pop(0))
开发者ID:Afey,项目名称:pyjs,代码行数:28,代码来源:Gettext.py
示例3: __init__
def __init__(self, n, limit):
Label.__init__(self,
"Sorry, your query had too many (%s) results! The current "
"supported limit is %s." % (
utils.splitthousands(n),
utils.splitthousands(limit)),
StyleName='userlist-error-title')
开发者ID:fluidinfo,项目名称:Tickery,代码行数:7,代码来源:unknown.py
示例4: make_panel
def make_panel(self):
message = Label(
'The configuration has been changed.\n'
'You must apply the changes in order for them to take effect.')
DOM.setStyleAttribute(message.getElement(), "whiteSpace", 'pre')
msgbox = Grid(1, 2, StyleName='changes')
msgbox.setWidget(0, 0, Image('icons/exclam.png'))
msgbox.setWidget(0, 1, message)
msgbox.getCellFormatter().setStyleName(0, 0, 'changes-image')
msgbox.getCellFormatter().setStyleName(0, 1, 'changes-text')
button = Button('apply changes')
button.addClickListener(self.apply_clicked)
self.changes = VerticalPanel()
self.changes.setHorizontalAlignment('right')
self.changes.setVisible(False)
self.changes.add(msgbox)
self.changes.add(button)
panel = VerticalPanel()
panel.setSpacing(10)
panel.add(self.table)
panel.add(self.status)
panel.add(self.changes)
return panel
开发者ID:christophgysin,项目名称:schoolbell,代码行数:28,代码来源:alarmwidget.py
示例5: _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
开发者ID:rwl,项目名称:traitsbackendpyjamas,代码行数:35,代码来源:ui_base.py
示例6: __init__
def __init__(self, ctype, data):
Label.__init__(self)
AddablePanel.__init__(self)
self.setStyleName('content_text')
self.setText("'%s' content:" % ctype)
self.content = HTML(data, StyleName='content')
self.append(self.content)
开发者ID:anandology,项目名称:pyjamas,代码行数:7,代码来源:DNDTest.py
示例7: WritePanel
class WritePanel(AbsolutePanel):
def __init__(self, parent):
AbsolutePanel.__init__(self)
self.post_header = Label("Write a Post", StyleName="header_label")
self.post_write_title_label = Label("Title:")
self.post_title = TextBox()
self.post_content = TextArea()
self.post_button = Button("Post")
self.cancel_button = Button("Cancel")
self.error_message_label = Label("", StyleName="error_message_label")
contents = VerticalPanel(StyleName="Contents", Spacing=4)
contents.add(self.post_header)
contents.add(self.post_write_title_label)
contents.add(self.post_title)
contents.add(self.post_content)
contents.add(self.post_button)
contents.add(self.cancel_button)
contents.add(self.error_message_label)
self.dialog = DialogBox(glass=True)
self.dialog.setHTML('<b>Blog Post Form</b>')
self.dialog.setWidget(contents)
left = (Window.getClientWidth() - 900) / 2 + Window.getScrollLeft()
top = (Window.getClientHeight() - 600) / 2 + Window.getScrollTop()
self.dialog.setPopupPosition(left, top)
self.dialog.hide()
def clear_write_panel(self):
self.post_title.setText("")
self.post_content.setText("")
self.error_message_label.setText("")
开发者ID:Afey,项目名称:pyjs,代码行数:31,代码来源:components.py
示例8: __init__
def __init__(self, text=None, forid=None, wordWrap=True, **kwargs):
if not kwargs.has_key('Element'):
element = DOM.createLabel()
if forid:
element.setAttribute("for", forid)
kwargs['Element'] = element
Label.__init__(self, text, wordWrap, **kwargs)
开发者ID:fedenko,项目名称:clientbank,代码行数:7,代码来源:DjangoForm.py
示例9: QueueSize
class QueueSize(HorizontalPanel):
def __init__(self):
HorizontalPanel.__init__(self, Spacing=4)
self.add(Label('Queue size:', StyleName='section'))
self.underway = Label()
self.add(self.underway)
self.queued = Label()
self.add(self.queued)
self.button = Button('Refresh', self, StyleName='refresh')
self.add(self.button)
self.err = Label()
self.add(self.err)
self.update()
def update(self):
remote = server.AdminService()
id = remote.queueSize(self)
if id < 0:
self.err.setText('oops: could not call getQueueSize')
def onRemoteResponse(self, result, request_info):
self.button.setEnabled(True)
underway, queued = result
self.underway.setText('Underway: %d' % underway)
self.queued.setText('Queued: %d' % queued)
def onRemoteError(self, code, message, request_info):
self.button.setEnabled(True)
self.err.setText('Could not getQueueWidth: ' + message)
def onClick(self, sender):
self.err.setText('')
self.button.setEnabled(False)
self.update()
开发者ID:jdunck,项目名称:Tickery,代码行数:34,代码来源:size.py
示例10: __init__
def __init__(self, milestone_names, milestone_dates):
# We need to use old form of inheritance because of pyjamas
SimplePanel.__init__(self)
self.milestone_dates = milestone_dates
self.hpanel = HorizontalPanel()
self.hpanel.setVerticalAlignment(HasAlignment.ALIGN_TOP)
self.name = ListBox(Height='34px', Width='208px')
self.name.setStyleName('form-control input-lg')
self.name.addChangeListener(getattr(self, 'on_milestone_changed'))
for m in milestone_names:
self.name.addItem(m)
if len(self.milestone_dates) > 0:
self.planned_completion = Label(self.milestone_dates[0])
else:
self.planned_completion = Label('Undefined')
self.planned_completion.setStyleName('form-control text-normal')
self.expected_completion = Report_Date_Field(cal_ID='end')
self.expected_completion.getTextBox().setStyleName('form-control')
self.expected_completion.setRegex(DATE_MATCHER)
self.expected_completion.appendValidListener(self._display_ok)
self.expected_completion.appendInvalidListener(self._display_error)
self.expected_completion.validate(None)
self.hpanel.add(self.name)
self.hpanel.add(Label(Width='10px'))
self.hpanel.add(self.planned_completion)
self.hpanel.add(Label(Width='10px'))
self.hpanel.add(self.expected_completion)
开发者ID:mcsquaredjr,项目名称:Reports,代码行数:32,代码来源:form.py
示例11: __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()
开发者ID:anandology,项目名称:pyjamas,代码行数:32,代码来源:minesweeper.py
示例12: EditPanel
class EditPanel(AbsolutePanel):
def __init__(self, key, title, content):
AbsolutePanel.__init__(self)
self.edit_header = Label("Edit a Post", StyleName="header_label")
self.edit_title_label = Label("Title:")
self.edit_title = TextBox()
self.edit_title.setMaxLength(255)
self.edit_content = TextArea()
self.edit_content.setVisibleLines(2)
self.edit_button = Button("Save")
self.edit_cancel_button = Button("Cancel")
self.edit_hidden_key = Hidden()
self.error_message_label = Label("", StyleName="error_message_label")
edit_contents = VerticalPanel(StyleName="Contents", Spacing=4)
edit_contents.add(self.edit_header)
edit_contents.add(self.edit_title_label)
edit_contents.add(self.edit_title)
edit_contents.add(self.edit_content)
edit_contents.add(self.edit_button)
edit_contents.add(self.edit_cancel_button)
edit_contents.add(self.error_message_label)
edit_contents.add(self.edit_hidden_key)
self.edit_dialog = DialogBox(glass=True)
self.edit_dialog.setHTML('<b>Blog Post Form</b>')
self.edit_dialog.setWidget(edit_contents)
left = (Window.getClientWidth() - 900) / 2 + Window.getScrollLeft()
top = (Window.getClientHeight() - 600) / 2 + Window.getScrollTop()
self.edit_dialog.setPopupPosition(left, top)
self.edit_dialog.hide()
def clear_edit_panel(self):
self.edit_title.setText("")
self.edit_content.setText("")
self.error_message_label.setText("")
开发者ID:Afey,项目名称:pyjs,代码行数:35,代码来源:components.py
示例13: Form_Row
class Form_Row(SimplePanel):
'''
Create row that will be put in the Form
'''
def __init__(self, name, widget, help=''):
SimplePanel.__init__(self)
# Container
self.mainpanel = VerticalPanel()
self.lbl = Label(name)
self.hlp = Label(help)
self.lbl.setStyleName('h3')
self.hlp.setStyleName('text-muted')
self.wdg = widget
self.mainpanel.add(self.lbl)
self.mainpanel.add(self.wdg)
self.mainpanel.add(self.hlp)
def panel(self):
return self.mainpanel
def widget(self):
return self.wdg
def help(self):
return self.hlp
开发者ID:mcsquaredjr,项目名称:Reports,代码行数:27,代码来源:form.py
示例14: ParticleDemoControls
class ParticleDemoControls(Composite):
def __init__(self):
self.average = 1
self.iterations = 1
self.startTime = -1
self.refreshRateLabel = Label("")
self.averageLabel = Label("")
layout = VerticalPanel()
layout.add(self.refreshRateLabel)
layout.add(self.averageLabel)
Composite.__init__(self, layout)
def doBenchmark(self, now):
if self.startTime < 0:
self.startTime = now
else:
self.refreshRate = now - self.startTime
self.startTime = now
self.average = ((self.average * self.iterations) + self.refreshRate) / (self.iterations + 1)
self.iterations += 1
self.refreshRateLabel.setText("Refresh Interval: " + str(refreshRate))
self.averageLabel.setText("Average Interval: " + str(average))
def resetBenchmark(self):
self.average = 1
self.iterations = 1
self.startTime = -1
开发者ID:andreyvit,项目名称:pyjamas,代码行数:31,代码来源:ParticleDemo.py
示例15: addRow
def addRow(self, values):
self.rows += 1
col = -1
for name, maxLength, visibleLength in self.columns:
col += 1
label = Label()
label.setText(values[col])
self.setWidget(self.rows, col, label)
开发者ID:certik,项目名称:pyjamas,代码行数:8,代码来源:Summary.py
示例16: __init__
def __init__(self, countdown=1000):
Timer.__init__(self)
Label.__init__(self)
self.countdown = countdown
self.task_id = None
self.wait_cnt = 0
self.remote_py = \
EchoServicePython(server="flask", flask_view_type="celery")
开发者ID:brodybits,项目名称:pyjs,代码行数:8,代码来源:FLASKCELERYExample.py
示例17: onRemoteResponse
def onRemoteResponse(self, response, request_info):
if(isinstance(response, (dict,))):
if("echo" in response):
msg = "Celery echo: %s\nElapsed Time: %d"
self.setText(msg % (response["echo"], self.wait_cnt))
else:
msg = "Waiting for Celery (id, checkno): %s, %d"
Label.setText(self, msg % (self.task_id, self.wait_cnt))
else:
self.setText("Could not get remote response as a dictionary")
开发者ID:brodybits,项目名称:pyjs,代码行数:10,代码来源:FLASKCELERYExample.py
示例18: addGroup
def addGroup(self, sender):
self.listPanel.setVisible(True)
op = Label(self.operator, Title='Invert group operator', StyleName='aur-search-advanced-group-op', Visible=False)
op.addClickListener(getattr(self, 'invertOperator'))
if len(self.children) > 0 or len(self.parameters) > 0: op.setVisible(True)
self.childPanel.add(op)
self.childPanel.setCellHorizontalAlignment(op, 'right')
g = ParamGroup(self.childPanel, self.kind, self, self.level+1)
g.op = op
self.children.append(g)
开发者ID:anthonyrisinger,项目名称:aur-pyjs,代码行数:10,代码来源:Search.py
示例19: AuthPanel
class AuthPanel(VerticalPanel):
def __init__(self, beginVerifyAuth, onClose, baseStyleName='gwt-authdlgbox'):
"""Initialize a new instance.
beginVerifyAuth: callable that takes (string username, string password).Should call 'endVerifyAuth' when
finished.
onClose: callable that takes (AuthDlgBox sender, bool wasAuthorized, string username, string password). Called
when Cancel is pressed, or OK is pressed and verification is successful.
baseStyleName: base css name for type. baseStyleName + -label, -textbox, and -warninglabel should also be
defined.
"""
VerticalPanel.__init__(self, StyleName=baseStyleName)
self.onClose = onClose
self.wasAuthorized = False
self._beginVerifyAuth = beginVerifyAuth
self.baseStyleName = baseStyleName
self._createContent()
def _createContent(self):
self.add(self._createUsernamePanel())
self.add(self._createPasswordPanel())
self.add(self._createButtonPanel())
self.warningLabel = Label('', StyleName='-warninglabel')
self.add(self.warningLabel)
def _createUsernamePanel(self):
hp = HorizontalPanel()
hp.add(Label('Username: ', StyleName=self.baseStyleName + '-label'))
self.usernameTB = TextBox(StyleName=self.baseStyleName + '-textbox')
hp.add(self.usernameTB)
return hp
def _createPasswordPanel(self):
hp = HorizontalPanel()
hp.add(Label('Password: ', StyleName=self.baseStyleName + '-label'))
self.passTB = PasswordTextBox(StyleName=self.baseStyleName + '-textbox')
hp.add(self.passTB)
return hp
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
def getUserAndPass(self):
return self.usernameTB.getText(), self.passTB.getText()
def onOk(self, sender):
self._beginVerifyAuth(*self.getUserAndPass())
return
def onCancel(self, sender):
self.onClose(self, False, None, None)
return
def endVerifyAuth(self, result, username, password, msg='Username/password invalid.'):
if result:
self.onClose(self, True, username, password)
else:
self.warningLabel.setText(msg)
开发者ID:satyam07,项目名称:taoggregator,代码行数:55,代码来源:commoncontrols.py
示例20: PauseResume
class PauseResume(HorizontalPanel):
def __init__(self):
HorizontalPanel.__init__(self, Spacing=4)
self.add(Label('Dispatch:', StyleName='section'))
self.pause = Button('Pause', self)
self.add(self.pause)
self.resume = Button('Resume', self)
self.add(self.resume)
self.refresh = Button('Refresh', self, StyleName='refresh')
self.add(self.refresh)
self.err = Label()
self.add(self.err)
self._refresh()
def _refresh(self):
self.refresh.setEnabled(False)
self.pause.setEnabled(False)
self.resume.setEnabled(False)
remote = server.AdminService()
id = remote.queuePaused(self)
if id < 0:
self.err.setText('oops: could not call getQueueSize')
def onClick(self, sender):
self.err.setText('')
if sender is self.refresh:
self._refresh()
elif sender is self.pause:
self._pause()
else:
self._resume()
def _pause(self):
remote = server.AdminService()
id = remote.pause(Paused(self))
if id < 0:
self.err.setText('oops: could not call pause.')
def _resume(self):
remote = server.AdminService()
id = remote.resume(Resumed(self))
if id < 0:
self.err.setText('oops: could not call resume.')
def onRemoteResponse(self, paused, request_info):
self.refresh.setEnabled(True)
if paused:
self.resume.setEnabled(True)
else:
self.pause.setEnabled(True)
def onRemoteError(self, code, message, request_info):
self.refresh.setEnabled(True)
self.err.setText('Error from queuePaused: ' + message)
开发者ID:jdunck,项目名称:Tickery,代码行数:54,代码来源:pause.py
注:本文中的pyjamas.ui.Label.Label类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论