text
stringlengths
0
828
131,"def disable_multicolor(self):
"""""" swap from the multicolor image to the single color image """"""
# disable the multicolor image
for color in ['red', 'green', 'blue']:
self.multicolorscales[color].config(state=tk.DISABLED, bg='grey')
self.multicolorframes[color].config(bg='grey')
self.multicolorlabels[color].config(bg='grey')
self.multicolordropdowns[color].config(bg='grey', state=tk.DISABLED)
self.multicolorminscale[color].config(bg='grey', state=tk.DISABLED)
self.multicolormaxscale[color].config(bg='grey', state=tk.DISABLED)
# enable the single color
self.singlecolorscale.config(state=tk.NORMAL, bg=self.single_color_theme)
self.singlecolorframe.config(bg=self.single_color_theme)
self.singlecolorlabel.config(bg=self.single_color_theme)
self.singlecolordropdown.config(bg=self.single_color_theme, state=tk.NORMAL)
self.singlecolorminscale.config(bg=self.single_color_theme, state=tk.NORMAL)
self.singlecolormaxscale.config(bg=self.single_color_theme, state=tk.NORMAL)"
132,"def update_button_action(self):
"""""" when update button is clicked, refresh the data preview""""""
if self.mode.get() == 3: # threecolor
self.configure_threecolor_image()
elif self.mode.get() == 1: # singlecolor
self.configure_singlecolor_image()
else:
raise ValueError(""mode can only be singlecolor or threecolor"")
self.imageplot.set_data(self.image)
if self.mode.get() == 1: # singlecolor
self.imageplot.set_cmap('gist_gray')
self.fig.canvas.draw_idle()"
133,"def make_configure_tab(self):
"""""" initial set up of configure tab""""""
# Setup the choice between single and multicolor
modeframe = tk.Frame(self.tab_configure)
self.mode = tk.IntVar()
singlecolor = tk.Radiobutton(modeframe, text=""Single color"", variable=self.mode,
value=1, command=lambda: self.disable_multicolor())
multicolor = tk.Radiobutton(modeframe, text=""Three color"", variable=self.mode,
value=3, command=lambda: self.disable_singlecolor())
self.mode.set(3)
singlecolor.pack(side=tk.LEFT)
multicolor.pack(side=tk.LEFT)
updatebutton = tk.Button(master=modeframe, text=""Update"",
command=self.update_button_action)
updatebutton.pack(side=tk.RIGHT)
modeframe.grid(row=0, column=0)
self.setup_multicolor()
self.setup_singlecolor()"
134,"def make_classify_tab(self):
"""""" initial set up of classification tab""""""
self.pick_frame = tk.Frame(self.tab_classify)
self.pick_frame2 = tk.Frame(self.tab_classify)
self.solar_class_var = tk.IntVar()
self.solar_class_var.set(0) # initialize to unlabeled
buttonnum = 0
frame = [self.pick_frame, self.pick_frame2]
for text, value in self.config.solar_classes:
b = tk.Radiobutton(frame[buttonnum % 2], text=text,
variable=self.solar_class_var,
value=value, background=self.config.solar_colors[text],
indicatoron=0, width=50, height=2, command=self.change_class)
b.pack(fill=tk.BOTH, expand=1)
buttonnum += 1
self.pick_frame.grid(row=0, column=0, rowspan=5, sticky=tk.W + tk.E + tk.N + tk.S)
self.pick_frame2.grid(row=0, column=1, rowspan=5, sticky=tk.W + tk.E + tk.N + tk.S)
undobutton = tk.Button(master=self.tab_classify, text=""Undo"",
command=self.undobutton_action)
undobutton.grid(row=6, column=0, columnspan=2, sticky=tk.W + tk.E)"
135,"def setup_singlecolor(self):
"""""" initial setup of single color options and variables""""""
self.singlecolorframe = tk.Frame(self.tab_configure, bg=self.single_color_theme)
channel_choices = sorted(list(self.data.keys()))
self.singlecolorlabel = tk.Label(self.singlecolorframe, text=""single"", bg=self.single_color_theme, width=10)
self.singlecolorvar = tk.StringVar()
self.singlecolorpower = tk.DoubleVar()
self.singlecolormin = tk.DoubleVar()
self.singlecolormax = tk.DoubleVar()
self.singlecolordropdown = tk.OptionMenu(self.singlecolorframe, self.singlecolorvar, *channel_choices)
self.singlecolorscale = tk.Scale(self.singlecolorframe, variable=self.singlecolorpower,
orient=tk.HORIZONTAL, from_=self.config.ranges['single_color_power_min'],
bg=self.single_color_theme,
to_=self.config.ranges['single_color_power_max'],
resolution=self.config.ranges['single_color_power_resolution'],
length=200)
self.singlecolorminscale = tk.Scale(self.singlecolorframe, variable=self.singlecolormin,
orient=tk.HORIZONTAL, from_=0,
bg=self.single_color_theme,
to_=self.config.ranges['single_color_vmin'],
resolution=self.config.ranges['single_color_vresolution'], length=200)
self.singlecolormaxscale = tk.Scale(self.singlecolorframe, variable=self.singlecolormax,
orient=tk.HORIZONTAL, from_=self.config.ranges['single_color_vmax'],
bg=self.single_color_theme,
to_=100, resolution=self.config.ranges['single_color_vresolution'],