本文整理汇总了Python中ginga.qtw.QtHelp类的典型用法代码示例。如果您正苦于以下问题:Python QtHelp类的具体用法?Python QtHelp怎么用?Python QtHelp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QtHelp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, title=''):
super(Expander, self).__init__()
# Qt doesn't seem to like it (segfault) if we actually construct
# these icons in the class variable declarations
if Expander.r_arrow is None:
Expander.r_arrow = QtHelp.get_icon(os.path.join(icondir,
'triangle-right-48.png'),
size=(12, 12))
if Expander.d_arrow is None:
Expander.d_arrow = QtHelp.get_icon(os.path.join(icondir,
'triangle-down-48.png'),
size=(12, 12))
self.widget = QtGui.QWidget()
vbox = QtGui.QVBoxLayout()
vbox.setContentsMargins(0, 0, 0, 0)
vbox.setSpacing(0)
self.layout = vbox
self.toggle = QtGui.QPushButton(Expander.r_arrow, title)
self.toggle.setStyleSheet(Expander.widget_style)
#self.toggle.setCheckable(True)
self.toggle.clicked.connect(self._toggle_widget)
vbox.addWidget(self.toggle, stretch=0)
self.widget.setLayout(vbox)
示例2: create_info_window
def create_info_window(self):
sw = QtGui.QScrollArea()
widget = QtGui.QWidget()
vbox = QtGui.QVBoxLayout()
vbox.setContentsMargins(2, 2, 2, 2)
widget.setLayout(vbox)
captions = (
('X', 'xlabel', '@X', 'entry'),
('Y', 'xlabel', '@Y', 'entry'),
('Z', 'xlabel', '@Z', 'entry'),
('Radius','label'),('Theta','label'),('Phi','label'),
('RA', 'label'), ('DEC', 'label'),
('Radius2','label'),('Theta2','label'),('Phi2','label'),
)
w, b = QtHelp.build_info(captions)
b.x.setToolTip("Set X value (press Enter)")
b.y.setToolTip("Set Y value (press Enter)")
b.z.setToolTip('Set Z value (press Enter)')
vbox.addWidget(w, stretch=0)
#widget.show()
sw.setWidget(widget)
return sw, b
示例3: gui_add_channels
def gui_add_channels(self):
captions = (('Prefix', 'entry'),
('Number', 'spinbutton'),
('Workspace', 'combobox'),
)
w, b = QtHelp.build_info(captions)
b.prefix.setText("Image")
b.number.setRange(1, 12)
b.number.setSingleStep(1)
b.number.setValue(1)
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.setCurrentIndex(idx)
dialog = QtHelp.Dialog("Add Channels",
0,
[['Cancel', 0], ['Ok', 1]],
lambda w, rsp: self.add_channels_cb(w, rsp,
b, names))
box = dialog.get_content_area()
layout = QtGui.QVBoxLayout()
box.setLayout(layout)
layout.addWidget(w, stretch=1)
dialog.show()
示例4: build_gui
def build_gui(self, container):
sw = QtGui.QScrollArea()
twidget = QtHelp.VBox()
sp = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
QtGui.QSizePolicy.Fixed)
twidget.setSizePolicy(sp)
vbox1 = twidget.layout()
vbox1.setContentsMargins(4, 4, 4, 4)
vbox1.setSpacing(2)
sw.setWidgetResizable(True)
sw.setWidget(twidget)
msgFont = QtGui.QFont("Sans", 14)
tw = QtGui.QLabel()
tw.setFont(msgFont)
tw.setWordWrap(True)
self.tw = tw
fr = QtHelp.Frame("Instructions")
fr.layout().addWidget(tw, stretch=1, alignment=QtCore.Qt.AlignTop)
vbox1.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop)
fr = QtHelp.Frame("HDU")
captions = [("Num HDUs", 'label'), ("Choose HDU", 'spinbutton')]
w, b = QtHelp.build_info(captions)
self.w.update(b)
self.w.numhdu = b.num_hdus
self.w.hdu = b.choose_hdu
self.w.hdu.valueChanged.connect(self.set_hdu_cb)
fr.layout().addWidget(w, stretch=1, alignment=QtCore.Qt.AlignLeft)
vbox1.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop)
fr = QtHelp.Frame("NAXIS")
self.stack = QtHelp.StackedWidget()
self.stack.addWidget(QtGui.QLabel(''))
fr.layout().addWidget(self.stack, stretch=1, alignment=QtCore.Qt.AlignLeft)
vbox1.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop)
btns = QtHelp.HBox()
layout = btns.layout()
layout.setSpacing(3)
#btns.set_child_size(15, -1)
btn = QtGui.QPushButton("Close")
btn.clicked.connect(self.close)
layout.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft)
vbox1.addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignLeft)
container.addWidget(sw, stretch=1)
示例5: deactivate
def deactivate(self, name):
self.logger.debug("deactivating %s" % (name))
lname = name.lower()
if lname in self.focus:
self.clear_focus(lname)
if self.active.has_key(lname):
bnch = self.active[lname]
self.logger.debug("stopping plugin")
self.stop_plugin(bnch.pInfo)
self.logger.debug("removing from tray")
QtHelp.removeWidget(self.hbox, bnch.widget)
bnch.widget = None
bnch.label = None
self.logger.debug("removing from dict")
del self.active[lname]
# Set focus to another plugin if one is running
active = self.active.keys()
if len(active) > 0:
name = active[0]
self.set_focus(name)
示例6: config_autocut_params
def config_autocut_params(self, method):
index = self.autocut_methods.index(method)
self.w.auto_method.setCurrentIndex(index)
# remove old params
layout = self.w.acvbox.layout()
for child in QtHelp.children(layout):
QtHelp.removeWidget(layout, child)
# Create new autocuts object of the right kind
ac = AutoCuts.get_autocuts(method)(self.logger)
# Build up a set of control widgets for the autocuts
# algorithm tweakable parameters
paramlst = ac.get_params_metadata()
params = self.autocuts_cache.setdefault(method, {})
self.ac_params = QtHelp.ParamSet(self.logger, params)
w = self.ac_params.build_params(paramlst)
self.ac_params.add_callback('changed', self.autocut_params_changed_cb)
self.w.acvbox.layout().addWidget(w, stretch=1)
示例7: build_gui
def build_gui(self, container):
sw = QtGui.QScrollArea()
twidget = QtHelp.VBox()
sp = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
QtGui.QSizePolicy.Fixed)
twidget.setSizePolicy(sp)
vbox1 = twidget.layout()
vbox1.setContentsMargins(4, 4, 4, 4)
vbox1.setSpacing(2)
sw.setWidgetResizable(True)
sw.setWidget(twidget)
msgFont = QtGui.QFont("Sans", 14)
tw = QtGui.QLabel()
tw.setFont(msgFont)
tw.setWordWrap(True)
self.tw = tw
fr = QtHelp.Frame("Instructions")
fr.layout().addWidget(tw, stretch=1, alignment=QtCore.Qt.AlignTop)
vbox1.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop)
fr = QtHelp.Frame("Ruler")
captions = (('Units', 'combobox'),)
w, b = QtHelp.build_info(captions)
self.w = b
combobox = b.units
for name in self.unittypes:
combobox.addItem(name)
index = self.unittypes.index(self.units)
combobox.setCurrentIndex(index)
combobox.activated.connect(self.set_units)
fr.layout().addWidget(w, stretch=1, alignment=QtCore.Qt.AlignLeft)
vbox1.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop)
btns = QtHelp.HBox()
layout = btns.layout()
layout.setSpacing(3)
#btns.set_child_size(15, -1)
btn = QtGui.QPushButton("Close")
btn.clicked.connect(self.close)
layout.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft)
vbox1.addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignLeft)
container.addWidget(sw, stretch=1)
示例8: gui_add_ws
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 = QtHelp.build_info(captions)
wsname = "ws%d" % (self.wscount)
self.wscount += 1
b.workspace_name.setText(wsname)
b.share_settings.setMaxLength(60)
cbox = b.workspace_type
cbox.append_text("Tabs")
cbox.append_text("Grid")
cbox.append_text("MDI")
cbox.setCurrentIndex(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.setCurrentIndex(idx)
b.channel_prefix.setText("Image")
spnbtn = b.number_of_channels
spnbtn.setRange(0, 12)
spnbtn.setSingleStep(1)
spnbtn.setValue(4)
dialog = QtHelp.Dialog("Add Workspace",
0,
[['Cancel', 0], ['Ok', 1]],
lambda w, rsp: self.new_ws_cb(w, rsp, b, names))
box = dialog.get_content_area()
layout = QtGui.QVBoxLayout()
box.setLayout(layout)
layout.addWidget(w, stretch=1)
dialog.show()
self._cur_dialogs.append(dialog)
示例9: build_gui
def build_gui(self, container):
width, height = 300, 300
cm, im = self.fv.cm, self.fv.im
tg = ImageViewCanvasQt.ImageViewCanvas(logger=self.logger)
tg.configure_window(200, 200)
tg.enable_autozoom('on')
tg.set_autocut_params('zscale')
tg.enable_autocuts('override')
tg.enable_auto_orient(True)
tg.defer_redraw = False
tg.set_bg(0.7, 0.7, 0.7)
self.thumb_generator = tg
sw = MyScrollArea()
sw.setWidgetResizable(True)
#sw.setEnabled(True)
sw.thumbs_cb = self.thumbpane_resized_cb
# Create thumbnails pane
widget = QtGui.QWidget()
vbox = QtGui.QGridLayout()
vbox.setContentsMargins(4, 4, 4, 4)
vbox.setSpacing(14)
widget.setLayout(vbox)
self.w.thumbs = vbox
self.w.thumbs_w = widget
#widget.show()
sw.setWidget(widget)
self.w.thumbs_scroll = sw
#self.w.thumbs_scroll.connect("size_allocate", self.thumbpane_resized_cb)
# TODO: should this even have it's own scrolled window?
cw = container.get_widget()
cw.addWidget(sw, stretch=1)
sw.show()
captions = (('Auto scroll', 'checkbutton', 'Clear', 'button'),)
w, b = QtHelp.build_info(captions)
self.w.update(b)
b.auto_scroll.setToolTip("Scroll the thumbs window when new images arrive")
b.clear.setToolTip("Remove all current thumbnails")
b.clear.clicked.connect(self.clear)
auto_scroll = self.settings.get('auto_scroll', True)
b.auto_scroll.setChecked(auto_scroll)
cw.addWidget(w, stretch=0)
self.gui_up = True
示例10: build_gui
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
vbox = QtHelp.VBox()
sp = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
QtGui.QSizePolicy.Fixed)
vbox.setSizePolicy(sp)
fr = QtHelp.Frame("IRAF")
captions = [("Control", 'hbox'),
("Channel", 'label'),
]
w, b = QtHelp.build_info(captions)
self.w = b
self.w.mode_d = {}
btn = QtGui.QRadioButton("Ginga")
btn.toggled.connect(lambda w: self.switchMode('ginga'))
self.w.mode_d['ginga'] = btn
self.w.control.layout().addWidget(btn, stretch=0,
alignment=QtCore.Qt.AlignLeft)
btn = QtGui.QRadioButton("IRAF")
btn.toggled.connect(lambda w: self.switchMode('iraf'))
self.w.mode_d['iraf'] = btn
self.w.control.layout().addWidget(btn, stretch=0,
alignment=QtCore.Qt.AlignLeft)
fr.layout().addWidget(w, stretch=1, alignment=QtCore.Qt.AlignLeft)
vbox.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop)
fr = QtHelp.Frame("Frame/Channel")
lbl = QtGui.QLabel("")
self.w.frch = lbl
fr.layout().addWidget(lbl, stretch=1, alignment=QtCore.Qt.AlignLeft)
vbox.addWidget(fr, stretch=0, alignment=QtCore.Qt.AlignTop)
container.addWidget(vbox, stretch=0, alignment=QtCore.Qt.AlignTop)
示例11: build_gui
def build_gui(self, container):
rvbox = container
width, height = 300, 300
cm, im = self.fv.cm, self.fv.im
tg = FitsImageQt.FitsImageQt(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 = MyScrollArea()
sw.setWidgetResizable(True)
#sw.setEnabled(True)
sw.thumbs_cb = self.thumbpane_resized_cb
# Create thumbnails pane
widget = QtGui.QWidget()
vbox = QtGui.QGridLayout()
vbox.setContentsMargins(4, 4, 4, 4)
vbox.setSpacing(14)
widget.setLayout(vbox)
self.w.thumbs = vbox
self.w.thumbs_w = widget
#widget.show()
sw.setWidget(widget)
self.w.thumbs_scroll = sw
#self.w.thumbs_scroll.connect("size_allocate", self.thumbpane_resized_cb)
# TODO: should this even have it's own scrolled window?
rvbox.addWidget(sw, stretch=1)
sw.show()
captions = (('Auto scroll', 'checkbutton'),)
w, b = QtHelp.build_info(captions)
self.w.update(b)
b.auto_scroll.setToolTip("Scroll the thumbs window when new images arrive")
autoScroll = self.settings.get('autoScroll', True)
b.auto_scroll.setChecked(autoScroll)
rvbox.addWidget(w, stretch=0)
示例12: build_naxis
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 = QtHelp.build_info(captions)
for n in xrange(0, len(dims)):
key = "naxis%d" % (n + 1)
lbl = b[key]
maxn = int(dims[n])
lbl.setText("%d" % maxn)
slkey = "choose_" + key
if b.has_key(slkey):
slider = b[slkey]
lower = 1
upper = maxn
slider.setRange(lower, upper)
slider.setSingleStep(1)
slider.setWrapping(True)
def make_cbfn(n):
return lambda idx: self.set_naxis_cb(idx - 1, n)
slider.valueChanged.connect(make_cbfn(n))
# Add naxis controls to gui
try:
oldw = self.stack.currentWidget()
self.stack.removeWidget(oldw)
except:
pass
self.stack.addWidget(w)
示例13: _setup_params
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 = QtHelp.build_info(captions)
# remove old widgets
old_w = container.currentWidget()
if old_w != None:
container.removeWidget(old_w)
# add new widgets
container.insertWidget(0, w)
return b
示例14: build_gui
def build_gui(self, container):
# self.msgFont = self.fv.getFont("fixedFont", 10)
tw = QtGui.QPlainTextEdit()
tw.setReadOnly(True)
# tw.setCurrentFont(self.msgFont)
tw.setLineWrapMode(QtGui.QPlainTextEdit.NoWrap)
tw.setMaximumBlockCount(self.histlimit)
self.tw = tw
sw = QtGui.QScrollArea()
sw.setWidgetResizable(True)
sw.setWidget(self.tw)
container.addWidget(sw, stretch=1)
# sw.show()
captions = (("Level", "combobox", "History", "spinbutton"), ("Auto scroll", "checkbutton", "Clear", "button"))
w, b = QtHelp.build_info(captions)
self.w.update(b)
combobox = b.level
for (name, level) in self.levels:
combobox.addItem(name)
combobox.setCurrentIndex(1)
combobox.activated.connect(self.set_loglevel_cb)
combobox.setToolTip("Set the logging level")
spinbox = b.history
spinbox.setRange(100, self.histmax)
spinbox.setSingleStep(10)
spinbox.setValue(self.histlimit)
spinbox.valueChanged.connect(self.set_history_cb)
spinbox.setToolTip("Set the logging history line limit")
btn = b.auto_scroll
btn.setToolTip("Scroll the log window automatically")
btn = b.clear
btn.clicked.connect(self.clear)
btn.setToolTip("Clear the log history")
container.addWidget(w, stretch=0)
示例15: _setup_params
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 'label' in bnch:
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 = QtHelp.build_info(captions)
# remove old widgets
old_w = container.currentWidget()
if old_w != None:
container.removeWidget(old_w)
# add new widgets
container.insertWidget(0, w)
return b