def __init__(self, path, appversion, newupd): QDialog.__init__(self) self.app_path = path self.setupUi(self) self.exiting = False self.appversion = appversion self.newupd = newupd self.filepath = "" if not newupd is None: self.label.setText("New version found: " + newupd[1]) self.download.setEnabled(True) #self.download.setEnabled(True) self.download.clicked.connect(self.downloadFile) self.check.clicked.connect(self.checkUpdate) self.thread = Worker() self.connect(self.thread, SIGNAL("output(QString, QString)"), self.showUpdateAvailable) self.connect(self.thread, SIGNAL("end()"), self.showNoUpdate) self.downloader = Downloader(self) self.connect(self.downloader, SIGNAL("loaded(int, int)"), self.updateProgress) self.connect(self.downloader, SIGNAL("finished()"), self.downloadFinished) self.connect(self.downloader, SIGNAL("finishederror()"), self.downloadFinishedError)
def open_screen(self): # Initializes screen with selected screen object, opens thread # when run screen = self.screens[self.lwScreen.currentRow()] dialog = customdialog.ViewDialog(screen, self._del_view_dialog) self.view_dialogs[screen.name] = dialog dialog.show() self.refresh_tab_buts() # Create new thread if screen is a Video object if type(screen) is svdevices.Video: # Initialize Phonon multimedia objects media_src = Phonon.MediaSource(screen.link) media_obj = Phonon.MediaObject(dialog) media_obj.setCurrentSource(media_src) video_widget = Phonon.VideoWidget(dialog) video_widget.setMinimumSize(640, 480) dialog.vLayout.addWidget(video_widget) Phonon.createPath(media_obj, video_widget) video_widget.show() worker = Worker(self._handle_video, media_obj, video_name=screen.name) self.threadpool.start(worker)
def open_cam(self): # Initializes screen with selected cam object, opens thread when run cam = self.cams[self.lwCam.currentRow()] dialog = customdialog.ViewDialog(cam, self._del_view_dialog) dialog.add_label() self.view_dialogs[cam.name] = dialog dialog.show() self.refresh_tab_buts() # Start new thread if "FLIR" in cam.link: worker = Worker(self._handle_flir_cam, cam) else: worker = Worker(self._handle_cam, cam) worker.signals.obj_passback.connect(self._paint_cam_frame) self.threadpool.start(worker)
def _run_timer(self, **kwargs): kwargs["cb_str_passback"].emit("00:00:00.000") start_time = time.time() while True: # Time calculations time.sleep(0.09) current_time = time.time() d_time = current_time - start_time # Send COM signals if a trigger is due worker = Worker(self._send_COM_signals, d_time) self.threadpool.start(worker) kwargs["cb_str_passback"].emit(time.strftime( "%H:%M:%S.{0:03d}".format( int(round(d_time % 1000, 3) * 1000) % 1000), time.gmtime(d_time))) if self._end_timer(d_time, kwargs["cb_int_passback"]): break
def start_timer(self): # Starts new thread updating runtime worker = Worker(self._run_timer) worker.signals.int_passback.connect(self._update_progbar) worker.signals.str_passback.connect(self._update_timer) self.threadpool.start(worker)
def __init__(self): QMainWindow.__init__( self) #QMainWindow.__init__(self, None, Qt.FramelessWindowHint) self.setupUi(self) self.appversion = appversion self.setupTable() self.settings = Settings(self) self.export = Export(self) self.actionPublic_Mode.setChecked(self.settings["public_mode"]) self.factor.setValue(self.settings["zoom_factor"]) self.ocr_all_set = False self.color_image = None self.preview_image = None self.current_result = None self.newupd = None self.zoom = False self.minres = 0 self.fields = [ self.name, self.sell, self.buy, self.demand_num, self.demand, self.supply_num, self.supply ] self.canvases = [ self.name_img, self.sell_img, self.buy_img, self.demand_img, self.demand_text_img, self.supply_img, self.supply_text_img ] #setup buttons self.add_button.clicked.connect(self.addFiles) self.remove_button.clicked.connect(self.removeFile) self.remove_all_button.clicked.connect(self.removeAllFiles) self.add_all_button.clicked.connect(self.addAllScreenshots) self.save_button.clicked.connect(self.addItemToTable) self.skip_button.clicked.connect(self.nextLine) self.continue_button.clicked.connect(self.continueOCR) self.ocr_button.clicked.connect(self.performOCR) self.ocr_all.clicked.connect(self.runOCRAll) self.export_button.clicked.connect(self.export.exportToFile) self.bpc_button.clicked.connect(self.export.bpcExport) self.eddn_button.clicked.connect(self.export.eddnExport) self.clear_table.clicked.connect(self.clearTable) self.zoom_button.clicked.connect(self.drawOCRPreview) QObject.connect(self.actionHelp, SIGNAL('triggered()'), self.openHelp) QObject.connect(self.actionUpdate, SIGNAL('triggered()'), self.openUpdate) QObject.connect(self.actionAbout, SIGNAL('triggered()'), self.About) QObject.connect(self.actionOpen, SIGNAL('triggered()'), self.addFiles) QObject.connect(self.actionPreferences, SIGNAL('triggered()'), self.openSettings) QObject.connect(self.actionPublic_Mode, SIGNAL('triggered()'), self.toggleMode) QObject.connect(self.actionCommodity_Editor, SIGNAL('triggered()'), self.openEditor) self.error_close = False #set up required items for nn self.training_image_dir = unicode( self.settings.app_path.decode( 'windows-1252')) + u"\\nn_training_images\\" self.loadPlugins() self.restorePos() self.eddnthread = EDDNExport(self) QObject.connect(self.eddnthread, SIGNAL('finished(QString)'), self.export.eddnFinished) QObject.connect(self.eddnthread, SIGNAL('update(int,int)'), self.export.eddnUpdate) self.checkupadte = self.settings["updates_check"] self.thread = Worker() self.connect(self.thread, SIGNAL("output(QString, QString)"), self.showUpdateAvailable) if self.checkupadte: self.thread.check(self.appversion) if not self.settings.reg.contains('info_accepted'): self.infoDialog = InfoDialog() self.infoDialog.exec_() else: if not self.settings['info_accepted']: self.infoDialog = InfoDialog() self.infoDialog.exec_()