本文整理汇总了Python中ginga.misc.Widgets.build_info方法的典型用法代码示例。如果您正苦于以下问题:Python Widgets.build_info方法的具体用法?Python Widgets.build_info怎么用?Python Widgets.build_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ginga.misc.Widgets
的用法示例。
在下文中一共展示了Widgets.build_info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_naxis
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import build_info [as 别名]
def build_naxis(self, dims):
# build a vbox of NAXIS controls
captions = [("NAXIS1:", 'label', 'NAXIS1', 'llabel'),
("NAXIS2:", 'label', 'NAXIS2', 'llabel')]
self.naxispath = []
for n in range(2, len(dims)):
self.naxispath.append(0)
key = 'naxis%d' % (n+1)
title = key.upper()
maxn = int(dims[n])
self.logger.debug("NAXIS%d=%d" % (n+1, maxn))
if maxn <= 1:
captions.append((title+':', 'label', title, 'llabel'))
else:
captions.append((title+':', 'label', title, 'llabel',
#"Choose %s" % (title), 'spinbutton'))
"Choose %s" % (title), 'hscale'))
# Remove old naxis widgets
for key in self.w:
if key.startswith('choose_'):
self.w[key] = None
w, b = Widgets.build_info(captions, orientation=self.orientation)
self.w.update(b)
for n in range(0, len(dims)):
key = 'naxis%d' % (n+1)
lbl = b[key]
maxn = int(dims[n])
lbl.set_text("%d" % maxn)
slkey = 'choose_'+key
if slkey in b:
slider = b[slkey]
lower = 1
upper = maxn
slider.set_limits(lower, upper, incr_value=1)
slider.set_value(lower)
slider.set_tracking(True)
#slider.set_digits(0)
#slider.set_wrap(True)
slider.add_callback('value-changed', self.set_naxis_cb, n)
# Add vbox of naxis controls to gui
self.naxisfr.set_widget(w)
self.play_axis = 2
if self.play_axis < len(dims):
self.play_max = dims[self.play_axis]
self.play_idx = 1
# Enable or disable NAXIS animation controls
is_dc = len(dims) > 2
self.w.next.set_enabled(is_dc)
self.w.prev.set_enabled(is_dc)
self.w.first.set_enabled(is_dc)
self.w.last.set_enabled(is_dc)
self.w.play.set_enabled(is_dc)
self.w.stop.set_enabled(is_dc)
self.w.interval.set_enabled(is_dc)
示例2: build_params
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import build_info [as 别名]
def build_params(self, paramlst):
# construct a set of widgets for the parameters
captions = []
for param in paramlst:
title = param.get('time', param.name)
captions.append((title+':', 'label', param.name, 'entry'))
w, b = Widgets.build_info(captions)
# fill with default values and tool tips
for param in paramlst:
name = param.name
# if we have a cached value for the parameter, use it
if self.params.has_key(name):
value = self.params[name]
b[name].set_text(str(value))
# otherwise initialize to the default value, if available
elif param.has_key('default'):
value = param.default
b[name].set_text(str(value))
self.params[name] = value
if param.has_key('description'):
b[name].set_tooltip(param.description)
b[name].add_callback('activated', self._value_changed_cb)
self.paramlst = paramlst
self.widgets = b
return w
示例3: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import build_info [as 别名]
def build_gui(self, container):
super(SPCAM, self).build_gui(container)
vbox = self.w.vbox
fr = Widgets.Frame("Flats")
captions = [
("Use flats", 'checkbutton'),
("Flat dir:", 'label', 'flat_dir', 'entry'),
("Load Flats", 'button'),
]
w, b = Widgets.build_info(captions)
self.w.update(b)
b.flat_dir.set_length(512)
b.flat_dir.set_text(self.settings.get('flat_dir', ''))
b.load_flats.add_callback('activated', self.load_flats_cb)
b.use_flats.set_tooltip("Flat field tiles as they arrive")
use_flats = self.settings.get('use_flats', False)
b.use_flats.set_state(use_flats)
b.flat_dir.set_tooltip("Directory containing flat field tiles")
b.load_flats.set_tooltip("Load flat field tiles from directory")
fr.set_widget(w)
vbox.add_widget(fr, stretch=0)
示例4: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import build_info [as 别名]
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)
self.msgFont = self.fv.getFont("sansFont", 12)
tw = Widgets.TextArea(wrap=True, editable=False)
tw.set_font(self.msgFont)
self.tw = tw
fr = Widgets.Frame("Instructions")
vbox2 = Widgets.VBox()
vbox2.add_widget(tw)
vbox2.add_widget(Widgets.Label(''), stretch=1)
fr.set_widget(vbox2)
vbox.add_widget(fr, stretch=0)
fr = Widgets.Frame("Blink")
captions = (("Interval:", 'label', 'Interval', 'entry',
"Start Blink", 'button', "Stop Blink", 'button'),
)
w, b = Widgets.build_info(captions, orientation=orientation)
self.w = b
b.interval.set_text(str(self.interval))
b.interval.add_callback('activated', lambda w: self._set_interval_cb())
b.interval.set_tooltip("Interval in seconds between changing images")
b.start_blink.add_callback('activated',
lambda w: self._start_blink_cb())
b.stop_blink.add_callback('activated',
lambda w: self._stop_blink_cb())
fr.set_widget(w)
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(3)
btn = Widgets.Button("Close")
btn.add_callback('activated', lambda w: self.close())
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)
示例5: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import build_info [as 别名]
def build_gui(self, container):
vbox = Widgets.VBox()
self.msgFont = self.fv.getFont("fixedFont", 12)
tw = Widgets.TextArea(wrap=False, editable=False)
tw.set_font(self.msgFont)
tw.set_limit(self.histlimit)
self.tw = tw
sw = Widgets.ScrollArea()
sw.set_widget(self.tw)
vbox.add_widget(sw, stretch=1)
captions = (('Level', 'combobox', 'History', 'spinbutton'),
('Auto scroll', 'checkbutton', 'Clear', 'button')
)
w, b = Widgets.build_info(captions)
self.w.update(b)
combobox = b.level
for (name, level) in self.levels:
combobox.append_text(name)
combobox.set_index(1)
combobox.add_callback('activated', self.set_loglevel_cb)
combobox.set_tooltip("Set the logging level")
spinbox = b.history
spinbox.set_limits(100, self.histmax, incr_value=10)
spinbox.set_value(self.histlimit)
spinbox.add_callback('value-changed', self.set_history_cb)
spinbox.set_tooltip("Set the logging history line limit")
btn = b.auto_scroll
btn.set_state(self.autoscroll)
btn.set_tooltip("Scroll the log window automatically")
btn.add_callback('activated', self.set_autoscroll_cb)
btn = b.clear
btn.add_callback('activated', lambda w: self.clear())
btn.set_tooltip("Clear the log history")
vbox.add_widget(w, stretch=0)
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)
btns.add_widget(Widgets.Label(''), stretch=1)
vbox.add_widget(btns, stretch=0)
container.add_widget(vbox, stretch=1)
示例6: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import build_info [as 别名]
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)
self.msgFont = self.fv.getFont("sansFont", 12)
tw = Widgets.TextArea(wrap=True, editable=False)
tw.set_font(self.msgFont)
self.tw = tw
fr = Widgets.Frame("Instructions")
vbox2 = Widgets.VBox()
vbox2.add_widget(tw)
vbox2.add_widget(Widgets.Label(''), stretch=1)
fr.set_widget(vbox2)
vbox.add_widget(fr, stretch=0)
fr = Widgets.Frame("Ruler")
captions = (('Units:', 'label', 'Units', 'combobox'),)
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.add_callback('activated', lambda w, idx: self.set_units())
fr.set_widget(w)
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(3)
btn = Widgets.Button("Close")
btn.add_callback('activated', lambda w: self.close())
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)
示例7: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import build_info [as 别名]
def build_gui(self, container):
if not have_samp:
raise GingaPlugin.PluginError("To run this plugin you need to install the astropy.vo.samp module")
vbox = Widgets.VBox()
vbox.set_border_width(4)
vbox.set_spacing(2)
msgFont = self.fv.getFont("sansFont", 12)
tw = Widgets.TextArea(wrap=True, editable=False)
tw.set_font(msgFont)
self.tw = tw
fr = Widgets.Frame("Instructions")
fr.set_widget(tw)
vbox.add_widget(fr, stretch=0)
fr = Widgets.Frame("SAMP")
captions = [('Start hub', 'checkbutton'),
('Connect client', 'checkbutton'),
]
w, b = Widgets.build_info(captions)
self.w.update(b)
b.start_hub.set_tooltip("Start a SAMP hub")
b.start_hub.set_state(self.settings.get('start_hub', True))
b.start_hub.add_callback('activated', self.start_hub_cb)
b.connect_client.set_tooltip("Register with a SAMP hub")
b.connect_client.set_state(self.settings.get('default_connect',
True))
b.connect_client.add_callback('activated', self.connect_client_cb)
fr.set_widget(w)
vbox.add_widget(fr, stretch=0)
# stretch
vbox.add_widget(Widgets.Label(''), 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)
btns.add_widget(Widgets.Label(''), stretch=1)
vbox.add_widget(btns, stretch=0)
container.add_widget(vbox, stretch=1)
示例8: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import build_info [as 别名]
def build_gui(self, container):
assert have_pyfits == True, \
Exception("Please install astropy/pyfits to use this plugin")
vbox1 = Widgets.VBox()
vbox1.set_border_width(4)
vbox1.set_spacing(4)
self.msgFont = self.fv.getFont("sansFont", 12)
tw = Widgets.TextArea(wrap=True, editable=False)
tw.set_font(self.msgFont)
self.tw = tw
fr = Widgets.Frame("Instructions")
fr.set_widget(tw)
vbox1.add_widget(fr, stretch=0)
fr = Widgets.Frame("HDU")
captions = [("Num HDUs:", 'label', "Num HDUs", 'llabel'),
("Choose HDU", 'spinbutton')]
w, b = Widgets.build_info(captions)
self.w.update(b)
self.w.numhdu = b.num_hdus
self.w.hdu = b.choose_hdu
self.w.hdu.set_tooltip("Choose which HDU to view")
self.w.hdu.add_callback('value-changed', self.set_hdu_cb)
fr.set_widget(w)
vbox1.add_widget(fr, stretch=0)
fr = Widgets.Frame("NAXIS")
self.naxisfr = fr
vbox1.add_widget(fr, stretch=0)
# FIX: somehow this is not working correctly with Qt
vbox1.add_widget(Widgets.Label(''), 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)
btns.add_widget(Widgets.Label(''), stretch=1)
vbox1.add_widget(btns, stretch=0)
container.add_widget(vbox1, stretch=1)
示例9: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import build_info [as 别名]
def build_gui(self, container):
vbox = Widgets.VBox()
self.msgFont = self.fv.getFont("fixedFont", 12)
tw = Widgets.TextArea(wrap=False, editable=False)
tw.set_font(self.msgFont)
self.tw = tw
self.history = []
self.histmax = 10
sw = Widgets.ScrollArea()
sw.set_widget(self.tw)
vbox.add_widget(sw, stretch=1)
captions = (('Local plugin:', 'label', 'Local plugin', 'entry',
'Reload', 'button'),
('Global plugin:', 'label', 'Global plugin', 'entry',
'ReloadG', 'button'),
)
w, b = Widgets.build_info(captions)
self.w.update(b)
b.local_plugin.set_tooltip("Name of a local plugin to reload")
b.local_plugin.set_length(14)
b.reload.add_callback('activated', self.reload_local_cb)
b.global_plugin.set_tooltip("Name of a global plugin to reload")
b.global_plugin.set_length(14)
b.reloadg.add_callback('activated', self.reload_global_cb)
vbox.add_widget(w, stretch=1)
self.entry = Widgets.TextEntry()
vbox.add_widget(self.entry, stretch=0)
self.entry.add_callback('activated', self.command_cb)
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)
btns.add_widget(Widgets.Label(''), stretch=1)
vbox.add_widget(btns)
container.add_widget(vbox, stretch=1)
示例10: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import build_info [as 别名]
def build_gui(self, container):
vbox = Widgets.VBox()
fr = Widgets.Frame("Remote Control")
captions = [
("Addr:", 'label', "Addr", 'llabel', 'Restart', 'button'),
("Set Addr:", 'label', "Set Addr", 'entry'),
]
w, b = Widgets.build_info(captions)
self.w.update(b)
addr = self.host + ':' + str(self.port)
b.addr.set_text(addr)
b.restart.set_tooltip("Restart the server")
b.restart.add_callback('activated', self.restart_cb)
b.set_addr.set_length(100)
b.set_addr.set_text(addr)
b.set_addr.set_tooltip("Set address to run remote control server")
b.set_addr.add_callback('activated', self.set_addr_cb)
fr.set_widget(w)
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())
btns.add_widget(btn)
btns.add_widget(Widgets.Label(''), stretch=1)
vbox.add_widget(btns)
container.add_widget(vbox, stretch=1)
示例11: build_naxis
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import build_info [as 别名]
def build_naxis(self, dims):
# build a vbox of NAXIS controls
captions = [("NAXIS1:", 'label', 'NAXIS1', 'llabel'),
("NAXIS2:", 'label', 'NAXIS2', 'llabel')]
self.naxispath = []
for n in xrange(2, len(dims)):
self.naxispath.append(0)
key = 'naxis%d' % (n+1)
title = key.upper()
maxn = int(dims[n])
self.logger.debug("NAXIS%d=%d" % (n+1, maxn))
if maxn <= 1:
captions.append((title+':', 'label', title, 'llabel'))
else:
captions.append((title+':', 'label', title, 'llabel',
"Choose %s" % (title), 'spinbutton'))
w, b = Widgets.build_info(captions)
self.w.update(b)
for n in xrange(0, len(dims)):
key = 'naxis%d' % (n+1)
lbl = b[key]
maxn = int(dims[n])
lbl.set_text("%d" % maxn)
slkey = 'choose_'+key
if b.has_key(slkey):
slider = b[slkey]
lower = 1
upper = maxn
slider.set_limits(lower, upper, incr_value=1)
slider.set_value(lower)
#slider.set_digits(0)
#slider.set_wrap(True)
slider.add_callback('value-changed', self.set_naxis_cb, n)
# Add vbox of naxis controls to gui
self.naxisfr.set_widget(w)
示例12: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import build_info [as 别名]
def build_gui(self, container):
top = Widgets.VBox()
top.set_border_width(4)
vbox, sw, self.orientation = Widgets.get_oriented_box(container)
vbox.set_border_width(4)
vbox.set_spacing(2)
msgFont = self.fv.getFont('sansFont', 12)
tw = Widgets.TextArea(wrap=True, editable=False)
tw.set_font(msgFont)
self.tw = tw
fr = Widgets.Frame('Instructions')
vbox2 = Widgets.VBox()
vbox2.add_widget(tw)
vbox2.add_widget(Widgets.Label(''), stretch=1)
fr.set_widget(vbox2)
vbox.add_widget(fr, stretch=0)
fr = Widgets.Frame('Background Selection')
captions = (('Type:', 'label', 'BG type', 'combobox'), )
w, b = Widgets.build_info(captions)
self.w.update(b)
combobox = b.bg_type
for name in self._bgtype_options:
combobox.append_text(name)
b.bg_type.set_index(self._bgtype_options.index(self.bgtype))
b.bg_type.widget.activated[str].connect(self.set_bgtype)
fr.set_widget(w)
vbox.add_widget(fr, stretch=0)
fr = Widgets.Frame('Attributes')
vbox2 = Widgets.VBox()
self.w.bgtype_attr_vbox = Widgets.VBox()
vbox2.add_widget(self.w.bgtype_attr_vbox, stretch=1)
fr.set_widget(vbox2)
vbox.add_widget(fr, stretch=0)
captions = (('Background Value:', 'label',
'Background Value', 'entry'), )
w, b = Widgets.build_info(captions, orientation=self.orientation)
self.w.update(b)
b.background_value.set_tooltip('Background value')
b.background_value.set_text(str(self.bgval))
b.background_value.widget.editingFinished.connect(self.set_constant_bg)
b.background_value.widget.setReadOnly(True)
b.background_value.widget.setEnabled(True)
b.background_value.widget.setStyleSheet(
'QLineEdit{background: white;}')
vbox.add_widget(w, stretch=0)
captions = (('Load Parameters', 'button',
'Save Parameters', 'button',
'Subtract', 'button'), )
w, b = Widgets.build_info(captions, orientation=self.orientation)
self.w.update(b)
b.load_parameters.set_tooltip('Load previously saved parameters')
b.load_parameters.widget.clicked.connect(self.load_params)
b.save_parameters.set_tooltip('Save background subtraction parameters')
b.save_parameters.widget.clicked.connect(self.save_params)
b.subtract.set_tooltip('Subtract background')
b.subtract.widget.clicked.connect(self.sub_bg)
b.subtract.widget.setEnabled(False)
vbox.add_widget(w, stretch=0)
top.add_widget(sw, stretch=1)
btns = Widgets.HBox()
btns.set_border_width(4)
btns.set_spacing(3)
btn = Widgets.Button('Close')
btn.add_callback('activated', lambda w: self.close())
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)
# Populate default attributes frame
self.set_bgtype(self.bgtype)
self.gui_up = True
示例13: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import build_info [as 别名]
def build_gui(self, container):
# Create a scrollable area
sw = Widgets.ScrollArea()
# Create a vertical box into which our widgets will be placed
vbox = Widgets.VBox()
vbox.set_border_width(4)
vbox.set_spacing(2)
# Place the vertical box inside the scrollable area
sw.set_widget(vbox)
# Create a frame for the program name and the OB ID.
prog_ob_frame = Widgets.Frame()
# Create some label widgets to display the program and the OB
# ID
captions = (('Program:', 'label', 'Program', 'label',
'OB ID:', 'label', 'OB ID', 'label',
'Dup All OB', 'checkbutton'),)
w, b = Widgets.build_info(captions, orientation='vertical')
self.w_prog_ob = b
# Set the inital text for the program and OB ID to N/A
b.program.set_text('N/A')
b.ob_id.set_text('N/A')
b.dup_all_ob.set_state(False)
# Place the label widgets into the frame
prog_ob_frame.set_widget(w)
# Add the frame to the vertical box
vbox.add_widget(prog_ob_frame, stretch=0)
# Create a frame for the resolution comments
comment_frame = Widgets.Frame('OB Comments')
# Create a text area into which comments can be entered
captions = (('Comment entry', 'textarea'),)
w, b = Widgets.build_info(captions, orientation='vertical')
self.w_comments = b
# Place the text area into the frame
comment_frame.set_widget(w)
# Add the frame to the vertical box
vbox.add_widget(comment_frame, stretch=0)
# Create a frame for the data quality buttons
data_button_frame = Widgets.Frame()
# Create some radio buttons to describe the data quality
buttonList = []
self.qualityButtonVals = {}
for i, name in enumerate(self.qualityButtons):
buttonList.append(name)
buttonList.append('radiobutton')
self.qualityButtonVals[name] = len(self.qualityButtons) - i
captions = (('Data Quality:', 'label'), buttonList)
w, b = Widgets.build_info(captions, orientation='vertical')
self.w_data_buttons = b
# Set the callback method for the data quality radio buttons
for name in self.qualityButtons:
b[name.lower()].add_callback('activated', self.rate_cb, self.qualityButtonVals[name]);
# Put the quality buttons into a QButtonGroup so that we set
# up the buttons as "exclusive", i.e., only one button can be
# selected at a time.
self.data_bg = QtGui.QButtonGroup()
for name in self.qualityButtons:
self.data_bg.addButton(self.w_data_buttons[name.lower()].get_widget())
# Place the radio buttons into the frame
data_button_frame.set_widget(w)
# Add the frame to the vertical box
vbox.add_widget(data_button_frame, stretch=0)
# Create a frame for the clear button
clear_button_frame = Widgets.Frame()
# Create the Clear button
captions = (('Clear', 'button'),)
w, b = Widgets.build_info(captions, orientation='vertical')
self.w_clear = b
# Connect the button-click event to the callback method
b.clear.add_callback('activated', self.clear_cb)
# Place the radio buttons into the frame
clear_button_frame.set_widget(w)
# Add the frame to the vertical box
vbox.add_widget(clear_button_frame, stretch=0)
# Create a frame for the slider bar
slider_frame = Widgets.Frame()
captions = (('ob list index', 'hscale'),)
w, b = Widgets.build_info(captions, orientation='vertical')
self.w_slider = b
b.ob_list_index.set_limits(0, 1)
b.ob_list_index.set_tracking(True)
b.ob_list_index.add_callback('value-changed', self.ob_list_index_cb)
# Place the slider bar into the frame
slider_frame.set_widget(w)
# Add the frame to the vertical box
vbox.add_widget(slider_frame, stretch=0)
#.........这里部分代码省略.........
示例14: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import build_info [as 别名]
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)
msgFont = self.fv.getFont("sansFont", 12)
tw = Widgets.TextArea(wrap=True, editable=False)
tw.set_font(msgFont)
self.tw = tw
fr = Widgets.Frame("Instructions")
vbox2 = Widgets.VBox()
vbox2.add_widget(tw)
vbox2.add_widget(Widgets.Label(''), stretch=1)
fr.set_widget(vbox2)
vbox.add_widget(fr, stretch=0)
fr = Widgets.Frame("Drawing")
captions = (("Draw type:", 'label', "Draw type", 'combobox'),
("Draw color:", 'label', "Draw color", 'combobox'),
("Line width:", 'label', "Line width", 'spinbutton'),
("Line style:", 'label', "Line style", 'combobox'),
("Alpha:", 'label', "Alpha", 'spinfloat'),
("Fill", 'checkbutton', "Fill color", 'combobox'),
("Fill Alpha:", 'label', "Fill Alpha", 'spinfloat'),
("Text:", 'label', "Text", 'entry'),
("Clear canvas", 'button')
)
w, b = Widgets.build_info(captions)
self.w = b
combobox = b.draw_type
for name in self.drawtypes:
combobox.append_text(name)
index = self.drawtypes.index(default_drawtype)
combobox.set_index(index)
combobox.add_callback('activated', lambda w, idx: self.set_drawparams())
combobox = b.draw_color
self.drawcolors = draw_colors
for name in self.drawcolors:
combobox.append_text(name)
index = self.drawcolors.index(default_drawcolor)
combobox.set_index(index)
combobox.add_callback('activated', lambda w, idx: self.set_drawparams())
combobox = b.fill_color
for name in self.drawcolors:
combobox.append_text(name)
index = self.drawcolors.index(default_drawcolor)
combobox.set_index(index)
combobox.add_callback('activated', lambda w, idx: self.set_drawparams())
b.line_width.set_limits(0, 10, 1)
#b.line_width.set_decimals(0)
b.line_width.set_value(1)
b.line_width.add_callback('value-changed', lambda w, val: self.set_drawparams())
combobox = b.line_style
for name in self.linestyles:
combobox.append_text(name)
combobox.set_index(0)
combobox.add_callback('activated', lambda w, idx: self.set_drawparams())
b.fill.add_callback('activated', lambda w, tf: self.set_drawparams())
b.fill.set_state(False)
b.alpha.set_limits(0.0, 1.0, 0.1)
b.alpha.set_decimals(2)
b.alpha.set_value(1.0)
b.alpha.add_callback('value-changed', lambda w, val: self.set_drawparams())
b.fill_alpha.set_limits(0.0, 1.0, 0.1)
b.fill_alpha.set_decimals(2)
b.fill_alpha.set_value(0.3)
b.fill_alpha.add_callback('value-changed', lambda w, val: self.set_drawparams())
b.text.add_callback('activated', lambda w: self.set_drawparams())
b.text.set_text('EDIT ME')
b.text.set_length(60)
b.clear_canvas.add_callback('activated', lambda w: self.clear_canvas())
fr.set_widget(w)
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())
#.........这里部分代码省略.........
示例15: set_bgtype
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import build_info [as 别名]
def set_bgtype(self, bgtype):
if bgtype not in self._bgtype_options:
self.logger.error(
'Undefined background selection type - {0}'.format(bgtype))
return True
self.bgtype = bgtype
# Remove old params
self.w.bgtype_attr_vbox.remove_all()
self.w.background_value.set_text(str(self._dummy_value))
self.w.subtract.widget.setEnabled(False)
self.canvas.deleteAllObjects()
# Reset parameters
self.xcen, self.ycen = self._dummy_value, self._dummy_value
self.radius = self._dummy_value
self.boxwidth, self.boxheight = self._dummy_value, self._dummy_value
captions = [('X:', 'label', 'X', 'entry'),
('Y:', 'label', 'Y', 'entry')]
if bgtype == 'constant':
self.canvas.enable_draw(False)
self.w.background_value.widget.setReadOnly(False)
else: # annulus, box
self.canvas.enable_draw(True)
if bgtype == 'annulus':
self.canvas.set_drawtype(
'annulus', width=self.annulus_width, color=self.bgsubcolor,
linestyle='dash')
captions += [('Radius:', 'label', 'r', 'entry'),
('Annulus Width:', 'label',
'Annulus Width', 'entry')]
else: # box
self.canvas.set_drawtype(
'rectangle', color=self.bgsubcolor, linestyle='dash')
captions += [('Width:', 'label', 'box w', 'entry'),
('Height:', 'label', 'box h', 'entry')]
captions += [
('Algorithm:', 'label', 'Algorithm', 'combobox'),
('Sigma:', 'label', 'Sigma', 'entry'),
('Number of Iterations:', 'label', 'NIter', 'entry')]
w, b = Widgets.build_info(captions, orientation=self.orientation)
self.w.update(b)
b.x.set_tooltip('X of centroid')
b.x.set_text(str(self.xcen))
b.x.widget.editingFinished.connect(self.set_xcen)
b.y.set_tooltip('Y of centroid')
b.y.set_text(str(self.ycen))
b.y.widget.editingFinished.connect(self.set_ycen)
if bgtype == 'annulus':
b.r.set_tooltip('Inner radius of annulus')
b.r.set_text(str(self.radius))
b.r.widget.editingFinished.connect(self.set_radius)
b.annulus_width.set_tooltip('Set annulus width manually')
b.annulus_width.set_text(str(self.annulus_width))
b.annulus_width.widget.editingFinished.connect(
self.set_annulus_width)
else: # box
b.box_w.set_tooltip('Width of box')
b.box_w.set_text(str(self.boxwidth))
b.box_w.widget.editingFinished.connect(self.set_boxwidth)
b.box_h.set_tooltip('Height of box')
b.box_h.set_text(str(self.boxheight))
b.box_h.widget.editingFinished.connect(self.set_boxheight)
for name in self._algorithm_options:
b.algorithm.append_text(name)
b.algorithm.set_index(
self._algorithm_options.index(self.algorithm))
b.algorithm.widget.activated[str].connect(self.set_algorithm)
b.sigma.set_tooltip('Sigma for clipping')
b.sigma.set_text(str(self.sigma))
b.sigma.widget.editingFinished.connect(self.set_sigma)
b.niter.set_tooltip('Number of clipping iterations')
b.niter.set_text(str(self.niter))
b.niter.widget.editingFinished.connect(self.set_niter)
self.w.bgtype_attr_vbox.add_widget(w, stretch=1)
self.w.background_value.widget.setReadOnly(True)
return True