本文整理汇总了Python中gtk.ICON_SIZE_MENU属性的典型用法代码示例。如果您正苦于以下问题:Python gtk.ICON_SIZE_MENU属性的具体用法?Python gtk.ICON_SIZE_MENU怎么用?Python gtk.ICON_SIZE_MENU使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类gtk
的用法示例。
在下文中一共展示了gtk.ICON_SIZE_MENU属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _init_gui
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ICON_SIZE_MENU [as 别名]
def _init_gui(self):
if self._add_operation_text is not None:
self._button_add = gtk.Button()
button_hbox = gtk.HBox()
button_hbox.set_spacing(self._ADD_BUTTON_HBOX_SPACING)
button_hbox.pack_start(
gtk.image_new_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_MENU),
expand=False,
fill=False)
label_add = gtk.Label(self._add_operation_text.encode(pg.GTK_CHARACTER_ENCODING))
label_add.set_use_underline(True)
button_hbox.pack_start(label_add, expand=False, fill=False)
self._button_add.add(button_hbox)
else:
self._button_add = gtk.Button(stock=gtk.STOCK_ADD)
self._button_add.set_relief(gtk.RELIEF_NONE)
self._button_add.connect("clicked", self._on_button_add_clicked)
self._vbox.pack_start(self._button_add, expand=False, fill=False)
self._operations_menu = gtk.Menu()
self._init_operations_menu_popup()
示例2: set_from_icon_name
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ICON_SIZE_MENU [as 别名]
def set_from_icon_name(self, name, size = gtk.ICON_SIZE_MENU):
"""Set an icon for the group label"""
if not name:
self.groupicon.hide()
return
self.groupicon.set_from_icon_name(APP_NAME + name, size)
self.groupicon.show()
示例3: update_button
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ICON_SIZE_MENU [as 别名]
def update_button(self):
"""Update the state of our close button"""
if not self.config['close_button_on_tab']:
if self.button:
self.button.remove(self.icon)
self.remove(self.button)
del(self.button)
del(self.icon)
self.button = None
self.icon = None
return
if not self.button:
self.button = gtk.Button()
if not self.icon:
self.icon = gtk.Image()
self.icon.set_from_stock(gtk.STOCK_CLOSE,
gtk.ICON_SIZE_MENU)
self.button.set_focus_on_click(False)
self.button.set_relief(gtk.RELIEF_NONE)
style = gtk.RcStyle()
style.xthickness = 0
style.ythickness = 0
self.button.modify_style(style)
self.button.add(self.icon)
self.button.connect('clicked', self.on_close)
self.button.set_name('terminator-tab-close-button')
if hasattr(self.button, 'set_tooltip_text'):
self.button.set_tooltip_text(_('Close Tab'))
self.pack_start(self.button, False, False)
self.show_all()
示例4: callback
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ICON_SIZE_MENU [as 别名]
def callback(self, menuitems, menu, terminal):
"""Add our menu items to the menu"""
item = gtk.MenuItem(_('Custom Commands'))
menuitems.append(item)
submenu = gtk.Menu()
item.set_submenu(submenu)
menuitem = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES)
menuitem.connect("activate", self.configure)
submenu.append(menuitem)
menuitem = gtk.SeparatorMenuItem()
submenu.append(menuitem)
theme = gtk.IconTheme()
for command in self.cmd_list:
if not command['enabled']:
continue
exe = command['command'].split(' ')[0]
iconinfo = theme.choose_icon([exe], gtk.ICON_SIZE_MENU, gtk.ICON_LOOKUP_USE_BUILTIN)
if iconinfo:
image = gtk.Image()
image.set_from_icon_name(exe, gtk.ICON_SIZE_MENU)
menuitem = gtk.ImageMenuItem(command['name'])
menuitem.set_image(image)
else:
menuitem = gtk.MenuItem(command["name"])
menuitem.connect("activate", self._execute, {'terminal' : terminal, 'command' : command['command'] })
submenu.append(menuitem)
示例5: finish
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ICON_SIZE_MENU [as 别名]
def finish(self):
image = gtk.Image()
image.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
self.widget2.set_image(image)
self.widget2.set_label("Close")
示例6: _init_icons
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ICON_SIZE_MENU [as 别名]
def _init_icons(self):
self._icons = {}
self._icons["layer_group"] = self._tree_view.render_icon(
gtk.STOCK_DIRECTORY, gtk.ICON_SIZE_MENU)
self._icons["layer"] = gtk.gdk.pixbuf_new_from_file_at_size(
self._icon_image_filepath, -1, self._icons["layer_group"].props.height)
self._icons["tag"] = gtk.gdk.pixbuf_new_from_file_at_size(
self._icon_tag_filepath, -1, self._icons["layer_group"].props.height)
self._icons["exported_layer_group"] = self._icons["layer"].copy()
scaling_factor = 0.8
width_unscaled = self._icons["layer_group"].props.width
width = int(width_unscaled * scaling_factor)
height_unscaled = self._icons["layer_group"].props.height
height = int(height_unscaled * scaling_factor)
x_offset_unscaled = (
self._icons["exported_layer_group"].props.width
- self._icons["layer_group"].props.width)
x_offset = x_offset_unscaled + width_unscaled - width
y_offset_unscaled = (
self._icons["exported_layer_group"].props.height
- self._icons["layer_group"].props.height)
y_offset = y_offset_unscaled + height_unscaled - height
self._icons["layer_group"].composite(self._icons["exported_layer_group"],
x_offset, y_offset, width, height, x_offset, y_offset,
scaling_factor, scaling_factor, gtk.gdk.INTERP_BILINEAR, 255)
示例7: _setup_item_button
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ICON_SIZE_MENU [as 别名]
def _setup_item_button(self, item_button, icon, position=None):
item_button.set_relief(gtk.RELIEF_NONE)
button_icon = gtk.image_new_from_pixbuf(
item_button.render_icon(icon, gtk.ICON_SIZE_MENU))
item_button.add(button_icon)
self._hbox_buttons.pack_start(item_button, expand=False, fill=False)
if position is not None:
self._hbox_buttons.reorder_child(item_button, position)
item_button.show_all()
示例8: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ICON_SIZE_MENU [as 别名]
def __init__(self, text=None, **kwargs):
super().__init__(self, **kwargs)
self._label = gtk.Label(text)
self._label.set_alignment(0.0, 0.5)
self._label.show_all()
self._label.set_no_show_all(True)
self._button_edit = gtk.Button()
self._button_edit.set_relief(gtk.RELIEF_NONE)
self._button_edit_icon = gtk.image_new_from_pixbuf(
self._button_edit.render_icon(gtk.STOCK_EDIT, gtk.ICON_SIZE_MENU))
self._button_edit.add(self._button_edit_icon)
self._hbox = gtk.HBox(homogeneous=False)
self._hbox.set_spacing(self._LABEL_EDIT_BUTTON_SPACING)
self._hbox.pack_start(self._label, expand=True, fill=True)
self._hbox.pack_start(self._button_edit, expand=False, fill=False)
self._entry = gtk.Entry()
self._entry.show_all()
self._entry.set_no_show_all(True)
self._entry.hide()
self.pack_start(self._hbox, expand=False, fill=False)
self.pack_start(self._entry, expand=False, fill=False)
self._button_edit.connect("clicked", self._on_button_edit_clicked)
self._entry.connect("activate", self._on_entry_finished_editing)
self._entry.connect("focus-out-event", self._on_entry_finished_editing)
示例9: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ICON_SIZE_MENU [as 别名]
def __init__(self, title, owner_, widget_, popup_):
gtk.HBox.__init__(self, False, 0)
self.title = title
self.owner = owner_
self.eb = gtk.EventBox()
label = self.label = gtk.Label()
self.eb.connect('button-press-event', self.popupmenu, label)
label.set_alignment(0.0, 0.5)
label.set_text(title)
self.eb.add(label)
self.pack_start(self.eb)
label.show()
self.eb.show()
close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
image_w, image_h = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)
self.widget=widget_
self.popup = popup_
close_btn = gtk.Button()
close_btn.set_relief(gtk.RELIEF_NONE)
close_btn.connect('clicked', self.on_close_tab, owner_)
close_btn.set_size_request(image_w+7, image_h+6)
close_btn.add(close_image)
style = close_btn.get_style();
self.eb2 = gtk.EventBox()
self.eb2.add(close_btn)
self.pack_start(self.eb2, False, False)
self.eb2.show()
close_btn.show_all()
self.is_active = True
self.show()
示例10: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ICON_SIZE_MENU [as 别名]
def __init__(self, terminal):
"""Class initialiser"""
gtk.EventBox.__init__(self)
self.__gobject_init__()
self.terminator = Terminator()
self.terminal = terminal
self.config = self.terminal.config
self.label = EditableLabel()
self.label.connect('edit-done', self.on_edit_done)
self.ebox = gtk.EventBox()
grouphbox = gtk.HBox()
self.grouplabel = gtk.Label()
self.groupicon = gtk.Image()
self.bellicon = gtk.Image()
self.bellicon.set_no_show_all(True)
self.groupentry = gtk.Entry()
self.groupentry.set_no_show_all(True)
self.groupentry.connect('focus-out-event', self.groupentry_cancel)
self.groupentry.connect('activate', self.groupentry_activate)
self.groupentry.connect('key-press-event', self.groupentry_keypress)
groupsend_type = self.terminator.groupsend_type
if self.terminator.groupsend == groupsend_type['all']:
icon_name = 'all'
elif self.terminator.groupsend == groupsend_type['group']:
icon_name = 'group'
elif self.terminator.groupsend == groupsend_type['off']:
icon_name = 'off'
self.set_from_icon_name('_active_broadcast_%s' % icon_name,
gtk.ICON_SIZE_MENU)
grouphbox.pack_start(self.groupicon, False, True, 2)
grouphbox.pack_start(self.grouplabel, False, True, 2)
grouphbox.pack_start(self.groupentry, False, True, 2)
self.ebox.add(grouphbox)
self.ebox.show_all()
self.bellicon.set_from_icon_name('terminal-bell', gtk.ICON_SIZE_MENU)
hbox = gtk.HBox()
hbox.pack_start(self.ebox, False, True, 0)
hbox.pack_start(gtk.VSeparator(), False, True, 0)
hbox.pack_start(self.label, True, True)
hbox.pack_end(self.bellicon, False, False, 2)
self.add(hbox)
hbox.show_all()
self.set_no_show_all(True)
self.show()
self.connect('button-press-event', self.on_clicked)
示例11: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ICON_SIZE_MENU [as 别名]
def __init__(self):
"""Class initialiser"""
gtk.HBox.__init__(self)
self.__gobject_init__()
self.config = Config()
# Search text
self.entry = gtk.Entry()
self.entry.set_activates_default(True)
self.entry.show()
self.entry.connect('activate', self.do_search)
self.entry.connect('key-press-event', self.search_keypress)
# Label
label = gtk.Label(_('Search:'))
label.show()
# Result label
self.reslabel = gtk.Label('')
self.reslabel.show()
# Close Button
close = gtk.Button()
close.set_relief(gtk.RELIEF_NONE)
close.set_focus_on_click(False)
icon = gtk.Image()
icon.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
close.add(icon)
close.set_name('terminator-search-close-button')
if hasattr(close, 'set_tooltip_text'):
close.set_tooltip_text(_('Close Search bar'))
close.connect('clicked', self.end_search)
close.show_all()
# Next Button
self.next = gtk.Button(_('Next'))
self.next.show()
self.next.set_sensitive(False)
self.next.connect('clicked', self.next_search)
# Previous Button
self.prev = gtk.Button(_('Prev'))
self.prev.show()
self.prev.set_sensitive(False)
self.prev.connect('clicked', self.prev_search)
self.pack_start(label, False)
self.pack_start(self.entry)
self.pack_start(self.reslabel, False)
self.pack_start(self.prev, False, False)
self.pack_start(self.next, False, False)
self.pack_end(close, False, False)
self.hide()
self.set_no_show_all(True)
示例12: sub_menu
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ICON_SIZE_MENU [as 别名]
def sub_menu(self):
"""Create daemon submenu
"""
submenu = gtk.Menu()
self.start = gtk.ImageMenuItem("Start")
self.stop = gtk.ImageMenuItem("Stop")
self.restart = gtk.ImageMenuItem("Restart")
self.status = gtk.ImageMenuItem("Status")
self.start.show()
self.stop.show()
self.restart.show()
self.status.show()
img_Start = gtk.image_new_from_stock(gtk.STOCK_MEDIA_PLAY,
gtk.ICON_SIZE_MENU)
img_Start.show()
self.start.set_image(img_Start)
img_Stop = gtk.image_new_from_stock(gtk.STOCK_STOP,
gtk.ICON_SIZE_MENU)
img_Stop.show()
self.stop.set_image(img_Stop)
img_Restart = gtk.image_new_from_stock(gtk.STOCK_REFRESH,
gtk.ICON_SIZE_MENU)
img_Restart.show()
self.restart.set_image(img_Restart)
img_Status = gtk.image_new_from_stock(gtk.STOCK_DIALOG_QUESTION,
gtk.ICON_SIZE_MENU)
img_Status.show()
self.status.set_image(img_Status)
submenu.append(self.start)
submenu.append(self.stop)
submenu.append(self.restart)
submenu.append(self.status)
self.daemon = gtk.ImageMenuItem("Daemon")
self.img_daemon = gtk.image_new_from_stock(self.daemon_STOCK,
gtk.ICON_SIZE_MENU)
self.img_daemon.show()
self.daemon.set_submenu(submenu)
示例13: menu
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ICON_SIZE_MENU [as 别名]
def menu(self, event_button, event_time, data=None):
"""Create popup menu
"""
self.sub_menu()
menu = gtk.Menu()
menu.append(self.daemon)
separator = gtk.SeparatorMenuItem()
menu_Check = gtk.ImageMenuItem("Check updates")
img_Check = gtk.image_new_from_stock(gtk.STOCK_OK,
gtk.ICON_SIZE_MENU)
img_Check.show()
menu_Info = gtk.ImageMenuItem("OS Info")
img_Info = gtk.image_new_from_stock(gtk.STOCK_INFO,
gtk.ICON_SIZE_MENU)
img_Info.show()
menu_About = gtk.ImageMenuItem("About")
img_About = gtk.image_new_from_stock(gtk.STOCK_ABOUT,
gtk.ICON_SIZE_MENU)
img_About.show()
self.daemon.set_image(self.img_daemon)
menu.append(self.daemon)
self.daemon.show()
menu_Quit = gtk.ImageMenuItem("Quit")
img_Quit = gtk.image_new_from_stock(gtk.STOCK_QUIT, gtk.ICON_SIZE_MENU)
img_Quit.show()
menu_Check.set_image(img_Check)
menu_Info.set_image(img_Info)
menu_About.set_image(img_About)
menu_Quit.set_image(img_Quit)
menu.append(menu_Check)
menu.append(menu_Info)
menu.append(separator)
menu.append(menu_About)
menu.append(menu_Quit)
separator.show()
menu_Check.show()
menu_Info.show()
menu_About.show()
menu_Quit.show()
menu_Check.connect_object("activate", self._Check, " ")
menu_Info.connect_object("activate", self._Info, "OS Info")
menu_About.connect_object("activate", self._About, "SUN")
self.start.connect_object("activate", self._start, "Start daemon ")
self.stop.connect_object("activate", self._stop, "Stop daemon ")
self.restart.connect_object("activate", self._restart,
"Restart daemon ")
self.status.connect_object("activate", self._status, daemon_status())
menu_Quit.connect_object("activate", self._Quit, "stop")
menu.popup(None, None, None, event_button, event_time, data)
示例14: _init_gui
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ICON_SIZE_MENU [as 别名]
def _init_gui(self):
self._button_menu = gtk.Button()
self._button_menu.set_relief(gtk.RELIEF_NONE)
self._button_menu.add(gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_IN))
self._menu_item_update_automatically = gtk.CheckMenuItem(
_("Update Preview Automatically"))
self._menu_item_update_automatically.set_active(True)
self._menu_settings = gtk.Menu()
self._menu_settings.append(self._menu_item_update_automatically)
self._menu_settings.show_all()
self._button_refresh = gtk.Button()
self._button_refresh.set_tooltip_text(_("Update Preview"))
self._button_refresh.set_relief(gtk.RELIEF_NONE)
self._button_refresh.add(gtk.image_new_from_pixbuf(
self._button_refresh.render_icon(gtk.STOCK_REFRESH, gtk.ICON_SIZE_MENU)))
self._button_refresh.show_all()
self._button_refresh.hide()
self._button_refresh.set_no_show_all(True)
self._hbox_buttons = gtk.HBox()
self._hbox_buttons.pack_start(self._button_menu, expand=False, fill=False)
self._hbox_buttons.pack_start(self._button_refresh, expand=False, fill=False)
self._preview_image = gtk.Image()
self._preview_image.set_no_show_all(True)
self._placeholder_image = gtk.Image()
self._placeholder_image.set_from_stock(
gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_DIALOG)
self._placeholder_image.set_no_show_all(True)
self._label_layer_name = gtk.Label()
self._label_layer_name.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
self.set_spacing(self._WIDGET_SPACING)
self.set_border_width(self._BORDER_WIDTH)
self.pack_start(self._hbox_buttons, expand=False, fill=False)
self.pack_start(self._preview_image, expand=True, fill=True)
self.pack_start(self._placeholder_image, expand=True, fill=True)
self.pack_start(self._label_layer_name, expand=False, fill=False)
self._show_placeholder_image()
示例15: updateTree
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ICON_SIZE_MENU [as 别名]
def updateTree(self):
for grupo in dict(groups):
if len(groups[grupo])==0:
del groups[grupo]
if conf.COLLAPSED_FOLDERS == None:
conf.COLLAPSED_FOLDERS = ','.join(self.get_collapsed_nodes())
self.menuServers.foreach(self.menuServers.remove)
self.treeModel.clear()
iconHost = self.treeServers.render_icon("gtk-network", size=gtk.ICON_SIZE_BUTTON, detail=None)
iconDir = self.treeServers.render_icon("gtk-directory", size=gtk.ICON_SIZE_BUTTON, detail=None)
grupos = groups.keys()
grupos.sort(lambda x,y: cmp(y,x))
for grupo in grupos:
group = None
path = ""
menuNode = self.menuServers
for folder in grupo.split("/"):
path = path + '/' + folder
row = self.get_folder(self.treeModel, '', path)
if row == None:
group = self.treeModel.prepend(group, [folder, None, iconDir])
else:
group = row.iter
menu = self.get_folder_menu(self.menuServers, '', path)
if menu == None:
menu = gtk.ImageMenuItem(folder)
#menu.set_image(gtk.image_new_from_stock(gtk.STOCK_DIRECTORY, gtk.ICON_SIZE_MENU))
menuNode.prepend(menu)
menuNode = gtk.Menu()
menu.set_submenu(menuNode)
menu.show()
else:
menuNode = menu
groups[grupo].sort(key=operator.attrgetter('name'))
for host in groups[grupo]:
self.treeModel.append(group, [host.name, host, iconHost])
mnuItem = gtk.ImageMenuItem(host.name)
mnuItem.set_image(gtk.image_new_from_stock(gtk.STOCK_NETWORK, gtk.ICON_SIZE_MENU))
mnuItem.show()
mnuItem.connect("activate", lambda arg, nb, h: self.addTab(nb, h), self.nbConsole, host)
menuNode.append(mnuItem)
self.set_collapsed_nodes()
conf.COLLAPSED_FOLDERS = None