def _parse_page(self, node, notebook, attributes): tab_box = gtk.HBox(spacing=3) if '_' not in attributes['string']: attributes['string'] = '_' + attributes['string'] label = gtk.Label(attributes['string']) label.set_use_underline(True) tab_box.pack_start(label) if 'icon' in attributes: ICONFACTORY.register_icon(attributes['icon']) pixbuf = tab_box.render_icon(attributes['icon'], gtk.ICON_SIZE_SMALL_TOOLBAR) icon = gtk.Image() icon.set_from_pixbuf(pixbuf) tab_box.pack_start(icon) tab_box.show_all() viewport = gtk.Viewport() viewport.set_shadow_type(gtk.SHADOW_NONE) scrolledwindow = gtk.ScrolledWindow() scrolledwindow.set_shadow_type(gtk.SHADOW_NONE) scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scrolledwindow.add(viewport) scrolledwindow.show_all() notebook.append_page(scrolledwindow, tab_box) container = self.parse(node) viewport.add(container.table)
def _parse_page(self, node, notebook, attributes): tab_box = gtk.HBox(spacing=3) if 'name' in attributes: field = self.screen.group.fields[attributes['name']] if attributes['name'] == self.screen.exclude_field: return for attr in ('states', 'string'): if attr not in attributes and attr in field.attrs: attributes[attr] = field.attrs[attr] label = gtk.Label('_' + attributes['string'].replace('_', '__')) label.set_use_underline(True) tab_box.pack_start(label) if 'icon' in attributes: ICONFACTORY.register_icon(attributes['icon']) pixbuf = tab_box.render_icon(attributes['icon'], gtk.ICON_SIZE_SMALL_TOOLBAR) icon = gtk.Image() icon.set_from_pixbuf(pixbuf) tab_box.pack_start(icon) tab_box.show_all() viewport = gtk.Viewport() viewport.set_shadow_type(gtk.SHADOW_NONE) scrolledwindow = ScrolledWindow(attrs=attributes) scrolledwindow.set_shadow_type(gtk.SHADOW_NONE) scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scrolledwindow.add(viewport) scrolledwindow.show_all() self.state_widgets.append(scrolledwindow) notebook.append_page(scrolledwindow, tab_box) container = self.parse(node) viewport.add(container.table)
def _set_icon(self, stock): if not stock: self.set_image(gtk.Image()) return ICONFACTORY.register_icon(stock) icon = gtk.Image() icon.set_from_stock(stock, gtk.ICON_SIZE_SMALL_TOOLBAR) self.set_image(icon)
def _set_icon(self, stock): image = self.get_image() if not image and not stock: return elif image and image.get_stock()[0] == stock: return if not stock: self.set_image(gtk.Image()) return ICONFACTORY.register_icon(stock) icon = gtk.Image() icon.set_from_stock(stock, gtk.ICON_SIZE_SMALL_TOOLBAR) self.set_image(icon)
def _parse_image(self, node, container, attributes): ICONFACTORY.register_icon(attributes['name']) image = Image(attrs=attributes) image.set_from_stock(attributes['name'], gtk.ICON_SIZE_DIALOG) self.state_widgets.append(image) container.add(image, attributes)
def _parse_image(self, node, container, attributes): ICONFACTORY.register_icon(attributes['name']) image = gtk.Image() image.set_from_stock(attributes['name'], gtk.ICON_SIZE_DIALOG) container.add(image, attributes)