def btn_event(self): if (self.btn_flag == 0): self.btn_flag = 1 self.startBtn.setIcon(QtGui.QIcon('stop.png')) self.startBtn.setIconSize(QtCore.QSize(100, 100)) self.__threads = [] # create a recorder object record = Recorder() record_thread = QThread() record_thread.setObjectName('record thread') self.__threads.append( (record_thread, record)) # need to store worker too otherwise will be gc'd record.moveToThread(record_thread) # get progress messages from worker: record.sig_step.connect(self.on_recorder_worker_step) # control worker: self.sig_recorder_abort_workers.connect(record.abort) # get read to start worker:record record_thread.started.connect(record.work) record_thread.start( ) # this will emit 'started' and start thread's event loop else: self.btn_flag = 0 self.startBtn.setIcon(QtGui.QIcon('record.png')) self.startBtn.setIconSize(QtCore.QSize(100, 100)) self.sig_recorder_abort_workers.emit() print('Asking each worker to abort') for record_thread, record in self.__threads: # note nice unpacking by Python, avoids indexing record_thread.quit( ) # this will quit **as soon as thread event loop unblocks** record_thread.wait( ) # <- so you need to wait for it to *actually* quit self.startBtn.setDisabled(True) self.statusLabel.show() inference = Inference() inference_thread = QThread() inference_thread.setObjectName('Inference Thread') self.__threads.append( (inference_thread, inference)) # need to store worker too otherwise will be gc'd inference.moveToThread(inference_thread) inference.sig_result.connect(self.on_inference_worker_end) self.sig_inference_abort_workers.connect(inference.abort) inference_thread.started.connect(inference.work) inference_thread.start( ) # this will emit 'started' and start thread's event loop
def __init__(self): about.label_version.setText(f"Version {__version__}") self.total_size = 0 self.is_link_menu = False self.main_title = 'Select the default Windows 10 apps to uninstall:\n(Hover over app names to view description)' self.store_title = 'Click on an app name to view it in Microsoft Store.' self.refresh_title = 'Refreshing list of installed apps...' self.size_text = 'MB' self.github_dialog = 'Visit the PyDebloatX GitHub page?' self.quit_dialog = 'Quit PyDebloatX?' self.dialog_yes = 'Yes' self.dialog_no = 'No' self.dialog_ok = 'OK' self.uninstall_text = 'Uninstall' self.uninstalling_text = 'Uninstalling' self.left_text = 'left' self.success_text = 'All selected apps were successfully uninstalled.' self.app_singular = 'app' self.app_genitive_singular = 'apps' self.app_genitive_plural = 'apps' self.size_available_text = 'MB of of disk space will be available.' self.main_widgets = (ui.refresh_btn, ui.refresh_bind, ui.store_btn, ui.store_bind, ui.button_select_all, ui.button_deselect_all, ui.button_uninstall) self.apps_dict = { ui.checkBox: {"name": "*Microsoft.3DBuilder*", "link": "/?PFN=Microsoft.3DBuilder_8wekyb3d8bbwe", "size": 35.02}, ui.checkBox_2: {"name": "*Microsoft.Microsoft3DViewer*", "link": "/?PFN=Microsoft.Microsoft3DViewer_8wekyb3d8bbwe", "size": 121.46}, ui.checkBox_3: {"name": "*Microsoft.WindowsAlarms*", "link": "/?PFN=Microsoft.WindowsAlarms_8wekyb3d8bbwe", "size": 11.87}, ui.checkBox_4: {"name": "*Microsoft.WindowsCalculator*", "link": "/?PFN=Microsoft.WindowsCalculator_8wekyb3d8bbwe", "size": 14.27}, ui.checkBox_5: {"name": "*microsoft.windowscommunicationsapps*", "link": "/?PFN=Microsoft.windowscommunicationsapps_8wekyb3d8bbwe", "size": 245.78}, ui.checkBox_6: {"name": "*Microsoft.WindowsCamera*", "link": "/?PFN=Microsoft.WindowsCamera_8wekyb3d8bbwe", "size": 49.05}, ui.checkBox_7: {"name": "*Microsoft.GetHelp*", "link": "/?PFN=Microsoft.Gethelp_8wekyb3d8bbwe", "size": 11.89}, ui.checkBox_8: {"name": "*Microsoft.ZuneMusic*", "link": "/?PFN=Microsoft.ZuneMusic_8wekyb3d8bbwe", "size": 50.34}, ui.checkBox_9: {"name": "*Microsoft.WindowsMaps*", "link": "/?PFN=Microsoft.WindowsMaps_8wekyb3d8bbwe", "size": 39.80}, ui.checkBox_10: {"name": "*Microsoft.Messaging*", "link": "/?PFN=Microsoft.Messaging_8wekyb3d8bbwe", "size": 30.08}, ui.checkBox_11: {"name": "*Microsoft.MixedReality.Portal*", "link": "?productId=9NG1H8B3ZC7M", "size": 18.23}, ui.checkBox_12: {"name": "*Microsoft.OneConnect*", "link": "?productId=9NBLGGH5PNB1", "size": 11.77}, ui.checkBox_13: {"name": "*Microsoft.BingFinance*", "link": "?productId=9WZDNCRFHV4V", "size": 32.82}, ui.checkBox_14: {"name": "*Microsoft.ZuneVideo*", "link": "/?PFN=Microsoft.ZuneVideo_8wekyb3d8bbwe", "size": 51.80}, ui.checkBox_15: {"name": "*Microsoft.BingNews*", "link": "?productId=9WZDNCRFHVFW", "size": 35.29}, ui.checkBox_16: {"name": "*Microsoft.MicrosoftOfficeHub*", "link": "/?PFN=Microsoft.MicrosoftOfficeHub_8wekyb3d8bbwe", "size": 30.21}, ui.checkBox_17: {"name": "*Microsoft.Office.OneNote*", "link": "/?PFN=Microsoft.Office.OneNote_8wekyb3d8bbwe", "size": 156.01}, ui.checkBox_18: {"name": "*Microsoft.MSPaint*", "link": "/?PFN=Microsoft.MSPaint_8wekyb3d8bbwe", "size": 65.79}, ui.checkBox_19: {"name": "*Microsoft.People*", "link": "/?PFN=Microsoft.People_8wekyb3d8bbwe", "size": 31.97}, ui.checkBox_20: {"name": "*Microsoft.Windows.Photos*", "link": "/?PFN=Microsoft.Windows.Photos_8wekyb3d8bbwe", "size": 346.04}, ui.checkBox_21: {"name": "*Microsoft.SkypeApp*", "link": "/?PFN=Microsoft.SkypeApp_kzf8qxf38zg5c", "size": 237.25}, ui.checkBox_22: {"name": "*Microsoft.MicrosoftSolitaireCollection*", "link": "/?PFN=Microsoft.MicrosoftSolitaireCollection_8wekyb3d8bbwe", "size": 134.37}, ui.checkBox_23: {"name": "*Microsoft.BingSports*", "link": "?productId=9WZDNCRFHVH4", "size": 30.92}, ui.checkBox_24: {"name": "*Microsoft.MicrosoftStickyNotes*", "link": "?productId=9NBLGGH4QGHW", "size": 39.82}, ui.checkBox_25: {"name": "*Microsoft.Getstarted*", "link": "/?PFN=Microsoft.Getstarted_8wekyb3d8bbwe", "size": 19.53}, ui.checkBox_26: {"name": "*Microsoft.WindowsSoundRecorder*", "link": "/?PFN=Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe", "size": 12.40}, ui.checkBox_27: {"name": "*Microsoft.BingWeather*", "link": "/?PFN=Microsoft.BingWeather_8wekyb3d8bbwe", "size": 32.32}, ui.checkBox_28: {"name": "*Microsoft.WindowsFeedbackHub*", "link": "/?PFN=Microsoft.WindowsFeedbackHub_8wekyb3d8bbwe", "size": 35.02}, ui.checkBox_29: {"name": "*xbox* | Where-Object {$_.name -notmatch 'xboxgamecallableui'}", "link": "/?PFN=Microsoft.XboxApp_8wekyb3d8bbwe", "size": 55.91}, ui.checkBox_30: {"name": "*Microsoft.YourPhone*", "link": "/?PFN=Microsoft.YourPhone_8wekyb3d8bbwe", "size": 280.27} } ui.progressbar.setValue(0) ui.progressbar.setMaximum(len(self.apps_dict)) ui.progressbar.setFont(ui.font) ui.button_uninstall.clicked.connect(self.uninstall) ui.button_select_all.clicked.connect(self.select_all) ui.button_deselect_all.clicked.connect(self.deselect_all) ui.refresh_btn.clicked.connect(self.app_refresh) ui.refresh_bind.activated.connect(self.app_refresh) ui.store_btn.clicked.connect(self.store_menu) ui.store_bind.activated.connect(self.store_menu) ui.homepage_btn.clicked.connect(self.app_homepage) ui.homepage_bind.activated.connect(self.app_homepage) ui.about_btn.clicked.connect(self.app_about) ui.about_bind.activated.connect(self.app_about) ui.quit_btn.clicked.connect(self.app_quit) ui.quit_bind.activated.connect(self.app_quit) about.button_quit_about.clicked.connect(about.close) for i in self.apps_dict: i.setFont(ui.font) i.clicked.connect(self.enable_buttons) with open("style.css", 'r') as file: i.setStyleSheet(file.read()) self.workerThread = QThread() self.thread_list = [] for item, i in enumerate(self.apps_dict): self.thread_list.append(CheckApps(self.apps_dict, i)) self.thread_list[item].moveToThread(self.workerThread) self.thread_list[item].app_signal.connect(self.enable_installed) self.thread_list[item].progress_signal.connect(self.update_progress) self.app_refresh()
def __init__(self): super().__init__() # icon = "icons/pain.png" self.filePath = "" self.tVal = 10 self.difficulty = 0 self.problemArr = [] self.resultsUUID = 0 self.setWindowTitle("Whiteboard Application") self.setWindowIcon(QIcon('UI/Images/Sun.png')) ui = uic.loadUi("UI/MainWindow.ui", self) # All findChild should go here # QPushButton self.whiteboardMainButton = self.findChild(QtWidgets.QPushButton, 'whiteboardMainButton') self.mathgameMainButton = self.findChild(QtWidgets.QPushButton, 'mathgameMainButton') self.backButton = self.findChild(QtWidgets.QPushButton, 'backButton') self.clearButton = self.findChild(QtWidgets.QPushButton, 'clearButton') self.clearAnswer = self.findChild(QtWidgets.QPushButton, 'clearAnswer') self.startButton = self.findChild(QtWidgets.QPushButton, 'startButton') self.nextButton = self.findChild(QtWidgets.QPushButton, 'nextButton') # StackedWidget self.mainStackedWidget = self.findChild(QtWidgets.QStackedWidget, 'mainStackedWidget') # Whiteboard self.mainWhiteboard = self.findChild(Whiteboard, 'mainWhiteboard') self.scratchPaperWhiteboard = self.findChild(Whiteboard, 'scratchPaperWhiteboard') self.answerBoxWhiteboard = self.findChild(Whiteboard, 'answerBoxWhiteboard') # QAction self.newWhiteboard = self.findChild(QtWidgets.QAction, 'actionWhiteboard') self.saveWhiteboard = self.findChild(QtWidgets.QAction, 'actionSave') self.saveAsWhiteboard = self.findChild(QtWidgets.QAction, 'actionSave_As') self.closeWhiteboard = self.findChild(QtWidgets.QAction, 'actionClose') self.openWhiteboard = self.findChild(QtWidgets.QAction, 'actionOpen') self.exportWhiteboard = self.findChild( QtWidgets.QAction, 'actionExport_Whiteboard_as_png') # QComboBox self.operatorComboBox = self.findChild(QtWidgets.QComboBox, 'operatorComboBox') self.difficultyComboBox = self.findChild(QtWidgets.QComboBox, 'difficultyComboBox') self.timeComboBox = self.findChild(QtWidgets.QComboBox, 'timeComboBox') # QLabel self.operatorText = self.findChild(QtWidgets.QLabel, 'operatorText') self.scoreResults = self.findChild(QtWidgets.QLabel, 'scoreResults') self.questionResults = self.findChild(QtWidgets.QLabel, 'questionResults') self.promptLabel = self.findChild(QtWidgets.QLabel, 'promptLabel') # QGroupBox self.timeUpBox = self.findChild(QtWidgets.QGroupBox, 'timeUpBox') # QDialogButtonBox self.timeUpOk = self.findChild(QtWidgets.QDialogButtonBox, 'timeUpOk') # End findChild self.mainWhiteboard.initalize() self.mainWhiteboard.setMouseTracking(True) self.mainWhiteboard.setFocusPolicy(Qt.StrongFocus) self.scratchPaperWhiteboard.initalize(761, 781) self.scratchPaperWhiteboard.setMouseTracking(True) self.scratchPaperWhiteboard.setFocusPolicy(Qt.StrongFocus) self.answerBoxWhiteboard.initalize(461, 421) self.answerBoxWhiteboard.setMouseTracking(True) self.answerBoxWhiteboard.setFocusPolicy(Qt.StrongFocus) if (type(self.mainStackedWidget) == "NoneType"): print("none") # home Screen actions self.whiteboardMainButton.clicked.connect( lambda: self.setNewWhiteboard()) self.mathgameMainButton.clicked.connect(lambda: self.setNewMathgame()) # back and clear actions whiteboard and math game self.backButton.clicked.connect( lambda: self.mainStackedWidget.setCurrentIndex(0)) self.backButton_3.clicked.connect( lambda: self.mainStackedWidget.setCurrentIndex(0)) self.clearButton.clicked.connect(lambda: self.clear()) self.clearButton_3.clicked.connect(lambda: self.clear()) self.clearAnswer.clicked.connect(lambda: self.clearAnswerBoard()) # actions for file new, open, save, save as, close self.newWhiteboard.triggered.connect(lambda: self.setNewWhiteboard()) self.openWhiteboard.triggered.connect( lambda: self.openExistingWhiteboard()) self.saveWhiteboard.triggered.connect(lambda: self.save()) self.saveAsWhiteboard.triggered.connect(lambda: self.saveAs()) self.closeWhiteboard.triggered.connect( lambda: self.setCloseWhiteboard()) self.exportWhiteboard.triggered.connect(lambda: self.export()) # actions for selecting pen Color self.blueButton.clicked.connect( lambda: self.mainWhiteboard.blueColor()) self.redButton.clicked.connect(lambda: self.mainWhiteboard.redColor()) self.greenButton.clicked.connect( lambda: self.mainWhiteboard.greenColor()) self.blackButton.clicked.connect( lambda: self.mainWhiteboard.blackColor()) self.purpleButton.clicked.connect( lambda: self.mainWhiteboard.purpleColor()) self.grayButton.clicked.connect( lambda: self.mainWhiteboard.grayColor()) # actions for Math game comboxes and timer self.operatorComboBox.currentIndexChanged.connect( lambda i: self.setOperator(i)) self.difficultyComboBox.currentIndexChanged.connect( lambda d: self.setDifficulty(d)) self.timeComboBox.currentIndexChanged.connect( lambda t: self.setTime(t)) self.startButton.clicked.connect(lambda: self.startMathGame()) self.nextButton.clicked.connect(lambda: self.nextProblem()) self.timeUpOk.clicked.connect(lambda: self.timeUpBox.setVisible(False)) self.nextButton.setEnabled(False) # next button self.timeUpBox.setVisible(False) # popup box self.mlthread = QThread() self.processor = MachineLearningProcessor() self.processor.moveToThread(self.mlthread) self.processor.dataReady.connect( lambda response: self.finishProcessing(response)) self.processor.finished.connect(self.mlthread.quit) self.mlthread.started.connect( lambda imgs=os.listdir('Machine_Learning/imgs'), answers=self. problemArr: self.processor.processImgs(imgs, answers))
def setupUi(self): self.load_ui("apol/commonquery.ui") # populate commons list self.common_model = SEToolsListModel(self) self.common_model.item_list = sorted(c for c in self.policy.commons()) self.commons.setModel(self.common_model) # populate perm list self.perms_model = SEToolsListModel(self) perms = set() for com in self.policy.commons(): perms.update(com.perms) self.perms_model.item_list = sorted(perms) self.perms.setModel(self.perms_model) # set up results self.table_results_model = CommonTableModel(self) self.sort_proxy = QSortFilterProxyModel(self) self.sort_proxy.setSourceModel(self.table_results_model) self.table_results.setModel(self.sort_proxy) self.table_results.sortByColumn(0, Qt.AscendingOrder) # setup indications of errors self.errors = set() self.orig_palette = self.name.palette() self.error_palette = self.name.palette() self.error_palette.setColor(QPalette.Base, Qt.red) self.clear_name_error() # set up processing thread self.thread = QThread() self.worker = QueryResultsUpdater(self.query, self.table_results_model) self.worker.moveToThread(self.thread) self.worker.raw_line.connect(self.raw_results.appendPlainText) self.worker.finished.connect(self.update_complete) self.worker.finished.connect(self.thread.quit) self.thread.started.connect(self.worker.update) # create a "busy, please wait" dialog self.busy = QProgressDialog(self) self.busy.setModal(True) self.busy.setRange(0, 0) self.busy.setMinimumDuration(0) self.busy.canceled.connect(self.thread.requestInterruption) self.busy.reset() # update busy dialog from query INFO logs self.handler = LogHandlerToSignal() self.handler.message.connect(self.busy.setLabelText) logging.getLogger("setools.commonquery").addHandler(self.handler) # Ensure settings are consistent with the initial .ui state self.set_name_regex(self.name_regex.isChecked()) self.notes.setHidden(not self.notes_expander.isChecked()) # connect signals self.commons.doubleClicked.connect(self.get_detail) self.commons.get_detail.triggered.connect(self.get_detail) self.name.textEdited.connect(self.clear_name_error) self.name.editingFinished.connect(self.set_name) self.name_regex.toggled.connect(self.set_name_regex) self.perms.selectionModel().selectionChanged.connect(self.set_perms) self.invert_perms.clicked.connect(self.invert_perms_selection) self.buttonBox.clicked.connect(self.run)
def play(self): if self.url is None: return capture = cv2.VideoCapture(self.url) if not capture.isOpened(): QMessageBox.critical(self, "Open File Error", "Failed to open file") return self.stop() table = self.ui.infoTable table.item(VideoInfoRow.File, 1).setText(self.url) table.item(VideoInfoRow.Width, 1).setText( str(round(capture.get(cv2.CAP_PROP_FRAME_WIDTH)))) table.item(VideoInfoRow.Height, 1).setText( str(round(capture.get(cv2.CAP_PROP_FRAME_HEIGHT)))) fps = capture.get(cv2.CAP_PROP_FPS) table.item(VideoInfoRow.FrameRate, 1).setText(str(round(fps, 2))) self.total_frames = round(capture.get(cv2.CAP_PROP_FRAME_COUNT)) table.item(VideoInfoRow.TotalFrame, 1).setText(str(self.total_frames)) if self.total_frames > 0: self.ui.playSlider.setMaximum(self.total_frames - 1) self.ui.playSlider.setEnabled(True) total_time = self.total_frames / fps self.total_time_text = '%02d:%02d' % (total_time // 60, total_time % 60) else: self.total_frames = 0 self.ui.playSlider.setMaximum(0) self.ui.playSlider.setEnabled(False) self.total_time_text = '∞' self.frames = set() self.items = [] self.instances = OrderedDict() self.faces = OrderedDict() self.blacklist = OrderedDict([(k, (set(), set())) for k in self.blacklist]) self.ui.pedestrianTable.blockSignals(True) self.ui.instanceTable.blockSignals(True) self.ui.faceTable.blockSignals(True) self.ui.blacklistTable.blockSignals(True) self.ui.pedestrianTable.setRowCount(0) self.ui.instanceTable.setRowCount(0) self.ui.faceTable.setRowCount(0) for i in range(self.ui.blacklistTable.rowCount()): self.ui.blacklistTable.item(i, 3).setText('') self.ui.pedestrianTable.blockSignals(False) self.ui.instanceTable.blockSignals(False) self.ui.faceTable.blockSignals(False) self.ui.blacklistTable.blockSignals(False) self.player_thread = QThread() self.player = VideoPlayer(capture, self.instance_file, self.reid_model, self.face_detect_model, self.face_recognize_model, self.attribute_model, self.blacklist_object) self.player.moveToThread(self.player_thread) self.player.frameReady.connect(self.on_frame_ready) self.player.finished.connect(self.on_player_finished) self.player.resultsReset.connect(self.reset_results) self.player_thread.started.connect(self.player.thread) self.player_thread.start() self.player.set_detector_enabled(self.ui.detector.isChecked()) if self.instance_file and os.path.exists(self.instance_file): self.player.load_instance_file() self.finished = False self.pause_or_resume()
def __init__(self, project_data): self.project_data = project_data super(ProjectManager, self).__init__() self.curve_thread = QThread()
def setupUi(self): self.load_ui("netifconquery.ui") # set up user autocompletion user_completion_list = [str(u) for u in self.policy.users()] user_completer_model = QStringListModel(self) user_completer_model.setStringList(sorted(user_completion_list)) self.user_completion = QCompleter() self.user_completion.setModel(user_completer_model) self.user.setCompleter(self.user_completion) # set up role autocompletion role_completion_list = [str(r) for r in self.policy.roles()] role_completer_model = QStringListModel(self) role_completer_model.setStringList(sorted(role_completion_list)) self.role_completion = QCompleter() self.role_completion.setModel(role_completer_model) self.role.setCompleter(self.role_completion) # set up type autocompletion type_completion_list = [str(t) for t in self.policy.types()] type_completer_model = QStringListModel(self) type_completer_model.setStringList(sorted(type_completion_list)) self.type_completion = QCompleter() self.type_completion.setModel(type_completer_model) self.type_.setCompleter(self.type_completion) # setup indications of errors on source/target/default self.errors = set() self.orig_palette = self.type_.palette() self.error_palette = self.type_.palette() self.error_palette.setColor(QPalette.Base, Qt.red) self.clear_name_error() self.clear_user_error() self.clear_type_error() self.clear_role_error() self.clear_range_error() # set up results self.table_results_model = NetifconTableModel(self) self.sort_proxy = QSortFilterProxyModel(self) self.sort_proxy.setSourceModel(self.table_results_model) self.table_results.setModel(self.sort_proxy) self.table_results.sortByColumn(0, Qt.AscendingOrder) # set up processing thread self.thread = QThread() self.worker = QueryResultsUpdater(self.query, self.table_results_model) self.worker.moveToThread(self.thread) self.worker.raw_line.connect(self.raw_results.appendPlainText) self.worker.finished.connect(self.update_complete) self.worker.finished.connect(self.thread.quit) self.thread.started.connect(self.worker.update) # create a "busy, please wait" dialog self.busy = QProgressDialog(self) self.busy.setModal(True) self.busy.setRange(0, 0) self.busy.setMinimumDuration(0) self.busy.canceled.connect(self.thread.requestInterruption) self.busy.reset() # update busy dialog from query INFO logs self.handler = LogHandlerToSignal() self.handler.message.connect(self.busy.setLabelText) logging.getLogger("setools.netifconquery").addHandler(self.handler) # Ensure settings are consistent with the initial .ui state self.set_name_regex(self.name_regex.isChecked()) self.criteria_frame.setHidden(not self.criteria_expander.isChecked()) self.notes.setHidden(not self.notes_expander.isChecked()) # Range criteria is available only if policy is MLS if not self.policy.mls: self.range_criteria.setEnabled(False) self.range_criteria.setToolTip("MLS is disabled in this policy.") self.range_.setToolTip("MLS is disabled in this policy.") self.range_exact.setToolTip("MLS is disabled in this policy.") self.range_overlap.setToolTip("MLS is disabled in this policy.") self.range_subset.setToolTip("MLS is disabled in this policy.") self.range_superset.setToolTip("MLS is disabled in this policy.") # connect signals self.buttonBox.clicked.connect(self.run) self.name.textEdited.connect(self.clear_name_error) self.name.editingFinished.connect(self.set_name) self.name_regex.toggled.connect(self.set_name_regex) self.user.textEdited.connect(self.clear_user_error) self.user.editingFinished.connect(self.set_user) self.user_regex.toggled.connect(self.set_user_regex) self.role.textEdited.connect(self.clear_role_error) self.role.editingFinished.connect(self.set_role) self.role_regex.toggled.connect(self.set_role_regex) self.type_.textEdited.connect(self.clear_type_error) self.type_.editingFinished.connect(self.set_type) self.type_regex.toggled.connect(self.set_type_regex) self.range_.textEdited.connect(self.clear_range_error) self.range_.editingFinished.connect(self.set_range)
def __init__(self, parent: QWidget = None, roiManager: ROIManager = None): self._parent = parent self._roiManager = roiManager self._processingThread = QThread(self._parent)
def getPaths(self): """ :return: """ # build dictionaries for long plot creation # long plot code ported straight from QGIS 2 plugin # I figured it all out once - too hard to do it all again! dsLines = { } # {name: [[dns network channels], [us invert, ds invert], [angle], [dns-dns connected channels], [upsnetworks}, [ups-ups channels]] lineDrape = { } # dict {name: [[QgsPoint - line vertices], [vertex chainage], [elevations]]} lineDict = {} startLines = [] inLyrs = [] areaFlags = self.flowTraceTool.flaggedAreaIds[:] angleFlags = self.flowTraceTool.flaggedAngleIds[:] invertFlags = self.flowTraceTool.flaggedInvertIds[:] gradientFlags = self.flowTraceTool.flaggedGradientIds[:] for id in self.flowTraceTool.dataCollector.ids: fData = self.flowTraceTool.dataCollector.features[id] dData = self.flowTraceTool.dataCollector.drapes[id] cData = self.flowTraceTool.dataCollector.connections[id] properties = [] linesDs = [] for line in cData.linesDs: if line in self.flowTraceTool.dataCollector.ids: linesDs.append(line) properties.append(linesDs) properties.append([fData.invertUs, fData.invertDs]) properties.append([180]) # refine later properties.append(cData.linesDsDs) properties.append(cData.linesUs) properties.append(cData.linesUsUs) drape = [] drape.append(dData.points) drape.append(dData.chainages) drape.append(dData.elevations) line = [] line.append([fData.startVertex, fData.endVertex]) line.append(fData.fid) line.append(fData.layer) line.append(fData.invertUs) line.append(fData.invertDs) line.append(fData.type) line.append(fData.feature) dsLines[id] = properties lineDrape[id] = drape lineDict[id] = line if not cData.linesUs: startLines.append(id) if fData.layer not in inLyrs: inLyrs.append(fData.layer) self.downstreamConnectivity = DownstreamConnectivity( dsLines, startLines, inLyrs, self.flowTraceTool.limitAngle, lineDrape, self.flowTraceTool.limitCover, lineDict, QgsUnitTypes.DistanceMeters, areaFlags, angleFlags, invertFlags, gradientFlags) self.thread = QThread() self.downstreamConnectivity.moveToThread(self.thread) self.thread.started.connect(self.downstreamConnectivity.getBranches) self.downstreamConnectivity.branchesCollected.connect( self.downstreamConnectivity.getPlotFormat) self.downstreamConnectivity.pathsCollected.connect(self.pathsCollected) self.timer = QTimer() self.timer.setInterval(750) self.timer.timeout.connect(self.updated.emit) self.timer2 = QTimer() self.timer2.setInterval(120000) self.timer2.setSingleShot(True) self.timer2.timeout.connect(self.updateMessage.emit) self.timer.start() self.timer2.start() self.thread.start()
def __init__(self, parent=None): super(emailWidget,self).__init__(parent) print("[INFO - EMAIL_WIDGET ] : EMAIL WIDGET INITIALIZATION CALLED") self.finished_status = False grid = QGridLayout() self.emailBox=QGroupBox("EMAIL SECTION") self.title = QLabel("LOADING") self.mainContent = QLabel("LOADING") self.opt_1 = QLabel("SMILE FOR 5 SEC TO OPEN EMAILS") self.opt_2 = QLabel("CLOSE BOTH EYES FOR 5 SEC TO BACK") self.opt_debug = QLabel("STATUS : LOADING") self.opt_debug.setWordWrap(True) self.title.setStyleSheet("color: white") self.title.setAlignment(Qt.AlignCenter) self.mainContent.setStyleSheet("color: white ; font: bold 20px") self.mainContent.setAlignment(Qt.AlignCenter) self.opt_1.setStyleSheet("color: white ;font: bold 12px") self.opt_1.setAlignment(Qt.AlignLeft) self.opt_2.setStyleSheet("color: white ;font: bold 12px") self.opt_2.setAlignment(Qt.AlignLeft) self.opt_debug.setStyleSheet("color: white ;font: bold 12px") self.opt_debug.setAlignment(Qt.AlignLeft) self.verticalLayout = QVBoxLayout() self.verticalLayout_Option = QVBoxLayout() self.combiner = QVBoxLayout() self.verticalLayout.addWidget(self.title) self.verticalLayout.addWidget(self.mainContent) self.verticalLayout_Option.addWidget(self.opt_debug) self.verticalLayout_Option.addWidget(self.opt_1) self.verticalLayout_Option.addWidget(self.opt_2) self.verticalLayout.addStretch(1) self.verticalLayout_Option.addStretch(1) self.combiner.addLayout(self.verticalLayout) self.combiner.addLayout(self.verticalLayout_Option) self.combiner.addStretch(0) self.emailBox.setLayout(self.combiner) grid.addWidget(self.emailBox,1,1) self.emailWorker = EMAIL_BACKEND() self.emailthread = QThread() self.emailWorker.signal_Email_Name.connect(self.updateDate) self.emailWorker.signal_Email_Notifications_Num.connect(self.updateNotification) self.emailWorker.emailLoader_finished.connect(self._finished) self.emailWorker.moveToThread(self.emailthread) self.emailthread.started.connect(self.emailWorker.emailExtractor) QApplication.processEvents() self.setLayout(grid) self.setWindowTitle("EMAIL MODULE") self.setAutoFillBackground(True) p = self.palette() p.setColor(self.backgroundRole(), Qt.black) self.setPalette(p) self.resize(600,300)
def __init__(self, *args): # Invoke parent init QTreeView.__init__(self, *args) # Get a reference to the window object self.app = get_app() self.win = args[0] # Get Model data self.blender_model = BlenderModel() # Keep track of mouse press start position to determine when to start drag self.selected = None self.deselected = None # Preview render timer self.preview_timer = QTimer(self) self.preview_timer.setInterval(300) self.preview_timer.timeout.connect(self.preview_timer_onTimeout) # Init dictionary which holds the values to the template parameters self.params = {} # Assign a new unique id for each template selected self.unique_folder_name = None # Disable interface self.disable_interface(cursor=False) self.selected_template = "" # Setup header columns self.setModel(self.blender_model.model) self.setIconSize(QSize(131, 108)) self.setGridSize(QSize(102, 92)) self.setViewMode(QListView.IconMode) self.setResizeMode(QListView.Adjust) self.setUniformItemSizes(False) self.setWordWrap(True) self.setTextElideMode(Qt.ElideRight) self.setStyleSheet('QTreeView::item { padding-top: 2px; }') # Hook up button self.win.btnRefresh.clicked.connect( functools.partial(self.btnRefresh_clicked)) self.win.sliderPreview.valueChanged.connect( functools.partial(self.sliderPreview_valueChanged)) # Refresh view self.refresh_view() # Background Worker Thread (for Blender process) self.background = QThread(self) self.worker = Worker() # no parent! # Hook up signals to Background Worker self.worker.closed.connect(self.onCloseWindow) self.worker.finished.connect(self.onRenderFinish) self.worker.blender_version_error.connect(self.onBlenderVersionError) self.worker.blender_error_nodata.connect(self.onBlenderErrorNoData) self.worker.progress.connect(self.onUpdateProgress) self.worker.image_updated.connect(self.onUpdateImage) self.worker.blender_error_with_data.connect(self.onBlenderErrorMessage) self.worker.enable_interface.connect(self.onRenableInterface) # Move Worker to new thread, and Start self.worker.moveToThread(self.background) self.background.start()
def setup_threads(self): self.asm_thread = QThread() self.sim_thread = QThread() self.vm_thread = QThread()
def _reset_thread(self): if self.thread: self.thread.terminate() self.thread = QThread(self) return self.thread
def __init__(self, log, key): super().__init__('KHOPENAPI.KHOpenAPICtrl.1') WookLog.custom_init(self, log) WookUtil.__init__(self) # Password wc = WookCipher(key) wc.decrypt_data() self.login_id = wc.login_id self.login_password = wc.login_password self.account_password = wc.account_password self.certificate_password = wc.certificate_password # Eventloop self.login_event_loop = QEventLoop() self.event_loop = QEventLoop() self.timer_event_loop = QEventLoop() self.wook_timer = WookTimer(self.timer_event_loop) # Chart self.draw_chart = ChartDrawer() self.chart_prices = list() self.min_timer = QTimer() self.min_timer.setInterval(60000) self.min_timer.timeout.connect(self.on_every_min) # Requesters self.deposit_requester = QThread() self.moveToThread(self.deposit_requester) self.deposit_requester.started.connect(self.request_deposit_info) self.portfolio_requester = QThread() self.moveToThread(self.portfolio_requester) self.portfolio_requester.started.connect(self.request_portfolio_info) self.order_history_requester = QThread() self.moveToThread(self.order_history_requester) self.order_history_requester.started.connect(self.request_order_history) self.request_time = 0 self.request_interval_limit = 0.5 self.order_position = '' # Signals self.log = None self.signal = None self.status = None # Deposit self.account_list = None self.account_number = 0 self.deposit = 0 self.withdrawable_money = 0 self.orderable_money = 0 # Items and Orders self.portfolio = dict() self.monitoring_items = dict() self.balance = dict() self.open_orders = dict() self.order_history = dict() self.algorithm = None # Pending order self.pending_order = None self.cancel_confirmed = False self.cancel_order_number = 0 # Request limit self.inquiry_count = 0 self.previous_time = 0.0 self.reference_time = Queue() self.reference_time_interval_limit = 20 self.consecutive_interval_limit = 0.25 self.request_block_time_limit = 5 self.request_block_size = 10 self.request_count = 0 self.request_count_threshold = 90 self.request_count_interval = 60 self.request_count_waiting = 30 # Fee and Tax self.fee_ratio = 0.0035 self.tax_ratio = 0.0023 # Screen numbers self.screen_account = '0010' self.screen_open_order = '0020' self.screen_operation_state = '0040' self.screen_portfolio = '0060' self.screen_send_order = '0080' self.screen_stock_price = '0120' self.screen_futures_stock_price = '0140' self.screen_test = '9999'
def __init__(self, *args, **kwargs): super(MainWindow, self).__init__(*args, **kwargs) QMainWindow.__init__(self) Ui_MainWindow.__init__(self) self.setupUi(self) self.v = Vars() self.threadpool = QThreadPool() # Thread Management self.thread = QThread() self.serial_thread = SerialThread(data_signal=self.display) self.request_signal.connect(self.serial_thread.run) self.thread.started.connect(self.serial_thread.start) self.serial_thread.moveToThread(self.thread) qApp.aboutToQuit.connect(self.thread.quit) self.thread.start() self.raw_data = [] self.all_runs = np.array([[0, 1, 2, 3, 4, 5, 6, 7, 8]]) self.current_sweep = 1 self.percent_complete = 0 self.total_colors_fixed_frequency_scale = 160000 self.sweep_count = self.sweep_count_spinBox.value() self.total_steps = self.number_of_steps_spinBox_4.value() self.subject_id_lineEdit.setText(f"{data_path['custom']}") self.lineEdit_data_file_name.setText(f"no data file") self.raw_frequency = 0 self.raw_real_unknown = 0 self.raw_imaginary_unknown = 0 self.raw_real_cal = 0 self.raw_imaginary_cal = 0 self.raw_real_cal2 = 0 self.raw_imaginary_cal2 = 0 self.raw_temp = 0 self.raw_status = 0 self.frequency = 0 self.impedance = 0 self.z_real = 0 self.z_imaginary = 0 self.real_cal2 = 0 self.imaginary_cal2 = 0 self.theta = 0 self.gain_factor = 0 self.temperature = 0 self.status = 0 self.start_frequency = self.start_freq_spinBox.value() self.step_size = self.step_size_spinBox.value() self.step_count = self.number_of_steps_spinBox_4.value() self.sweep_range = (self.step_size * self.step_count) - self.step_size self.end_frequency = self.start_frequency + self.sweep_range # temp_graphicsView self.temp_graphicsView.setBackground('w') self.temp_graphicsView.setDownsampling(mode='peak') self.temp_graphicsView.setClipToView(True) self.temp_graphicsView.showGrid(x=True, y=True) # self.temp_graphicsView.hideAxis('bottom') self.temp_graphicsView.setLabel('left', text='Temp (C)') self.temp_graphicsView.setLabel('bottom', text='Frequency (kHz)') # plot1_graphicsView self.plot1_graphicsView.setBackground('w') self.plot1_graphicsView.setDownsampling(mode='peak') self.plot1_graphicsView.setClipToView(True) self.plot1_graphicsView.showGrid(x=True, y=True) self.plot1_graphicsView.setTitle(title="Z impedance") self.plot1_graphicsView.setLabel('left', text='X reactance (ohms)') self.plot1_graphicsView.setLabel('bottom', text='R resistance (ohms)') self.plot2_graphicsView.setBackground('w') self.plot2_graphicsView.setTitle(title="Raw Data") self.plot2_graphicsView.showGrid(x=True, y=True) self.plot2_graphicsView.setLabel('left', text='Value') self.plot2_graphicsView.setLabel('bottom', text='Frequency (Hz)') self.input_plot.setBackground('w') self.input_plot.hideAxis('bottom') self.pw = self.input_plot self.p1 = self.pw.plotItem self.p1.setLabels(left='Excitation (V)') self.p2 = pg.ViewBox() self.p1.showAxis('right') self.p1.scene().addItem(self.p2) self.p1.getAxis('right').linkToView(self.p2) self.p2.setXLink(self.p1) self.p1.getAxis('right').setLabel('Response (I)', color='#ff0000') self.raw_plot.setBackground('w') self.raw_plot.setTitle(title="Impedance") self.raw_plot.showGrid(x=True, y=True) self.raw_plot.setLabel('left', text='Z Magnitude') self.raw_plot.setLabel('bottom', text='Frequency (kHz)') self.raw_plot.addLegend() self.disconnect_pushButton.hide() self.start_QPushButton.clicked.connect(self.start_sweep) self.stop_QPushButton.clicked.connect(self.stop_sweep) self.connect_pushButton.clicked.connect(self.connect) self.disconnect_pushButton.clicked.connect(self.disconnect) self.save_data_button.clicked.connect(self.save_data) self.command_line.returnPressed.connect(self.issue_command) self.measure_1_comboBox_1.setCurrentIndex( int(device_settings['measure_1_comboBox_1'])) self.measure_2_comboBox_1.setCurrentIndex( int(device_settings['measure_2_comboBox_1'])) self.measure_3_comboBox_1.setCurrentIndex( int(device_settings['measure_3_comboBox_1'])) self.gain_resistor_comboBox.setCurrentIndex( int(device_settings['ADG1608_GAIN'])) self.fbr_comboBox.setCurrentIndex(int(device_settings['ADG1608_RFB'])) self.number_of_steps_spinBox_4.setProperty( "value", float(device_settings['number_of_steps'])) self.step_size_spinBox.setProperty("value", int(device_settings['step_size'])) self.settling_time_spinBox.setProperty( "value", int(device_settings['SWEEP_DELAY'])) self.pga_comboBox.setCurrentIndex(int(device_settings['PGA'])) self.output_voltage_comboBox.setCurrentIndex( int(device_settings['VOLTAGE'])) self.cal_resistor_doubleSpinBox.setProperty( "value", float(device_settings['cal_resistor'])) self.cal_resistor_doubleSpinBox_2.setProperty( "value", float(device_settings['cal_resistor2'])) self.start_freq_spinBox.setProperty( "value", int(device_settings['START_FREQUENCY'])) self.serial_port_QLineEdit.setText(str(serial_settings['port_name'])) self.lineEdit_data_file_name.editingFinished.connect(self.file_to_save) self.subject_id_lineEdit.editingFinished.connect( self.file_path_to_save) self.sweep_text() self.start_freq_spinBox.valueChanged['int'].connect(self.sweep_text) self.step_size_spinBox.valueChanged['int'].connect(self.sweep_text) self.number_of_steps_spinBox_4.valueChanged['int'].connect( self.sweep_text) self.settling_time_spinBox.valueChanged['int'].connect(self.sweep_text) self.start_QPushButton.setEnabled(False) self.start_QPushButton.show() self.stop_QPushButton.setEnabled(False) self.stop_QPushButton.hide() self.groupBox_2.setEnabled(False) self.max_frequency = (self.start_freq_spinBox.value() + (self.step_size_spinBox.value() * self.number_of_steps_spinBox_4.value())) self.current_frequency = self.start_freq_spinBox.value() self.current_step = ( (self.start_freq_spinBox.value() - self.start_freq_spinBox.value()) / self.step_size_spinBox.value()) + 1 self.percent_complete = (self.current_step / self.number_of_steps_spinBox_4.value()) * 100 self.progressBar.setValue(int(self.percent_complete)) self.current_color_fixed_frequency_scale = self.start_freq_spinBox.value( ) self.progressBar.setProperty("value", 0) # view self.view = self.plot1_graphicsView self.s3 = pg.ScatterPlotItem() self.view.addItem(self.s3) legend = pg.LegendItem((80, 60), offset=(0, 20)) legend.setParentItem(self.view.graphicsItem()) legend.addItem(self.s3, 'Meas. 1 Calibrated (Gain Factor and Phase)') # view2 self.view2 = self.temp_graphicsView self.s2 = pg.ScatterPlotItem() self.view2.addItem(self.s2) # view3 self.view3 = self.plot2_graphicsView self.sp1 = pg.ScatterPlotItem() self.sp2 = pg.ScatterPlotItem() self.sp3 = pg.ScatterPlotItem() self.sp4 = pg.ScatterPlotItem() self.sp5 = pg.ScatterPlotItem() self.sp6 = pg.ScatterPlotItem() self.view3.addItem(self.sp1) self.view3.addItem(self.sp2) self.view3.addItem(self.sp3) self.view3.addItem(self.sp4) self.view3.addItem(self.sp5) self.view3.addItem(self.sp6) legend = pg.LegendItem((80, 60), offset=(0, 20)) legend.setParentItem(self.view3.graphicsItem()) legend.addItem(self.sp1, 'Meas. 1 R') legend.addItem(self.sp2, 'Meas. 1 X') legend.addItem(self.sp3, 'Meas. 2 R') legend.addItem(self.sp4, 'Meas. 2 X') legend.addItem(self.sp5, 'Meas. 3 R') legend.addItem(self.sp6, 'Meas. 3 X') # view4 self.view4 = self.raw_plot self.init1 = pg.PlotCurveItem() self.init2 = pg.PlotCurveItem() self.init3 = pg.PlotCurveItem() self.view4.addItem(self.init1) self.view4.addItem(self.init2) self.view4.addItem(self.init3) self.init1.setData(size=5, pen=(255, 0, 0)) self.init2.setData(size=5, pen=(0, 255, 0)) self.init3.setData(size=5, pen=(0, 0, 255)) legend = pg.LegendItem((80, 60), offset=(0, 20)) legend.setParentItem(self.view4.graphicsItem()) legend.addItem(self.init1, 'Meas. 1 Unk') legend.addItem(self.init2, 'Meas. 2 Cal1') legend.addItem(self.init3, 'Meas. 3 Cal2') # self.cycles_per_nano_second = ((self.start_freq_spinBox.value()) / 1000) # self.cycles_per_nano_second_radians = self.cycles_per_nano_second * np.pi * 2 # self.linspace_data = np.linspace(0, self.cycles_per_nano_second_radians, 100000) # self.sin_data = np.sin(self.linspace_data) # # response signal # self.cycles_per_nano_second_output = ((self.start_freq_spinBox.value()) / 1000) # self.cycles_per_nano_second_radians_output = self.cycles_per_nano_second_output * np.pi * 2 # self.linspace_data_output = np.linspace(0, self.cycles_per_nano_second_radians_output, 100000) # self.sin_data_output = np.sin(self.linspace_data_output + 0) / 1 print("Multithreading with maximum %d threads" % self.threadpool.maxThreadCount()) # self.pushButton_new.pressed.connect(self.oh_no) self.clear_all_data.clicked.connect(self.clear_plots) self.cole_model_button.clicked.connect(self.regression) self.view_and_view2_thread_timer = QTimer(self) self.view3_thread_timer = QTimer(self) self.view4_thread_timer = QTimer(self) self.view_and_view2_thread_timer.timeout.connect( self.view_and_view2_thread) self.view3_thread_timer.timeout.connect(self.view3_thread) self.view4_thread_timer.timeout.connect(self.view4_thread)
# add_menu_item(BOLD_URL, 'Bold', ui.toolbar, lambda: action_format('b')) # add_menu_item(ITALIC_URL, 'Italic', ui.toolbar, lambda: action_format('i')) # add_menu_item(UNDERLINED_URL, 'Underlined', ui.toolbar, lambda: action_format('u')) user = setLoginPassword() print(user) if len(user['login']) != 0: login = user['login'] print(login) ui.lineEditNickname.setText(login) client = Client(login) client.start_session() contact_list = client.get_contacts() print(contact_list) load_contacts(contact_list) client_avatar = client.get_avatar() print(client_avatar) load_avatar(client_avatar[AVATAR]) listener = GuiReciever(client.sock, client.request_queue) listener.gotData.connect(update_chat) th = QThread() listener.moveToThread(th) th.started.connect(listener.poll) th.start() window.show() sys.exit(app.exec_())
def recv(sock): while True: data = connectionSocket.recv(1024) print("상대방 ", data.decode('utf-8')) host = 'localhost' port = 12345 serverSocket = socket(AF_INET, SOCK_STREAM) serverSocket.bind((host, port)) serverSocket.listen(1) print('대기중입니다.') connectionSocket, addr = serverSocket.accept() print(str(addr), "에서 접속되었습니다.") sender = QThread(threading.Thread(target=send, args=(connectionSocket, ))) receiver = QThread(threading.Thread(target=recv, args=(connectionSocket, ))) sender.start() receiver.start() while True: time.sleep(1) pass serverSocket.close()
def setupUi(self): self.load_ui("userquery.ui") # populate user list self.user_model = SEToolsListModel(self) self.user_model.item_list = sorted(self.policy.users()) self.users.setModel(self.user_model) # populate role list self.role_model = SEToolsListModel(self) self.role_model.item_list = sorted(r for r in self.policy.roles() if r != "object_r") self.roles.setModel(self.role_model) # set up results self.table_results_model = UserTableModel(self, self.policy.mls) self.sort_proxy = QSortFilterProxyModel(self) self.sort_proxy.setSourceModel(self.table_results_model) self.table_results.setModel(self.sort_proxy) self.table_results.sortByColumn(0, Qt.AscendingOrder) # setup indications of errors on level/range self.orig_palette = self.name.palette() self.error_palette = self.name.palette() self.error_palette.setColor(QPalette.Base, Qt.red) self.clear_name_error() if self.policy.mls: self.clear_level_error() self.clear_range_error() else: # disable level and range criteria self.level_criteria.setEnabled(False) self.level_criteria.setToolTip("MLS is disabled in this policy.") self.level.setToolTip("MLS is disabled in this policy.") self.level_exact.setToolTip("MLS is disabled in this policy.") self.level_dom.setToolTip("MLS is disabled in this policy.") self.level_domby.setToolTip("MLS is disabled in this policy.") self.range_criteria.setEnabled(False) self.range_criteria.setToolTip("MLS is disabled in this policy.") self.range_.setToolTip("MLS is disabled in this policy.") self.range_exact.setToolTip("MLS is disabled in this policy.") self.range_overlap.setToolTip("MLS is disabled in this policy.") self.range_subset.setToolTip("MLS is disabled in this policy.") self.range_superset.setToolTip("MLS is disabled in this policy.") # set up processing thread self.thread = QThread() self.worker = QueryResultsUpdater(self.query, self.table_results_model) self.worker.moveToThread(self.thread) self.worker.raw_line.connect(self.raw_results.appendPlainText) self.worker.finished.connect(self.update_complete) self.worker.finished.connect(self.thread.quit) self.thread.started.connect(self.worker.update) # create a "busy, please wait" dialog self.busy = QProgressDialog(self) self.busy.setModal(True) self.busy.setRange(0, 0) self.busy.setMinimumDuration(0) self.busy.canceled.connect(self.thread.requestInterruption) self.busy.reset() # update busy dialog from query INFO logs self.handler = LogHandlerToSignal() self.handler.message.connect(self.busy.setLabelText) logging.getLogger("setools.userquery").addHandler(self.handler) # Ensure settings are consistent with the initial .ui state self.notes.setHidden(not self.notes_expander.isChecked()) # connect signals self.users.doubleClicked.connect(self.get_detail) self.users.get_detail.triggered.connect(self.get_detail) self.name.textEdited.connect(self.clear_name_error) self.name.editingFinished.connect(self.set_name) self.name_regex.toggled.connect(self.set_name_regex) self.roles.selectionModel().selectionChanged.connect(self.set_roles) self.invert_roles.clicked.connect(self.invert_role_selection) self.level.textEdited.connect(self.clear_level_error) self.level.editingFinished.connect(self.set_level) self.range_.textEdited.connect(self.clear_range_error) self.range_.editingFinished.connect(self.set_range) self.buttonBox.clicked.connect(self.run)
def __init__(self, params_obj): super(MainWindow, self).__init__() self.params_cb = params_obj self.th_mouse = ThreadMouse(params_obj) self.sim_thread = QThread() self.th_mouse.moveToThread(self.sim_thread) self.sim_thread.started.connect(self.th_mouse.run) grid = QGridLayout() grid.addWidget( self.createActivation('Stance to lift off', 6, params_obj), 0, 0) grid.addWidget( self.createActivation('Swing to touch down', 3, params_obj), 0, 1) grid.addWidget( self.createActivation('Touch down to stance', 2, params_obj), 1, 0) grid.addWidget( self.createActivation('Lift off to swing', 2, params_obj), 1, 1) grid.addWidget(self.createReflex(params_obj, key='Hip angle liftoff'), 2, 0) grid.addWidget( self.createReflex(params_obj, key='Ankle unloading liftoff'), 2, 1) grid.addWidget( self.createReflex(params_obj, key='Hip angle touchdown'), 3, 0) grid.addWidget( self.createReflex(params_obj, key='Knee angle touchdown'), 3, 1) radio_couple = QRadioButton('Coupling') radio_couple.setAutoExclusive(False) radio_couple.setChecked(params_obj.enable['Coupling']) radio_couple.toggled.connect(lambda: params_obj.set_enable( 'Coupling', radio_couple.isChecked())) grid.addWidget(radio_couple, 4, 0) radio_ank = QRadioButton('Ankle unloading rule') radio_ank.setAutoExclusive(False) radio_ank.setChecked(params_obj.enable['Ankle unloading rule']) radio_ank.toggled.connect(lambda: params_obj.set_enable( 'Ankle unloading rule', radio_ank.isChecked())) grid.addWidget(radio_ank, 4, 1) radio_hip = QRadioButton('Hip extension rule') radio_hip.setAutoExclusive(False) radio_hip.setChecked(params_obj.enable['Hip extension rule']) radio_hip.toggled.connect(lambda: params_obj.set_enable( 'Hip extension rule', radio_hip.isChecked())) grid.addWidget(radio_hip, 5, 0) radio_rev = QRadioButton('Revert simulation') radio_rev.setAutoExclusive(False) radio_rev.setChecked(False) radio_rev.toggled.connect(self.revert) grid.addWidget(radio_rev, 5, 1) self.w = QWidget() self.w.setLayout(grid) self.setCentralWidget(self.w) self.setWindowTitle("Parameter tuning") self.resize(400, 300) self.show() self.sim_thread.start()
def initUI(self): central_widget = QWidget() layout = QGridLayout(central_widget) layout.setSpacing(10) self._thread = None if self._thread == None: self._thread = QThread() self._thread.start() self.vid = ShowVideo() self.vid.moveToThread(self._thread) image_viewer = ImageViewer() self.vid.VideoSignal.connect(image_viewer.setImage) self.sgnStop.connect(self.vid.stopVideo) # Button to start the videocapture: start_button = PicButton(QPixmap(join(images_path + "/play.png")), QPixmap(join(images_path + "/play.png")), QPixmap(join(images_path + "/play.png"))) start_button.clicked.connect(self.vid.startVideo) start_button.setFixedWidth(50) start_button.setFixedHeight(50) # stop_button = QPushButton('Stop') stop_button = PicButton(QPixmap(join(images_path + "/rec.png")), QPixmap(join(images_path + "/rec.png")), QPixmap(join(images_path + "/rec.png"))) stop_button.clicked.connect(self.disable) stop_button.setFixedWidth(45) stop_button.setFixedHeight(45) # void QGridLayout::addWidget(QWidget * widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment = 0) # layout.setContentsMargins(left, top, right, bottom) layout.setContentsMargins(100, 100, 100, 100) image_viewer.setFixedWidth(720) image_viewer.setFixedHeight(290) label = QLabel(self) pixmap = QPixmap(logo_path) pixmap = pixmap.scaled(pixmap.width() / 6, pixmap.height() / 6) label.setPixmap(pixmap) hbox_logo = QHBoxLayout() hbox_logo.addWidget(label) layout.addLayout(hbox_logo, 0, 0, 1, 1, Qt.AlignLeft) hbox_image = QHBoxLayout() hbox_image.addWidget(image_viewer) layout.addLayout(hbox_image, 0, 1, 1, 1, Qt.AlignLeft) frame_rate = QLabel("Select frame rate", self) comboBox = QComboBox(self) comboBox.addItem("6") comboBox.addItem("15") comboBox.addItem("30") comboBox.setCurrentIndex(1) comboBox.activated[str].connect(self.style_choice) hbox_dummy = QVBoxLayout() hbox_dummy.addWidget(frame_rate) hbox_dummy.addWidget(comboBox) layout.addLayout(hbox_dummy, 0, 2, 1, 1, Qt.AlignCenter) hbox_start_buttons = QHBoxLayout() hbox_start_buttons.addWidget(start_button) hbox_start_buttons.addWidget(stop_button) layout.addLayout(hbox_start_buttons, 0, 1, 1, 1, Qt.AlignBottom | Qt.AlignCenter) layout.setVerticalSpacing(100) # 3d reconstruction reconstruct_btn = QPushButton() reconstruct_btn.clicked.connect(self.Reconstruct) reconstruct_btn.setIcon(QIcon(join(images_path + '/construct.png'))) reconstruct_btn.setIconSize(QSize(70, 70)) reconstruct_btn.setFixedWidth(100) reconstruct_btn.setFixedHeight(90) reconstruct_label = QLabel(" Reconstruct", self) # View pointclouds view_btn = QPushButton() view_btn.clicked.connect(self._viewReconstruction) # show_btn.resize(reconstruct_btn.sizeHint()) view_btn.setIcon(QIcon(join(images_path + '/view.png'))) view_btn.setIconSize(QSize(50, 50)) view_btn.setFixedWidth(100) view_btn.setFixedHeight(90) view_label = QLabel(" View", self) # Segment segment_btn = QPushButton() segment_btn.clicked.connect(self.Augment) segment_btn.setIcon(QIcon(join(images_path + '/seg3.png'))) segment_btn.setIconSize(QSize(80, 80)) segment_btn.setFixedWidth(100) segment_btn.setFixedHeight(90) segmentation_label = QLabel(" Segment", self) # View pointclouds show_btn = QPushButton() show_btn.clicked.connect(self.Augment) show_btn.setIcon(QIcon(join(images_path + '/view1.png'))) show_btn.setIconSize(QSize(50, 50)) show_btn.setFixedWidth(100) show_btn.setFixedHeight(90) show_label = QLabel(" Show", self) # Augmentation augment_btn = QPushButton() augment_btn.clicked.connect(self.Augment) augment_btn.setIcon(QIcon(join(images_path + '/magic.png'))) augment_btn.setIconSize(QSize(70, 70)) augment_btn.setFixedWidth(100) augment_btn.setFixedHeight(90) augmentation_label = QLabel(" Augment", self) hbox_buttons = QHBoxLayout() vbox_rec = QVBoxLayout() vbox_rec.addWidget(reconstruct_btn) vbox_rec.addWidget(reconstruct_label) hbox_buttons.addLayout(vbox_rec) vbox_view = QVBoxLayout() vbox_view.addWidget(view_btn) vbox_view.addWidget(view_label) hbox_buttons.addLayout(vbox_view) vbox_comp = QVBoxLayout() vbox_comp.addWidget(segment_btn) vbox_comp.addWidget(segmentation_label) hbox_buttons.addLayout(vbox_comp) vbox_show = QVBoxLayout() vbox_show.addWidget(show_btn) vbox_show.addWidget(show_label) hbox_buttons.addLayout(vbox_show) vbox_aug = QVBoxLayout() vbox_aug.addWidget(augment_btn) vbox_aug.addWidget(augmentation_label) hbox_buttons.addLayout(vbox_aug) layout.addLayout(hbox_buttons, 3, 0, 1, 5) self.setLayout(layout) # set geometry self.setGeometry(0, 0, 1000, 650) self.setWindowTitle('App') self.show()
min-height: 0; } .detector { background-color: yellow; } """) # Program state state = State() # Tray Icon tray_icon = SystemTrayIcon(state) tray_icon.show() # Start device thread device_thread = QThread() device = connect.Device() device.moveToThread(device_thread) device_thread.started.connect(device.run) # Login Window login = LoginWindow(state, device) # Calibration Window calib_window = CalibrationWindow(state, device) # Popup Window popup = PopupWindow(state, device) def show_popup(): if state.sensor_values is None:
def start_Midi_Thread(self): self.thread3 = QThread() self.worker3 = MidiPlayer_Worker(self.current_tempo, self.drum_current) self.worker3.moveToThread(self.thread3) self.thread3.started.connect(self.worker3.work) self.thread3.start()
def setupUi(self): self.load_ui("apol/rbacrulequery.ui") # set up role autocompletion (source, default) role_completion_list = [str(r) for r in self.policy.roles()] role_completer_model = QStringListModel(self) role_completer_model.setStringList(sorted(role_completion_list)) self.role_completion = QCompleter() self.role_completion.setModel(role_completer_model) self.source.setCompleter(self.role_completion) self.default_role.setCompleter(self.role_completion) # set up role/type autocompletion (target) roletype_completion_list = [str(r) for r in self.policy.roles()] # roletype_completion_list.extend(str(a) for a in self.policy.roleattributes()) roletype_completion_list.extend(str(t) for t in self.policy.types()) roletype_completion_list.extend( str(a) for a in self.policy.typeattributes()) roletype_completer_model = QStringListModel(self) roletype_completer_model.setStringList( sorted(roletype_completion_list)) self.roletype_completion = QCompleter() self.roletype_completion.setModel(roletype_completer_model) self.target.setCompleter(self.roletype_completion) # setup indications of errors on source/target/default self.errors = set() self.orig_palette = self.source.palette() self.error_palette = self.source.palette() self.error_palette.setColor(QPalette.Base, Qt.red) self.clear_source_error() self.clear_target_error() self.clear_default_error() # populate class list self.class_model = SEToolsListModel(self) self.class_model.item_list = sorted(self.policy.classes()) self.tclass.setModel(self.class_model) # set up results self.table_results_model = RBACRuleTableModel(self) self.sort_proxy = QSortFilterProxyModel(self) self.sort_proxy.setSourceModel(self.table_results_model) self.table_results.setModel(self.sort_proxy) self.table_results.sortByColumn(0, Qt.AscendingOrder) # set up processing thread self.thread = QThread() self.worker = QueryResultsUpdater(self.query, self.table_results_model) self.worker.moveToThread(self.thread) self.worker.raw_line.connect(self.raw_results.appendPlainText) self.worker.finished.connect(self.update_complete) self.worker.finished.connect(self.thread.quit) self.thread.started.connect(self.worker.update) # create a "busy, please wait" dialog self.busy = QProgressDialog(self) self.busy.setModal(True) self.busy.setRange(0, 0) self.busy.setMinimumDuration(0) self.busy.canceled.connect(self.thread.requestInterruption) self.busy.reset() # update busy dialog from query INFO logs self.handler = LogHandlerToSignal() self.handler.message.connect(self.busy.setLabelText) logging.getLogger("setools.rbacrulequery").addHandler(self.handler) # Ensure settings are consistent with the initial .ui state self.set_source_regex(self.source_regex.isChecked()) self.set_target_regex(self.target_regex.isChecked()) self.set_default_regex(self.default_regex.isChecked()) self.criteria_frame.setHidden(not self.criteria_expander.isChecked()) self.notes.setHidden(not self.notes_expander.isChecked()) # connect signals self.buttonBox.clicked.connect(self.run) self.clear_ruletypes.clicked.connect(self.clear_all_ruletypes) self.all_ruletypes.clicked.connect(self.set_all_ruletypes) self.source.textEdited.connect(self.clear_source_error) self.source.editingFinished.connect(self.set_source) self.source_regex.toggled.connect(self.set_source_regex) self.target.textEdited.connect(self.clear_target_error) self.target.editingFinished.connect(self.set_target) self.target_regex.toggled.connect(self.set_target_regex) self.tclass.selectionModel().selectionChanged.connect(self.set_tclass) self.invert_class.clicked.connect(self.invert_tclass_selection) self.default_role.textEdited.connect(self.clear_default_error) self.default_role.editingFinished.connect(self.set_default_role) self.default_regex.toggled.connect(self.set_default_regex)
def __init__(self): self.cc = Casting() signal.signal(signal.SIGINT, signal.SIG_DFL) self.cast = None self.stopped = False self.played = False self.pcastfailed = False self.read_config() """ These dictionaries are used to set icons' colors """ self.google = { "black": "google", "blue": "google_b", "white": "google_w" } self.google_working = { "black": "google_working", "blue": "google_working_b", "white": "google_working_w", } self.google_nodev = { "black": "google_nodev", "blue": "google_nodev_b", "white": "google_nodev_w", } """ This is used when searching for cast devices """ self.obj = mkchromecast.tray_threading.Worker() # no parent! self.thread = QThread() # no parent! self.obj.intReady.connect(self.onIntReady) self.obj.moveToThread(self.thread) self.obj.finished.connect(self.thread.quit) self.thread.started.connect(self.obj._search_cast_) """ This is used when one clicks on cast device """ self.objp = mkchromecast.tray_threading.Player() # no parent! self.threadplay = QThread() # no parent! self.objp.moveToThread(self.threadplay) self.objp.pcastready.connect(self.pcastready) self.objp.pcastfinished.connect(self.threadplay.quit) self.threadplay.started.connect(self.objp._play_cast_) """ This is used when one clicks on the updater """ self.objup = mkchromecast.tray_threading.Updater() # no parent! self.threadupdater = QThread() # no parent! self.objup.moveToThread(self.threadupdater) self.objup.updateready.connect(self.updateready) self.objup.upcastfinished.connect(self.threadupdater.quit) self.threadupdater.started.connect(self.objup._updater_) self.app = QtWidgets.QApplication(sys.argv) """ This is to determine the scale factor. """ screen_resolution = self.app.desktop().screenGeometry() self.width = screen_resolution.width() self.height = screen_resolution.height() if self.height > 1280: self.scale_factor = 2 else: self.scale_factor = 1 if debug is True: print(":::systray::: Screen resolution: ", self.width, self.height) # This avoid the QMessageBox to close parent processes. self.app.setQuitOnLastWindowClosed(False) if hasattr(QtCore.Qt, "AA_UseHighDpiPixmaps"): self.app.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps) if debug is True: print(":::systray::: High-DPI screen detected...") self.w = QWidget() # This is useful when launching from git repo if os.path.exists("images/" + self.google[self.colors] + ".icns") is True: self.icon = QtGui.QIcon() if platform == "Darwin": self.icon.addFile("images/" + self.google[self.colors] + ".icns") else: self.icon.addFile("images/" + self.google[self.colors] + ".png") else: self.icon = QtGui.QIcon() if platform == "Linux": self.icon.addFile("/usr/share/mkchromecast/images/" + self.google[self.colors] + ".png") else: self.icon.addFile(self.google[self.colors] + ".icns") super(QtWidgets.QMainWindow, self).__init__() self.createUI()
def __init__(self, topic, **kwargs): """Initialization. :param str topic: topic, e.g. SCS, MID, DET, etc. """ super().__init__() self._topic_st = topic self.setWindowTitle(f"EXtra-foam {__version__} - " f"special suite - {self._title}") self._com_ctrl_st = _SharedCtrlWidgetS(**kwargs) cv = Condition() catalog = SourceCatalog() queue = SimpleQueue(maxsize=1) self._client_st = self._client_instance_type(queue, cv, catalog) self._worker_st = self._worker_instance_type(queue, cv) self._worker_thread_st = QThread() self._ctrl_widget_st = self._ctrl_instance_type(topic) if isinstance(self._client_st, QThreadFoamClient): self._com_ctrl_st.updateDefaultPort(config["EXTENSION_PORT"]) # book-keeping plot widgets self._plot_widgets_st = WeakKeyDictionary() # book-keeping ImageView widget self._image_views_st = WeakKeyDictionary() self._data_st = None self._gui_logger_st = GuiLogger(parent=self) logger.addHandler(self._gui_logger_st) self._cw_st = QSplitter() self._cw_st.setChildrenCollapsible(False) self.setCentralWidget(self._cw_st) self._plot_timer_st = QTimer() self._plot_timer_st.setInterval(config["GUI_PLOT_UPDATE_TIMER"]) self._plot_timer_st.timeout.connect(self.updateWidgetsST) # init UI self._left_panel_st = QSplitter(Qt.Vertical) self._left_panel_st.addWidget(self._com_ctrl_st) self._left_panel_st.addWidget(self._ctrl_widget_st) self._left_panel_st.addWidget(self._gui_logger_st.widget) self._left_panel_st.setChildrenCollapsible(False) self._cw_st.addWidget(self._left_panel_st) # init Connections self._client_st.log.logOnMainThread(self) self._worker_st.log.logOnMainThread(self) # start/stop/reset self._com_ctrl_st.start_btn.clicked.connect(self._onStartST) self._com_ctrl_st.stop_btn.clicked.connect(self._onStopST) self._com_ctrl_st.reset_btn.clicked.connect(self._onResetST) # dark operation self._com_ctrl_st.record_dark_btn.toggled.connect( self._worker_st.onRecordDarkToggledST) self._com_ctrl_st.record_dark_btn.toggled.emit( self._com_ctrl_st.record_dark_btn.isChecked()) self._com_ctrl_st.load_dark_run_btn.clicked.connect( self._onSelectDarkRunDirectoryST) self._com_ctrl_st.remove_dark_btn.clicked.connect( self._worker_st.onRemoveDark) self._com_ctrl_st.dark_subtraction_cb.toggled.connect( self._worker_st.onSubtractDarkToggledST) self._com_ctrl_st.dark_subtraction_cb.toggled.emit( self._com_ctrl_st.dark_subtraction_cb.isChecked()) self._com_ctrl_st.auto_level_btn.clicked.connect(self._onAutoLevelST) # ROI ctrl self._com_ctrl_st.roi_geometry_change_sgn.connect( self._worker_st.onRoiGeometryChange)
super(DataAnimation, self).__init__(plot.fig, event_source=event_source, *args, **kwargs) self.plot = plot def new_frame_seq(self): return itertools.count() def _draw_frame(self, frame_data): self._drawn_artists = self.plot.updated_artists for artist in self._drawn_artists: artist.set_animated(self._blit) # def _end_redraw(self, evt): # self._post_draw(None, self._blit) # self.event_source.start() # self._fig.canvas.mpl_disconnect(self._resize_id) # self._resize_id = self._fig.canvas.mpl_connect('resize_event', self._handle_resize) if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) main_window = MainWindow() plot = Plot() event_source = DataReceivedEventListener(plot.update) data_receiver = DataReceiver(event_source) data_receiver_thread = QThread() data_receiver.moveToThread(data_receiver_thread) data_receiver_thread.started.connect(data_receiver.start) data_receiver_thread.start() main_window.add_plot(plot, event_source) main_window.show() sys.exit(app.exec_())
def scan(self): try: #read data from the input boxes start = float(self.ui.scan_start_input.text()) end = float(self.ui.scan_end_input.text()) step = float(self.ui.scan_step_input.text()) time = float(self.ui.count_time_input.text()) filename = self.ui.file_name_input.text() sample_id = self.ui.sample_ID_input.text() except: print('scan did not recieve valid inputs') return #set the range and clear the data from plots self.wavelength_plot.set_xlim(start, end) self.wavelength_plot_log.set_xlim(start, end) energy_start = 1239841.984 / (1.000289 * end) energy_end = 1239841.984 / (1.000289 * start) print(energy_start) print(energy_end) self.energy_plot.set_xlim(energy_start, energy_end) self.energy_plot_log.set_xlim(energy_start, energy_end) self.wavelength_plot.cla() self.energy_plot.cla() self.wavelength_plot_log.cla() self.energy_plot_log.cla() # Step 2: Create a QThread object self.scan_thread = QThread() # Step 3: Create a worker object if self.ui.radioButton.isChecked(): #if we have double selected if abs(end - self.double.position) > 100: #safety measure intent = self.check_intent() if not intent: return self.worker = scanWorker(self.double, start, end, step, time, filename, sample_id) #input double self.worker.position.connect(self.update_position_dbl) else: #if single is selected if abs(end - self.single.position) > 100: intent = self.check_intent() if not intent: return self.worker = scanWorker(self.single, start, end, step, time, filename, sample_id) #input single self.worker.position.connect(self.update_position_sngl) #disable the buttons to prevent crashing self.disable_buttons() self.change_status('Scanning') # # Step 4: Move worker to the thread self.worker.moveToThread( self.scan_thread ) #this makes the scan_thread methos be executed by the thread # # Step 5: Connect signals and slots self.scan_thread.started.connect( self.worker.scan) #connect to the scan method self.worker.data.connect( self.update_plots) #update the plots as we take data self.worker.finished.connect(self.scan_thread.quit) #quit when done self.worker.finished.connect( self.worker.deleteLater) #delete when done self.worker.finished.connect( self.enable_buttons) #enable buttons when done self.worker.finished.connect(self.change_status) self.scan_thread.finished.connect( self.scan_thread.deleteLater) #delete the thread when done self.scan_thread.finished.connect(self.check_repeat) #start the thread self.scan_thread.start()
def run(self): self._thread = QThread(self) self.moveToThread(self._thread) self._thread.start() self._run()
def process(self): while True: next_value = -1.0 + random() * 2 self.value_read.emit(next_value) time.sleep(0.001) @pyqtSlot(float) def handle(next_value): """Test handler""" print("%s" % str(next_value)) if __name__ == "__main__": app = QApplication(sys.argv) # define a Qt application thread = QThread() producer = Producer() producer.moveToThread(thread) thread.started.connect(producer.process) producer.finished.connect(thread.quit) producer.finished.connect(producer.deleteLater) thread.finished.connect(thread.deleteLater) producer.value_read.connect(handle) thread.start() sys.exit(app.exec_())
def __init__(self, parent=None): super(DebugWindow, self).__init__(parent) grid = QGridLayout() self.groupBox = QGroupBox("FACE NAVIGATION") self.mouth_Open_Counter = QLabel("NO. MOUTH OPEN : ") self.mouth_Closed_Counter = QLabel("NO. MOUTH CLOSE : ") self.mouth_condition = QLabel("MOUTH CONDITION : ") self.leftEyeOpen = QLabel("LEFT EYE OPEN COUNTER : ") self.leftEyeClose = QLabel("LEFT EYE CLOSE COUNTER: ") self.rightEyeOpen = QLabel("RIGHT EYE OPEN COUNTER : ") self.rightEyeClose = QLabel("RIGHT EYE CLOSE COUNTER: ") self.leftEyeCondition = QLabel("LEFT EYE CONDITION: ") self.rightEyeCondition = QLabel("RIGHT EYE CONDITION: ") self.activateWindow = QLabel("ACTIVATED FRAME : ") self.mouth_Open_Counter_Value = QLabel("#") self.mouth_Closed_Counter_Value = QLabel("#") self.mouth_condition_Value = QLabel("#") self.leftEyeOpenValue = QLabel("#") self.leftEyeCloseValue = QLabel("#") self.rightEyeOpenValue = QLabel("#") self.rightEyeCloseValue = QLabel("#") self.leftEyeConditionValue = QLabel("#") self.rightEyeConditionValue = QLabel("#") self.activateWindowValue = QLabel("MAIN") self.work = Navigation() self.thread = QThread() self.groupBox.setStyleSheet("color: white ;font: bold 12px") self.work.Mouth_Open_progress.connect(self.updateDataMO) self.work.Mouth_Close_progress.connect(self.updateDataMC) self.work.Mouth_State_progress.connect(self.updateDataMS) self.work.LeftEye_Open_progress.connect(self.updateDataLEO) self.work.LeftEye_Close_progress.connect(self.updateDataLEC) self.work.LeftEye_State_progress.connect(self.updateDataLES) self.work.RightEye_Open_progress.connect(self.updateDataREO) self.work.RightEye_Close_progress.connect(self.updateDataREC) self.work.RightEye_State_progress.connect(self.updateDataRES) self.work.Pattern_progress.connect(self.updateDataWIN) self.work.moveToThread(self.thread) self.work.finished.connect(self._finished) self.thread.started.connect(self.work.navigationMode_1) self.thread.start() QApplication.processEvents() verticalLayout = QVBoxLayout() horizontalLayout = QHBoxLayout() horizontalLayout1 = QHBoxLayout() horizontalLayout2 = QHBoxLayout() horizontalLayout3 = QHBoxLayout() horizontalLayout4 = QHBoxLayout() horizontalLayout5 = QHBoxLayout() horizontalLayout6 = QHBoxLayout() horizontalLayout7 = QHBoxLayout() horizontalLayout8 = QHBoxLayout() horizontalLayout9 = QHBoxLayout() horizontalLayout.addWidget(self.mouth_Open_Counter) horizontalLayout.addWidget(self.mouth_Open_Counter_Value) horizontalLayout1.addWidget(self.mouth_Closed_Counter) horizontalLayout1.addWidget(self.mouth_Closed_Counter_Value) horizontalLayout2.addWidget(self.mouth_condition) horizontalLayout2.addWidget(self.mouth_condition_Value) horizontalLayout3.addWidget(self.leftEyeOpen) horizontalLayout3.addWidget(self.leftEyeOpenValue) horizontalLayout4.addWidget(self.leftEyeClose) horizontalLayout4.addWidget(self.leftEyeCloseValue) horizontalLayout5.addWidget(self.rightEyeOpen) horizontalLayout5.addWidget(self.rightEyeOpenValue) horizontalLayout6.addWidget(self.rightEyeClose) horizontalLayout6.addWidget(self.rightEyeCloseValue) horizontalLayout7.addWidget(self.leftEyeCondition) horizontalLayout7.addWidget(self.leftEyeConditionValue) horizontalLayout8.addWidget(self.rightEyeCondition) horizontalLayout8.addWidget(self.rightEyeConditionValue) horizontalLayout3.addWidget(self.activateWindow) horizontalLayout3.addWidget(self.activateWindowValue) verticalLayout.addLayout(horizontalLayout) verticalLayout.addLayout(horizontalLayout1) verticalLayout.addLayout(horizontalLayout2) verticalLayout.addLayout(horizontalLayout3) verticalLayout.addLayout(horizontalLayout4) verticalLayout.addLayout(horizontalLayout5) verticalLayout.addLayout(horizontalLayout6) verticalLayout.addLayout(horizontalLayout7) verticalLayout.addLayout(horizontalLayout8) verticalLayout.addLayout(horizontalLayout9) verticalLayout.addStretch(1) self.groupBox.setLayout(verticalLayout) grid.addWidget(self.groupBox, 0, 0) QApplication.processEvents() self.setLayout(grid) self.setWindowTitle("EXPRESSION DATA") self.resize(400, 300) self.setStyleSheet("background-color : black ; font :white")