class File(lists.ListItem): folder_pixbuf = resources.load_icon('folder.png').get_pixbuf() file_pixbuf = resources.load_icon('page_white.png').get_pixbuf() MARKUP_TEMPLATE = '<b><tt>{0}</tt></b>{1}' def __init__(self, model, filename, expanded=False): self.model = model self.filename = unicode(filename) self.basename = os.path.basename(self.filename) if self.model.files.expanded: self.dispname = os.path.relpath(self.filename, self.model.files.path) else: self.dispname = self.basename self.lowname = self.dispname.lower() self.isdir = os.path.isdir(self.filename) self.isdir_key = (self.isdir and 'a' or 'b', self.lowname) self.hidden = HIDDEN_PATTERN.match(self.basename) self.annotation = '' @property def markup_args(self): return (self.annotation, self.dispname) @property def icon(self): if self.isdir: return self.folder_pixbuf else: return self.file_pixbuf
def create_menuitem(self): """Create a menu item from an action.""" item = gtk.ImageMenuItem() item.set_label(self.label) if self.icon is not None: item.set_image(resources.load_icon(self.icon)) item.set_always_show_image(True) item.set_data('action_key', self.key) return item
def create_tab_widget(self): """Create the tab widget.""" vb = gtk.VBox() vb.set_spacing(3) self.tab_icon = resources.load_icon(self.ICON) self.tab_icon.set_tooltip_text(self.LABEL) self.tab_holder = gtk.EventBox() self.tab_holder.add(self.tab_icon) self.tab_icon.set_can_focus(False) self.tab_holder.set_can_focus(False) self.tab_holder.add_events(gtk.gdk.BUTTON_PRESS_MASK) self.tab_holder.connect('button-press-event', self.on_tab_icon_button) vb.pack_start(self.tab_holder, expand=False) vb.show_all() return vb
def create_tab_widget(self): self.tab_box = gtk.HBox() self.tab_box.set_spacing(1) self.icon = resources.load_icon('application_xp_terminal.png') self.tab_box.pack_start(self.icon, expand=False) self.label = gtk.Label('Terminal') self.label.set_ellipsize(pango.ELLIPSIZE_START) small = pango.AttrScale(pango.SCALE_X_SMALL, 0, -1) self.label_attributes = pango.AttrList() self.label_attributes.insert(small) self.label.set_attributes(self.label_attributes) self.label.set_width_chars(9) self.tab_box.pack_start(self.label) self.tab_box.show_all() return self.tab_box
# -*- coding: utf-8 -*- # (c) 2005-2012 PIDA Authors # vim: ft=python sw=2 ts=2 sts=2 tw=80 import gtk from pygtkhelpers import delegates, utils from a8 import resources gtk.window_set_default_icon(resources.load_icon('a8.png').get_pixbuf()) class A8Window(delegates.WindowView): """Abominade window object""" def post_configure(self): self.widget.set_title('Abominade loves you.') self.accel_group = self.model.shortcuts.create_group() self.widget.add_accel_group(self.accel_group) self.set_title('') self.widget.set_default_size(800, 600) self.widget.show_all() def set_title(self, title): self.widget.set_title(u'a8♥u {0}'.format(title)) class ApplicationWindow(A8Window):
# -*- coding: utf-8 -*- # (c) 2005-2012 PIDA Authors # vim: ft=python sw=2 ts=2 sts=2 tw=80 import gtk from pygtkhelpers import delegates, utils from a8 import resources gtk.window_set_default_icon(resources.load_icon('a8.png').get_pixbuf()) class A8Window(delegates.WindowView): """Abominade window object""" def post_configure(self): self.widget.set_title('Abominade loves you.') self.accel_group = self.model.shortcuts.create_group() self.widget.add_accel_group(self.accel_group) self.set_title('') self.widget.set_default_size(800, 600) self.widget.show_all() def set_title(self, title): self.widget.set_title(u'a8♥u {0}'.format(title)) class ApplicationWindow(A8Window): """Main application window.""" def create_ui(self): """Create the user interface."""
def update_popinout_button(self): in_out = (self.model.terminals.popped_out and 'in' or 'out') self.popinout_button.set_image(resources.load_icon('terminal_pop_%s.png' % in_out)) self.popinout_button.set_tooltip_text('Pop %s terminals' % in_out)