本文整理汇总了Python中higwidgets.higbuttons.HIGButton.set_image方法的典型用法代码示例。如果您正苦于以下问题:Python HIGButton.set_image方法的具体用法?Python HIGButton.set_image怎么用?Python HIGButton.set_image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类higwidgets.higbuttons.HIGButton
的用法示例。
在下文中一共展示了HIGButton.set_image方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Proprieties
# 需要导入模块: from higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from higwidgets.higbuttons.HIGButton import set_image [as 别名]
class Proprieties(HIGScrolledWindow):
'''
This box should be configurable
if widget is of a type all configuration should be change to this type
#tricks: option_list have a icon to fill with options
and option_check have a list of options in combo to change
'''
def __init__(self):
HIGScrolledWindow.__init__(self)
self._boxeditable = None
vp = gtk.Viewport()
self._create_widgets()
vp.add(self._box)
vp.set_shadow_type(gtk.SHADOW_NONE)
self.add(vp)
self._profilecore = None
self._selected = None
def set_profilecore(self, profilecore):
self._profilecore = profilecore
def _create_widgets(self):
'''
Create the main entrys of the option
'''
self._box = HIGVBox()
self._table = HIGTable()
#Name
self._label_name = HIGEntryLabel(_('Name'))
self._entry_name = HIGTextEntry()
self._entry_name.connect('activate', self._update_label)
#Type
self._label_type = HIGEntryLabel(_('Type'))
self._combo_type = gtk.combo_box_new_text()
self._combo_type.append_text('')
self._combo_type.append_text('Option List')
self._combo_type.append_text('Option Check')
self._combo_type.set_active(0)
self._combo_type.connect('changed', self.change_combo)
self._label_opt = HIGEntryLabel(_('Option'))
self._entry_opt = HIGTextEntry()
self._entry_opt.set_sensitive(False)
#For option list open a dialog to add/remove options
self._button_list = HIGButton('Edit Option List')
img = gtk.Image()
img_dir = os.path.join(pixmaps_dir, 'uie', 'combo.png')
img.set_from_file(img_dir)
self._button_list.set_image(img)
self._button_list.connect('button-press-event', self._button_list_clicked)
self._table.attach(self._label_name, 0,1,0, 1)
self._table.attach(self._entry_name, 1,2,0,1)
self._table.attach(self._label_type, 0,1,1,2)
self._table.attach(self._combo_type, 1,2,1, 2)
self._table.attach(self._button_list, 0,2, 3,4)
self._table.attach(self._label_opt, 0,1, 4,5)
self._table.attach(self._entry_opt, 1,2,4,5)
self._box.pack_start(self._table, False, False)
def _button_list_clicked(self, widget, event):
section_name = self._boxeditable.get_name()
lm = ListManager(self._entry_name.get_text(),section_name,
self._profilecore, self._selected, _('List of items'))
def _update_label(self, widget):
#XXX Replace by Command
log.debug("Update Label")
selected = self._selected
cmd = CommandChangeLabel(selected, self._entry_name.get_text(),
self._profilecore,self._boxeditable, True)
command_manager.add_command(cmd)
def change_combo(self,combo):
model = combo.get_model()
index = combo.get_active()
if index:
if model[index][0]=='Option List':
log.debug('Show Button List ')
self._button_list.show()
else:
log.debug('Hide Button List ')
self._button_list.hide()
return
#.........这里部分代码省略.........
示例2: ToolDesign
# 需要导入模块: from higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from higwidgets.higbuttons.HIGButton import set_image [as 别名]
class ToolDesign(HIGScrolledWindow):
'''
ToolDesign contains widgets that you can add to Notebook to edit Profile
and Wizard
'''
def __init__(self, only_text=True):
HIGScrolledWindow.__init__(self)
self._box = HIGVBox()
vp = gtk.Viewport()
self._box.set_border_width(6)
if only_text:
self._draw_buttons()
self._pack()
#ELSE == Algo com icons; ETC!
vp.add(self._box)
vp.set_shadow_type(gtk.SHADOW_NONE)
self.add(vp)
def update_toolbar(self):
pass
def _draw_buttons(self):
self.button_list = HIGButton('Option List')
img = gtk.Image()
img_dir = os.path.join(pixmaps_dir, 'uie', 'combo.png')
img.set_from_file(img_dir)
self.button_list.set_image(img)
self.button_list.drag_source_set(gtk.gdk.BUTTON1_MASK ,
target, gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
self.button_list.connect('drag_data_get', self._drag_option_list)
self.button_label = HIGButton('Label')
img = gtk.Image()
img_dir = os.path.join(pixmaps_dir,'uie', 'label.png')
img.set_from_file(img_dir)
self.button_label.set_image(img)
self.button_label.drag_source_set(gtk.gdk.BUTTON1_MASK ,
target, gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
self.button_label.connect('drag_data_get', self.source_drag_data_get)
self.button_check = HIGButton('Option Check')
img = gtk.Image()
img_dir = os.path.join(pixmaps_dir, 'uie', 'checkbutton.png')
img.set_from_file(img_dir)
self.button_check.set_image(img)
self.button_path = HIGButton('Choose Path')
self.button_text_entry = HIGButton('String')
img = gtk.Image()
img_dir = os.path.join(pixmaps_dir,'uie', 'entry.png')
img.set_from_file(img_dir)
self.button_text_entry.set_image(img)
self.button_float = HIGButton('Float Spin')
img = gtk.Image()
img_dir = os.path.join(pixmaps_dir, 'uie', 'spinbutton.png')
img.set_from_file(img_dir)
self.button_float.set_image(img)
self.button_level = HIGButton('Level Spin')
img = gtk.Image()
img_dir = os.path.join(pixmaps_dir, 'uie', 'spinbutton.png')
img.set_from_file(img_dir)
self.button_level.set_image(img)
self.button_interface = HIGButton('Interface')
self.button_integer = HIGButton('Integer Spin ')
img = gtk.Image()
img_dir = os.path.join(pixmaps_dir, 'uie', 'spinbutton.png')
img.set_from_file(img_dir)
self.button_integer.set_image(img)
def source_drag_data_get(self, btn, context, selection_data, info, time):
selection_data.set(selection_data.target, 8, "Label")
def _drag_option_list(self, btn, context, selection_data, info, time):
selection_data.set(selection_data.target, 8, "_widget_option_list")
def _pack(self):
box = self._box
box.pack_start(self.button_list, False, False)
box.pack_start(self.button_label, False, False)
示例3: PluginRow
# 需要导入模块: from higwidgets.higbuttons import HIGButton [as 别名]
# 或者: from higwidgets.higbuttons.HIGButton import set_image [as 别名]
#.........这里部分代码省略.........
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)
reader = property(get_reader)