本文整理汇总了Python中ginga.gtkw.GtkHelp.build_info方法的典型用法代码示例。如果您正苦于以下问题:Python GtkHelp.build_info方法的具体用法?Python GtkHelp.build_info怎么用?Python GtkHelp.build_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ginga.gtkw.GtkHelp
的用法示例。
在下文中一共展示了GtkHelp.build_info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_gui
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import build_info [as 别名]
def build_gui(self, container):
vbox1 = gtk.VBox()
self.msgFont = self.fv.getFont("sansFont", 14)
tw = gtk.TextView()
tw.set_wrap_mode(gtk.WRAP_WORD)
tw.set_left_margin(4)
tw.set_right_margin(4)
tw.set_editable(False)
tw.set_left_margin(4)
tw.set_right_margin(4)
tw.modify_font(self.msgFont)
self.tw = tw
fr = gtk.Frame(label=" Instructions ")
fr.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
fr.set_label_align(0.1, 0.5)
fr.add(tw)
fr.show_all()
vbox1.pack_start(fr, padding=4, fill=True, expand=False)
fr = gtk.Frame(label="HDU")
fr.set_shadow_type(gtk.SHADOW_ETCHED_IN)
fr.set_label_align(0.5, 0.5)
captions = [("Num HDUs", 'label'), ("Choose HDU", 'spinbutton')]
w, b = GtkHelp.build_info(captions)
self.w.update(b)
self.w.numhdu = b.num_hdus
self.w.hdu = b.choose_hdu
self.w.hdu.set_tooltip_text("Choose which HDU to view")
if not gtksel.have_gtk3:
self.w.hdu.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
self.w.hdu.connect('value-changed', self.set_hdu_cb)
fr.add(w)
vbox1.pack_start(fr, padding=4, fill=True, expand=False)
fr = gtk.Frame(label="NAXIS")
fr.set_shadow_type(gtk.SHADOW_ETCHED_IN)
fr.set_label_align(0.5, 0.5)
self.naxisfr = fr
vbox1.pack_start(fr, padding=4, fill=True, expand=False)
btns = gtk.HButtonBox()
btns.set_layout(gtk.BUTTONBOX_START)
btns.set_spacing(3)
btn = gtk.Button("Close")
btn.connect('clicked', lambda w: self.close())
btns.add(btn)
vbox1.pack_start(btns, padding=4, fill=True, expand=False)
vbox1.show_all()
container.pack_start(vbox1, padding=0, fill=True, expand=False)
示例2: build_gui
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import build_info [as 别名]
def build_gui(self, container):
vbox1 = gtk.VBox()
self.msgFont = self.fv.getFont("sansFont", 14)
tw = gtk.TextView()
tw.set_wrap_mode(gtk.WRAP_WORD)
tw.set_left_margin(4)
tw.set_right_margin(4)
tw.set_editable(False)
tw.set_left_margin(4)
tw.set_right_margin(4)
tw.modify_font(self.msgFont)
self.tw = tw
fr = gtk.Frame(" Instructions ")
fr.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
fr.set_label_align(0.1, 0.5)
fr.add(tw)
fr.show_all()
vbox1.pack_start(fr, padding=4, fill=True, expand=False)
fr = gtk.Frame("Ruler")
fr.set_shadow_type(gtk.SHADOW_ETCHED_IN)
fr.set_label_align(0.5, 0.5)
captions = (("Units", "combobox"),)
w, b = GtkHelp.build_info(captions)
self.w = b
combobox = b.units
index = 0
for name in self.unittypes:
combobox.insert_text(index, name)
index += 1
index = self.unittypes.index(self.units)
combobox.set_active(index)
combobox.sconnect("changed", lambda w: self.set_units())
fr.add(w)
vbox1.pack_start(fr, padding=4, fill=True, expand=False)
btns = gtk.HButtonBox()
btns.set_layout(gtk.BUTTONBOX_START)
btns.set_spacing(3)
btns.set_child_size(15, -1)
btn = gtk.Button("Close")
btn.connect("clicked", lambda w: self.close())
btns.add(btn)
vbox1.pack_start(btns, padding=4, fill=True, expand=False)
vbox1.show_all()
container.pack_start(vbox1, padding=0, fill=True, expand=False)
示例3: gui_add_channels
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import build_info [as 别名]
def gui_add_channels(self):
captions = (('Prefix', 'entry'),
('Number', 'spinbutton'),
('Workspace', 'combobox'),
#('Base on Channel', 'combobox'),
#('Copy Settings', 'button'),
#'Share Settings', 'button'),
#('Cancel', 'button', 'Ok', 'button')
)
w, b = GtkHelp.build_info(captions)
b.prefix.set_text("Image")
adj = b.number.get_adjustment()
lower = 1
upper = 12
adj.configure(lower, lower, upper, 1, 1, 0)
adj.set_value(lower)
cbox = b.workspace
names = self.ds.get_wsnames()
try:
idx = names.index('channels')
except:
idx = 0
for name in names:
cbox.append_text(name)
cbox.set_active(idx)
## cbox = b.base_on_channel
## names = self.get_channelNames()
## for name in names:
## cbox.append_text(name)
## prefs = self.prefs.getSettings('channel_Image')
## d = prefs.getDict()
## cbox = b.copy_settings
## for name in d.keys():
## cbox.append_text(name)
## cbox = b.share_settings
## for name in d.keys():
## cbox.append_text(name)
dialog = GtkHelp.Dialog("Add Channels",
gtk.DIALOG_DESTROY_WITH_PARENT,
[['Cancel', 0], ['Ok', 1]],
lambda w, rsp: self.add_channels_cb(w, rsp,
b, names))
box = dialog.get_content_area()
box.pack_start(w, True, True, 0)
dialog.show_all()
self._cur_dialogs.append(dialog)
示例4: gui_add_ws
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import build_info [as 别名]
def gui_add_ws(self):
captions = (('Workspace name', 'entry'),
('Workspace type', 'combobox'),
('In workspace', 'combobox'),
('Channel prefix', 'entry'),
('Number of channels', 'spinbutton'),
('Share settings', 'entry'),
)
w, b = GtkHelp.build_info(captions)
self.wscount += 1
wsname = "ws%d" % (self.wscount)
b.workspace_name.set_text(wsname)
b.share_settings.set_width_chars(60)
cbox = b.workspace_type
cbox.append_text("Tabs")
cbox.append_text("Grid")
#cbox.append_text("MDI")
cbox.set_active(1)
cbox = b.in_workspace
names = self.ds.get_wsnames()
names.insert(0, 'top level')
try:
idx = names.index('channels')
except:
idx = 0
for name in names:
cbox.append_text(name)
cbox.set_active(idx)
b.channel_prefix.set_text("Image")
adj = b.number_of_channels.get_adjustment()
lower = 0
upper = 12
adj.configure(lower, lower, upper, 1, 1, 0)
adj.set_value(4)
dialog = GtkHelp.Dialog("Add Workspace",
gtk.DIALOG_DESTROY_WITH_PARENT,
[['Cancel', 0], ['Ok', 1]],
lambda w, rsp: self.new_ws_cb(w, rsp, b, names))
box = dialog.get_content_area()
box.pack_start(w, expand=True, fill=True)
dialog.show_all()
self._cur_dialogs.append(dialog)
示例5: build_naxis
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import build_info [as 别名]
def build_naxis(self, dims):
# build a vbox of NAXIS controls
captions = [("NAXIS1", 'label'), ("NAXIS2", 'label')]
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'))
else:
captions.append((title, 'label',
"Choose %s" % (title), 'spinbutton'))
w, b = GtkHelp.build_info(captions)
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]
adj = slider.get_adjustment()
lower = 1
upper = maxn
adj.configure(lower, lower, upper, 1, 1, 0)
adj.set_value(lower)
slider.set_digits(0)
slider.set_wrap(True)
slider.set_snap_to_ticks(True)
slider.connect('value-changed', self.set_naxis_cb, n)
if not gtksel.have_gtk3:
slider.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
# Add vbox of naxis controls to gui
try:
oldv = self.naxisfr.get_child()
self.naxisfr.remove(oldv)
except:
pass
self.naxisfr.add(w)
self.naxisfr.show_all()
示例6: build_gui
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import build_info [as 别名]
def build_gui(self, container):
self.msgFont = self.fv.getFont("fixedFont", 10)
tw = gtk.TextView()
tw.set_wrap_mode(gtk.WRAP_NONE)
tw.set_left_margin(4)
tw.set_right_margin(4)
tw.set_editable(False)
tw.modify_font(self.msgFont)
self.tw = tw
self.buf = self.tw.get_buffer()
sw = gtk.ScrolledWindow()
sw.set_border_width(2)
sw.set_policy(gtk.POLICY_AUTOMATIC,
gtk.POLICY_AUTOMATIC)
sw.add(self.tw)
container.pack_start(sw, fill=True, expand=True)
captions = (('Level', 'combobox', 'History', 'spinbutton'),
('Auto scroll', 'checkbutton', 'Clear', 'button')
)
w, b = GtkHelp.build_info(captions)
self.w.update(b)
combobox = b.level
for (name, level) in self.levels:
combobox.append_text(name)
combobox.set_active(1)
combobox.sconnect('changed', self.set_loglevel_cb)
combobox.set_tooltip_text("Set the logging level")
spinbox = b.history
adj = spinbox.get_adjustment()
adj.configure(self.histlimit, 100, self.histmax, 10, 100, 0)
spinbox.sconnect('value-changed', self.set_history_cb)
spinbox.set_tooltip_text("Set the logging history line limit")
btn = b.auto_scroll
btn.set_tooltip_text("Scroll the log window automatically")
btn = b.clear
btn.connect('clicked', lambda w: self.clear())
btn.set_tooltip_text("Clear the log history")
container.pack_end(w, fill=False, expand=False)
示例7: build_gui
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import build_info [as 别名]
def build_gui(self, container):
canvas = CanvasTypes.DrawingCanvas()
canvas.enable_draw(False)
#canvas.set_callback('button-press', self.btndown)
canvas.set_callback('motion', self.cursormotion)
#canvas.set_callback('button-release', self.update)
canvas.add_callback('key-press', self.window_key_press)
canvas.add_callback('key-release', self.window_key_release)
self.canvas = canvas
vbox1 = gtk.VBox()
fr = gtk.Frame("IRAF")
fr.set_shadow_type(gtk.SHADOW_ETCHED_IN)
fr.set_label_align(0.5, 0.5)
captions = [("Control", 'hbox'),
("Channel", 'label'),
]
w, b = GtkHelp.build_info(captions)
fr.add(w)
self.w = b
self.w.mode_d = {}
btn = GtkHelp.RadioButton(group=None, label="Ginga")
btn.sconnect('toggled', lambda w: self.switchMode('ginga'))
self.w.mode_d['ginga'] = btn
self.w.control.pack_start(btn, padding=4, fill=False, expand=False)
btn = GtkHelp.RadioButton(group=btn, label="IRAF")
btn.sconnect('toggled', lambda w: self.switchMode('iraf'))
self.w.mode_d['iraf'] = btn
self.w.control.pack_start(btn, padding=4, fill=False, expand=False)
vbox1.pack_start(fr, padding=4, fill=True, expand=False)
fr = gtk.Frame("Frame/Channel")
fr.set_shadow_type(gtk.SHADOW_ETCHED_IN)
fr.set_label_align(0.5, 0.5)
lbl = gtk.Label("")
self.w.frch = lbl
fr.add(lbl)
vbox1.pack_start(fr, padding=4, fill=True, expand=False)
vbox1.show_all()
container.pack_start(vbox1, padding=0, fill=True, expand=False)
示例8: build_gui
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import build_info [as 别名]
def build_gui(self, container):
width, height = 300, 300
cm, im = self.fv.cm, self.fv.im
tg = ImageViewCanvasGtk.ImageViewCanvas(logger=self.logger)
tg.configure(200, 200)
tg.enable_autozoom('on')
tg.enable_autocuts('override')
tg.enable_auto_orient(True)
tg.set_bg(0.7, 0.7, 0.7)
tg.defer_redraw = False
self.thumb_generator = tg
sw = gtk.ScrolledWindow()
sw.set_border_width(2)
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
# Create thumbnails pane
vbox = gtk.VBox(spacing=14)
vbox.set_border_width(4)
self.w.thumbs = vbox
sw.add_with_viewport(vbox)
sw.show_all()
self.w.thumbs_scroll = sw
self.w.thumbs_scroll.connect("size_allocate", self.thumbpane_resized_cb)
#nb.connect("size_allocate", self.thumbpane_resized_cb)
# TODO: should this even have it's own scrolled window?
cw = container.get_widget()
cw.pack_start(sw, fill=True, expand=True)
captions = (('Auto scroll', 'checkbutton', 'Clear', 'button'),)
w, b = GtkHelp.build_info(captions)
self.w.update(b)
b.auto_scroll.set_tooltip_text(
"Scroll the thumbs window when new images arrive")
b.clear.set_tooltip_text("Remove all current thumbnails")
b.clear.connect("clicked", lambda w: self.clear())
auto_scroll = self.settings.get('auto_scroll', True)
b.auto_scroll.set_active(auto_scroll)
cw.pack_start(w, fill=True, expand=False)
self.gui_up = True
示例9: _setup_params
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import build_info [as 别名]
def _setup_params(self, obj, container):
params = obj.getParams()
captions = []
for key, bnch in params.items():
text = key
if bnch.has_key('label'):
text = bnch.label
captions.append((text, 'entry'))
# TODO: put RA/DEC first, and other stuff not in random orders
w, b = GtkHelp.build_info(captions)
# remove old widgets
children = container.get_children()
for child in children:
container.remove(child)
# add new widgets
container.pack_start(w, fill=False, expand=False)
container.show_all()
return b
示例10: build_gui
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import build_info [as 别名]
def build_gui(self, container):
width, height = 300, 300
cm, im = self.fv.cm, self.fv.im
tg = FitsImageGtk.FitsImageGtk(logger=self.logger)
tg.configure(200, 200)
tg.enable_autozoom('on')
tg.enable_autocuts('on')
tg.enable_auto_orient(True)
tg.set_makebg(False)
self.thumb_generator = tg
sw = gtk.ScrolledWindow()
sw.set_border_width(2)
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
# Create thumbnails pane
vbox = gtk.VBox(spacing=14)
vbox.set_border_width(4)
self.w.thumbs = vbox
sw.add_with_viewport(vbox)
sw.show_all()
self.w.thumbs_scroll = sw
self.w.thumbs_scroll.connect("size_allocate", self.thumbpane_resized)
#nb.connect("size_allocate", self.thumbpane_resized)
# TODO: should this even have it's own scrolled window?
container.pack_start(sw, fill=True, expand=True)
captions = (('Auto scroll', 'checkbutton'),)
w, b = GtkHelp.build_info(captions)
self.w.update(b)
self.w.tooltips.set_tip(b.auto_scroll,
"Scroll the thumbs window when new images arrive")
autoScroll = self.settings.get('autoScroll', True)
b.auto_scroll.set_active(autoScroll)
container.pack_start(w, fill=True, expand=False)
示例11: _setup_params
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import build_info [as 别名]
def _setup_params(self, obj, container):
params = obj.getParams()
captions = []
paramList = sorted(params.values(), key=lambda b: b.order)
for bnch in paramList:
text = bnch.name
if bnch.has_key('label'):
text = bnch.label
#captions.append((text, 'entry'))
captions.append((text, 'xlabel', '@'+bnch.name, 'entry'))
# TODO: put RA/DEC first, and other stuff not in random orders
w, b = GtkHelp.build_info(captions)
# remove old widgets
children = container.get_children()
for child in children:
container.remove(child)
# add new widgets
container.pack_start(w, fill=False, expand=False)
container.show_all()
return b
示例12: build_gui
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import build_info [as 别名]
#.........这里部分代码省略.........
fr = gtk.Frame(" Instructions ")
fr.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
fr.set_label_align(0.1, 0.5)
fr.add(tw)
vbox.pack_start(fr, padding=4, fill=True, expand=False)
fr = gtk.Frame(" Pick ")
fr.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
fr.set_label_align(0.1, 0.5)
nb = gtk.Notebook()
#nb.set_group_id(group)
#nb.connect("create-window", self.detach_page, group)
nb.set_tab_pos(gtk.POS_BOTTOM)
nb.set_scrollable(True)
nb.set_show_tabs(True)
nb.set_show_border(False)
self.w.nb2 = nb
fr.add(nb)
vbox.pack_start(fr, padding=4, fill=True, expand=False)
# Build report panel
captions = (('Zoom', 'label', 'Contour Zoom', 'label'),
('Object_X', 'label', 'Object_Y', 'label'),
('RA', 'label', 'DEC', 'label'),
('Equinox', 'label', 'Background', 'label'),
('Sky Level', 'label', 'Brightness', 'label'),
('FWHM X', 'label', 'FWHM Y', 'label'),
('FWHM', 'label', 'Star Size', 'label'),
('Sample Area', 'label', 'Default Region', 'button'),
)
w, b = GtkHelp.build_info(captions)
self.w.update(b)
b.zoom.set_text(self.fv.scale2text(di.get_scale()))
self.wdetail = b
b.default_region.connect('clicked', lambda w: self.reset_region())
self.w.tooltips.set_tip(b.default_region,
"Reset region size to default")
# Pick field evaluation status
label = gtk.Label()
label.set_alignment(0.05, 0.5)
self.w.eval_status = label
w.pack_start(self.w.eval_status, fill=False, expand=False, padding=2)
# Pick field evaluation progress bar and stop button
hbox = gtk.HBox()
btn = gtk.Button("Stop")
btn.connect('clicked', lambda w: self.eval_intr())
btn.set_sensitive(False)
self.w.btn_intr_eval = btn
hbox.pack_end(btn, fill=False, expand=False, padding=2)
self.w.eval_pgs = gtk.ProgressBar()
# GTK3
#self.w.eval_pgs.set_orientation(gtk.ORIENTATION_HORIZONTAL)
#self.w.eval_pgs.set_inverted(False)
hbox.pack_start(self.w.eval_pgs, fill=True, expand=True, padding=4)
w.pack_start(hbox, fill=False, expand=False, padding=2)
label = gtk.Label("Report")
label.show()
nb.append_page(w, label)
nb.set_tab_reorderable(w, True)
#nb.set_tab_detachable(w, True)
示例13: build_gui
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import build_info [as 别名]
def build_gui(self, container, future=None):
vbox1 = gtk.VBox()
self.msgFont = self.fv.getFont('sansFont', 12)
tw = gtk.TextView()
tw.set_wrap_mode(gtk.WRAP_WORD)
tw.set_left_margin(4)
tw.set_right_margin(4)
tw.set_editable(False)
tw.set_left_margin(4)
tw.set_right_margin(4)
tw.modify_font(self.msgFont)
self.tw = tw
fr = gtk.Frame(label=" Instructions ")
fr.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
fr.set_label_align(0.1, 0.5)
fr.add(tw)
vbox1.pack_start(fr, padding=4, fill=True, expand=False)
nb = gtk.Notebook()
#nb.set_group_id(group)
#nb.connect("create-window", self.detach_page, group)
nb.set_tab_pos(gtk.POS_BOTTOM)
nb.set_scrollable(True)
nb.set_show_tabs(True)
nb.set_show_border(False)
vbox1.pack_start(nb, padding=4, fill=True, expand=True)
vbox0 = gtk.VBox()
hbox = gtk.HBox(spacing=4)
vbox = gtk.VBox()
fr = gtk.Frame(label=" Image Server ")
fr.set_shadow_type(gtk.SHADOW_ETCHED_IN)
fr.set_label_align(0.5, 0.5)
fr.add(vbox)
captions = (('Server', 'xlabel'),
('@Server', 'combobox'),
('Use DSS channel', 'checkbutton'),
('Get Image', 'button'))
w, self.w = GtkHelp.build_info(captions)
self.w.nb = nb
self.w.get_image.connect('clicked', lambda w: self.getimage_cb())
self.w.use_dss_channel.set_active(self.use_dss_channel)
self.w.use_dss_channel.connect('toggled', self.use_dss_channel_cb)
vbox.pack_start(w, padding=4, fill=True, expand=False)
self.w.img_params = gtk.VBox()
vbox.pack_start(self.w.img_params, padding=4, fill=True, expand=False)
combobox = self.w.server
index = 0
self.image_server_options = self.fv.imgsrv.getServerNames(kind='image')
for name in self.image_server_options:
combobox.insert_text(index, name)
index += 1
index = 0
combobox.set_active(index)
combobox.sconnect('changed', self.setup_params_image)
if len(self.image_server_options) > 0:
self.setup_params_image(combobox, redo=False)
hbox.pack_start(fr, fill=True, expand=True)
vbox = gtk.VBox()
fr = gtk.Frame(label=" Catalog Server ")
fr.set_shadow_type(gtk.SHADOW_ETCHED_IN)
fr.set_label_align(0.5, 0.5)
fr.add(vbox)
captions = (('Server', 'xlabel'),
('@Server', 'combobox'),
('Limit stars to area', 'checkbutton'),
('Search', 'button'))
w, self.w2 = GtkHelp.build_info(captions)
self.w2.search.connect('clicked', lambda w: self.getcatalog_cb())
self.w2.limit_stars_to_area.set_active(self.limit_stars_to_area)
self.w2.limit_stars_to_area.connect('toggled', self.limit_area_cb)
vbox.pack_start(w, padding=4, fill=True, expand=False)
self.w2.cat_params = gtk.VBox()
vbox.pack_start(self.w2.cat_params, padding=4, fill=True, expand=False)
combobox = self.w2.server
index = 0
self.catalog_server_options = self.fv.imgsrv.getServerNames(kind='catalog')
for name in self.catalog_server_options:
combobox.insert_text(index, name)
index += 1
index = 0
combobox.set_active(index)
combobox.sconnect('changed', self.setup_params_catalog)
if len(self.catalog_server_options) > 0:
self.setup_params_catalog(combobox, redo=False)
hbox.pack_start(fr, fill=True, expand=True)
#.........这里部分代码省略.........
示例14: build_gui
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import build_info [as 别名]
def build_gui(self, container):
vpaned = gtk.VPaned()
width, height = 200, 200
# Uncomment to debug; passing parent logger generates too
# much noise in the main logger
#zi = FitsImageCanvasGtk.FitsImageCanvas(logger=self.logger)
zi = FitsImageCanvasGtk.FitsImageCanvas(logger=None)
zi.enable_autozoom('off')
zi.enable_autocuts('off')
zi.enable_zoom(False)
#zi.set_scale_limits(0.001, 1000.0)
zi.zoom_to(self.default_zoom, redraw=False)
zi.add_callback('zoom-set', self.zoomset)
#zi.add_callback('motion', self.showxy)
zi.set_bg(0.4, 0.4, 0.4)
zi.show_pan_mark(True, redraw=False)
self.zoomimage = zi
iw = zi.get_widget()
iw.set_size_request(width, height)
vpaned.pack1(iw, resize=True, shrink=True)
vbox = gtk.VBox()
vbox.pack_start(gtk.Label("Zoom Radius:"), padding=2,
fill=True, expand=False)
adj = gtk.Adjustment(lower=1, upper=100)
adj.set_value(self.zoom_radius)
scale = GtkHelp.HScale(adj)
scale.set_size_request(200, -1)
scale.set_digits(0)
scale.set_draw_value(True)
scale.set_value_pos(gtk.POS_BOTTOM)
#scale.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
self.w_radius = scale
scale.connect('value-changed', self.set_radius_cb)
vbox.pack_start(scale, padding=0, fill=True, expand=False)
vbox.pack_start(gtk.Label("Zoom Amount:"), padding=2,
fill=True, expand=False)
adj = gtk.Adjustment(lower=-20, upper=30)
adj.set_value(self.zoom_amount)
scale = GtkHelp.HScale(adj)
scale.set_size_request(200, -1)
scale.set_digits(0)
scale.set_draw_value(True)
scale.set_value_pos(gtk.POS_BOTTOM)
#scale.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
self.w_amount = scale
scale.connect('value-changed', self.set_amount_cb)
vbox.pack_start(scale, padding=0, fill=True, expand=False)
captions = (('Zoom', 'label'),
("Relative Zoom", 'checkbutton'),
("Lag Time", 'spinbutton'),
('Defaults', 'button'),
)
w, b = GtkHelp.build_info(captions)
b.zoom.set_text(self.fv.scale2text(zi.get_scale()))
self.wzoom = b
b.relative_zoom.set_active(not self.t_abszoom)
b.relative_zoom.sconnect("toggled", self.set_absrel_cb)
b.defaults.connect("clicked", lambda w: self.set_defaults())
adj = b.lag_time.get_adjustment()
adj.configure(0, 0, 20, 1, 1, 1)
adj.set_value(self.lagtime)
b.lag_time.set_digits(0)
b.lag_time.set_wrap(True)
b.lag_time.connect('value-changed', self.setlag_cb)
vbox.pack_start(w, padding=4, fill=True, expand=False)
sw = gtk.ScrolledWindow()
sw.set_border_width(2)
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
sw.add_with_viewport(vbox)
vpaned.pack2(sw, resize=True, shrink=True)
vpaned.show_all()
vpaned.set_position(height)
container.pack_start(vpaned, padding=0, fill=True, expand=True)
示例15: build_gui
# 需要导入模块: from ginga.gtkw import GtkHelp [as 别名]
# 或者: from ginga.gtkw.GtkHelp import build_info [as 别名]
def build_gui(self, container):
sw = gtk.ScrolledWindow()
sw.set_border_width(2)
sw.set_policy(gtk.POLICY_AUTOMATIC,
gtk.POLICY_AUTOMATIC)
vbox = gtk.VBox(spacing=2)
vbox.set_border_width(4)
sw.add_with_viewport(vbox)
# COLOR MAPPING OPTIONS
fr = gtk.Frame(label="Colors")
fr.set_shadow_type(gtk.SHADOW_ETCHED_IN)
fr.set_label_align(0.5, 0.5)
captions = (('Colormap', 'combobox', 'Intensity', 'combobox'),
('Algorithm', 'combobox', 'Table Size', 'entry'),
('Color Defaults', 'button'))
w, b = GtkHelp.build_info(captions)
self.w.cmap_choice = b.colormap
self.w.imap_choice = b.intensity
self.w.calg_choice = b.algorithm
self.w.table_size = b.table_size
b.color_defaults.connect('clicked', lambda w: self.set_default_maps())
b.colormap.set_tooltip_text("Choose a color map for this image")
b.intensity.set_tooltip_text("Choose an intensity map for this image")
b.algorithm.set_tooltip_text("Choose a color mapping algorithm")
b.table_size.set_tooltip_text("Set size of the color mapping table")
b.color_defaults.set_tooltip_text("Restore default color and intensity maps")
fr.add(w)
vbox.pack_start(fr, padding=4, fill=True, expand=False)
combobox = b.colormap
options = []
index = 0
for name in self.cmap_names:
options.append(name)
combobox.insert_text(index, name)
index += 1
cmap_name = self.t_.get('color_map', "ramp")
try:
index = self.cmap_names.index(cmap_name)
except Exception:
index = self.cmap_names.index('ramp')
combobox.set_active(index)
combobox.sconnect('changed', self.set_cmap_cb)
combobox = b.intensity
options = []
index = 0
for name in self.imap_names:
options.append(name)
combobox.insert_text(index, 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_active(index)
combobox.sconnect('changed', self.set_imap_cb)
combobox = b.algorithm
options = []
index = 0
for name in self.calg_names:
options.append(name)
combobox.insert_text(index, name)
index += 1
index = self.calg_names.index(self.t_.get('color_algorithm', "linear"))
combobox.set_active(index)
combobox.sconnect('changed', self.set_calg_cb)
entry = b.table_size
entry.set_text(str(self.t_.get('color_hashsize', 65535)))
entry.connect('activate', self.set_tablesize_cb)
# ZOOM OPTIONS
fr = gtk.Frame(label="Zoom")
fr.set_shadow_type(gtk.SHADOW_ETCHED_IN)
fr.set_label_align(0.5, 0.5)
captions = (('Zoom Alg', 'combobox', 'Zoom Rate', 'spinbutton'),
('Stretch XY', 'combobox', 'Stretch Factor', 'spinbutton'),
('Scale X', 'entry', 'Scale Y', 'entry'),
('Scale Min', 'spinbutton', 'Scale Max', 'spinbutton'),
('Zoom Defaults', 'button'))
w, b = GtkHelp.build_info(captions)
self.w.update(b)
index = 0
for name in self.zoomalg_names:
b.zoom_alg.insert_text(index, name.capitalize())
index += 1
zoomalg = self.t_.get('zoom_algorithm', "step")
index = self.zoomalg_names.index(zoomalg)
b.zoom_alg.set_active(index)
b.zoom_alg.set_tooltip_text("Choose Zoom algorithm")
b.zoom_alg.sconnect('changed', lambda w: self.set_zoomalg_cb())
#.........这里部分代码省略.........