本文整理汇总了Python中ginga.misc.Widgets.get_oriented_box方法的典型用法代码示例。如果您正苦于以下问题:Python Widgets.get_oriented_box方法的具体用法?Python Widgets.get_oriented_box怎么用?Python Widgets.get_oriented_box使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ginga.misc.Widgets
的用法示例。
在下文中一共展示了Widgets.get_oriented_box方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import get_oriented_box [as 别名]
def build_gui(self, container):
"""
This method is called when the plugin is invoked. It builds the
GUI used by the plugin into the widget layout passed as
``container``.
This method may be called many times as the plugin is opened and
closed for modal operations. The method may be omitted if there
is no GUI for the plugin.
This specific example uses the GUI widget set agnostic wrappers
to build the GUI, but you can also just as easily use explicit
toolkit calls here if you only want to support one widget set.
"""
top = Widgets.VBox()
top.set_border_width(4)
# this is a little trick for making plugins that work either in
# a vertical or horizontal orientation. It returns a box container,
# a scroll widget and an orientation ('vertical', 'horizontal')
vbox, sw, orientation = Widgets.get_oriented_box(container)
vbox.set_border_width(4)
vbox.set_spacing(2)
# Take a text widget to show some instructions
self.msgFont = self.fv.getFont("sansFont", 12)
tw = Widgets.TextArea(wrap=True, editable=False)
tw.set_font(self.msgFont)
self.tw = tw
# Frame for instructions and add the text widget with another
# blank widget to stretch as needed to fill emp
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)
# Add a spacer to stretch the rest of the way to the end of the
# plugin space
spacer = Widgets.Label('')
vbox.add_widget(spacer, stretch=1)
# scroll bars will allow lots of content to be accessed
top.add_widget(sw, stretch=1)
# A button box that is always visible at the bottom
btns = Widgets.HBox()
btns.set_spacing(3)
# Add a close button for the convenience of the user
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)
# Add our GUI to the container
container.add_widget(top, stretch=1)
示例2: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import get_oriented_box [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)
示例3: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import get_oriented_box [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)
示例4: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import get_oriented_box [as 别名]
def build_gui(self, container):
top = Widgets.VBox()
top.set_border_width(4)
# Make the cuts plot
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)
self.plot = Plot.Plot(self.logger, width=2, height=3, dpi=100)
ax = self.plot.add_axis()
ax.grid(True)
# for now we need to wrap this native widget
w = Widgets.wrap(self.plot.get_widget())
vbox.add_widget(w, stretch=1)
captions = (('Cut Low:', 'label', 'Cut Low', 'entry'),
('Cut High:', 'label', 'Cut High', 'entry', 'Cut Levels', 'button'),
('Auto Levels', 'button'),
('Log Histogram', 'checkbutton', 'Plot By Cuts', 'checkbutton'),
('NumBins:', 'label', 'NumBins', 'entry'),
('Full Image', 'button'),
)
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)
b.cut_levels.set_tooltip("Set cut levels manually")
b.auto_levels.set_tooltip("Set cut levels by algorithm")
b.cut_low.set_tooltip("Set low cut level (press Enter)")
b.cut_high.set_tooltip("Set high cut level (press Enter)")
b.log_histogram.set_tooltip("Use the log of the pixel values for the histogram (empty bins map to 10^-1)")
b.plot_by_cuts.set_tooltip("Only show the part of the histogram between the cuts")
b.numbins.set_tooltip("Number of bins for the histogram")
b.full_image.set_tooltip("Use the full image for calculating the histogram")
b.numbins.set_text(str(self.numbins))
b.cut_low.add_callback('activated', lambda w: self.cut_levels())
b.cut_high.add_callback('activated', lambda w: self.cut_levels())
b.cut_levels.add_callback('activated', lambda w: self.cut_levels())
b.auto_levels.add_callback('activated', lambda w: self.auto_levels())
b.log_histogram.set_state(self.plot.logy)
b.log_histogram.add_callback('activated', self.log_histogram_cb)
b.plot_by_cuts.set_state(self.xlimbycuts)
b.plot_by_cuts.add_callback('activated', self.plot_by_cuts_cb)
b.numbins.add_callback('activated', lambda w: self.set_numbins_cb())
b.full_image.add_callback('activated', lambda w: self.full_image_cb())
vbox.add_widget(w, stretch=0)
## spacer = Widgets.Label('')
## vbox.add_widget(spacer, stretch=1)
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)
self.gui_up = True
示例5: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import get_oriented_box [as 别名]
def build_gui(self, container):
top = Widgets.VBox()
top.set_border_width(4)
vbox1, sw, orientation = Widgets.get_oriented_box(container)
vbox1.set_border_width(4)
vbox1.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)
vbox1.add_widget(fr, stretch=0)
# Main pipeline control area
captions = [
("Subtract Bias", 'button', "Bias Image:", 'label',
'bias_image', 'llabel'),
("Apply Flat Field", 'button', "Flat Image:", 'label',
'flat_image', 'llabel'),
]
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)
fr = Widgets.Frame("Pipeline")
fr.set_widget(w)
vbox1.add_widget(fr, stretch=0)
b.subtract_bias.add_callback('activated', self.subtract_bias_cb)
b.subtract_bias.set_tooltip("Subtract a bias image")
bias_name = 'None'
if self.bias is not None:
bias_name = self.bias.get('name', "NoName")
b.bias_image.set_text(bias_name)
b.apply_flat_field.add_callback('activated', self.apply_flat_cb)
b.apply_flat_field.set_tooltip("Apply a flat field correction")
flat_name = 'None'
if self.flat is not None:
flat_name = self.flat.get('name', "NoName")
b.flat_image.set_text(flat_name)
vbox2 = Widgets.VBox()
# Pipeline status
hbox = Widgets.HBox()
hbox.set_spacing(4)
hbox.set_border_width(4)
label = Widgets.Label()
self.w.eval_status = label
hbox.add_widget(self.w.eval_status, stretch=0)
hbox.add_widget(Widgets.Label(''), stretch=1)
vbox2.add_widget(hbox, stretch=0)
# progress bar and stop button
hbox = Widgets.HBox()
hbox.set_spacing(4)
hbox.set_border_width(4)
btn = Widgets.Button("Stop")
btn.add_callback('activated', lambda w: self.eval_intr())
btn.set_enabled(False)
self.w.btn_intr_eval = btn
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.clear.add_callback('activated', self.clear_stack_cb)
#.........这里部分代码省略.........
示例6: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import get_oriented_box [as 别名]
def build_gui(self, container):
top = Widgets.VBox()
top.set_border_width(4)
vbox, sw, orientation = Widgets.get_oriented_box(container)
vbox.set_margins(4, 4, 4, 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.Expander("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)
self.plot = Plot.Plot(self.logger, width=2, height=4, dpi=100)
ax = self.plot.add_axis()
ax.grid(False)
w = Widgets.wrap(self.plot.get_widget())
vbox.add_widget(w, stretch=0)
fr = Widgets.Frame("Axes controls")
self.hbox_axes = Widgets.HBox()
self.hbox_axes.set_border_width(4)
self.hbox_axes.set_spacing(1)
fr.set_widget(self.hbox_axes)
vbox.add_widget(fr, stretch=0)
btns = Widgets.HBox()
btns.set_border_width(4)
btns.set_spacing(4)
# control for selecting a mark
cbox2 = Widgets.ComboBox()
for tag in self.marks:
cbox2.append_text(tag)
if self.mark_selected is None:
cbox2.set_index(0)
else:
cbox2.show_text(self.mark_selected)
cbox2.add_callback('activated', self.mark_select_cb)
self.w.marks = cbox2
cbox2.set_tooltip("Select a mark")
btns.add_widget(cbox2, stretch=0)
btn1 = Widgets.CheckBox("Pan to mark")
btn1.set_state(self.pan2mark)
btn1.add_callback('activated', self.pan2mark_cb)
btn1.set_tooltip("Pan follows selected mark")
btns.add_widget(btn1)
btns.add_widget(Widgets.Label(''), stretch=1)
btn2 = Widgets.Button("Delete")
self.del_btn = btn2
btn2.add_callback('activated', lambda w: self.clear_mark_cb())
btn2.set_tooltip("Delete selected mark")
btn2.set_enabled(False)
btns.add_widget(btn2, stretch=0)
btn3 = Widgets.Button("Delete All")
self.del_all_btn = btn3
btn3.add_callback('activated', lambda w: self.clear_all())
btn3.set_tooltip("Clear all marks")
btn3.set_enabled(False)
btns.add_widget(btn3, stretch=0)
vbox2 = Widgets.VBox()
vbox2.add_widget(btns, stretch=0)
vbox2.add_widget(Widgets.Label(''), stretch=1)
fr = Widgets.Frame("Mark controls")
fr.set_widget(vbox2)
vbox.add_widget(fr, stretch=1)
# scroll bars will allow lots of content to be accessed
top.add_widget(sw, stretch=1)
# A button box that is always visible at the bottom
btns = Widgets.HBox()
btns.set_spacing(3)
# Add a close button for the convenience of the user
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)
# Add our GUI to the container
container.add_widget(top, stretch=1)
self.gui_up = True
self.build_axes()
示例7: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import get_oriented_box [as 别名]
def build_gui(self, container):
"""
This method is called when the plugin is invoked. It builds the
GUI used by the plugin into the widget layout passed as
``container``.
This method may be called many times as the plugin is opened and
closed for modal operations. The method may be omitted if there
is no GUI for the plugin.
This specific example uses the GUI widget set agnostic wrappers
to build the GUI, but you can also just as easily use explicit
toolkit calls here if you only want to support one widget set.
"""
top = Widgets.VBox()
top.set_border_width(4)
# this is a little trick for making plugins that work either in
# a vertical or horizontal orientation. It returns a box container,
# a scroll widget and an orientation ('vertical', 'horizontal')
vbox, sw, orientation = Widgets.get_oriented_box(container)
vbox.set_border_width(4)
vbox.set_spacing(2)
# Take a text widget to show some instructions
self.msgFont = self.fv.getFont("sansFont", 12)
tw = Widgets.TextArea(wrap=True, editable=False)
tw.set_font(self.msgFont)
self.tw = tw
self.msgFont = self.fv.getFont("sansFont", 12)
tw = Widgets.TextArea(wrap=True, editable=False)
tw.set_font(self.msgFont)
self.tw = tw
db_driver = Widgets.TextArea(wrap=True, editable=True)
self.db_driver = db_driver
db_name = Widgets.TextArea(wrap=True, editable=True)
self.db_name = db_name
db_user = Widgets.TextArea(wrap=True, editable=True)
self.db_user = db_user
db_pass = Widgets.TextArea(wrap=True, editable=True)
self.db_pass = db_pass
db_driver_label = Widgets.Label(text="Driver Name")
self.db_driver_label = db_driver_label
db_name_label = Widgets.Label(text="Database Name")
self.db_name_label = db_name_label
db_user_label = Widgets.Label(text="User Name")
self.db_user_label = db_user_label
db_pass_label = Widgets.Label(text="Password")
self.db_pass_label = db_pass_label
connect_button = Widgets.Button(text="Connect")
self.connect_button = connect_button
connect_button.add_callback('activated', lambda w: self.connectDB())
populate_button = Widgets.Button(text="Populate Database")
self.populate_button = populate_button
populate_button.add_callback('activated', lambda w: self.add_file_to_db())
status_label = Widgets.Label(text="Status:")
self.status_label = status_label
default_wavelength_label = Widgets.Label(text="Default Wavelength")
self.default_wavelength_label = default_wavelength_label
default_wavelength = Widgets.ComboBox()
default_wavelength.insert_alpha('angstrom')
default_wavelength.append_text('nm')
self.default_wavelength = default_wavelength
set_default_box = Widgets.CheckBox("Set Database as default")
self.set_default_box = set_default_box
view_button = Widgets.Button(text="View Database")
self.view_button = view_button
view_button.add_callback('activated', lambda w: self.view_database())
add_button = Widgets.Button(text="Add file to Database")
self.add_button = add_button
add_button.add_callback('activated', lambda w: self.add_file())
open_button = Widgets.Button(text="Open Database")
self.open_button = open_button
open_button.add_callback('activated', lambda w: self.open_sqlite_database())
commit_button = Widgets.Button(text="Commit changes to Database")
self.commit_button = commit_button
commit_button.add_callback('activated', lambda w: self.commit_database())
# Frame for instructions and add the text widget with another
# blank widget to stretch as needed to fill emp
fr = Widgets.Frame("Instructions")
#.........这里部分代码省略.........
示例8: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import get_oriented_box [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
示例9: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import get_oriented_box [as 别名]
def build_gui(self, container):
vbox, sw, orientation = Widgets.get_oriented_box(container,
scrolled=False)
vbox.set_border_width(4)
vbox.set_spacing(2)
width, height = 300, 300
# Uncomment to debug; passing parent logger generates too
# much noise in the main logger
#zi = CanvasTypes.ImageViewCanvas(logger=self.logger)
zi = CanvasTypes.ImageViewCanvas(logger=None)
zi.set_desired_size(width, height)
zi.enable_autozoom('off')
zi.enable_autocuts('off')
#zi.set_scale_limits(0.001, 1000.0)
zi.zoom_to(self.default_zoom, redraw=False)
settings = zi.get_settings()
settings.getSetting('zoomlevel').add_callback('set',
self.zoomset, zi)
zi.set_bg(0.4, 0.4, 0.4)
zi.show_pan_mark(True, redraw=False)
# for debugging
zi.set_name('zoomimage')
self.zoomimage = zi
bd = zi.get_bindings()
bd.enable_zoom(False)
bd.enable_pan(False)
bd.enable_cmap(False)
iw = Widgets.wrap(zi.get_widget())
vpaned = Widgets.Splitter(orientation=orientation)
vpaned.add_widget(iw)
vpaned.add_widget(Widgets.Label(''))
vbox.add_widget(vpaned, stretch=1)
vbox2 = Widgets.VBox()
captions = (("Zoom Radius:", 'label', 'Zoom Radius', 'hscale'),
("Zoom Amount:", 'label', 'Zoom Amount', 'hscale'),
)
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)
vbox2.add_widget(w, stretch=0)
self.w.zoom_radius.set_limits(1, 300, incr_value=1)
self.w.zoom_radius.set_value(self.zoom_radius)
self.w.zoom_radius.add_callback('value-changed', self.set_radius_cb)
self.w.zoom_radius.set_tracking(True)
self.w.zoom_amount.set_limits(-20, 30, incr_value=1)
self.w.zoom_amount.set_value(self.zoom_amount)
self.w.zoom_amount.add_callback('value-changed', self.set_amount_cb)
self.w.zoom_amount.set_tracking(True)
captions = (("Zoom:", 'label', 'Zoom', 'label'),
("Relative Zoom", 'checkbutton'),
("Refresh Interval", 'label',
'Refresh Interval', 'spinbutton'),
("Defaults", 'button'),
)
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)
b.zoom.set_text(self.fv.scale2text(zi.get_scale()))
b.relative_zoom.set_state(not self.t_abszoom)
b.relative_zoom.add_callback("activated", self.set_absrel_cb)
b.defaults.add_callback("activated", lambda w: self.set_defaults())
b.refresh_interval.set_limits(0, 200, incr_value=1)
b.refresh_interval.set_value(int(self.refresh_interval * 1000))
b.refresh_interval.add_callback('value-changed', self.set_refresh_cb)
row = Widgets.HBox()
row.add_widget(w, stretch=0)
row.add_widget(Widgets.Label(''), stretch=1)
vbox2.add_widget(row, stretch=0)
# stretch
spacer = Widgets.Label('')
vbox2.add_widget(spacer, stretch=1)
vbox.add_widget(vbox2, stretch=0)
vbox.add_widget(Widgets.Label(''), stretch=1)
container.add_widget(sw, stretch=1)
示例10: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import get_oriented_box [as 别名]
def build_gui(self, container):
top = Widgets.VBox()
top.set_border_width(4)
vbox, sw, orientation = Widgets.get_oriented_box(container)
self.orientation = orientation
#vbox.set_border_width(4)
vbox.set_spacing(2)
# COLOR DISTRIBUTION OPTIONS
fr = Widgets.Frame("Color Distribution")
captions = (('Algorithm:', 'label', 'Algorithm', 'combobox'),
#('Table Size:', 'label', 'Table Size', 'entry'),
('Dist Defaults', 'button'))
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)
self.w.calg_choice = b.algorithm
#self.w.table_size = b.table_size
b.algorithm.set_tooltip("Choose a color distribution algorithm")
#b.table_size.set_tooltip("Set size of the distribution hash table")
b.dist_defaults.set_tooltip("Restore color distribution defaults")
b.dist_defaults.add_callback('activated',
lambda w: self.set_default_distmaps())
combobox = b.algorithm
options = []
index = 0
for name in self.calg_names:
options.append(name)
combobox.append_text(name)
index += 1
index = self.calg_names.index(self.t_.get('color_algorithm', "linear"))
combobox.set_index(index)
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)
combobox = b.colormap
options = []
index = 0
for name in self.cmap_names:
options.append(name)
combobox.append_text(name)
index += 1
cmap_name = self.t_.get('color_map', "gray")
try:
index = self.cmap_names.index(cmap_name)
except Exception:
index = self.cmap_names.index('gray')
combobox.set_index(index)
combobox.add_callback('activated', self.set_cmap_cb)
combobox = b.intensity
options = []
index = 0
for name in self.imap_names:
options.append(name)
combobox.append_text(name)
index += 1
imap_name = self.t_.get('intensity_map', "ramp")
try:
index = self.imap_names.index(imap_name)
except Exception:
index = self.imap_names.index('ramp')
combobox.set_index(index)
combobox.add_callback('activated', self.set_imap_cb)
# AUTOCUTS OPTIONS
fr = Widgets.Frame("Auto Cuts")
vbox2 = Widgets.VBox()
fr.set_widget(vbox2)
captions = (('Auto Method:', 'label', 'Auto Method', 'combobox'),
)
w, b = Widgets.build_info(captions, orientation=orientation)
#.........这里部分代码省略.........
示例11: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import get_oriented_box [as 别名]
def build_gui(self, container):
assert iqcalc.have_scipy == True, \
Exception("Please install python-scipy to use this plugin")
self.pickcenter = None
vtop = Widgets.VBox()
vtop.set_border_width(4)
vbox, sw, orientation = Widgets.get_oriented_box(container)
vbox.set_border_width(4)
vbox.set_spacing(2)
vpaned = Widgets.Splitter(orientation=orientation)
nb = Widgets.TabWidget(tabpos='bottom')
#nb.set_scrollable(True)
self.w.nb1 = nb
vpaned.add_widget(nb)
cm, im = self.fv.cm, self.fv.im
di = CanvasTypes.ImageViewCanvas(logger=self.logger)
width, height = 200, 200
di.set_desired_size(width, height)
di.enable_autozoom('off')
di.enable_autocuts('off')
di.zoom_to(3, redraw=False)
settings = di.get_settings()
settings.getSetting('zoomlevel').add_callback('set',
self.zoomset, di)
di.set_cmap(cm, redraw=False)
di.set_imap(im, redraw=False)
di.set_callback('none-move', self.detailxy)
di.set_bg(0.4, 0.4, 0.4)
# for debugging
di.set_name('pickimage')
self.pickimage = di
bd = di.get_bindings()
bd.enable_pan(True)
bd.enable_zoom(True)
bd.enable_cuts(True)
iw = Widgets.wrap(di.get_widget())
nb.add_widget(iw, title="Image")
if have_mpl:
self.plot1 = Plot.Plot(logger=self.logger,
width=2, height=3, dpi=72)
self.w.canvas = self.plot1.canvas
self.w.fig = self.plot1.fig
self.w.ax = self.w.fig.add_subplot(111, axisbg='black')
self.w.ax.set_aspect('equal', adjustable='box')
self.w.ax.set_title('Contours')
#self.w.ax.grid(True)
canvas = self.w.canvas
connect = canvas.mpl_connect
# These are not ready for prime time...
# connect("motion_notify_event", self.plot_motion_notify)
# connect("button_press_event", self.plot_button_press)
connect("scroll_event", self.plot_scroll)
nb.add_widget(Widgets.wrap(canvas), title="Contour")
self.plot2 = Plot.Plot(logger=self.logger,
width=2, height=3, dpi=72)
self.w.canvas2 = self.plot2.canvas
self.w.fig2 = self.plot2.fig
self.w.ax2 = self.w.fig2.add_subplot(111, axisbg='white')
#self.w.ax2.set_aspect('equal', adjustable='box')
self.w.ax2.set_ylabel('brightness')
self.w.ax2.set_xlabel('pixels')
self.w.ax2.set_title('FWHM')
self.w.ax.grid(True)
canvas = self.w.canvas2
nb.add_widget(Widgets.wrap(canvas), title="FWHM")
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)
vpaned.add_widget(Widgets.Label(''))
vbox.add_widget(vpaned, stretch=1)
fr = Widgets.Frame("Pick")
nb = Widgets.TabWidget(tabpos='bottom')
self.w.nb2 = nb
# Build report panel
captions = (('Zoom:', 'label', 'Zoom', 'llabel',
#.........这里部分代码省略.........
示例12: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import get_oriented_box [as 别名]
def build_gui(self, container):
"""
This method is called when the plugin is invoked. It builds the
GUI used by the plugin into the widget layout passed as
``container``.
This method could be called several times if the plugin is opened
and closed. The method may be omitted if there is no GUI for the
plugin.
This specific example uses the GUI widget set agnostic wrappers
to build the GUI, but you can also just as easily use explicit
toolkit calls here if you only want to support one widget set.
"""
top = Widgets.VBox()
top.set_border_width(4)
# this is a little trick for making plugins that work either in
# a vertical or horizontal orientation. It returns a box container,
# a scroll widget and an orientation ('vertical', 'horizontal')
vbox, sw, orientation = Widgets.get_oriented_box(container)
vbox.set_border_width(4)
vbox.set_spacing(2)
# Take a text widget to show some instructions
self.msgFont = self.fv.getFont("sansFont", 12)
tw = Widgets.TextArea(wrap=True, editable=False)
tw.set_font(self.msgFont)
self.tw = tw
# Database Parameters
db_parameters_frame = self.add_db_parameters_to_gui()
vbox.add_widget(db_parameters_frame, stretch=0)
# Database Default Values
db_default_values_frame = self.add_db_default_values_to_gui()
vbox.add_widget(db_default_values_frame, stretch=0)
# Adding Buttons
connect_db_button = Widgets.Button(text="Connect")
self.connect_db_button = connect_db_button
connect_db_button.add_callback("activated", lambda w: self.connect_db())
view_db_button = Widgets.Button(text="View Database")
self.view_db_button = view_db_button
view_db_button.add_callback("activated", lambda w: self.view_database())
add_file_to_db_button = Widgets.Button(text="Add file to Database")
self.add_file_to_db_button = add_file_to_db_button
add_file_to_db_button.add_callback("activated", lambda w: self.add_file())
open_db_button = Widgets.Button(text="Open Database")
self.open_db_button = open_db_button
open_db_button.add_callback("activated", lambda w: self.open_sqlite_database())
commit_db_button = Widgets.Button(text="Commit changes to Database")
self.commit_db_button = commit_db_button
commit_db_button.add_callback("activated", lambda w: self.commit_database())
vbox.add_widget(connect_db_button)
vbox.add_widget(view_db_button)
vbox.add_widget(add_file_to_db_button)
vbox.add_widget(open_db_button)
vbox.add_widget(commit_db_button)
# Frame for instructions and add the text widget with another
# blank widget to stretch as needed to fill emp
fr = Widgets.Frame("Status")
vbox2 = Widgets.VBox()
vbox2.add_widget(tw)
vbox2.add_widget(Widgets.Label(""), stretch=1)
fr.set_widget(vbox2)
vbox.add_widget(fr, stretch=0)
# Add a spacer to stretch the rest of the way to the end of the
# plugin space
spacer = Widgets.Label("")
vbox.add_widget(spacer, stretch=1)
# scroll bars will allow lots of content to be accessed
top.add_widget(sw, stretch=1)
# A button box that is always visible at the bottom
btns = Widgets.HBox()
btns.set_spacing(3)
# Add a close button for the convenience of the user
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)
# Add our GUI to the container
container.add_widget(top, stretch=1)
示例13: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import get_oriented_box [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("Limits")
captions = (('Opacity:', 'label', 'Opacity', 'spinfloat'),
('Hi color:', 'label', 'Hi color', 'combobox'),
('Hi limit:', 'label', 'Hi value', 'entry'),
('Lo color:', 'label', 'Lo color', 'combobox'),
('Lo limit:', 'label', 'Lo value', 'entry'),
('Redo', 'button'))
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)
b.opacity.set_decimals(2)
b.opacity.set_limits(0.0, 1.0, incr_value=0.1)
b.opacity.set_value(self.opacity)
b.opacity.add_callback('value-changed', lambda *args: self.redo())
combobox = b.hi_color
for name in self.colornames:
combobox.append_text(name)
index = self.colornames.index(self.hi_color)
combobox.set_index(index)
combobox.add_callback('activated', lambda *args: self.redo())
b.hi_value.set_length(22)
if self.hi_value != None:
b.hi_value.set_text(str(self.hi_value))
b.hi_value.add_callback('activated', lambda *args: self.redo())
combobox = b.lo_color
for name in self.colornames:
combobox.append_text(name)
index = self.colornames.index(self.lo_color)
combobox.set_index(index)
combobox.add_callback('activated', lambda *args: self.redo())
b.lo_value.set_length(22)
if self.lo_value != None:
b.lo_value.set_text(str(self.lo_value))
b.lo_value.add_callback('activated', lambda *args: self.redo())
b.redo.add_callback('activated', lambda *args: self.redo())
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)
示例14: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import get_oriented_box [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('Single Pixel')
captions = [('X:', 'label', 'X', 'entry'),
('Y:', 'label', 'Y', 'entry'),
('DQ Flag:', 'label', 'DQ', 'llabel')]
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)
b.x.set_tooltip('X of pixel')
b.x.set_text(str(self.xcen))
b.x.widget.editingFinished.connect(self.set_xcen)
b.y.set_tooltip('Y of pixel')
b.y.set_text(str(self.ycen))
b.y.widget.editingFinished.connect(self.set_ycen)
b.dq.set_tooltip('DQ value of pixel')
b.dq.set_text(self._no_keyword)
b.dq.widget.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
self.pxdqlist = QtGui.QListWidget()
splitter = Widgets.Splitter('vertical')
splitter.add_widget(w)
splitter.widget.addWidget(self.pxdqlist)
fr.set_widget(splitter)
vbox.add_widget(fr, stretch=1)
fr = Widgets.Frame('Whole Image')
captions = [('Number of pixels:', 'llabel', 'npix', 'llabel',
'spacer1', 'spacer')]
w, b = Widgets.build_info(captions, orientation=orientation)
self.w.update(b)
b.npix.set_tooltip('Number of affected pixels')
b.npix.set_text(self._no_keyword)
b.npix.widget.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
self.imdqlist = QtGui.QListWidget()
self.imdqlist.setSelectionMode(
QtGui.QAbstractItemView.ExtendedSelection)
self.imdqlist.itemSelectionChanged.connect(self.mark_dqs)
splitter = Widgets.Splitter('vertical')
splitter.add_widget(w)
splitter.widget.addWidget(self.imdqlist)
fr.set_widget(splitter)
vbox.add_widget(fr, stretch=1)
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)
self.gui_up = True
# Populate fields based on active image
self.redo()
示例15: build_gui
# 需要导入模块: from ginga.misc import Widgets [as 别名]
# 或者: from ginga.misc.Widgets import get_oriented_box [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'),
('Clear canvas', 'button'))
w, b = Widgets.build_info(captions)
self.w = b
combobox = b.draw_type
options = []
index = 0
for name in self.drawtypes:
options.append(name)
combobox.append_text(name)
index += 1
index = self.drawtypes.index(default_drawtype)
combobox.set_index(index)
combobox.add_callback('activated', lambda w, idx: self.set_drawparams())
self.w.draw_color = b.draw_color
combobox = b.draw_color
options = []
index = 0
self.drawcolors = draw_colors
for name in self.drawcolors:
options.append(name)
combobox.append_text(name)
index += 1
index = self.drawcolors.index(default_drawcolor)
combobox.set_index(index)
combobox.add_callback('activated', lambda w, idx: self.set_drawparams())
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())
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)