本文整理汇总了Python中higwidgets.higbuttons.HIGButton.set_label方法的典型用法代码示例。如果您正苦于以下问题:Python HIGButton.set_label方法的具体用法?Python HIGButton.set_label怎么用?Python HIGButton.set_label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类higwidgets.higbuttons.HIGButton
的用法示例。
在下文中一共展示了HIGButton.set_label方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PluginRow
# 需要导入模块: from higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from higwidgets.higbuttons.HIGButton import set_label [as 别名]
#.........这里部分代码省略.........
self.box_act = gtk.HBox(False, 2)
self.box_act.pack_start(align, True, True, 0)
self.box_act.pack_start(self.uninstall_btn, False, False, 0)
self.box_act.pack_start(self.action_btn, False, False, 0)
self.box_act.set_border_width(4)
self.vbox.pack_start(self.box_act, False, False, 0)
def __on_activate(self, widget):
if not self._activatable:
self.box_act.hide()
return
if self._show_progress:
self.box_act.hide()
self.progressbar.show()
else:
self.progressbar.hide()
if self.active:
self.box_act.show()
else:
self.box_act.hide()
def get_enabled(self):
return self._enabled
def set_enabled(self, val):
self._enabled = val
# We need more testing on color/saturate on enabled
if self._enabled:
self.action_btn.set_label(_("Disable"))
self.action_btn.set_image(self.img_stop)
#
color = self.style.text[gtk.STATE_NORMAL]
self.saturate = False
else:
self.action_btn.set_label(_("Enable"))
self.action_btn.set_image(self.img_play)
#
color = self.style.text[gtk.STATE_INSENSITIVE]
self.saturate = True
self.label.set_text( \
"<span color=\"%s\">"
"<span size=\"x-large\" weight=\"bold\">%s</span>" \
" %s" \
"\n<tt>%s</tt>" \
"</span>" % \
( \
color.to_string(), \
self._reader.name, \
self._reader.version, \
self._message \
) \
)
self.label.set_use_markup(True)
def get_reader(self):
return self._reader
enabled = property(get_enabled, set_enabled)
示例2: Date
# 需要导入模块: from higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from higwidgets.higbuttons.HIGButton import set_label [as 别名]
class Date(gtk.HBox, object):
def __init__(self):
gtk.HBox.__init__(self)
self._create_widgets()
self._connect_widgets()
self._pack_widgets()
self.date = localtime()[:3]
def _create_widgets(self):
t = localtime()
self.date_button = HIGButton()
self.date_sep = gtk.Label(", ")
self.hour = gtk.SpinButton(gtk.Adjustment(value=t[3],
lower=0,
upper=23,
step_incr=1), 1)
self.hour_sep = gtk.Label(":")
self.minute = gtk.SpinButton(gtk.Adjustment(value=t[4],
lower=0,
upper=59,
step_incr=1), 1)
def _connect_widgets(self):
self.date_button.connect("clicked", self.show_calendar)
def _pack_widgets(self):
self.hour.set_width_chars(2)
self.minute.set_width_chars(2)
self.pack_start(self.date_button, False, False)
self.pack_start(self.date_sep, False, False)
self.pack_start(self.hour, False, False)
self.pack_start(self.hour_sep, False, False)
self.pack_start(self.minute, False, False)
def show_calendar(self, widget):
calendar = DateCalendar()
calendar.connect_calendar(self.update_button)
calendar.show_all()
def update_button(self, widget):
date = list(widget.get_date())
date[1] += 1 # Add 1 to month, because calendar date is zero-based
self.date = tuple(date)
def set_date(self, date):
# Localtime Format: (year, month, day)
self.date_button.set_label("%02d %s %04d" % (
date[2], calendar.month_name[date[1]][:3], date[0]))
self._date = date
def get_date(self):
return self._date
def get_time(self):
return (self.hour.get_value_as_int(), self.minute.get_value_as_int())
def set_time(self, time):
print time
if isinstance(time, list):
self.hour.set_value(time[0])
self.minute.set_value(time[1])
elif isinstance(time, basestring):
time = time.split(";")
self.hour.set_value(time[0])
self.minute.set_value(time[1])
date = property(get_date, set_date)
time = property(get_time, set_time)
_date = localtime()[:3]