Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
hbox.add_widget(btn, stretch=0)
self.w.eval_pgs = Widgets.ProgressBar()
hbox.add_widget(self.w.eval_pgs, stretch=1)
vbox2.add_widget(hbox, stretch=0)
vbox2.add_widget(Widgets.Label(''), stretch=1)
vbox1.add_widget(vbox2, stretch=0)
# Image list
captions = [
("Append", 'button', "Prepend", 'button', "Clear", 'button'),
]
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)
fr = Widgets.Frame("Image Stack")
vbox = Widgets.VBox()
hbox = Widgets.HBox()
self.w.stack = Widgets.Label('')
hbox.add_widget(self.w.stack, stretch=0)
vbox.add_widget(hbox, stretch=0)
vbox.add_widget(w, stretch=0)
fr.set_widget(vbox)
vbox1.add_widget(fr, stretch=0)
self.update_stack_gui()
b.append.add_callback('activated', self.append_image_cb)
b.append.set_tooltip("Append an individual image to the stack")
b.prepend.add_callback('activated', self.prepend_image_cb)
b.prepend.set_tooltip("Prepend an individual image to the stack")
b.flip_y.set_tooltip("Flip the image around the Y axis")
b.swap_xy.set_tooltip("Swap the X and Y axes in the image")
b.rotate.set_tooltip("Rotate the image around the pan position")
b.restore.set_tooltip("Clear any transforms and center image")
b.restore.add_callback('activated', self.restore_cb)
b.rotate.set_limits(0.00, 359.99999999, incr_value=10.0)
b.rotate.set_value(0.00)
b.rotate.set_decimals(8)
b.rotate.add_callback('value-changed', self.rotate_cb)
fr.set_widget(w)
vbox.add_widget(fr, stretch=0)
# WCS OPTIONS
fr = Widgets.Frame("WCS")
captions = (('WCS Coords:', 'label', 'WCS Coords', 'combobox'),
('WCS Display:', 'label', 'WCS Display', 'combobox'),
)
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)
b.wcs_coords.set_tooltip("Set WCS coordinate system")
b.wcs_display.set_tooltip("Set WCS display format")
# Setup WCS coords method choice
combobox = b.wcs_coords
index = 0
for name in wcsmod.coord_types:
combobox.append_text(name)
index += 1
combobox.set_index(index)
combobox.add_callback('activated', self.set_sort_cb)
b.sort_order.set_tooltip("Sort order for images in channel")
scrollbars = self.t_.get('scrollbars', 'off')
self.w.use_scrollbars.set_state(scrollbars in ['on', 'auto'])
self.w.use_scrollbars.add_callback('activated', self.set_scrollbars_cb)
b.use_scrollbars.set_tooltip("Use scrollbars around viewer")
preload_images = self.t_.get('preload_images', False)
self.w.preload_images.set_state(preload_images)
self.w.preload_images.add_callback('activated', self.set_preload_cb)
b.preload_images.set_tooltip(
"Preload adjacent images to speed up access")
fr = Widgets.Frame()
fr.set_widget(w)
exp.set_widget(fr)
vbox.add_widget(exp, stretch=0)
exp = Widgets.Expander("Remember")
captions = (('Restore Scale', 'checkbutton',
'Restore Pan', 'checkbutton'),
('Restore Transform', 'checkbutton',
'Restore Rotation', 'checkbutton'),
('Restore Cuts', 'checkbutton',
'Restore Color Map', 'checkbutton'),
)
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)
index = self.calg_names.index(self.t_.get('color_algorithm',
"linear"))
combobox.set_index(index)
except Exception:
pass
combobox.add_callback('activated', self.set_calg_cb)
## entry = b.table_size
## entry.set_text(str(self.t_.get('color_hashsize', 65535)))
## entry.add_callback('activated', self.set_tablesize_cb)
fr.set_widget(w)
vbox.add_widget(fr)
# COLOR MAPPING OPTIONS
fr = Widgets.Frame("Color Mapping")
captions = (('Colormap:', 'label', 'Colormap', 'combobox'),
('Intensity:', 'label', 'Intensity', 'combobox'),
('Color Defaults', 'button'))
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)
self.w.cmap_choice = b.colormap
self.w.imap_choice = b.intensity
b.color_defaults.add_callback('activated',
lambda w: self.set_default_cmaps())
b.colormap.set_tooltip("Choose a color map for this image")
b.intensity.set_tooltip("Choose an intensity map for this image")
b.color_defaults.set_tooltip("Restore default color and intensity maps")
fr.set_widget(w)
vbox.add_widget(fr)
b.interval.set_enabled(False)
vbox.add_widget(w, stretch=0)
captions = [("Slice:", 'label', "Slice", 'llabel'),
# ("Value:", 'label', "Value", 'llabel'),
("Save Slice", 'button'),
]
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)
b.save_slice.add_callback('activated', lambda w: self.save_slice_cb())
b.save_slice.set_enabled(False)
b.save_slice.set_tooltip("Save current slice as RGB image")
vbox.add_widget(w, stretch=0)
fr = Widgets.Frame("Movie")
if have_mencoder:
captions = [("Start:", 'label', "Start Slice", 'entry',
"End:", 'label', "End Slice", 'entry',
'Save Movie', 'button')]
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)
b.start_slice.set_tooltip("Starting slice")
b.end_slice.set_tooltip("Ending slice")
b.start_slice.set_length(6)
b.end_slice.set_length(6)
b.save_movie.add_callback(
'activated', lambda w: self.save_movie_cb())
b.save_movie.set_enabled(False)
fr.set_widget(w)
else:
infolbl = Widgets.Label()
def build_gui(self, container):
top = Widgets.VBox()
top.set_border_width(4)
vbox, sw, orientation = Widgets.get_oriented_box(container)
vbox.set_border_width(4)
vbox.set_spacing(2)
fr = Widgets.Frame("Ruler")
captions = (("Units:", 'label', 'Units', 'combobox'),
("Show ends", 'checkbutton', "Show plumb", 'checkbutton'),
("Pan to src", 'button', "Pan to dst", 'button'),
("Pan to ctr", 'button', "Clear", 'button'),
)
w, b = Widgets.build_info(captions, orientation=orientation)
self.w = b
combobox = b.units
for name in self.unittypes:
combobox.append_text(name)
index = self.unittypes.index(self.units)
combobox.set_index(index)
combobox.set_tooltip("What units to show the measurements")
combobox.add_callback('activated', lambda w, idx: self.set_units())
self.w.mode_d = {}
btn1 = Widgets.RadioButton("Ginga")
btn1.set_state(True)
btn1.add_callback('activated', lambda w, val: self.switch_mode('ginga'))
self.w.mode_d['ginga'] = btn1
self.w.control.add_widget(btn1)
btn2 = Widgets.RadioButton("IRAF", group=btn1)
btn2.add_callback('activated', lambda w, val: self.switch_mode('iraf'))
self.w.mode_d['iraf'] = btn2
self.w.control.add_widget(btn2)
fr.set_widget(w)
vbox.add_widget(fr, stretch=0)
fr = Widgets.Frame("Frame/Channel")
lbl = Widgets.Label("")
self.w.frch = lbl
fr.set_widget(lbl)
vbox.add_widget(fr, stretch=0)
# stretch
vbox.add_widget(Widgets.Label(''), stretch=1)
btns = Widgets.HBox()
btns.set_spacing(4)
btns.set_border_width(4)
btn = Widgets.Button("Close")
btn.add_callback('activated', lambda w: self.close())
show_tabs=params.show_tabs,
show_border=params.show_border,
detachable=params.detachable,
tabpos=params.tabpos,
wstype=params.wstype,
scrollable=params.scrollable,
use_toolbar=params.use_toolbar)
widget = ws.widget
# debug(widget)
if params.get('default', False):
self.default_ws_name = params.name
# If a title was passed as a parameter, then make a frame to
# wrap the widget using the title.
if params.title:
fr = Widgets.Frame(title=params.title)
fr.set_widget(widget)
pack(fr)
else:
pack(widget)
res = []
if (kind in ('ws', 'mdi', 'grid', 'stack')) and (len(args) > 0):
# <-- Workspace specified a sub-layout. We expect a list
# of tabname, layout pairs--iterate over these and add them
# to the workspace as tabs.
for tabname, layout in args[0]:
def pack(w):
# ?why should group be the same as parent group?
self.add_tab(params.name, w, group,
tabname, tabname.lower())
def build_gui(self, container):
top = Widgets.VBox()
top.set_border_width(4)
vbox, sw, orientation = Widgets.get_oriented_box(container)
vbox.set_border_width(4)
vbox.set_spacing(2)
fr = Widgets.Frame('General')
captions = (('Line color:', 'label', 'Line colors', 'combobox'),
('Alpha:', 'label', 'Alpha', 'entryset'))
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)
combobox = b.line_colors
for name in self.colornames:
combobox.append_text(name)
combobox.set_index(self.colornames.index(self.axes.color))
combobox.add_callback('activated', self.set_linecolor_cb)
b.alpha.set_text(str(self.axes.alpha))
b.alpha.set_tooltip('Line transparency (alpha)')
b.alpha.add_callback('activated', lambda *args: self.set_alpha())
fr.set_widget(w)
def build_gui(self, container):
top = Widgets.VBox()
top.set_border_width(4)
vbox, sw, orientation = Widgets.get_oriented_box(container)
vbox.set_border_width(4)
vbox.set_spacing(2)
fr = Widgets.Frame("Mosaic")
captions = [
("FOV (deg):", 'label', 'Fov', 'llabel', 'set_fov', 'entry'),
("New Mosaic", 'button', "Allow expansion", 'checkbutton'),
("Label images", 'checkbutton', "Match bg", 'checkbutton'),
("Trim Pixels:", 'label', 'Trim Px', 'llabel',
'trim_pixels', 'entry'),
("Num Threads:", 'label', 'Num Threads', 'llabel',
'set_num_threads', 'entry'),
("Merge data", 'checkbutton', "Drop new",
'checkbutton'),
("Mosaic HDUs", 'checkbutton'),
]
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)