Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#sw.set_border_width(2)
sw.setWidget(self.browser)
cw = container.get_widget()
cw.layout().addWidget(sw, stretch=1)
sw.show()
self.entry = QtGui.QLineEdit()
cw.layout().addWidget(self.entry, stretch=0)
self.entry.returnPressed.connect(self.browse_cb)
btns = QtHelp.HBox()
layout = btns.layout()
layout.setSpacing(3)
btn = QtGui.QPushButton("Close")
btn.clicked.connect(self.close)
layout.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft)
cw.layout().addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignLeft)
if has_webkit:
from ginga.doc.download_doc import get_doc
helpurl = get_doc()
self.browse(helpurl)
self.msgList = QtGui.QWidget()
vbox = QtGui.QGridLayout()
vbox.setContentsMargins(0, 0, 0, 0)
vbox.setSpacing(0)
self.msgList.setLayout(vbox)
sw = QtGui.QScrollArea()
sw.setWidgetResizable(True)
#sw.set_border_width(2)
sw.setWidget(self.msgList)
cw = container.get_widget()
cw.addWidget(sw, stretch=1)
hbox = QtHelp.HBox()
btn = QtGui.QPushButton("Remove All")
btn.clicked.connect(self.remove_all)
hbox.addWidget(btn, stretch=0)
cw.addWidget(hbox, stretch=0)
self.widgetList = []
vbox = QtGui.QVBoxLayout()
vbox.setContentsMargins(QtCore.QMargins(2, 2, 2, 2))
vbox.setSpacing(1)
vbox.addWidget(w, stretch=1)
# for simple WCS readout
self.readout = Readout(-1, 16)
readout = self.readout.get_widget()
fi.set_callback('none-move', self.motion, self.readout)
vbox.addWidget(readout, stretch=0,
alignment=QtCore.Qt.AlignCenter)
hbox = QtGui.QHBoxLayout()
hbox.setContentsMargins(QtCore.QMargins(4, 2, 4, 2))
wopen = QtGui.QPushButton("Open File")
def _open_file(name):
return lambda: self.open_file(name)
wopen.clicked.connect(_open_file(name))
wquit = QtGui.QPushButton("Close")
def _close(name):
return lambda: self.close_viewer(name)
wquit.clicked.connect(_close(name))
hbox.addStretch(1)
for w in (wopen, wquit):
hbox.addWidget(w, stretch=0)
hw = QtGui.QWidget()
hw.setLayout(hbox)
vbox.addWidget(hw, stretch=0)
self.btn['imap'] = combobox
btns.addWidget(combobox, stretch=0, alignment=QtCore.Qt.AlignRight)
combobox = QtHelp.ComboBox()
options = []
index = 0
for name, fn in self.operation_table:
options.append(name)
combobox.addItem(name)
index += 1
combobox.setCurrentIndex(0)
combobox.activated.connect(self.do_operation_cb)
self.btn['oprn'] = combobox
btns.addWidget(combobox, stretch=0, alignment=QtCore.Qt.AlignRight)
btn = QtGui.QPushButton("Do it")
btns.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignRight)
vbox.addWidget(btns, stretch=0, alignment=QtCore.Qt.AlignTop)
btns = QtHelp.HBox()
btns.setSpacing(5)
for name in ('Plot', 'Clear', #'Close'
):
btn = QtGui.QPushButton(name)
btns.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft)
self.btn[name.lower()] = btn
self.btn.plot.clicked.connect(self.replot_stars)
self.btn.clear.clicked.connect(self.clear)
#self.btn.close.clicked.connect(self.close)
vbox = QtGui.QVBoxLayout()
vbox.setContentsMargins(0, 0, 0, 0)
self.widget.setLayout(vbox)
TopLevelMixin.__init__(self, title=title)
self.content = VBox()
vbox.addWidget(self.content.get_widget(), stretch=1)
if len(buttons) > 0:
hbox_w = QtGui.QWidget()
hbox = QtGui.QHBoxLayout()
hbox_w.setLayout(hbox)
for name, val in buttons:
btn = QtGui.QPushButton(name)
def cb(val):
return lambda: self._cb_redirect(val)
btn.clicked.connect(cb(val))
hbox.addWidget(btn, stretch=0)
vbox.addWidget(hbox_w, stretch=0)
# self.widget.closeEvent = lambda event: self.delete()
self.enable_callback('activated')
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)
vbox.addWidget(hbox, stretch=0)
self.w.listing = vbox
nb.addTab(vbox, "Listing")
btns = QtHelp.HBox()
btns.setSpacing(3)
#btns.set_child_size(15, -1)
self.w.buttons = btns
btn = QtGui.QPushButton("Close")
btn.clicked.connect(self.close)
btns.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft)
if future:
btn = QtGui.QPushButton('Ok')
btn.clicked.connect(lambda w: self.ok())
btns.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft)
btn = QtGui.QPushButton('Cancel')
btn.clicked.connect(lambda w: self.cancel())
btns.addWidget(btn, stretch=0, alignment=QtCore.Qt.AlignLeft)
vbox1.addWidget(btns, stretch=0)
cw = container.get_widget()
cw.layout().addWidget(vbox1, stretch=1)
self.wdrawcolor = wdrawcolor
wfill = QtGui.QCheckBox("Fill")
wfill.stateChanged.connect(self.set_drawparams)
self.wfill = wfill
walpha = QtGui.QDoubleSpinBox()
walpha.setRange(0.0, 1.0)
walpha.setSingleStep(0.1)
walpha.setValue(1.0)
walpha.valueChanged.connect(self.set_drawparams)
self.walpha = walpha
wclear = QtGui.QPushButton("Clear Canvas")
wclear.clicked.connect(self.clear_canvas)
wopen = QtGui.QPushButton("Open File")
wopen.clicked.connect(self.open_file)
wquit = QtGui.QPushButton("Quit")
wquit.clicked.connect(self.quit)
hbox.addStretch(1)
for w in (wopen, wdrawtype, wdrawcolor, wfill,
QtGui.QLabel('Alpha:'), walpha, wclear, wquit):
hbox.addWidget(w, stretch=0)
hw = QtGui.QWidget()
hw.setLayout(hbox)
vbox.addWidget(hw, stretch=0)
mode = self.canvas.get_draw_mode()
hbox = QtGui.QHBoxLayout()
hbox.setContentsMargins(QtCore.QMargins(4, 2, 4, 2))
vbox2.addWidget(w, stretch=1)
# Pick field evaluation status
label = QtGui.QLabel()
self.w.eval_status = label
## w.layout().addWidget(label, stretch=0, alignment=QtCore.Qt.AlignLeft)
vbox2.addWidget(label, stretch=0)
# Pick field evaluation progress bar and stop button
hbox = QtHelp.HBox()
pgs = QtGui.QProgressBar()
pgs.setRange(0, 100)
pgs.setTextVisible(True)
self.w.eval_pgs = pgs
hbox.addWidget(pgs, stretch=0)
btn = QtGui.QPushButton("Stop")
btn.clicked.connect(lambda w: self.eval_intr())
btn.setEnabled(False)
self.w.btn_intr_eval = btn
hbox.addWidget(btn, stretch=0)
vbox2.addWidget(hbox, stretch=0)
nb.addTab(vbox2, "Readout")
# Build settings panel
captions = (('Show Candidates', 'checkbutton'),
('Radius', 'xlabel', '@Radius', 'spinfloat'),
('Threshold', 'xlabel', '@Threshold', 'entry'),
('Min FWHM', 'xlabel', '@Min FWHM', 'spinfloat'),
('Max FWHM', 'xlabel', '@Max FWHM', 'spinfloat'),
('Ellipticity', 'xlabel', '@Ellipticity', 'entry'),
('Edge', 'xlabel', '@Edge', 'entry'),
w.resize(512, 512)
# add scrollbar interface around this viewer
si = ScrolledView(fi)
vbox = QtGui.QVBoxLayout()
vbox.setContentsMargins(QtCore.QMargins(2, 2, 2, 2))
vbox.setSpacing(1)
vbox.addWidget(si, stretch=1)
hbox = QtGui.QHBoxLayout()
hbox.setContentsMargins(QtCore.QMargins(4, 2, 4, 2))
wopen = QtGui.QPushButton("Open File")
wopen.clicked.connect(self.open_file)
wquit = QtGui.QPushButton("Quit")
wquit.clicked.connect(self.quit)
hbox.addStretch(1)
for w in (wopen, wquit):
hbox.addWidget(w, stretch=0)
hw = QtGui.QWidget()
hw.setLayout(hbox)
vbox.addWidget(hw, stretch=0)
vw = QtGui.QWidget()
self.setCentralWidget(vw)
vw.setLayout(vbox)