本文整理汇总了Python中dtk.ui.button.Button.get_label方法的典型用法代码示例。如果您正苦于以下问题:Python Button.get_label方法的具体用法?Python Button.get_label怎么用?Python Button.get_label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dtk.ui.button.Button
的用法示例。
在下文中一共展示了Button.get_label方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EqualizerWindow
# 需要导入模块: from dtk.ui.button import Button [as 别名]
# 或者: from dtk.ui.button.Button import get_label [as 别名]
#.........这里部分代码省略.........
def __select_name(self):
self.menu_dict = OrderedDict()
for name in MANDATORY.keys():
self.menu_dict[name] = [None, name, self.__change, name]
values = []
for i in range(0, 10):
try:
value = int(float(config.get("equalizer", "equalizer-band%s" % str(i))))
except:
value = 0
values.append(str(value))
values = ":".join(values)
self.has_tick = False
for name, value in MANDATORY.iteritems():
value = value.split(":")
value = ":".join([str(int(float(v))) for v in value])
if value == values:
self.menu_dict[name][0] = (
app_theme.get_pixbuf("menu/tick.png"),
app_theme.get_pixbuf("menu/tick_press.png"),
)
self.has_tick = True
if not self.has_tick:
self.menu_dict[MANDATORY_CUSTOM][0] = (
app_theme.get_pixbuf("menu/tick.png"),
app_theme.get_pixbuf("menu/tick_press.png"),
)
def get_selected_index(self):
values = []
for i in range(0, 10):
try:
value = int(float(config.get("equalizer", "equalizer-band%s" % str(i))))
except:
value = 0
values.append(str(value))
values = ":".join(values)
for index, value in enumerate(MANDATORY.values()):
value = value.split(":")
value = ":".join([str(int(float(v))) for v in value])
if value == values:
return index
return 0
def set_predefine_value(self, widget, label, allocated_data, index):
self.__change(allocated_data)
def show_predefine(self, widget):
self.__select_name()
menu_items = self.menu_dict.values()
menu_items.insert(2, None)
Menu(menu_items, True).show(get_widget_root_coordinate(widget))
def __on_adjust_change(self, adjust, i):
if not self.manual_flag:
self.predefine_combo_box.set_select_index(0)
config.set("equalizer", "equalizer-band%s" % str(i), str(adjust.get_value()))
self.manual_flag = False
def __save(self, *args):
text = self.predefine_button.get_label()
if text in MANDATORY.keys():
return
values = []
for i in range(0, 10):
try:
value = float(config.get("equalizer", "equalizer-band%s" % str(i)))
except:
value = 0.0
values.append(str(value))
def __change(self, name):
if name == MANDATORY_CUSTOM:
self.predefine_combo_box.set_select_index(0)
return True
self.manual_flag = True
if name in MANDATORY.keys():
values = MANDATORY[name].split(":")
for i, value in enumerate(values):
adj = self.__scales[i].get_adjustment()
adj.handler_block(adj.changed_id)
self.__scales[i].set_value(float(value))
config.set("equalizer", "equalizer-band%s" % str(i), str(float(value)))
adj.handler_unblock(adj.changed_id)
return True
def run(self):
if config.get("equalizer", "x") == "-1":
self.set_position(gtk.WIN_POS_CENTER)
else:
self.move(int(config.get("equalizer", "x")), int(config.get("equalizer", "y")))
self.show_all()