本文整理汇总了Python中dtk.ui.label.Label.show_all方法的典型用法代码示例。如果您正苦于以下问题:Python Label.show_all方法的具体用法?Python Label.show_all怎么用?Python Label.show_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dtk.ui.label.Label
的用法示例。
在下文中一共展示了Label.show_all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: JobsManager
# 需要导入模块: from dtk.ui.label import Label [as 别名]
# 或者: from dtk.ui.label.Label import show_all [as 别名]
class JobsManager(gtk.HBox):
__jobs = []
__id_updater = None
def __init__(self):
super(JobsManager,self).__init__(spacing=6)
self.connect("expose-event", self.draw_bg_mask)
self.jobs_label = Label("0 " + _("jobs waiting!"), app_theme.get_color("labelText"), 8)
self.jobs_label.set_size_request(150, 12)
label_align = gtk.Alignment()
label_align.set(0.5, 0.5, 0, 0)
label_align.set_padding(0, 0, 10, 0)
label_align.add(self.jobs_label)
self.progress_label = Label("", app_theme.get_color("labelText"), 8)
self.progress_label.set_size_request(500, 10)
self.__paused = False
btn_cancel = self.__create_simple_button("stop", self.stop)
self.__btn_pause = self.__create_begin_button(self.pause)
btn_pause_align = gtk.Alignment()
btn_pause_align.set(0.5, 0.5, 0, 0)
btn_pause_align.add(self.__btn_pause)
btn_cancel_align = gtk.Alignment()
btn_cancel_align.set(0.5, 0.5, 0, 0)
btn_cancel_align.set_padding(0, 0, 0, 10)
btn_cancel_align.add(btn_cancel)
self.pack_start(label_align, False, False)
# self.pack_start(self.throbber, False, False)
self.pack_start(self.progress_label,True,True)
self.pack_start(btn_pause_align,False,False)
self.pack_start(btn_cancel_align,False,False)
self.show_all()
self.set_no_show_all(True)
self.hide()
self.jobs_label.hide_all()
def draw_bg_mask(self, widget, event):
cr = widget.window.cairo_create()
rect = widget.allocation
draw_alpha_mask(cr, rect.x, rect.y, rect.width, rect.height, "frameLight")
def __create_simple_button(self, name, callback):
button = ImageButton(
app_theme.get_pixbuf("jobs/%s_normal.png" % name),
app_theme.get_pixbuf("jobs/%s_hover.png" % name),
app_theme.get_pixbuf("jobs/%s_hover.png" % name),
)
if callback:
button.connect("clicked", callback)
return button
def __create_begin_button(self, callback):
toggle_button = ToggleButton(
app_theme.get_pixbuf("jobs/pause_normal.png"),
app_theme.get_pixbuf("jobs/begin_normal.png"),
app_theme.get_pixbuf("jobs/pause_hover.png"),
app_theme.get_pixbuf("jobs/begin_hover.png")
)
if callback:
toggle_button.connect("toggled", callback)
return toggle_button
def add(self, job):
job_id = job.connect("end",self.__job_end)
self.__jobs.append((job, job_id))
if len(self.__jobs) == 1:
try: gobject.source_remove(self.__id_updater)
except: pass
self.__id_updater = gobject.timeout_add(250,self.__update)
self.__jobs[0][0].start()
if self.__paused:
self.pause(self.__btn_pause)
self.__update()
def __job_end(self, ajob):
gobject.idle_add(self.__job_end_cb, ajob)
def __job_end_cb(self, ajob):
job, job_id = self.__jobs.pop(0)
job.disconnect(job_id)
if self.__paused:
self.pause(self.__btn_pause)
if self.__jobs:
jobs = [ (job[0].priority, job) for job in self.__jobs ]
jobs.sort()
self.__jobs = [ job[1] for job in jobs ]
self.__jobs[0][0].start()
self.__update()
else:
try: gobject.source_remove(self.__id_updater)
except:pass
self.__update()
del job
def pause(self, btn):
#.........这里部分代码省略.........