def _make_imshow_box(self): self.output_box = OutputList([field.label for field in per_image_fields]) radio_box = make_radio_list([("Image", (self.imshow,)), ("Raw Image", (self.raw_imshow,)), ("X axis spectra", (self.x_spectra,)), ("Edge", (self.edge,)), ("B&W", (self.threshold,))], self.radio_callback) marker_box = make_radio_list([("None", (self.noop,)), ("marker", (self.marker,)), ("stars", (self.stars,)), ("threshold", (self.threshold_points,))], self.marker_callback) button_box = self.make_left_right_arrows(self.parent.image_spin) radio_box.pack_start(marker_box, False, False, 0) radio_box.pack_start(button_box, False, False, 0) self.display_button = make_button("Display", self.display) self.display16_button = make_button("Display x16", self.display16) self.comment, comment_box = make_entry_button(64, "comment", self.add_comment) disp_box = make_box(gtk.HBox, [self.display_button, self.display16_button]) radio_box.pack_start(disp_box, False, False, 0) radio_box.pack_start(comment_box, False, False, 0) vbox = make_box(gtk.VBox, [self.output_box.box, radio_box]) box = gtk.HBox() box.pack_start(vbox, False, False, 0) box.pack_start(self.image_box, True, True, 0) return box
def make_save_group(self): save_button = make_button("save", self.save) load_button = make_button("load", self.load) self.save_load_list = gtk.combo_box_entry_new_text() f = open(".savefile", "r") for line in f.readlines(): save_name = line.split(":")[0] self.save_load_list.append_text(save_name) return make_box(gtk.HBox, [self.save_load_list, save_button, load_button])
def _make_box(self): radio_box = make_radio_list([("Image Fields", (self.image_hist, per_image_fields)), ("Image Data", (self.data_hist, [])), ("Image Stars", (self.image_stars_hist, per_star_fields)), ("Star Fields", (self.star_hist, per_image_fields + per_star_fields)), ("Sky Value", (self.sky_value_hist, []))], self.radio_callback) self.min_spin = make_float_spinner(0, 0, 1, 0.1) self.max_spin = make_float_spinner(1, 0, 1, 0.1) self.output_box = OutputList(["N: ", "mean: ", "stddev: "]) button = make_button("set", self.replot) self.bin_spin = make_integer_spinner(5, 1000) radio_box.pack_start(make_box(gtk.HBox, [self.min_spin, self.max_spin, button]), False, False, 0) radio_box.pack_start(self.bin_spin, False, False, 0) radio_box.pack_start(self.output_box.box, False, False, 0) hbox = gtk.HBox() hbox.pack_start(radio_box, False, False, 0) hbox.pack_start(self.image_box) return hbox
def __init__(self): self.win = gtk.Window() self.win.connect("destroy", lambda x: gtk.main_quit()) self.win.set_default_size(800,600) self.win.set_title("Gattini Data Explorer") plot_button = make_button("Plot", self._plot) self.make_cmap_combo() self.make_filter_combos() self.make_xyc_combos(per_image_fields + per_star_fields) self.image_spin = make_integer_spinner(1, count("image")) self.star_spin = make_integer_spinner(1, count("star")) vsep = [gtk.VSeparator() for i in range(4)] [v.set_property("width-request", 1) for v in vsep] toolbar1 = make_box(gtk.HBox, [plot_button, vsep[0], self.xyc_box, vsep[1], self.image_spin, self.star_spin, vsep[3], self.cmap_combo]) toolbar2 = make_box(gtk.HBox, [self.filter_box, vsep[2]]) self.nb = gtk.Notebook() self.nb.set_tab_pos(gtk.POS_TOP) self.nb.connect("switch-page", self.change_page) self.tabs = [] for tab, name in [(PlottingTab, "plot"), (ImageTab, "image"), (StarTab, "star"), (HistTab, "hist")]: tab = tab(self) self.tabs.append(tab) self.nb.append_page(tab.box, tab.label) setattr(self, name, tab) box = gtk.VBox() box.pack_start(toolbar1, False, False, 0) box.pack_start(toolbar2, False, False, 0) box.pack_start(self.nb) self.win.add(box) self.win.show_all()
def make_clear_button(self): return make_button("Clear", self.clear)
def make_left_right_arrows(self, spinner): buttons = [] for lab, offset in [("<<<", -50), ("<<-", -10), ("<-", -1), ("->", 1), ("->>", 10), (">>>", 50)]: buttons.append(make_button(lab, self.left_right, *(offset, spinner))) return make_box(gtk.HBox, buttons)