本文整理汇总了Python中efl.elementary.label.Label类的典型用法代码示例。如果您正苦于以下问题:Python Label类的具体用法?Python Label怎么用?Python Label使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Label类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent, session):
Frame.__init__(self, parent)
self.text = "Limits"
self.size_hint_align = FILL_HORIZ
base = 1024
units = ( "bytes/s", "KiB/s", "MiB/s", "GiB/s", "TiB/s" )
t = Table(parent)
for r, values in enumerate((
("Upload limit", session.upload_rate_limit, session.set_upload_rate_limit),
("Download limit", session.download_rate_limit, session.set_download_rate_limit),
("Upload limit for local connections", session.local_upload_rate_limit, session.set_local_upload_rate_limit),
("Download limit for local connections", session.local_download_rate_limit, session.set_local_download_rate_limit),
)):
title, rfunc, wfunc = values
l = Label(parent)
l.text = title
l.size_hint_align = FILL_HORIZ
t.pack(l, 0, r, 1, 1)
l.show()
usw = UnitSpinner(parent, base, units)
usw.size_hint_weight = EXPAND_HORIZ
usw.size_hint_align = FILL_HORIZ
usw.set_value(rfunc())
usw.callback_changed_add(wfunc, delay=2.0)
t.pack(usw, 1, r, 1, 1)
usw.show()
self.content = t
示例2: build_prog_popup
def build_prog_popup(self):
pp = Popup(self)
pp.part_text_set('title,text', _('Extracting files, please wait...'))
pp.show()
vbox = Box(self)
pp.part_content_set('default', vbox)
vbox.show()
lb = Label(self, ellipsis=True, size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_HORIZ)
vbox.pack_end(lb)
lb.show()
pb = Progressbar(pp, size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_HORIZ)
vbox.pack_end(pb)
pb.show()
bt = Button(pp, text=_('Cancel'))
bt.callback_clicked_add(lambda b: self.app.abort_operation())
pp.part_content_set('button1', bt)
self.prog_pbar = pb
self.prog_label = lb
self.prog_popup = pp
示例3: __init__
def __init__(self, parent):
InnerWindow.__init__(self, parent)
vbox = Box(self)
vbox.show()
self.content = vbox
title = Label(self, scale=2.0, text='Edone %s' % VERSION)
title.show()
vbox.pack_end(title)
en = Entry(self, text=INFO, editable=False, scrollable=True,
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
en.show()
vbox.pack_end(en)
sep = Separator(self, horizontal=True)
sep.show()
vbox.pack_end(sep)
close = Button(self, text='Close')
close.callback_clicked_add(lambda b: self.delete())
close.show()
vbox.pack_end(close)
self.activate()
示例4: __init__
def __init__(self, canvas, text):
n = Notify(canvas)
l = Label(canvas)
l.text = text
n.content = l
n.timeout = 3
n.show()
示例5: __init__
def __init__(self, parent, title, done_cb, **kargs):
self._user_cb = done_cb
self._inwin = InnerWindow(parent)
vbox = Box(self._inwin)
self._inwin.content = vbox
vbox.show()
lb = Label(vbox, text='<b>%s</b>' % title)
vbox.pack_end(lb)
lb.show()
Fileselector.__init__(self, vbox, expandable=False,
size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH, **kargs)
self.callback_done_add(self._fileselector_done_cb)
self.callback_activated_add(self._fileselector_done_cb)
# TODO this filter seems not to work well...need fixing
# fs.mime_types_filter_append(list(EXTRACT_MAP.keys()), 'Archive files')
# fs.mime_types_filter_append(['*'], 'All files')
vbox.pack_end(self)
self.show()
self._inwin.activate()
示例6: buildLoadBox
def buildLoadBox(self):
# build the load label
loadLable = Label(self, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_HORIZ)
loadLable.text = "<b>Processing</b>"
loadLable.show()
# build the spinning wheel
wheel = Progressbar(self, pulse_mode=True,
size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_HORIZ)
wheel.pulse(True)
wheel.show()
detailsbtn = Button(self, style="anchor")
detailsbtn.text_set("Details")
detailsbtn.callback_pressed_add(self.innerWinShow)
detailsbtn.show()
# build the status label
self.statusLabel = Label(self, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_HORIZ)
self.statusLabel.show()
# put all the built objects in a vertical box
box = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
box.pack_end(loadLable)
box.pack_end(wheel)
box.pack_end(self.statusLabel)
box.pack_end(detailsbtn)
box.show()
return box
示例7: fileExists
def fileExists(self, filePath):
self.confirmPopup = Popup(self.mainWindow,
size_hint_weight=EXPAND_BOTH)
# Add a table to hold dialog image and text to Popup
tb = Table(self.confirmPopup, size_hint_weight=EXPAND_BOTH)
self.confirmPopup.part_content_set("default", tb)
tb.show()
# Add dialog-error Image to table
need_ethumb()
icon = Icon(self.confirmPopup, thumb='True')
icon.standard_set('dialog-question')
# Using gksudo or sudo fails to load Image here
# unless options specify using preserving their existing environment.
# may also fail to load other icons but does not raise an exception
# in that situation.
# Works fine using eSudo as a gksudo alternative,
# other alternatives not tested
try:
dialogImage = Image(self.confirmPopup,
size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_BOTH,
file=icon.file_get())
tb.pack(dialogImage, 0, 0, 1, 1)
dialogImage.show()
except RuntimeError:
# An error message is displayed for this same error
# when aboutWin is initialized so no need to redisplay.
pass
# Add dialog text to table
dialogLabel = Label(self.confirmPopup, line_wrap=ELM_WRAP_WORD,
size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_BOTH)
current_file = os.path.basename(filePath)
dialogLabel.text = "'%s' already exists. Overwrite?<br><br>" \
% (current_file)
tb.pack(dialogLabel, 1, 0, 1, 1)
dialogLabel.show()
# Close without saving button
no_btt = Button(self.mainWindow)
no_btt.text = "No"
no_btt.callback_clicked_add(self.closePopup, self.confirmPopup)
no_btt.show()
# Save the file and then close button
sav_btt = Button(self.mainWindow)
sav_btt.text = "Yes"
sav_btt.callback_clicked_add(self.doSelected)
sav_btt.callback_clicked_add(self.closePopup, self.confirmPopup)
sav_btt.show()
# add buttons to popup
self.confirmPopup.part_content_set("button1", no_btt)
self.confirmPopup.part_content_set("button3", sav_btt)
self.confirmPopup.show()
示例8: __init__
def __init__(self):
StandardWindow.__init__(self, "ex1", "Hello Elementary", size=(300, 200))
self.callback_delete_request_add(lambda o: elm.exit())
ourLabel = Label(self)
ourLabel.size_hint_weight = EXPAND_BOTH
ourLabel.text = "Hello Elementary!"
ourLabel.show()
self.resize_object_add(ourLabel)
示例9: __init__
def __init__( self ):
win = StandardWindow("Testing", "Elementary Sorted Table")
win.callback_delete_request_add(lambda o: elm.exit())
"""Build the titles for the table. The titles is a list of tuples with the following format:
( <String - Header Text>, <Bool - Sortable> )"""
titles = []
for i in range(COLUMNS):
titles.append(
("Column " + str(i), True if i != 2 else False)
)
#Create our sorted list object
slist = SortedList(win, titles=titles, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
#Populate the rows in our table
for i in range(ROWS):
#Each row is a list with the number of elements that must equal the number of headers
row = []
for j in range(COLUMNS):
#Row elements can be ANY elementary object
if j == 0:
#For the first column in each row, we will create a button that will delete the row when pressed
btn = Button(slist, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
btn.text = "Delete row"
btn.callback_clicked_add(
lambda x, y=row: slist.row_unpack(y, delete=True)
)
btn.show()
#Add the btn created to our row
row.append(btn)
else:
#For each other row create a label with a random number
data = random.randint(0, ROWS*COLUMNS)
lb = Label(slist, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
lb.text=str(data)
"""For integer data we also need to assign value to "sort_data" because otherwise things get sorted as text"""
lb.data["sort_data"] = data
lb.show()
#Append our label to the row
row.append(lb)
#Add the row into the SortedList
slist.row_pack(row, sort=False)
#Show the list
slist.show()
win.resize_object_add(slist)
win.resize(600, 400)
win.show()
示例10: update_ui
def update_ui(self, listing_in_progress=False):
box = self.header_box
box.clear()
ui_disabled = True
# file listing in progress
if listing_in_progress:
spin = Progressbar(box, style='wheel', pulse_mode=True)
spin.pulse(True)
spin.show()
box.pack_end(spin)
lb = Label(box, text=_('Reading archive, please wait...'),
size_hint_weight=EXPAND_HORIZ,
size_hint_align=(0.0, 0.5))
lb.show()
box.pack_end(lb)
# or header button
else:
if self.app.file_name is None:
txt = _('No archive loaded, click to choose a file')
else:
ui_disabled = False
txt = _('<b>Archive:</b> %s') % \
(os.path.basename(self.app.file_name))
txt = '<align=left>%s</align>' % txt
lb = Label(box, ellipsis=True, text=txt)
bt = Button(box, content=lb, size_hint_weight=EXPAND_HORIZ,
size_hint_fill=FILL_HORIZ)
bt.callback_clicked_add(lambda b: \
FileSelectorInwin(self, _('Choose an archive'),
self._archive_selected_cb,
path=os.getcwd()))
box.pack_end(bt)
bt.show()
# always show the about button
sep = Separator(box)
box.pack_end(sep)
sep.show()
ic = SafeIcon(box, 'help-about', size_hint_min=(24,24))
ic.callback_clicked_add(lambda i: InfoWin(self))
box.pack_end(ic)
ic.show()
for widget in (self.extract_btn, self.fsb,
self.create_folder_chk, self.del_chk):
widget.disabled = ui_disabled
self.update_fsb_label()
示例11: __init__
def __init__(self, parent, repo):
self.repo = repo
Popup.__init__(self, parent)
self.part_text_set("title,text", "Add remote")
tb = Table(self, padding=(3, 3), size_hint_expand=EXPAND_BOTH)
self.content = tb
tb.show()
# name
lb = Label(tb, text="Name")
tb.pack(lb, 0, 0, 1, 1)
lb.show()
en = Entry(
tb, editable=True, single_line=True, scrollable=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH
)
en.part_text_set("guide", "Name for the new remote")
en.callback_changed_user_add(lambda e: self.err_unset())
tb.pack(en, 1, 0, 1, 1)
en.show()
self.name_entry = en
# url
lb = Label(tb, text="URL")
tb.pack(lb, 0, 1, 1, 1)
lb.show()
en = Entry(
tb, editable=True, single_line=True, scrollable=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH
)
en.part_text_set("guide", "git://git.example.com/repo.git")
en.callback_changed_user_add(lambda e: self.err_unset())
tb.pack(en, 1, 1, 1, 1)
en.show()
self.url_entry = en
# error label
lb = Label(tb, text="", size_hint_expand=EXPAND_HORIZ)
tb.pack(lb, 0, 2, 2, 1)
lb.show()
self.error_label = lb
# buttons
bt = Button(self, text="Cancel")
bt.callback_clicked_add(lambda b: self.delete())
self.part_content_set("button1", bt)
bt.show()
bt = Button(self, text="Add remote")
bt.callback_clicked_add(self._add_btn_cb)
self.part_content_set("button2", bt)
bt.show()
self.show()
示例12: addPackage
def addPackage(self, pak):
row = []
ourCheck = Check(self)
ourCheck.data['packageName'] = pak.name
ourCheck.callback_changed_add(self.app.checkChange)
ourCheck.show()
row.append(ourCheck)
ourName = Button(self, style="anchor", size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_HORIZ)
ourName.text = pak.name
ourName.data["packageDes"] = pak.candidate.description
ourName.callback_pressed_add(self.packagePressed)
ourName.show()
row.append(ourName)
ourVersion = Label(self, size_hint_weight=EXPAND_HORIZ,
size_hint_align=(0.1, 0.5))
ourVersion.text = pak.installed.version
ourVersion.show()
row.append(ourVersion)
newVersion = Label(self, size_hint_weight=EXPAND_HORIZ,
size_hint_align=(0.1, 0.5))
newVersion.text = pak.candidate.version
newVersion.show()
row.append(newVersion)
self.app.packagesToUpdate[pak.name] = {'check':ourCheck, 'selected':False}
self.packageList.row_pack(row, sort=False)
示例13: popup_created
def popup_created(self, popup):
super().popup_created(popup)
# add all the available players to the popup edje box
for player in self.mpris.players:
self.popup_player_add(popup, player)
# add all the channel sliders
if self.pulse.conn is not None:
for ch in self.pulse.channels:
self.popup_volume_add(popup, ch)
else:
lb = Label(popup, text='Cannot connect to PulseAudio')
lb.show()
popup.part_box_append('volumes.box', lb)
示例14: entryInit
def entryInit(self):
self.mainEn = Entry(self.mainWindow, scrollable=True,
line_wrap=self.wordwrap, autosave=False,
size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
self.mainEn.callback_changed_user_add(self.textEdited)
self.mainEn.elm_event_callback_add(self.eventsCb)
self.mainEn.callback_clicked_add(resetCloseMenuCount)
# delete line lable if it exist so we can create and add new one
# Later need to rethink logic here
try:
self.line_label.delete()
except AttributeError:
pass
# Add label to show current cursor position
if SHOW_POS:
self.line_label = Label(self.mainWindow,
size_hint_weight=EXPAND_HORIZ,
size_hint_align=ALIGN_RIGHT)
self.mainEn.callback_cursor_changed_add(self.curChanged,
self.line_label)
self.curChanged(self.mainEn, self.line_label)
self.line_label.show()
self.mainBox.pack_end(self.line_label)
# self.mainEn.markup_filter_append(self.textFilter)
self.mainEn.show()
self.mainEn.focus_set(True)
try:
self.mainBox.pack_before(self.mainEn, self.line_label)
except AttributeError:
# line_label has not been initialized on first run
# Should have better logic on all this
self.mainBox.pack_end(self.mainEn)
示例15: errorPopup
def errorPopup(window, errorMsg):
errorPopup = Popup(window, size_hint_weight=EXPAND_BOTH)
errorPopup.callback_block_clicked_add(lambda obj: errorPopup.delete())
# Add a table to hold dialog image and text to Popup
tb = Table(errorPopup, size_hint_weight=EXPAND_BOTH)
errorPopup.part_content_set("default", tb)
tb.show()
# Add dialog-error Image to table
need_ethumb()
icon = Icon(errorPopup, thumb='True')
icon.standard_set('dialog-warning')
# Using gksudo or sudo fails to load Image here
# unless options specify using preserving their existing environment.
# may also fail to load other icons but does not raise an exception
# in that situation.
# Works fine using eSudo as a gksudo alternative,
# other alternatives not tested
try:
dialogImage = Image(errorPopup,
size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_BOTH,
file=icon.file_get())
tb.pack(dialogImage, 0, 0, 1, 1)
dialogImage.show()
except RuntimeError:
# An error message is displayed for this same error
# when aboutWin is initialized so no need to redisplay.
pass
# Add dialog text to table
dialogLabel = Label(errorPopup, line_wrap=ELM_WRAP_WORD,
size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_BOTH)
dialogLabel.text = errorMsg
tb.pack(dialogLabel, 1, 0, 1, 1)
dialogLabel.show()
# Ok Button
ok_btt = Button(errorPopup)
ok_btt.text = "Ok"
ok_btt.callback_clicked_add(lambda obj: errorPopup.delete())
ok_btt.show()
# add button to popup
errorPopup.part_content_set("button3", ok_btt)
errorPopup.show()