Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module=getattr(self.rp, "pid0")
)
# a IQ controller for "iq0" here
self.iq_widget = IqWidget(name="iq0",
rp=self.rp,
parent=None,
module=getattr(self.rp, "iq0")
)
# setup controller layout here
self.control_widget_layout = QtGui.QVBoxLayout()
self.control_widget_layout.addWidget(self.asg_widget)
self.control_widget_layout.addWidget(self.scope_widget)
self.control_widget_layout.addWidget(self.pid_widget)
self.control_widget_layout.addWidget(self.iq_widget)
#
self.control_widget=QtGui.QWidget()
self.control_widget.setLayout(self.control_widget_layout)
#------------#
# a scope for another rp
'''
self.another_scope_widget = ScopeWidget(name="another_SHG",
rp=another_rp,
parent=None,
module=self.another_rp.scope
)
'''
# set dock_widgets for the main windows
self.dock_widgets = {}
self.last_docked = None
self.add_dock_widget(self.console_widget,'console')
self.add_dock_widget(self.control_widget,'controller')
#self.add_dock_widget(self.another_scope_widget, 'another')
self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
self.label_7 = QtGui.QLabel(self.groupBoxDis_2)
self.label_7.setObjectName(_fromUtf8("label_7"))
self.verticalLayout_4.addWidget(self.label_7)
self.gridLayout_45.addWidget(self.groupBoxDis_2, 2, 3, 1, 1)
self.stackedWidget_2 = QtGui.QStackedWidget(self.dockWidgetContents)
self.stackedWidget_2.setObjectName(_fromUtf8("stackedWidget_2"))
self.page1_2 = QtGui.QWidget()
self.page1_2.setObjectName(_fromUtf8("page1_2"))
self.gridLayout_35 = QtGui.QGridLayout(self.page1_2)
self.gridLayout_35.setObjectName(_fromUtf8("gridLayout_35"))
self.label_57 = QtGui.QLabel(self.page1_2)
self.label_57.setObjectName(_fromUtf8("label_57"))
self.gridLayout_35.addWidget(self.label_57, 0, 0, 1, 1)
self.stackedWidget_2.addWidget(self.page1_2)
self.page2_2 = QtGui.QWidget()
self.page2_2.setObjectName(_fromUtf8("page2_2"))
self.gridLayout_36 = QtGui.QGridLayout(self.page2_2)
self.gridLayout_36.setObjectName(_fromUtf8("gridLayout_36"))
self.label_58 = QtGui.QLabel(self.page2_2)
self.label_58.setObjectName(_fromUtf8("label_58"))
self.gridLayout_36.addWidget(self.label_58, 0, 0, 1, 1)
self.stackedWidget_2.addWidget(self.page2_2)
self.gridLayout_45.addWidget(self.stackedWidget_2, 5, 2, 1, 1)
self.stackedWidgetDis_2 = QtGui.QStackedWidget(self.dockWidgetContents)
self.stackedWidgetDis_2.setEnabled(False)
self.stackedWidgetDis_2.setObjectName(_fromUtf8("stackedWidgetDis_2"))
self.page1Dis_2 = QtGui.QWidget()
self.page1Dis_2.setObjectName(_fromUtf8("page1Dis_2"))
self.gridLayout_37 = QtGui.QGridLayout(self.page1Dis_2)
self.gridLayout_37.setObjectName(_fromUtf8("gridLayout_37"))
self.label_113 = QtGui.QLabel(self.page1Dis_2)
f.close()
if keys is None:
keys = np.unique(self.pd.objid.values)
print 'N keys: ', len(keys)
self.keys = keys
self.key_index = -1
self.key = None
self.candidate = None
self.candidates = None
self.candidate_index = -1
self.new_key = True
## create GUI
self.app = QtGui.QApplication([])
self.w = QtGui.QWidget()
self.layout = QtGui.QGridLayout()
self.w.setLayout(self.layout)
next_btn = QtGui.QPushButton('next match')
next_btn.pressed.connect(self.next_stitch)
self.layout.addWidget(next_btn, 0, 0)
save_btn = QtGui.QPushButton('save stitch')
save_btn.pressed.connect(self.save_stitch)
self.layout.addWidget(save_btn, 1, 0)
reject_btn = QtGui.QPushButton('reject stitch')
reject_btn.pressed.connect(self.reject_stitch)
self.layout.addWidget(reject_btn, 2, 0)
self.button = 'accepted'
d5 = Dock("Dock5", size=(100,100))
d6 = Dock("Dock6", size=(300,300))
area.addDock(d1, 'left')
area.addDock(d2, 'right')
area.addDock(d3, 'bottom')
area.addDock(d4, 'right')
area.addDock(d5, 'left', d1)
area.addDock(d6, 'top', d4)
area.moveDock(d6, 'above', d4)
d3.hideTitleBar()
print("===build complete====")
for d in [d1, d2, d3, d4, d5]:
w = QtGui.QWidget()
l = QtGui.QVBoxLayout()
w.setLayout(l)
btns = []
for i in range(4):
btns.append(QtGui.QPushButton("%s Button %d"%(d.name(), i)))
l.addWidget(btns[-1])
d.w = (w, l, btns)
d.addWidget(w)
import pyqtgraph as pg
p = pg.PlotWidget()
d6.addWidget(p)
print("===widgets added===")
opts = self.param.opts
if 'tip' in opts:
w.setToolTip(opts['tip'])
self.displayLabel = QtGui.QLabel()
self.displayLabel.hide()
self.defaultBtn = QtGui.QPushButton("")
self.defaultBtn.hide()
layout = QtGui.QHBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(w)
layout.addWidget(self.displayLabel)
layout.addWidget(self.defaultBtn)
self.layoutWidget = QtGui.QWidget()
self.layoutWidget.setLayout(layout)
if w.sigChanged is not None:
w.sigChanged.connect(self.widgetValueChanged)
if hasattr(w, 'sigChanging'):
w.sigChanging.connect(self.widgetValueChanging)
## update value shown in widget.
if opts.get('value', None) is not None:
self.valueChanged(self, opts['value'], force=True)
else:
## no starting value was given; use whatever the widget has
self.widgetValueChanged()
|list| |------------------|
|----|<| |
|data| | graph2 |
|list| | |
===========================
"""
super(MainWindow, self).__init__()
self.log_data_list = None
self.log_file_name = None
self.data_dict = None
self.log_info_data = None
self.log_params_data = None
self.log_changed_params = []
self.main_widget = QtGui.QWidget(self)
self.mainlayout = QtGui.QHBoxLayout()
self.main_widget.setLayout(self.mainlayout)
# ToolBar
self.toolbar = self.addToolBar('FileManager')
self.basic_tool_group = QtGui.QActionGroup(self)
## load log file
self.loadfile_action = QtGui.QAction(QtGui.QIcon(get_source_name('icons/open.gif')), 'Open log file', self)
self.loadfile_action.setShortcut('Ctrl+O')
self.loadfile_action.triggered.connect(self.callback_open_log_file)
self.toolbar.addAction(self.loadfile_action)
## plot quadrotor in 3d graph
self.show_quadrotor_3d = QtGui.QAction(QtGui.QIcon(get_source_name('icons/quadrotor.gif')), 'show 3d viewer', self)
self.show_quadrotor_3d.setShortcut('Ctrl+Shift+Q')
self.show_quadrotor_3d.triggered.connect(self.callback_show_quadrotor)
self.toolbar.addAction(self.show_quadrotor_3d)
def initUIControls(self):
self.uiConrolsWidget = QtGui.QWidget()
buttonBarWidgetLayout = QtGui.QHBoxLayout(spacing=0)
buttonBarWidgetLayout.setContentsMargins(0, 0, 0, 0)
buttonBarWidgetLayout.setSpacing(0)
self.uiConrolsWidget.setLayout(buttonBarWidgetLayout)
def addButton(label, widget=None, function=None):
button = QtGui.QPushButton(label)
if function is None:
button.clicked.connect(lambda: widget.setVisible(widget.isHidden()))
else:
button.clicked.connect(function)
button.setStyleSheet('QPushButton {'
'border-color: black;'
'border-width: 5px;}')
buttonBarWidgetLayout.addWidget(button)
return button
def setItemWidget(self, item, col, wid):
"""
Overrides QTreeWidget.setItemWidget such that widgets are added inside an invisible wrapper widget.
This makes it possible to move the item in and out of the tree without its widgets being automatically deleted.
"""
w = QtGui.QWidget() ## foster parent / surrogate child widget
l = QtGui.QVBoxLayout()
l.setContentsMargins(0,0,0,0)
w.setLayout(l)
w.setSizePolicy(wid.sizePolicy())
w.setMinimumHeight(wid.minimumHeight())
w.setMinimumWidth(wid.minimumWidth())
l.addWidget(wid)
w.realChild = wid
self.placeholders.append(w)
QtGui.QTreeWidget.setItemWidget(self, item, col, w)
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(596, 569)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.gridLayout_7 = QtGui.QGridLayout(self.centralwidget)
self.gridLayout_7.setObjectName(_fromUtf8("gridLayout_7"))
self.groupBox_2 = QtGui.QGroupBox(self.centralwidget)
self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
self.gridLayout = QtGui.QGridLayout(self.groupBox_2)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.tabWidget = QtGui.QTabWidget(self.groupBox_2)
self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
self.tab = QtGui.QWidget()
self.tab.setObjectName(_fromUtf8("tab"))
self.gridLayout_4 = QtGui.QGridLayout(self.tab)
self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4"))
self.groupBox_3 = QtGui.QGroupBox(self.tab)
self.groupBox_3.setObjectName(_fromUtf8("groupBox_3"))
self.gridLayout_5 = QtGui.QGridLayout(self.groupBox_3)
self.gridTwoChButton = QtGui.QPushButton('Two-color grid 128px')
self.gridTwoChButton.setCheckable(True)
self.gridTwoChButton.setEnabled(False)
self.gridTwoCh82Button = QtGui.QPushButton('Two-color grid 82px')
self.gridTwoCh82Button.setCheckable(True)
self.gridTwoCh82Button.setEnabled(False)
self.crosshairButton = QtGui.QPushButton('Crosshair')
self.crosshairButton.setCheckable(True)
self.crosshairButton.setEnabled(False)
self.flipperButton = QtGui.QPushButton('x1000')
self.flipperButton.setStyleSheet("font-size:16px")
self.flipperButton.setCheckable(True)
self.flipperButton.clicked.connect(self.daq.toggleFlipper)
self.viewCtrl = QtGui.QWidget()
self.viewCtrlLayout = QtGui.QGridLayout(self.viewCtrl)
self.viewCtrlLayout.addWidget(self.liveviewButton, 0, 0, 1, 4)
self.viewCtrlLayout.addWidget(self.gridButton, 1, 0)
self.viewCtrlLayout.addWidget(self.gridTwoChButton, 1, 1)
self.viewCtrlLayout.addWidget(self.gridTwoCh82Button, 1, 2)
self.viewCtrlLayout.addWidget(self.crosshairButton, 1, 3)
self.viewCtrlLayout.addWidget(self.flipperButton, 2, 0, 1, 4)
# Status bar info
self.fpsBox = QtGui.QLabel('0 fps', self)
self.statusBar().addPermanentWidget(self.fpsBox)
self.tempStatus = QtGui.QLabel(self)
self.statusBar().addPermanentWidget(self.tempStatus)
self.temp = QtGui.QLabel(self)
self.statusBar().addPermanentWidget(self.temp)
self.cursorPos = QtGui.QLabel('0, 0', self)