def __init__(self, colorSeq=colorSeq): names, self.colors= zip(*colorSeq) self.colorDict = dict(colorSeq) self.colorNames = list(names) gtk.HBox.__init__(self) self._ignore_updates = False vb1 = gtk.VBox() vb2 = gtk.VBox() vb1.show() vb2.show() self.pack_start(vb1, False) self.pack_start(vb2, False) self.colorNames.append(self.custom_str) self.optmenu = make_option_menu( self.colorNames, self._ddlist_changed) self.optmenu.show() vb1.pack_start(self.optmenu, True, False) initial_color = self.colorDict[self.optmenu.get_active_text()] self.color_chooser = ColorChooser(initial_color) vb2.pack_start(self.color_chooser, True, False) self.color_chooser.connect("color_changed", self.color_changed) self.show()
def _make_intensity_frame(self): """ Provides the following attributes self.collecting # intensity collection on self.intensitySum = 0 # intensity sum self.intensityCnt = 0 # intensity cnt self.labelIntensity # label for intensity entry self.entryIntensity # intensity entry box """ self.collecting = False self.intensitySum = 0 self.intensityCnt = 0 vbox = gtk.VBox() vbox.show() vbox.set_spacing(3) label = gtk.Label('Segmentation') label.show() self.notebook.append_page(vbox, label) frame = gtk.Frame('Set the segment intensity') frame.show() frame.set_border_width(5) vbox.pack_start(frame, False, False) vboxFrame = gtk.VBox() vboxFrame.show() vboxFrame.set_spacing(3) frame.add(vboxFrame) table = gtk.Table(1, 2) table.set_col_spacings(3) table.show() vboxFrame.pack_start(table, True, True) self.labelIntensity = gtk.Label('Value: ') self.labelIntensity.show() self.entryIntensity = gtk.Entry() self.entryIntensity.show() self.entryIntensity.set_text('%1.1f' % SurfParams.intensity) table.attach(self.labelIntensity, 0, 1, 0, 1, xoptions=gtk.FILL, yoptions=0) table.attach(self.entryIntensity, 1, 2, 0, 1, xoptions=gtk.EXPAND | gtk.FILL, yoptions=0) hbox = gtk.HBox() hbox.show() hbox.set_homogeneous(True) hbox.set_spacing(3) vboxFrame.pack_start(hbox, False, False) button = ButtonAltLabel('Capture', gtk.STOCK_ADD) button.show() button.connect('clicked', self.start_collect_intensity) hbox.pack_start(button, True, True) button = ButtonAltLabel('Stop', gtk.STOCK_STOP) button.show() button.connect('clicked', self.stop_collect_intensity) hbox.pack_start(button, True, True) button = ButtonAltLabel('Clear', gtk.STOCK_CLEAR) button.show() button.connect('clicked', self.clear_intensity) hbox.pack_start(button, True, True) frame = gtk.Frame('Segment properties') frame.show() frame.set_border_width(5) vbox.pack_start(frame, False, False) vboxFrame = gtk.VBox() vboxFrame.show() vboxFrame.set_spacing(3) frame.add(vboxFrame) table = gtk.Table(2, 2) table.set_col_spacings(3) table.set_row_spacings(3) table.show() vboxFrame.pack_start(table, True, True) self.labelName = gtk.Label('Label: ') self.labelName.show() self.labelName.set_alignment(xalign=1.0, yalign=0.5) self.entryName = gtk.Entry() self.entryName.show() self.entryName.set_text(SurfParams.label) table.attach(self.labelName, 0, 1, 0, 1, xoptions=gtk.FILL, yoptions=0) table.attach(self.entryName, 1, 2, 0, 1, xoptions=gtk.EXPAND | gtk.FILL, yoptions=0) def func(menuitem, s): if s == 'choose': self.lastColor = self.choose_color() else: self.entryName.set_text(s) self.lastColor = colord[s] colors = [name for name, color in colorSeq] colors.append('choose') label = gtk.Label('Color: ') label.show() label.set_alignment(xalign=1.0, yalign=0.5) optmenu = make_option_menu(colors, func) optmenu.show() table.attach(label, 0, 1, 1, 2, xoptions=gtk.FILL, yoptions=0) table.attach(optmenu, 1, 2, 1, 2, xoptions=gtk.EXPAND | gtk.FILL, yoptions=0) button = ButtonAltLabel('Add segment', gtk.STOCK_ADD) button.show() button.connect('clicked', self.add_segment) vbox.pack_start(button, False, False)
def _make_intensity_frame(self): """ Provides the following attributes self.collecting # intensity collection on self.intensitySum = 0 # intensity sum self.intensityCnt = 0 # intensity cnt self.labelIntensity # label for intensity entry self.entryIntensity # intensity entry box """ self.collecting = False self.intensitySum = 0 self.intensityCnt = 0 vbox = gtk.VBox() vbox.show() vbox.set_spacing(3) label = gtk.Label("Segmentation") label.show() self.notebook.append_page(vbox, label) frame = gtk.Frame("Set the segment intensity") frame.show() frame.set_border_width(5) vbox.pack_start(frame, False, False) vboxFrame = gtk.VBox() vboxFrame.show() vboxFrame.set_spacing(3) frame.add(vboxFrame) table = gtk.Table(1, 2) table.set_col_spacings(3) table.show() vboxFrame.pack_start(table, True, True) self.labelIntensity = gtk.Label("Value: ") self.labelIntensity.show() self.entryIntensity = gtk.Entry() self.entryIntensity.show() self.entryIntensity.set_text("%1.1f" % SurfParams.intensity) table.attach(self.labelIntensity, 0, 1, 0, 1, xoptions=gtk.FILL, yoptions=0) table.attach(self.entryIntensity, 1, 2, 0, 1, xoptions=gtk.EXPAND | gtk.FILL, yoptions=0) hbox = gtk.HBox() hbox.show() hbox.set_homogeneous(True) hbox.set_spacing(3) vboxFrame.pack_start(hbox, False, False) button = ButtonAltLabel("Capture", gtk.STOCK_ADD) button.show() button.connect("clicked", self.start_collect_intensity) hbox.pack_start(button, True, True) button = ButtonAltLabel("Stop", gtk.STOCK_STOP) button.show() button.connect("clicked", self.stop_collect_intensity) hbox.pack_start(button, True, True) button = ButtonAltLabel("Clear", gtk.STOCK_CLEAR) button.show() button.connect("clicked", self.clear_intensity) hbox.pack_start(button, True, True) frame = gtk.Frame("Segment properties") frame.show() frame.set_border_width(5) vbox.pack_start(frame, False, False) vboxFrame = gtk.VBox() vboxFrame.show() vboxFrame.set_spacing(3) frame.add(vboxFrame) table = gtk.Table(2, 2) table.set_col_spacings(3) table.set_row_spacings(3) table.show() vboxFrame.pack_start(table, True, True) self.labelName = gtk.Label("Label: ") self.labelName.show() self.labelName.set_alignment(xalign=1.0, yalign=0.5) self.entryName = gtk.Entry() self.entryName.show() self.entryName.set_text(SurfParams.label) table.attach(self.labelName, 0, 1, 0, 1, xoptions=gtk.FILL, yoptions=0) table.attach(self.entryName, 1, 2, 0, 1, xoptions=gtk.EXPAND | gtk.FILL, yoptions=0) def func(menuitem, s): if s == "choose": self.lastColor = self.choose_color() else: self.entryName.set_text(s) self.lastColor = colord[s] colors = [name for name, color in colorSeq] colors.append("choose") label = gtk.Label("Color: ") label.show() label.set_alignment(xalign=1.0, yalign=0.5) optmenu = make_option_menu(colors, func) optmenu.show() table.attach(label, 0, 1, 1, 2, xoptions=gtk.FILL, yoptions=0) table.attach(optmenu, 1, 2, 1, 2, xoptions=gtk.EXPAND | gtk.FILL, yoptions=0) button = ButtonAltLabel("Add segment", gtk.STOCK_ADD) button.show() button.connect("clicked", self.add_segment) vbox.pack_start(button, False, False)