Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.msg_font = self.fv.get_font('fixed', 12)
vbox.add_widget(Widgets.Label("Output:"))
tw = Widgets.TextArea(wrap=True, editable=False)
tw.set_font(self.msg_font)
tw.set_limit(self.histlimit)
self.hist_w = tw
vbox2 = Widgets.VBox()
vbox2.add_widget(tw, stretch=1)
vbox2.add_widget(Widgets.Label(''), stretch=0)
vbox.add_widget(vbox2, stretch=1)
vbox2 = Widgets.VBox()
vbox2.add_widget(Widgets.Label("Type command here:"))
self.cmd_w = Widgets.TextEntry()
self.cmd_w.set_font(self.msg_font)
vbox2.add_widget(self.cmd_w, stretch=0)
self.cmd_w.add_callback('activated', self.exec_cmd_cb)
vbox.add_widget(vbox2, stretch=0)
btns = Widgets.HBox()
btns.set_spacing(4)
btns.set_border_width(4)
btn = Widgets.Button("Close")
btn.add_callback('activated', lambda w: self.close())
btns.add_widget(btn)
btn = Widgets.Button("Help")
btn.add_callback('activated', lambda w: self.help())
btns.add_widget(btn, stretch=0)
vbox = Widgets.VBox()
menubar = Widgets.Menubar()
clockmenu = menubar.add_name('Clock')
item = clockmenu.add_name("Quit")
item.add_callback('activated', lambda *args: self.quit())
vbox.add_widget(menubar, stretch=0)
self.grid = Widgets.GridBox()
self.grid.set_border_width(1)
self.grid.set_spacing(2)
vbox.add_widget(self.grid, stretch=1)
hbox = Widgets.HBox()
self.timezone_label = Widgets.Label('TimeZone')
self.county_timezone = Widgets.ComboBox(editable=True)
# make a giant list of time zones
zones = [timezone for timezones in pytz.country_timezones.values()
for timezone in timezones]
zones.sort()
for timezone in zones:
self.county_timezone.append_text(timezone)
# also let user set timezone by UTC offset
self.location_label = Widgets.Label('Location')
self.location = Widgets.TextEntry()
self.location.set_tooltip("Type a label to denote this UTC offset")
#self.location.set_length(10)
self.timeoffset_label = Widgets.Label('UTC Offset(hour)')
self.time_offset = Widgets.SpinBox(dtype=float)
b.save_path.add_callback('activated', lambda *args: self.save_as_cb())
vbox.add_widget(w, stretch=0)
top.add_widget(vbox, stretch=1)
btns = Widgets.HBox()
btns.set_border_width(4)
btns.set_spacing(4)
btn = Widgets.Button("Close")
btn.add_callback('activated', lambda w: self.close())
btns.add_widget(btn)
btn = Widgets.Button("Help")
btn.add_callback('activated', lambda w: self.help())
btns.add_widget(btn, stretch=0)
btns.add_widget(Widgets.Label(''), stretch=1)
top.add_widget(btns, stretch=0)
container.add_widget(top, stretch=1)
self.gui_up = True
btn = Widgets.CheckBox("Record Picks automatically")
btn.set_state(self.do_record)
btn.add_callback('activated', self.record_cb)
btns.add_widget(btn)
btn = Widgets.Button("Clear Log")
btn.add_callback('activated', lambda w: self.clear_pick_log_cb())
btns.add_widget(btn)
btns.add_widget(Widgets.Label(''), stretch=1)
vbox3.add_widget(btns, stretch=0)
btns = Widgets.HBox()
btns.set_spacing(4)
btn = Widgets.Button("Save table")
btn.add_callback('activated', self.write_pick_log_cb)
btns.add_widget(btn)
btns.add_widget(Widgets.Label("File:"))
ent = Widgets.TextEntry()
report_log = self.settings.get('report_log_path', None)
if report_log is None:
report_log = "pick_log.fits"
ent.set_text(report_log)
ent.set_tooltip('File type determined by extension')
self.w.report_log = ent
btns.add_widget(ent, stretch=1)
vbox3.add_widget(btns, stretch=0)
nb.add_widget(vbox3, title="Report")
fr.set_widget(nb)
box.add_widget(fr, stretch=5)
paned.add_widget(sw)
auto_scroll = self.settings.get('auto_scroll', False)
b.auto_scroll.set_state(auto_scroll)
vbox.add_widget(w, stretch=0)
if self.settings.get('closeable', False):
btns = Widgets.HBox()
btns.set_border_width(4)
btns.set_spacing(4)
btn = Widgets.Button("Close")
btn.add_callback('activated', lambda w: self.close())
btns.add_widget(btn)
btn = Widgets.Button("Help")
btn.add_callback('activated', lambda w: self.help())
btns.add_widget(btn, stretch=0)
btns.add_widget(Widgets.Label(''), stretch=1)
vbox.add_widget(btns, stretch=0)
container.add_widget(vbox, stretch=1)
self.gui_up = True
def gui_delete_window(self, tabname):
lbl = Widgets.Label("Really delete window '%s' ?" % (tabname))
dialog = Widgets.Dialog(title="Delete Window",
flags=0,
buttons=[['Cancel', 0], ['Ok', 1]],
parent=self.w.root)
dialog.add_callback('activated',
lambda w, rsp: self.delete_tab_cb(w, rsp, tabname))
box = dialog.get_content_area()
box.add_widget(lbl, stretch=0)
self.ds.show_dialog(dialog)
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()
infolbl.set_text("Please install 'mencoder' to save as movie")
fr.set_widget(infolbl)
vbox.add_widget(fr, stretch=0)
# spacer = Widgets.Label('')
# vbox.add_widget(spacer, stretch=1)
top.add_widget(sw, stretch=1)
btns = Widgets.HBox()
btns.set_spacing(4)
btn = Widgets.Button("Close")
btn.add_callback('activated', lambda w: self.close())
btns.add_widget(btn)
btn = Widgets.Button("Help")
box.set_border_width(6)
if len(l_img) < 12:
text = Widgets.Label("\n".join(l_img))
else:
text = Widgets.TextArea(wrap=None)
text.set_text("\n".join(l_img))
box.add_widget(text, stretch=1)
if action != 'remove':
hbox = Widgets.HBox()
hbox.add_widget(Widgets.Label("To channel: "))
chnl = Widgets.ComboBox()
for chname in self.chnames:
chnl.append_text(chname)
hbox.add_widget(chnl)
hbox.add_widget(Widgets.Label(''), stretch=1)
box.add_widget(hbox)
else:
chnl = None
dialog.add_callback('activated',
lambda w, rsp: self.action_images_cb(w, rsp,
chnl,
images,
action))
self.fv.ds.show_dialog(dialog)
iconpath=iconpath)
if tup[3]:
btn.set_tooltip(tup[3])
if tup[4]:
btn.add_callback('activated', tup[4])
# add to our widget dict
self.w[Widgets.name_mangle(name, pfx='btn_')] = btn
# add widget to toolbar
#tb.add_widget(btn)
hbox = Widgets.HBox()
hbox.add_widget(tb, stretch=0)
# stretcher
hbox.add_widget(Widgets.Label(''), stretch=1)
#sw.set_widget(tb)
#top.add_widget(sw, stretch=1)
container.add_widget(hbox, stretch=0)
self.gui_up = True