def create_ui (self): w = libglade.GladeXML (ROOT+"misc/devhelp.glade") self.win = w.get_widget ("app1") self.win.connect ("delete_event", self.destroy) self.menu_exit = w.get_widget ("menu_exit") self.menu_exit.connect ('activate', self.menu_file_exit) self.menu_about = w.get_widget ('menu_about') self.menu_about.connect ('activate', self.menu_file_about) self.tree = w.get_widget ("ctree1") self.tree.connect ("tree_select_row", self.select_row) self.hpaned = w.get_widget ("hpaned1") self.html = HTMLWidget() self.html.html.connect ('on_url', self.on_url) self.html.html.connect ('enter_notify_event', self.html_enter) self.hpaned.add2 (self.html) self.hpaned.set_position (180) self.statusbar = w.get_widget ("appbar1") self.book_closed_icon = gtk.create_pixmap_from_xpm (self.win, None, ROOT+"images/book_red.xpm") self.book_opened_icon = gtk.create_pixmap_from_xpm (self.win, None, ROOT+"images/book_open.xpm")
def __init__(self, gui, title): Tab.__init__(self, gui, title) self._roster_selected = None self._online_icon, self._online_mask = \ gtk.create_pixmap_from_xpm( gui.get_window(), None,"online.xpm" ); self._offline_icon, self._offline_mask = \ gtk.create_pixmap_from_xpm( gui.get_window(), None,"offline.xpm" ); self._pending_icon, self._pending_mask = \ gtk.create_pixmap_from_xpm( gui.get_window(), None,"pending.xpm" ); self._rows = [] self._scroll = gtk.GtkScrolledWindow() self._ctree = gtk.GtkCTree(1,0) self._ctree.set_column_width(0,200); self._ctree.set_line_style(gtk.CTREE_LINES_NONE) self._ctree.set_expander_style(gtk.CTREE_EXPANDER_CIRCULAR) self._ctree.connect("select_row" , self.rosterSelectCB) self.paint_tree() self._scroll.add(self._ctree) self._scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.FALSE) self._box.pack_start(self._scroll, fill=gtk.TRUE, expand=gtk.TRUE) self._hbox = gtk.GtkHBox() self._box.pack_end(self._hbox, fill=gtk.TRUE, expand=gtk.FALSE) self._box.show_all() self._addToNoteBook()
def __init__(self, gui, title): Tab.__init__(self, gui, title) self._roster_selected = None self._online_icon, self._online_mask = \ gtk.create_pixmap_from_xpm( gui.get_window(), None,"online.xpm" ) self._offline_icon, self._offline_mask = \ gtk.create_pixmap_from_xpm( gui.get_window(), None,"offline.xpm" ) self._pending_icon, self._pending_mask = \ gtk.create_pixmap_from_xpm( gui.get_window(), None,"pending.xpm" ) self._rows = [] self._scroll = gtk.GtkScrolledWindow() self._ctree = gtk.GtkCTree(1, 0) self._ctree.set_column_width(0, 200) self._ctree.set_line_style(gtk.CTREE_LINES_NONE) self._ctree.set_expander_style(gtk.CTREE_EXPANDER_CIRCULAR) self._ctree.connect("select_row", self.rosterSelectCB) self.paint_tree() self._scroll.add(self._ctree) self._scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.FALSE) self._box.pack_start(self._scroll, fill=gtk.TRUE, expand=gtk.TRUE) self._hbox = gtk.GtkHBox() self._box.pack_end(self._hbox, fill=gtk.TRUE, expand=gtk.FALSE) self._box.show_all() self._addToNoteBook()
def __init__(self, resourceFile=_defaultResourceFile): import gtk self._currentNode = None self._panel = self._constructPanel(resourceFile) self._tree = self._panel.get_widget("ctree") self._folderImage, self._folderMask = \ gtk.create_pixmap_from_xpm(self._tree, None, folder) self._openFolderImage, self._openFolderMask = \ gtk.create_pixmap_from_xpm(self._tree, None, open_folder) self._nodemap = {} return
def add_button_icon(button, file, orientation="left"): button.realize() window = button.get_parent_window() xpm, mask = gtk.create_pixmap_from_xpm(window, None, file) pixmap = gtk.Image() pixmap.set_from_pixmap(xpm, mask) add_button_icon_pixmap(button, pixmap, orientation)
def add_button_icon(button, file, orientation='left'): button.realize() window = button.get_parent_window() xpm, mask = gtk.create_pixmap_from_xpm(window, None, file) pixmap = gtk.Image() pixmap.set_from_pixmap(xpm, mask) add_button_icon_pixmap(button, pixmap, orientation)
def get_histview( self, histogram, min, max,set_ymin=None,set_ymax=None ): # Prepare histogram plot data = [] bucket_width = (max - min) / 256.0 for bucket_index in range(256): data.append( (min + bucket_width * bucket_index, histogram[bucket_index]) ) # Generate histogram graph import gvplot xpm_file = gvutils.tempnam(extension='xpm') if ((set_ymin is not None) and (set_ymax is not None)): # Allows you to explicitly set ymin/ymax at startup # to avoid the gnuplot 0 y-range warning. gvplot.plot( data, xaxis = 'Pixel Value', yaxis = 'Count', xmin = min, xmax = max, ymin = set_ymin, ymax = set_ymax, output = xpm_file, title = 'Histogram', terminal = 'xpm' ) else: gvplot.plot( data, xaxis = 'Pixel Value', yaxis = 'Count', xmin = min, xmax = max, output = xpm_file, title = 'Histogram', terminal = 'xpm' ) # apply it to display. gdk_pixmap, gdk_mask = \ gtk.create_pixmap_from_xpm(self,None,xpm_file) os.unlink( xpm_file ) return (gdk_pixmap, gdk_mask)
def create_pixmap(self, filename): """ create a pixmap from a filename filename - string, the filename to create the pixmap from """ full_filename = os.path.join(gview.home_dir, 'pics', filename) if not os.path.isfile(full_filename): print '%s filename not found, using default.xpm' % full_filename full_filename = os.path.join(gview.home_dir, 'pics', 'default.xpm') pix, mask = gtk.create_pixmap_from_xpm(self, None, full_filename) return gtk.GtkPixmap(pix, mask)
def __init__(self, pix_on = "ck_on_l.xpm", pix_off = "ck_off_l.xpm"): """ """ gtk.GtkToggleButton.__init__( self ) filename = os.path.join(gview.home_dir, 'pics', pix_on) pix, mask = gtk.create_pixmap_from_xpm(self, None, filename) self.pix_on = gtk.GtkPixmap( pix, mask ) self.pix_on.show() filename = os.path.join(gview.home_dir, 'pics', pix_off) pix, mask = gtk.create_pixmap_from_xpm(self, None, filename) self.pix_off = gtk.GtkPixmap( pix, mask ) self.pix_off.show() self.add( self.pix_off ) self.active_pix = self.pix_off self.set_usize( pix.width, pix.height ) self.connect( 'toggled', self.expose ) self.connect( 'expose-event', self.expose ) self.show()
def __init__(self, pix_on="ck_on_l.xpm", pix_off="ck_off_l.xpm"): """ """ gtk.GtkToggleButton.__init__(self) filename = os.path.join(gview.home_dir, 'pics', pix_on) pix, mask = gtk.create_pixmap_from_xpm(self, None, filename) self.pix_on = gtk.GtkPixmap(pix, mask) self.pix_on.show() filename = os.path.join(gview.home_dir, 'pics', pix_off) pix, mask = gtk.create_pixmap_from_xpm(self, None, filename) self.pix_off = gtk.GtkPixmap(pix, mask) self.pix_off.show() self.add(self.pix_off) self.active_pix = self.pix_off self.set_usize(pix.width, pix.height) self.connect('toggled', self.expose) self.connect('expose-event', self.expose) self.show()
def add_icon_to_bar(self, filename, text, hint_text, cb ): full_filename = os.path.join(gview.home_dir,'pics',filename) pix, mask = gtk.create_pixmap_from_xpm(self,None,full_filename) self.iconbar.append_item(text,hint_text, hint_text, gtk.GtkPixmap(pix,mask), cb )