Exemple #1
0
		def __init__(self,parent=None):
			super(AppWindow.portSelectionDialog, self).__init__(parent)
			self.button_layout = QtGui.QVBoxLayout()
			self.setLayout(self.button_layout)
			self.btns=[]
			self.doneButton = QtWidgets.QPushButton("Done")
			self.button_layout.addWidget(self.doneButton)
			self.doneButton.clicked.connect(self.finished)
    def makeBottomMenu(self):
        try:
            self.pushbutton.setParent(None)
        except:
            pass
        self.pushbutton = QtWidgets.QPushButton('Menu')
        self.pushbutton.setStyleSheet(
            "height: 13px;padding:3px;color: #FFFFFF;")
        menu = QtWidgets.QMenu()

        menu.addAction('Save Window as Svg', self.exportSvg)
        menu.addAction('Open Stepper Controller', self.newStepperController)

        #Theme
        self.themeAction = QtWidgets.QWidgetAction(menu)
        themes = [
            a.split('.qss')[0] for a in os.listdir(path["themes"])
            if '.qss' in a
        ]
        self.themeBox = QtWidgets.QComboBox()
        self.themeBox.addItems(themes)
        self.themeBox.currentIndexChanged['QString'].connect(self.setTheme)
        self.themeAction.setDefaultWidget(self.themeBox)
        menu.addAction(self.themeAction)

        self.pushbutton.setMenu(menu)

        self.userApplication = QtWidgets.QCheckBox("User App")
        self.userApplication.toggled['bool'].connect(self.jumpToApplication)
        self.statusBar.addPermanentWidget(self.userApplication)

        self.hexUploadButton = QtWidgets.QPushButton("Upload Hex")
        self.hexUploadButton.clicked.connect(self.uploadHex)
        self.statusBar.addPermanentWidget(self.hexUploadButton)

        self.speedbutton = QtWidgets.QComboBox()
        self.speedbutton.addItems(['Slow', 'Fast', 'Ultra'])
        self.speedbutton.setCurrentIndex(1)
        self.speedbutton.currentIndexChanged['int'].connect(self.setSpeed)
        self.statusBar.addPermanentWidget(self.speedbutton)

        self.statusBar.addPermanentWidget(self.pushbutton)
    def I2CScan(self):
        if self.p.connected:
            x = self.p.I2CScan()
            print('Responses from: ', x)
            for a in self.sensorList:
                a[0].setParent(None)
                a[1].setParent(None)
            self.sensorList = []
            for a in self.controllerList:
                a[0].setParent(None)
                a[1].setParent(None)
            self.controllerList = []
            for a in x:
                s = self.p.sensors.get(a, None)
                if s is not None:
                    btn = QtWidgets.QPushButton(s['name'] + ':' + hex(a))
                    dialog = dio.DIOSENSOR(self, s)
                    btn.clicked.connect(dialog.launch)
                    self.sensorLayout.addWidget(btn)
                    self.sensorList.append([dialog, btn])
                    continue

                s = self.p.controllers.get(a, None)
                if s is not None:
                    btn = QtWidgets.QPushButton(s['name'] + ':' + hex(a))
                    dialog = dio.DIOCONTROL(self, s)
                    btn.clicked.connect(dialog.launch)
                    self.sensorLayout.addWidget(btn)
                    self.controllerList.append([dialog, btn])
                    continue

                s = self.p.special.get(a, None)
                if s is not None:
                    btn = QtWidgets.QPushButton(s['name'] + ':' + hex(a))
                    dialog = dio.DIOROBOT(self, s)
                    btn.clicked.connect(dialog.launch)
                    self.sensorLayout.addWidget(btn)
                    self.controllerList.append([dialog, btn])
                    continue
Exemple #4
0
	def makeBottomMenu(self):
		try:self.pushbutton.setParent(None)
		except:pass
		self.pushbutton = QtWidgets.QPushButton('Menu')
		menu = QtWidgets.QMenu()
		menu.addAction(self.controlDock.toggleViewAction())
		menu.addAction(self.historyWindow.toggleViewAction())
		menu.addAction('Set Square Wave', self.sqr1)
		if self.version_number>=2.0:
			menu.addAction('Set Threshold', self.set_threshold)
		
		menu.addSeparator()

		self.plotColorAction = QtWidgets.QAction('Light Theme', menu, checkable=True)
		self.plotColorAction.triggered.connect(self.setPlotColor)
		menu.addAction(self.plotColorAction)
		

		self.removeCalBox = QtWidgets.QAction('File Load: Remove Calibration', menu, checkable=True)
		self.removeCalBox.triggered.connect(menu.show)
		menu.addAction(self.removeCalBox)

		#self.pileUpAction = QtWidgets.QAction('PileUp Reject', menu, checkable=True)
		#self.pileUpAction.triggered.connect(self.pileUpRejection)
		#self.pileUpAction.triggered.connect(menu.show)
		#menu.addAction(self.pileUpAction)

		self.coincidencegate = QtWidgets.QAction('External Gate', menu, checkable=True)
		self.coincidencegate.triggered.connect(self.externalGate)
		self.coincidencegate.triggered.connect(menu.show)
		menu.addAction(self.coincidencegate)


		menu.addAction('Set Window Opacity', self.setOpacity)
		menu.addAction('Save Window as Svg', self.exportSvg)

		#Theme
		self.themeAction = QtWidgets.QWidgetAction(menu)
		themes = [a.split('.qss')[0] for a in os.listdir(path["themes"]) if '.qss' in a]
		self.themeBox = QtWidgets.QComboBox(); self.themeBox.addItems(themes)
		self.themeBox.currentIndexChanged['QString'].connect(self.setTheme)
		self.themeAction.setDefaultWidget(self.themeBox)
		menu.addAction(self.themeAction)

		#Alpha Markers
		self.markerAction = QtWidgets.QWidgetAction(menu)
		self.markerBox = QtWidgets.QComboBox(); self.markerBox.addItems(['Add Alpha Energy Guides']+list(constants.ALPHAS.keys()))
		self.markerBox.currentIndexChanged['QString'].connect(self.showAlphaMarkers)
		self.markerAction.setDefaultWidget(self.markerBox)
		menu.addAction(self.markerAction)
		
		#Gamma Markers
		self.markerActionG = QtWidgets.QWidgetAction(menu)
		self.markerBoxG = QtWidgets.QComboBox(); self.markerBoxG.addItems(['Add Gamma Energy Guides']+list(constants.GAMMAS.keys()))
		self.markerBoxG.currentIndexChanged['QString'].connect(self.showGammaMarkers)
		self.markerActionG.setDefaultWidget(self.markerBoxG)
		menu.addAction(self.markerActionG)


		#Graph Colour
		self.traceRow = traceRowWidget(self.curve)

		self.colAction = QtWidgets.QWidgetAction(menu)
		self.colAction.setDefaultWidget(self.traceRow)
		menu.addAction(self.colAction)
		
		#TRACE2
		self.traceRow2 = traceRowWidget(self.curve2)
		self.colAction2 = QtWidgets.QWidgetAction(menu)
		self.colAction2.setDefaultWidget(self.traceRow2)
		menu.addAction(self.colAction2)

		# Quit
		menu.addAction('Exit', self.askBeforeQuit)

		self.pushbutton.setMenu(menu)
		self.extraLayout.addWidget(self.pushbutton)
		#self.statusBar.addPermanentWidget(self.pushbutton)
		self.deviceSelector = self.portSelectionDialog()