def gui_add_channel(self, chname=None): if not chname: self.chncnt += 1 chname = "Image%d" % self.chncnt lbl = gtk.Label('New channel name:') ent = gtk.Entry() ent.set_text(chname) ent.set_activates_default(True) lbl2 = gtk.Label('Workspace:') cbox = gtk.combo_box_new_text() names = self.ds.get_wsnames() try: idx = names.index(self._lastwsname) except: idx = 0 for name in names: cbox.append_text(name) cbox.set_active(idx) dialog = GtkHelp.Dialog("Add Channel", gtk.DIALOG_DESTROY_WITH_PARENT, [['Cancel', 0], ['Ok', 1]], lambda w, rsp: self.add_channel_cb(w, rsp, ent, cbox, names)) box = dialog.get_content_area() box.pack_start(lbl, True, False, 0) box.pack_start(ent, True, True, 0) box.pack_start(lbl2, True, False, 0) box.pack_start(cbox, True, True, 0) dialog.show_all()
def gui_delete_channel(self): chinfo = self.get_channelInfo() chname = chinfo.name lbl = gtk.Label("Really delete channel '%s' ?" % (chname)) dialog = GtkHelp.Dialog("Delete Channel", gtk.DIALOG_DESTROY_WITH_PARENT, [['Cancel', 0], ['Ok', 1]], lambda w, rsp: self.delete_channel_cb(w, rsp, chname)) box = dialog.get_content_area() box.pack_start(lbl, True, False, 0) dialog.show_all()
def gui_add_channels(self): captions = (('Prefix', 'entry'), ('Number', 'spinbutton'), ('Workspace', 'combobox'), #('Base on Channel', 'combobox'), #('Copy Settings', 'button'), #'Share Settings', 'button'), #('Cancel', 'button', 'Ok', 'button') ) w, b = GtkHelp.build_info(captions) b.prefix.set_text("Image") adj = b.number.get_adjustment() lower = 1 upper = 12 adj.configure(lower, lower, upper, 1, 1, 0) adj.set_value(lower) cbox = b.workspace names = self.ds.get_wsnames() try: idx = names.index('channels') except: idx = 0 for name in names: cbox.append_text(name) cbox.set_active(idx) ## cbox = b.base_on_channel ## names = self.get_channelNames() ## for name in names: ## cbox.append_text(name) ## prefs = self.prefs.getSettings('channel_Image') ## d = prefs.getDict() ## cbox = b.copy_settings ## for name in d.keys(): ## cbox.append_text(name) ## cbox = b.share_settings ## for name in d.keys(): ## cbox.append_text(name) dialog = GtkHelp.Dialog("Add Channels", gtk.DIALOG_DESTROY_WITH_PARENT, [['Cancel', 0], ['Ok', 1]], lambda w, rsp: self.add_channels_cb(w, rsp, b, names)) box = dialog.get_content_area() box.pack_start(w, True, True, 0) dialog.show_all()
def gui_add_ws(self): captions = (('Workspace name', 'entry'), ('Workspace type', 'combobox'), ('In workspace', 'combobox'), ('Channel prefix', 'entry'), ('Number of channels', 'spinbutton')) w, b = GtkHelp.build_info(captions) self.wscount += 1 wsname = "ws%d" % (self.wscount) b.workspace_name.set_text(wsname) cbox = b.workspace_type cbox.append_text("Tabs") cbox.append_text("Grid") #cbox.append_text("MDI") cbox.set_active(0) cbox = b.in_workspace names = self.ds.get_wsnames() names.insert(0, 'top level') try: idx = names.index('top level') except: idx = 0 for name in names: cbox.append_text(name) cbox.set_active(idx) b.channel_prefix.set_text("Image") adj = b.number_of_channels.get_adjustment() lower = 0 upper = 12 adj.configure(lower, lower, upper, 1, 1, 0) adj.set_value(1) dialog = GtkHelp.Dialog("Add Workspace", gtk.DIALOG_DESTROY_WITH_PARENT, [['Cancel', 0], ['Ok', 1]], lambda w, rsp: self.new_ws_cb(w, rsp, b, names)) box = dialog.get_content_area() box.pack_start(w, expand=True, fill=True) dialog.show_all()