def __init__(self, app=None): gtk.GtkWindow.__init__(self) self.set_title('Image Fusion') self.set_policy(FALSE, TRUE, TRUE) self.roichanged_id = None rgbdict, pandict = getLayersDict() if len(rgbdict) and len(pandict): self.rgbDict = rgbdict self.panDict = pandict else: self.close() self.nprv = 0 self.tips = gtk.GtkTooltips() self.roichanged_id = gview.app.toolbar.roi_tool.connect( 'roi-changed', self.getROIinfo) gview.app.toolbar.roi_button.set_active(TRUE) gui_OK = self.createGUI() if gui_OK is FALSE: return None else: self.show_all() self.fus = self.initFusionObject() if self.fus is None: gvutils.error('Could not initialize Fusion') self.close() self.updateExtentEntries() self.setFilename()
def __init__(self, fontspec=None, use_font=FALSE): """ Initialize the font selector and optionally load a previous font spec """ gtk.GtkHBox.__init__(self) self.use_font = use_font self.font = XLFDFontSpec() tips = gtk.GtkTooltips() if fontspec is not None: self.font.parse_font_spec(fontspec) else: self.font.set_font_part('Family', 'Arial') self.font.set_font_part('Point Size', '100') table = gtk.GtkTable() self.pack_start(table) table.set_row_spacings(6) table.set_col_spacings(6) table.set_border_width(6) self.font_label = pguFontDisplay() self.font_label.set_text(self.font.get_display_string()) table.attach(self.font_label, 0, 1, 0, 1, xoptions=gtk.SHRINK, yoptions=gtk.SHRINK) tips.set_tip(self.font_label, 'double click to toggle sample mode') font_button = gtk.GtkButton('...') font_button.connect('clicked', self.show_font_dialog) table.attach(font_button, 1, 2, 0, 1, xoptions=gtk.SHRINK, yoptions=gtk.SHRINK) tips.set_tip(font_button, 'click to select a different font') self.show_all() self.font_label.set_events(gtk.GDK.BUTTON_PRESS_MASK) self.font_label.connect('button-press-event', self.label_clicked) self.update_gui() self.publish('font-changed')
def init_customize_gui_panel(self): # By now, main panel, basic frames, buttons have been created # Middle frame (region display) must be filled in. patch_table = gtk.GtkTable(1,4,FALSE) self.show_list.append(patch_table) self.frame_dict['base_frame2'].add(patch_table) patch_table.set_border_width(5) patch_table.set_col_spacings(5) patch_table.set_col_spacing(1, 20) label1 = gtk.GtkLabel('Line: ') label1.set_alignment(0, 0.5) patch_table.attach(label1, 0,1, 0, 1) self.entry_dict['line'] = gtk.GtkEntry() self.entry_dict['line'].set_editable(gtk.FALSE) self.entry_dict['line'].set_usize(90, 25) self.entry_dict['line'].set_text('1') patch_table.attach(self.entry_dict['line'], 1,2, 0,1) label2 = gtk.GtkLabel('Pixel: ') label2.set_alignment(0, 0.5) patch_table.attach(label2, 2,3,0, 1) self.entry_dict['pixel'] = gtk.GtkEntry() self.entry_dict['pixel'].set_editable(gtk.FALSE) self.entry_dict['pixel'].set_usize(90, 25) self.entry_dict['pixel'].set_text('1') patch_table.attach(self.entry_dict['pixel'], 3,4, 0,1) # Create tooltips self.tooltips = gtk.GtkTooltips() tip_text = "Re-enable point-of-interest selection mode (" + \ "required for this tool's operation)." self.tooltips.set_tip(self.button_dict['Set Tool'],tip_text) tip_text = 'Automatically update every time the point of ' + \ 'interest changes.' self.tooltips.set_tip(self.button_dict['Auto Update'],tip_text) tip_text = 'Enable/Disable this tool.' self.tooltips.set_tip(self.button_dict['Activate'],tip_text) tip_text = 'Perform analysis.' self.tooltips.set_tip(self.button_dict['Analyze'],tip_text) self.frame_dict['base_frame2'].show_all()
def init_dialog(self): self.dialog = gtk.GtkWindow() self.dialog.set_title('GDAL Export Tool') self.dialog.set_border_width(10) self.tips = gtk.GtkTooltips() #self.dialog.set_default_size(500,400) self.dialog.set_policy(gtk.FALSE, gtk.TRUE, gtk.TRUE) # main shell mainshell = gtk.GtkHBox(spacing=1, homogeneous=gtk.FALSE) self.dialog.add(mainshell) self.show_list = [] self.adv_show_list = [] # advanced show list self.show_list.append(mainshell) #navigation shell navshell = gtk.GtkVBox(spacing=1, homogeneous=gtk.FALSE) mainshell.pack_start(navshell) self.show_list.append(navshell) self.frame_dict = {} self.button_dict = {} self.frame_dict['Files'] = gvutils.GvDataFilesFrame( 'Data Files', sel_list=('Input', 'Output')) self.frame_dict['Files'].set_border_width(5) self.frame_dict['Files'].set_spacings(5, 5) self.frame_dict['Files'].show_all() navshell.pack_start(self.frame_dict['Files']) self.show_list.append(self.frame_dict['Files']) bopt_frame = gtk.GtkFrame('Basic Options') self.frame_dict['Basic Options'] = bopt_frame self.show_list.append(bopt_frame) navshell.pack_start(bopt_frame, gtk.FALSE, gtk.FALSE, 0) bopt_table = gtk.GtkTable(2, 4, gtk.FALSE) bopt_table.set_border_width(5) bopt_table.set_row_spacings(5) bopt_table.set_col_spacings(5) bopt_frame.add(bopt_table) self.show_list.append(bopt_table) # Might be nice to have more formats below, but # this involves error checking to test for # supported data types, etc. fmtlabel = gtk.GtkLabel('Output Format: ') fmtlabel.set_alignment(0, 0.5) self.show_list.append(fmtlabel) bopt_table.attach(fmtlabel, 0, 1, 0, 1) self.format_list = [] hist_idx = 0 for iDriver in gdal.GetDriverList(): create = None try: create = iDriver.GetMetadata()["DCAP_CREATE"] except KeyError: try: create = iDriver.GetMetadata()["DCAP_CREATECOPY"] except KeyError: pass if create == "YES": if iDriver.ShortName == 'DTED': # DTED is a special case that needs certain # conditions to be valid. Skip it. continue self.format_list.append(iDriver.ShortName) self.format_list.sort() # Default to GTiff if possible try: hist_idx = self.format_list.index('GTiff') except ValueError: pass self.format_menu = gvutils.GvOptionMenu(self.format_list) self.format_menu.set_history(hist_idx) self.show_list.append(self.format_menu) bopt_table.attach(self.format_menu, 1, 2, 0, 1) self.button_dict['Format_help'] = gtk.GtkButton('Help') self.show_list.append(self.button_dict['Format_help']) bopt_table.attach(self.button_dict['Format_help'], 2, 3, 0, 1) reslabel = gtk.GtkLabel('Output Resolution: ') reslabel.set_alignment(0, 0.5) self.show_list.append(reslabel) bopt_table.attach(reslabel, 0, 1, 1, 2) self.res_list = ['Full', '1:2', '1:4', '1:8'] self.res_menu = gvutils.GvOptionMenu(self.res_list) bopt_table.attach(self.res_menu, 1, 2, 1, 2) self.show_list.append(self.res_menu) self.button_dict['Mode'] = gtk.GtkCheckButton('Advanced Options') navshell.pack_start(self.button_dict['Mode']) self.show_list.append(self.button_dict['Mode']) self.frame_dict['IP_window'] = DataWindowFrame(navshell) self.adv_show_list.append(self.frame_dict['IP_window']) iopt_frame = gtk.GtkFrame('Interactive Options') self.frame_dict['Interactive Options'] = iopt_frame self.adv_show_list.append(iopt_frame) navshell.pack_start(iopt_frame, gtk.FALSE, gtk.FALSE, 0) iopt_table = gtk.GtkTable(3, 3, gtk.FALSE) iopt_table.set_border_width(5) iopt_table.set_row_spacings(5) iopt_table.set_col_spacings(5) iopt_frame.add(iopt_table) self.adv_show_list.append(iopt_table) self.button_dict['IP_window'] = gtk.GtkCheckButton('Window Input File') iopt_table.attach(self.button_dict['IP_window'], 0, 2, 0, 1) self.adv_show_list.append(self.button_dict['IP_window']) self.button_dict['Scale'] = gtk.GtkCheckButton( 'Scale to View Settings') self.tips.set_tip( self.button_dict['Scale'], 'Scale the output bands ' + 'according to the min/max settings of the ' + 'currently active raster layer. This only ' + 'applies to real data.') iopt_table.attach(self.button_dict['Scale'], 0, 2, 1, 2) self.adv_show_list.append(self.button_dict['Scale']) self.button_dict['Refresh'] = gtk.GtkButton( 'Active Layer->Input Filename') self.tips.set_tip( self.button_dict['Refresh'], 'Set the input ' + 'filename to that of the currently active layer') iopt_table.attach(self.button_dict['Refresh'], 0, 1, 2, 3) self.adv_show_list.append(self.button_dict['Refresh']) self.button_dict['Enable_ROI'] = gtk.GtkButton('Draw ROI mode') self.tips.set_tip( self.button_dict['Enable_ROI'], 'Re-activate the ' + 'ROI mode used for interactive input file window definition') iopt_table.attach(self.button_dict['Enable_ROI'], 1, 2, 2, 3) self.adv_show_list.append(self.button_dict['Enable_ROI']) self.frame_dict['Other_Advanced'] = gtk.GtkFrame('') self.frame_dict['Other_Advanced'].set_shadow_type(gtk.SHADOW_NONE) self.adv_show_list.append(self.frame_dict['Other_Advanced']) oadvbox = gtk.GtkVBox(spacing=5, homogeneous=gtk.FALSE) oadvbox.set_border_width(5) self.adv_show_list.append(oadvbox) self.frame_dict['Other_Advanced'].add(oadvbox) otable = gtk.GtkTable(2, 3, gtk.FALSE) otable.set_row_spacings(5) otable.set_col_spacings(5) self.adv_show_list.append(otable) oadvbox.pack_start(otable) self._overview_list = ['None', 'Nearest', 'Average'] self.overview_menu = gvutils.GvOptionMenu(self._overview_list) ovrlabel = gtk.GtkLabel('Overviews:') self.tips.set_tip(self.overview_menu, 'Tiled overview creation options') ovrlabel.set_alignment(0, 0.5) self.adv_show_list.append(ovrlabel) otable.attach(ovrlabel, 0, 1, 0, 1) otable.attach(self.overview_menu, 1, 2, 0, 1) self.adv_show_list.append(self.overview_menu) self._geocode_list = ['Default', 'GCP', 'Geotransform'] self.geocoding_menu = gvutils.GvOptionMenu(self._geocode_list) geolabel = gtk.GtkLabel('Geocoding:') self.tips.set_tip( self.geocoding_menu, 'Specify the type of georeferencing ' + 'information to output. Default is to output ' + 'all available geocoding from the input file. ' + 'If GCP or Geotransform is selected, geocoding ' + 'information will only be output if it is of the ' + 'selected type. This may later be updated to ' + 'generate information of the specified form if ' + 'it is not present but can be accurately computed ' + 'from the existing information.') geolabel.set_alignment(0, 0.5) self.adv_show_list.append(geolabel) otable.attach(geolabel, 0, 1, 1, 2) otable.attach(self.geocoding_menu, 1, 2, 1, 2) self.adv_show_list.append(self.geocoding_menu) opthbox = gtk.GtkHBox(spacing=5, homogeneous=gtk.FALSE) self.adv_show_list.append(opthbox) oadvbox.pack_start(opthbox) optlabel = gtk.GtkLabel('Create Options:') optlabel.set_alignment(0, 0.5) self.adv_show_list.append(optlabel) self.optentry = gtk.GtkEntry() self.optentry.set_editable(editable=gtk.TRUE) self.optentry.set_usize(400, 25) self.optentry.set_text('') self.adv_show_list.append(self.optentry) opthbox.pack_start(optlabel) opthbox.pack_start(self.optentry) navshell.pack_start(self.frame_dict['Other_Advanced'], gtk.FALSE, gtk.FALSE, 0) echbox = gtk.GtkHBox(spacing=5, homogeneous=gtk.FALSE) echbox.set_border_width(3) navshell.pack_end(echbox, gtk.FALSE, gtk.FALSE, 0) self.show_list.append(echbox) self.button_dict['Close'] = gtk.GtkButton('Close') echbox.pack_end(self.button_dict['Close'], expand=gtk.TRUE) self.show_list.append(self.button_dict['Close']) self.button_dict['Export'] = gtk.GtkButton('Export') echbox.pack_end(self.button_dict['Export'], expand=gtk.TRUE) self.show_list.append(self.button_dict['Export']) self.button_dict['Format_help'].connect('clicked', self.format_help_cb) self.button_dict['Enable_ROI'].connect('clicked', self.set_roitool) self.button_dict['Refresh'].connect('clicked', self.refresh_fileinfo) self.button_dict['Export'].connect('clicked', self.export_cb) self.button_dict['Close'].connect('clicked', self.close) self.button_dict['IP_window'].connect('toggled', self.ip_window_toggled_cb) self.button_dict['Mode'].connect('toggled', self.mode_toggled_cb) self.button_dict['IP_window'].set_active(gtk.FALSE) self.button_dict['Mode'].set_active(gtk.FALSE) self.frame_dict['IP_window'].set_entry_sensitivities(gtk.FALSE) # Trap window close event self.dialog.connect('delete-event', self.close) for item in self.show_list: item.show() if self.button_dict['Mode'].get_active(): for item in self.adv_show_list: item.show() else: for item in self.adv_show_list: item.hide()
def _interact(func_name): (blurb, help, author, copyright, date, menupath, imagetypes, plugin_type, params, results, function) = _registered_plugins_[func_name] # short circuit for no parameters ... if len(params) == 0: return [] import gtk import gimpui gtk.rc_parse(gimp.gtkrc()) defaults = _get_defaults(func_name) # define a mapping of param types to edit objects ... class StringEntry(gtk.GtkEntry): def __init__(self, default=''): import gtk gtk.GtkEntry.__init__(self) self.set_text(str(default)) def get_value(self): return self.get_text() class IntEntry(StringEntry): def get_value(self): import string return string.atoi(self.get_text()) class FloatEntry(StringEntry): def get_value(self): import string return string.atof(self.get_text()) class ArrayEntry(StringEntry): def get_value(self): return eval(self.get_text()) class SliderEntry(gtk.GtkHScale): # bounds is (upper, lower, step) def __init__(self, default=0, bounds=(0, 100, 5)): import gtk self.adj = gtk.GtkAdjustment(default, bounds[0], bounds[1], bounds[2], bounds[2], bounds[2]) gtk.GtkHScale.__init__(self, self.adj) def get_value(self): return self.adj.value class SpinnerEntry(gtk.GtkSpinButton): # bounds is (upper, lower, step) def __init__(self, default=0, bounds=(0, 100, 5)): import gtk self.adj = gtk.GtkAdjustment(default, bounds[0], bounds[1], bounds[2], bounds[2], bounds[2]) gtk.GtkSpinButton.__init__(self, self.adj, 1, 0) def get_value(self): return int(self.adj.value) class ToggleEntry(gtk.GtkToggleButton): def __init__(self, default=0): import gtk gtk.GtkToggleButton.__init__(self) self.label = gtk.GtkLabel("No") self.add(self.label) self.label.show() self.connect("toggled", self.changed) self.set_active(default) def changed(self, tog): if tog.active: self.label.set_text("Yes") else: self.label.set_text("No") def get_value(self): return self.get_active() _edit_mapping = { PF_INT8 : IntEntry, PF_INT16 : IntEntry, PF_INT32 : IntEntry, PF_FLOAT : FloatEntry, PF_STRING : StringEntry, PF_INT8ARRAY : ArrayEntry, PF_INT16ARRAY : ArrayEntry, PF_INT32ARRAY : ArrayEntry, PF_FLOATARRAY : ArrayEntry, PF_STRINGARRAY : ArrayEntry, PF_COLOUR : gimpui.ColourSelector, PF_REGION : IntEntry, # should handle differently ... PF_IMAGE : gimpui.ImageSelector, PF_LAYER : gimpui.LayerSelector, PF_CHANNEL : gimpui.ChannelSelector, PF_DRAWABLE : gimpui.DrawableSelector, PF_TOGGLE : ToggleEntry, PF_SLIDER : SliderEntry, PF_SPINNER : SpinnerEntry, PF_FONT : gimpui.FontSelector, PF_FILE : gimpui.FileSelector, PF_BRUSH : gimpui.BrushSelector, PF_PATTERN : gimpui.PatternSelector, PF_GRADIENT : gimpui.GradientSelector, } tooltips = gtk.GtkTooltips() dialog = gtk.GtkDialog() dialog.set_title(func_name) table = gtk.GtkTable(len(params), 3, gtk.FALSE) table.set_border_width(5) table.set_row_spacings(2) table.set_col_spacings(10) dialog.vbox.pack_start(table) table.show() vbox = gtk.GtkVBox(gtk.FALSE, 15) table.attach(vbox, 0,1, 0,len(params), xoptions=gtk.FILL) vbox.show() pix = _get_logo(vbox.get_colormap()) vbox.pack_start(pix, expand=gtk.FALSE) pix.show() label = gtk.GtkLabel(blurb) label.set_line_wrap(TRUE) label.set_justify(gtk.JUSTIFY_LEFT) label.set_usize(100, -1) vbox.pack_start(label, expand=gtk.FALSE) label.show() edit_wids = [] for i in range(len(params)): type = params[i][0] name = params[i][1] desc = params[i][2] def_val = defaults[i] label = gtk.GtkLabel(name) label.set_alignment(1.0, 0.5) table.attach(label, 1,2, i,i+1, xoptions=gtk.FILL) label.show() if type in (PF_SPINNER, PF_SLIDER): wid = _edit_mapping[type](def_val, params[i][4]) else: wid = _edit_mapping[type](def_val) table.attach(wid, 2,3, i,i+1) tooltips.set_tip(wid, desc, None) wid.show() edit_wids.append(wid) def delete_event(win, event=None): import gtk win.hide() gtk.mainquit() return TRUE # this is a hack ... finished = [ 0 ] def ok_clicked(button, win=dialog, finished=finished): import gtk win.hide() finished[0] = 1 gtk.mainquit() b = gtk.GtkButton("OK") b.set_flags(gtk.CAN_DEFAULT) dialog.action_area.pack_start(b) b.grab_default() b.connect("clicked", ok_clicked) b.show() b = gtk.GtkButton("Cancel") b.set_flags(gtk.CAN_DEFAULT) dialog.action_area.pack_start(b) b.connect("clicked", delete_event) b.show() dialog.show() tooltips.enable() # run the main loop gtk.mainloop() ret = None if finished[0]: # OK was clicked ret = map(lambda wid: wid.get_value(), edit_wids) _set_defaults(func_name, ret) dialog.destroy() return ret
def __init__(self, app=None): gtk.GtkWindow.__init__(self) self.set_title('Compose Dataset') self.set_policy(gtk.FALSE, gtk.TRUE, gtk.TRUE) self.set_border_width(10) self.shell = gtk.GtkVBox(spacing=spc) self.add(self.shell) self.tips = gtk.GtkTooltips() self.input_frame = InputFrame(self, self.tips) self.show_list = [] self.adv_show_list = [] self.show_list.append(self.input_frame) self.app = app self.button_dict = {} self.button_dict['Mode'] = gtk.GtkCheckButton('Advanced Options') self.shell.pack_start(self.button_dict['Mode']) self.show_list.append(self.button_dict['Mode']) self.adv_notebook = gtk.GtkNotebook() self.shell.pack_start(self.adv_notebook) self.adv_show_list.append(self.adv_notebook) self.geo_frame = GeocodingFrame(self.tips) self.adv_notebook.append_page(self.geo_frame, gtk.GtkLabel('Geocoding')) echbox = gtk.GtkHBox(spacing=5, homogeneous=gtk.FALSE) echbox.set_border_width(3) self.shell.pack_end(echbox, gtk.FALSE, gtk.FALSE, 0) self.show_list.append(echbox) self.button_dict['Close'] = gtk.GtkButton('Close') echbox.pack_end(self.button_dict['Close'], expand=gtk.TRUE) self.button_dict['Save'] = gtk.GtkButton('Save VRT') echbox.pack_end(self.button_dict['Save'], expand=gtk.TRUE) self.button_dict['New'] = gtk.GtkButton('New View') echbox.pack_end(self.button_dict['New'], expand=gtk.TRUE) self.button_dict['Current'] = gtk.GtkButton('Current View') echbox.pack_end(self.button_dict['Current'], expand=gtk.TRUE) self.tips.set_tip(self.button_dict['Close'], 'Exit the Compose Dataset tool') self.tips.set_tip(self.button_dict['Save'], 'Create dataset and save to a VRT format file') self.tips.set_tip(self.button_dict['New'], 'Create dataset and display in a new view') self.tips.set_tip(self.button_dict['Current'], 'Create dataset and display in current view') for item in self.show_list: item.show_all() item.show() # geocode frame hides some of its contents self.geo_frame.show() self.button_dict['Save'].connect('clicked', self.create_cb, 'Save') self.button_dict['New'].connect('clicked', self.create_cb, 'New') self.button_dict['Current'].connect('clicked', self.create_cb, 'Current') self.button_dict['Close'].connect('clicked', self.close) self.button_dict['Mode'].connect('toggled', self.mode_toggled_cb) self.input_frame.subscribe('output-bands-empty', self.clear_defaults) self.input_frame.subscribe('output-bands-notempty', self.update_defaults) self.button_dict['Mode'].set_active(0) self.mode_toggled_cb() self.shell.show()
def init_dialog(self): self.dialog = gtk.GtkWindow() self.dialog.set_title('Available Image Formats') self.dialog.set_usize(300, 500) self.dialog.set_border_width(10) self.dialog.set_policy(gtk.FALSE, gtk.TRUE, gtk.TRUE) self.tooltips = gtk.GtkTooltips() self.button_dict = {} # main shell mainshell = gtk.GtkVBox(spacing=1, homogeneous=gtk.FALSE) self.dialog.add(mainshell) self.show_list = [] self.show_list.append(mainshell) #frame1=gtk.GtkFrame('Supported') #self.show_list.append(frame1) #mainshell.pack_start(frame1,expand=gtk.FALSE) #num_s=len(self.supported_list) #if num_s > 0: # s_table = gtk.GtkTable(num_s,3) # row=0 # for fmt_list in self.supported_list: # clabel=gtk.GtkEntry() # clabel.set_editable(gtk.FALSE) # clabel.set_text(fmt_list[0]) # self.show_list.append(clabel) # self._make_tooltip(clabel,fmt_list) # s_table.attach(clabel,0,1,row,row+1) # if fmt_list[4] is not None: # self.button_dict[fmt_list[1]]=gtk.GtkButton('Help') # self.button_dict[fmt_list[1]].connect('clicked',self.help_clicked_cb,fmt_list[4]) # s_table.attach(self.button_dict[fmt_list[1]],1,2,row,row+1) # row=row+1 # frame1.add(s_table) # self.show_list.append(s_table) num_us = len(self.unsupported_list) frame2 = gtk.GtkFrame() pixel_scroll = gtk.GtkScrolledWindow() self.show_list.append(pixel_scroll) self.show_list.append(frame2) mainshell.pack_start(frame2) frame2.add(pixel_scroll) num_us = len(self.unsupported_list) if num_us > 0: us_table = gtk.GtkTable(num_us, 3) row = 0 for fmt_list in self.unsupported_list: clabel = gtk.GtkEntry() clabel.set_editable(gtk.FALSE) clabel.set_text(fmt_list[0]) self.show_list.append(clabel) self._make_tooltip(clabel, fmt_list) us_table.attach(clabel, 0, 1, row, row + 1) if fmt_list[4] is not None: self.button_dict[fmt_list[1]] = gtk.GtkButton('Help') self.button_dict[fmt_list[1]].connect( 'clicked', self.help_clicked_cb, fmt_list[4]) us_table.attach(self.button_dict[fmt_list[1]], 1, 2, row, row + 1) row = row + 1 pixel_scroll.add_with_viewport(us_table) self.show_list.append(us_table) self.button_dict['close'] = gtk.GtkButton('Close') self.button_dict['close'].connect('clicked', self.close) mainshell.pack_start(self.button_dict['close'], expand=gtk.FALSE) self.show_list.append(self.button_dict['close']) self.dialog.connect('delete-event', self.close) for item in self.show_list: item.show()
def __init__(self, app=None): tooltips = gtk.GtkTooltips() gtk.GtkWindow.__init__(self) self.set_title(_('Adjust Brightness,Contrast,Gamma')) self.set_policy(gtk.FALSE, gtk.TRUE, gtk.TRUE) self.set_border_width(10) self.pan_value = [] self.vpanel = gtk.GtkVBox(spacing=spc) self.hpanel = gtk.GtkHBox(spacing=spc) self.add(self.vpanel) self.tips = gtk.GtkTooltips() #gvhtml.set_help_topic( self, "profileplot.html" ) butbox = gtk.GtkVBox() tooltips = gtk.GtkTooltips() opts = (( 'zoomin.xpm', _('Zoom in. You can also press CTRL+left mouse button to zoom in.' ), self.zoomin ), ('zoomout.xpm', _('Zoom out x 2. You can also press CTRL+right mouse button to zoom out.' ), self.zoomout)) for opt in opts: but = gtk.GtkButton() pixmap = gtk.GtkPixmap( self, os.path.join(gview.home_dir, 'pics', opt[0])) but.add(pixmap) tooltips.set_tip(but, opt[1]) but.connect('clicked', opt[2]) but.set_usize(26, 26) butbox.pack_start(but, expand=FALSE) # pan toggle panView = (('hand.xpm', _('Pan View'))) pantoggle = gtk.GtkToggleButton() pantoggle.set_name('pan') pantoggle.add( gtk.GtkPixmap(self, os.path.join(gview.home_dir, 'pics', panView[0]))) tooltips.set_tip(pantoggle, panView[1]) #pantoggle.connect('clicked', self.pan, 'pan') butbox.pack_start(pantoggle, expand=FALSE) tooltips.set_tip( pantoggle, 'Click and drag in the BEFORE window to pan the image') self.pantoggle = pantoggle self.hpanel.pack_start(butbox) lab_box = gtk.GtkHBox() lab = gtk.GtkLabel('Before') lab_box.pack_start(lab) lab = gtk.GtkLabel('After') lab_box.pack_start(lab) self.vpanel.pack_start(lab_box) self.vpanel.pack_start(self.hpanel) self.viewarea1 = gview.GvViewArea() self.viewarea1.set_usize(250, 250) self.viewarea1.connect('view-state-changed', self.view_linker) # Set up viewarea for panning self.viewarea1.connect('button-press-event', self.motion_cb) self.viewarea1.connect('button-release-event', self.dragend_cb) self.viewarea1.connect('motion-notify-event', self.drag_cb) self.hpanel.pack_start(self.viewarea1) self.viewarea2 = gview.GvViewArea() self.viewarea2.set_usize(250, 250) #self.viewarea2.connect('view-state-changed',self.view_linker) self.hpanel.pack_start(self.viewarea2) #brightness box = gtk.GtkHBox() lab = gtk.GtkLabel('Brightness') lab.set_usize(75, 20) lab.set_justify(0) self.bright_adjustment = GtkAdjustment(0, -100, 101, 1, 1, 1) self.bright_adjustment.connect('value-changed', self.image_adjust) self.bright_slider = GtkHScale(self.bright_adjustment) self.bright_slider.set_digits(0) self.bright_entry = GtkEntry(maxlen=3) self.bright_entry.set_usize(60, 25) self.bright_entry.set_text('0') self.bright_entry.connect('activate', self.entry_cb) self.bright_entry.connect('leave-notify-event', self.entry_cb) box.pack_end(self.bright_entry, expand=FALSE) box.pack_start(lab, expand=FALSE, padding=3) box.pack_start(self.bright_slider) self.vpanel.pack_start(box) #contrast box = gtk.GtkHBox() lab = gtk.GtkLabel('Contrast') lab.set_usize(75, 20) lab.set_justify(0) self.contrast_adjustment = GtkAdjustment(0, -100, 101, 1, 1, 1) self.contrast_adjustment.connect('value-changed', self.image_adjust) self.contrast_slider = GtkHScale(self.contrast_adjustment) self.contrast_slider.set_digits(0) self.contrast_entry = GtkEntry(maxlen=3) self.contrast_entry.set_usize(60, 25) self.contrast_entry.set_text('0') self.contrast_entry.connect('activate', self.entry_cb) self.contrast_entry.connect('leave-notify-event', self.entry_cb) box.pack_end(self.contrast_entry, expand=FALSE) box.pack_start(lab, expand=FALSE, padding=3) box.pack_start(self.contrast_slider) self.vpanel.pack_start(box) #gamma box = gtk.GtkHBox() lab = gtk.GtkLabel('Gamma') lab.set_usize(75, 20) lab.set_justify(0) self.gamma_adjustment = GtkAdjustment(1, 0.2, 5, 0.2, 1, 1) self.gamma_adjustment.connect('value-changed', self.image_adjust) self.gamma_slider = GtkHScale(self.gamma_adjustment) self.gamma_slider.set_digits(2) self.gamma_entry = GtkEntry(maxlen=3) self.gamma_entry.set_usize(60, 25) self.gamma_entry.set_text('1.0') self.gamma_entry.connect('activate', self.entry_cb) self.gamma_entry.connect('leave-notify-event', self.entry_cb) box.pack_end(self.gamma_entry, expand=FALSE) box.pack_start(lab, expand=FALSE, padding=3) box.pack_start(self.gamma_slider) self.vpanel.pack_start(box) sep = gtk.GtkHSeparator() self.vpanel.pack_start(sep) box = gtk.GtkHBox() but = gtk.GtkRadioButton(None, 'Overwrite', None) # box.pack_start(but) but.set_active(1) self.owrite_but = but but = gtk.GtkRadioButton(but, 'Create Copy', None) # box.pack_start(but) self.copy_but = but but = gtk.GtkButton(' Reload Original ') but.connect('clicked', self.reset) tooltips.set_tip(but, 'Remove All B-C-G Enhancements') box.pack_start(but) but = gtk.GtkButton(' Preview ') but.connect('clicked', self.apply) tooltips.set_tip(but, 'Preview your changes in the main view') box.pack_start(but) but = gtk.GtkButton(' Save ') but.connect('clicked', self.save_cb) tooltips.set_tip( but, 'Save your changes to the original file. Note: This is irreversible.' ) box.pack_start(but) but = gtk.GtkButton(' Close ') but.connect('clicked', self.cancel_cb) tooltips.set_tip(but, 'Close this Dialog') box.pack_start(but) self.vpanel.pack_start(box) self.show_all() self.load_active()