def __init__(self, threshold_img, threshold_new, *args, **kwargs): super(DetectionBook, self).__init__(*args, **kwargs) self.threshold_img = threshold_img self.threshold_new = threshold_new self.book = FindBook('book') self.measure = Measure() self.discriptor = Descriptor() self.helper = Helper() self.lst_disptor = self.load() self.page = 0 self.start = False self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ui.btn_start.clicked.connect(self.btn_start_click) self.ui.btn_close.clicked.connect(self.btn_close_click) self.ui.btn_stop.clicked.connect(self.btn_stop_click) self.show() self.is_new = False self.thread_1 = QThreadPool() self.thread_2 = QThreadPool() self.timer_1 = QTimer() self.timer_1.timeout.connect(self.viewCam) self.timer_2 = QTimer() self.timer_2.timeout.connect(self.execute) self.start_time = time.time()
def __init__(self): QtWidgets.QMainWindow.__init__(self) Ui_MainWindow.__init__(self) self.setupUi(self) self.model = VentModel() # settings file self.bconfirm.released.connect(self.confirm) self.bstart.released.connect(self.start) self.model.load() insptime, exptime, pressure = self.model.settings self.x1, self.x2, self.x3 = plot_points * [0], plot_points * [ 0 ], plot_points * [0] self.y1, self.y2, self.y3 = plot_points * [0.0], plot_points * [ 0.0 ], plot_points * [0.0] self.holding_registers = 3 * [0] self.coil = False self.tnewinsp.setValue(insptime) self.tnewexp.setValue(exptime) self.newpress.setValue(pressure) self.tcurrinsp.setValue(insptime) self.tcurrexp.setValue(exptime) self.currpress.setValue(pressure) self.graph1 = pg.PlotWidget() self.graph2 = pg.PlotWidget() self.graph3 = pg.PlotWidget() self.vlgraphs.addWidget(self.graph1) self.vlgraphs.addWidget(self.graph2) self.vlgraphs.addWidget(self.graph3) pen = pg.mkPen(color=(255, 0, 0)) self.data_line1 = self.graph1.plot([], [], pen=pen) self.data_line2 = self.graph2.plot([], [], pen=pen) self.data_line3 = self.graph3.plot([], [], pen=pen) self.x1, self.y1 = self.graphInit(self.data_line1, plot_points) self.x1, self.y2 = self.graphInit(self.data_line2, plot_points) self.x1, self.y3 = self.graphInit(self.data_line3, plot_points) self.setStyle(self.graph1, 'Expiration vs time', 'Expiration', 'time (ms)') self.setStyle(self.graph2, 'Inspiration vs time', 'Inspiration', 'time (ms)') self.setStyle(self.graph3, 'Pressure vs time', 'Pressure', 'time (ms)') self.timer = QtCore.QTimer() self.timer.setInterval(time_interval) self.timer.timeout.connect(self.update_plot_data) self.modbuspool = QThreadPool() self.modbuswritepool = QThreadPool() self.modbustimer = QtCore.QTimer() self.modbustimer.setInterval(time_interval // 2) self.modbustimer.timeout.connect(self.modbus_timer) self.modbustimer.start()
def __init__(self, gui): self.filter_thread = QThreadPool() self.download_thread = QThreadPool() self.download_thread.setMaxThreadCount( 1) # Limits concurrent downloads to 1. self.download_workers = [] self.gui = gui self.handle_init()
def __init__(self, dir): self.threadpool = QThreadPool() self.subthreadpool = QThreadPool() self.threads = 0 self.BackupDirectory = dir self.BackupStorage = {} self.load_from_txt() self.load_prev_from_json() print("Backup Manager initiated: " + dir) self.print()
def main(): args = read_args() # application app = QApplication([]) app.setOverrideCursor(Qt.BlankCursor) # main window window = MainWindow( { 'green': ROOT / 'bg_green.png', 'red': ROOT / 'bg_red.png' }, fullscreen=True, debug=False, size=app.desktop().screenGeometry().size()) try: window.set_power(not args.poweroff) window.set_color(args.color) window.set_background(args.background) except BaseException: logging.exception('Failed to exec args') # signals piper = Piper() window.connect_signals(piper.signals) pool = QThreadPool() pool.start(piper) try: app.exec() except KeyboardInterrupt: print('Keyboard interrupt', flush=True) finally: print('quitting', flush=True)
def __init__(self): QtWidgets.QMainWindow.__init__(self) # Call the inherited classes __init__ method # uic.loadUi('gui/ui/MA35D1-Writer.ui', self) # Load the .ui file self.setupUi(self) self.setWindowTitle("MA35D1 NuWriter") self.addMedia() self.text_browser = QtWidgets.QTextBrowser(self) self.verticalLayout.addWidget(self.text_browser) # Install the custom output stream # sys.stdout = EmittingStream(textWritten=self.normalOutputWritten) self.outputStream = EmittingStream(textWritten=self.normalOutputWritten) sys.stdout = self.outputStream sys.stderr = self.outputStream self.initToolSetting() # Attach self.browseDDR_btn.clicked.connect(self.iniBrowse) self.attach_btn.clicked.connect(self.doAttach) self.threadpool = QThreadPool()
def __init__(self, width=200, height=200, position=None): """ :param width: integer: width of the selected area :param height: integer: height of the selected area :param position: QPoint: coordinates of the top left corner of the selected area """ super(QWidget, self).__init__() self.recording = False self.paused = False self.width = width self.height = height self.position = position self.fourcc = cv2.VideoWriter_fourcc(*"XVID") self.out = cv2.VideoWriter("Untitled.avi", self.fourcc, 30.0, (int(self.width), int(self.height))) self.image_data = None self.thread_pool = QThreadPool() self.init_ui()
def __init__(self, parent=None): super(Gui, self).__init__(parent) # Other classes self.db_manager = DatabaseManager() self.db_sitemanager = mysql.connector.connect( host="srv-11.edyson.nl", user="******", password="******", database="frisonline_sitemanager") self.db_sitemanager_cursor = self.db_sitemanager.cursor() self.stacker = Stacker() self.initExcel() # Multithreading self.threadpool = QThreadPool() self.popup_window_trigger_thread = PopupWindowTriggerThread(self) self.popup_window_trigger_thread.finished_stacking_signal.connect( self.displayPopupWindowFinishedStacking) self.popup_window_trigger_thread.start() # Create all the layouts and button events self.createButtonsLayout() self.createButtonEvents() self.createGridOrdersLayout() self.createGridDrawing() self.createGridOrdersEvents() self.createMainLayout() self.setLayout(self.main_layout) self.refreshNewOrders()
def __init__(self, glsurface, tilesource='opentopomap'): super().__init__(target=glh.Texture.Target2DArray) self.threadpool = QThreadPool() tileinfo = bs.settings.tile_sources.get(tilesource) if not tileinfo: raise KeyError(f'Tile source {tilesource} not found!') max_dl = tileinfo.get('max_download_workers', bs.settings.max_download_workers) self.maxzoom = tileinfo.get('max_tile_zoom', bs.settings.max_tile_zoom) self.threadpool.setMaxThreadCount( min(bs.settings.max_download_workers, max_dl)) self.tileslot = TiledTexture.SlotHolder(self.load_tile) self.tilesource = tilesource self.tilesize = (256, 256) self.curtileext = (0, 0, 0, 0) self.curtilezoom = 1 self.curtiles = OrderedDict() self.fullscreen = False self.offsetscale = np.array([0, 0, 1], dtype=np.float32) self.bbox = list() self.glsurface = glsurface self.indextexture = glh.Texture(target=glh.Texture.Target2D) self.indexsampler_loc = 0 self.arraysampler_loc = 0 bs.net.actnodedata_changed.connect(self.actdata_changed) Signal('panzoom').connect(self.on_panzoom_changed)
def ingestLogs(self, root): if self.clientHandler.eventConfig.eventStartTime != None and self.clientHandler.eventConfig.eventEndTime != None and root != None: redTeamPath = root + "/red/" blueTeamPath = root + "/blue/" whiteTeamPath = root + "/white/" for filename in os.listdir(redTeamPath): self.clientHandler.logFileManager.createLogFile( redTeamPath + filename, "Red Team", "Red Team") for filename in os.listdir(blueTeamPath): self.clientHandler.logFileManager.createLogFile( blueTeamPath + filename, "Blue Team", "Blue Team") for filename in os.listdir(whiteTeamPath): self.clientHandler.logFileManager.createLogFile( whiteTeamPath + filename, "White Team", "White Team") self.updateLogFileTable() self.updateEnfActRepTable() self.clientHandler.logFileManager.ingested = True self.clientHandler.logFileManager.storeIngested() self.threadpool = QThreadPool() ingestionWorker = IngestionWorker(self.clientHandler) self.threadpool.start(ingestionWorker)
def __init__(self): super().__init__() self.setupUi(self) # Animation self.animation = QPropertyAnimation(self, b'windowOpacity') self.animation.setDuration(800) self.doShow() # ProgressBar self.progressBar.setValue(0) self.progressBar.setTextVisible(False) # Buttons self.to_page_action.clicked.connect(self.action) self.to_page_setting.clicked.connect(self.setting) self.to_page_home.clicked.connect(self.home) self.to_page_graph.clicked.connect(self.Graph) self.setTable.clicked.connect(self.set_to_table) self.setGraph.clicked.connect(self.set_to_graph) self.export_to_xls_.clicked.connect(self.resetBar) # SET self.from_data.setDateTime(one_day) self.to_date.setDateTime(now) self.MCCMNC.setText("*") self.ANI.setText("*") self.Client.addItem(None) self.Vendor.addItem(None) # Combo_box for i in client: self.Client.addItem(i[1]) for s in vendor: self.Vendor.addItem(s[1]) self.threadpool = QThreadPool()
def __init__(self): super().__init__() self.ui = Ui_form() self.ui.setupUi(self) self.threadpool = QThreadPool() self.ui.actionDatabase.triggered.connect(self.create_db) self.ui.actionQuit.triggered.connect( QtCore.QCoreApplication.instance().quit) # self.ui.opendb_btn.clicked.connect(self.open_db) self.ui.openfile_btn.clicked.connect(self.open_sps) # self.ui.dbupdate_btn.clicked.connect(self.__update_db) self.ui.dataselect_btn.clicked.connect(self.__select_from_db) self.ui.quit_btn.clicked.connect( QtCore.QCoreApplication.instance().quit) # self.ui.search_btn.clicked.connect(self.__search) self.ui.tableclear_btn.clicked.connect(self.__clear_tab) self.db_file = None self.sps_file = None self.ui.progressBar.setValue(0) self.ui.comboBox.addItems(config.table_dict.keys())
def new_room_dialog(self, db): ui = Ui_Room() new_rm = QDialog() ui.setupUi(new_rm) model = QSqlTableModel(new_rm, db) #Threading thrd = QThreadPool().globalInstance() hlist = ['Reserv. ID','Customer ID','Room #','From','To','Discount','Extension','Net Total'] worker = TableWorker(update_table("CurrentReservation", hlist, ui.tableView, db, model, where=f"RmNumber={ui.lineEdit.text()}")) #We pass a function for the worker to execute thrd.tryStart(worker) #Setup Signals and other UI elements ui.lineEdit.setFocus() # TODO find a better signal than textChanged because it sucks bad ui.lineEdit.textChanged.connect(lambda: update_table_onEnter(new_rm, hlist, ui, db, thrd, model)) ui.pushButton_3.clicked.connect(lambda: thrd.tryStart(TableWorker(add_DB(ui, new_rm, db, "Room", [ui.lineEdit.text(),ui.comboBox.currentText(),ui.spinBox.value(),0], "?, ?, ?, ?", [ui.lineEdit,ui.spinBox])))) ui.pushButton_2.clicked.connect(lambda: thrd.tryStart(TableWorker(edit_DB(ui, new_rm, db, "Room", [ui.lineEdit.text(),ui.comboBox.currentText(),ui.spinBox.value(),ui.lineEdit.text()], "Number = ?, Type = ?, Price = ?", "Number", [ui.lineEdit,ui.spinBox])))) ui.pushButton.clicked.connect(lambda: thrd.tryStart(TableWorker(del_DB(ui, new_rm, db, "Room", "Number = ?", [ui.lineEdit.text()], [ui.lineEdit,ui.spinBox])))) new_rm.setWindowTitle('Create, edit, or delete a Room') new_rm.exec()
def new_customer_dialog(self, db): ui = Ui_Customer() new_cust = QDialog() ui.setupUi(new_cust) model = QSqlTableModel(new_cust, db) #Setup Threading thrd = QThreadPool().globalInstance() hlist = ['Customer ID','Name','Phone #','Date of Birth','# Reservations'] worker = TableWorker(update_table("Customer", hlist, ui.tableView, db, model)) #We pass a function for the worker to execute thrd.tryStart(worker) #? Consider using, instead of QSqlQuery, A QSqlTableModel and insert or delete from it ui.lineEdit_2.textEdited.connect(lambda: update_custTable_onEnter(new_cust, hlist, ui, db, thrd, model)) ui.pushButton_3.clicked.connect(lambda: thrd.tryStart(TableWorker(add_DB(ui, new_cust, db, "Customer", [ui.lineEdit_2.text(),ui.lineEdit.text(),ui.spinBox.value(),ui.dateEdit.date().toString("yyyy-MM-dd"),ui.comboBox.currentText(),0], "?,?,?,?,?,?", [ui.lineEdit_2,ui.lineEdit,ui.spinBox,ui.dateEdit])))) ui.pushButton_2.clicked.connect(lambda: thrd.tryStart(TableWorker(edit_DB(ui, new_cust, db, "Customer", [ui.lineEdit_2.text(),ui.lineEdit.text(),ui.spinBox.value(),ui.dateEdit.date().toString("yyyy-MM-dd"),ui.comboBox.currentText(),ui.lineEdit_2.text()], "ID = ?, Name = ?, Phone = ?, DoB = ?, Sex = ?", "ID", [ui.lineEdit_2,ui.lineEdit,ui.spinBox,ui.dateEdit])))) ui.pushButton.clicked.connect(lambda: thrd.tryStart(TableWorker(del_DB(ui, new_cust, db, "Customer", "ID = ?", [ui.lineEdit_2.text()], [ui.lineEdit_2,ui.lineEdit,ui.spinBox,ui.dateEdit])))) ui.lineEdit_2.setText("CTMR" + str(randrange(100, 999, 10))) new_cust.setWindowTitle('Create, edit, or delete a Customer') new_cust.exec()
def __init__(self): super().__init__() pack_info = rcm_utils.pack_info() title = "Remote Connection Manager - CINECA - v" + pack_info.rcmVersion self.setWindowTitle(title) width = 1000 height = 370 screen_width = QDesktopWidget().width() screen_height = QDesktopWidget().height() self.setGeometry((screen_width / 2) - (width / 2), (screen_height / 2) - (height / 2), width, height) self.setMinimumHeight(height) self.setMinimumWidth(width) self.build_menu() self.main_widget = MainWidget(self) self.setCentralWidget(self.main_widget) self.thread_pool = QThreadPool() logger.info("Welcome to RCM!") logger.debug("Multithreading with maximum %d threads" % self.thread_pool.maxThreadCount())
def __init__(self, parent=None, dev=None): super(ActionWidget, self).__init__(parent) self.setStyleSheet("background-color: black;") vbox = QVBoxLayout() self.dev = dev self.action = ActionLabel(self) self.timerlabel = TimerLabel(self) vbox.addWidget(self.action) vbox.addWidget(self.timerlabel) vbox.setContentsMargins(QMargins(0, 0, 0, 0)) self.setLayout(vbox) # Workers self.threadpool = QThreadPool() self.quit_thread = False self._active_listen = True # Timer self._interval_done = True self._interval_time = 0 self._timer = QTimer() self._timer.timeout.connect(self.iterate) # Sound self.timer_sound = QSound(TIMER_FX) self.interval_sound = QSound(TIMER_FX3) # Button self._button = None # ON EXIT self.thread_done = False self.start_action_signal()
def retranslateUi(self, MainWindow): ''' Redefines label and button names for front-end usages. :param MainWindow: QtWidgets.QMainWindow() :return: None ''' _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.pushButton.setText(_translate("MainWindow", "Connect")) self.pushButton_2.setText(_translate("MainWindow", "Disconnect")) self.pushButton_4.setText(_translate("MainWindow", "Status")) self.pushButton_5.setText(_translate("MainWindow", "Reset")) self.pushButton_6.setText(_translate("MainWindow", "Disable")) self.pushButton_7.setText(_translate("MainWindow", "Close")) self.label_5.setText(_translate("MainWindow", "5")) self.label_6.setText(_translate("MainWindow", "6")) self.label.setText(_translate("MainWindow", "1")) self.label_3.setText(_translate("MainWindow", "3")) self.label_7.setText(_translate("MainWindow", "7")) self.label_2.setText(_translate("MainWindow", "2")) self.label_8.setText(_translate("MainWindow", "8")) self.label_4.setText(_translate("MainWindow", "4")) self.label_9.setText(_translate("MainWindow", "Fault")) self.menuOctolok.setTitle(_translate("MainWindow", "Octolok")) # Start thread self.threadpool = QThreadPool() print("Multithreading with maximum %d threads" % self.threadpool.maxThreadCount())
def __init__(self, path, reject, path2, **kwargs): super().__init__(**kwargs) self.path = path self.reject = reject self.path2 = path2 self.threadpool = QThreadPool() self.mails_list = []
def __init__(self): super().__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) self.dealerStep = DM.DealerStepper() #setup motors self.dealerDC = DM.DealerDC() self.display(0) self.threadpool = QThreadPool() print("Multithreading with maximum %d threads" % self.threadpool.maxThreadCount()) self.ui.page1label1.setText("ARTOPS: Blackjack") self.ui.page3hitButton.clicked.connect(lambda: self.roundMainTrigger(0)) #setup the UI button functions self.ui.page3stickButton.clicked.connect(lambda: self.roundMainTrigger(1)) self.ui.page7statsButton.clicked.connect(lambda: self.statisticsPage()) self.ui.page7resetButton.clicked.connect(lambda: self.resetTrigger()) self.ui.page8resetButton.clicked.connect(lambda: self.resetTrigger()) self.ui.pageErrorButton1.clicked.connect(lambda: self.resetTrigger()) self.shortcut = QShortcut(QKeySequence("Ctrl+E"), self) self.shortcut.activated.connect(self.exitApp) self.shortcut = QShortcut(QKeySequence("Ctrl+R"), self) self.shortcut.activated.connect(self.resetTrigger) self.showFullScreen() self.initialise()
def __init__(self, parent=None): super().__init__(parent) self._instruments = InstrumentManager() self.pool = QThreadPool() self._code = 0 self._harmonic = 1 self._lastMeasurement = tuple() self._lastFreqs = list() self._lastAmps = list() self.freqs = list() self.amps = list() self.codes = list() self.cutoff_freqs = list() self.loss_double_freq = list() self.loss_triple_freq = list() self.cutoff_freq_delta_x = list() self.cutoff_freq_delta_y = list() self.harms = defaultdict(list) self.harm_deltas = defaultdict(list) self._cutoffMag = -6 self._cutoffAmp = 0 self.measurementFinished.connect(self._processStats) self.harmonicPointMeasured.connect(self._processHarmonics)
def __init__(self, parent=None): """ initialize Queue, Manager and ThreadPool for work with that """ super().__init__(parent) self.pool = QThreadPool(self) self.pool.setMaxThreadCount(5000) self.queues = {'HQueue': PGQ('HQueue'), 'MQueue': PGQ('MQueue'), 'LQueue': PGQ('LQueue')}
def __init__(self): super(MainWindow, self).__init__() layout = QVBoxLayout() self.treble_clef_label = QLabel() treble_clef_pix = QPixmap('./treble_clef.jpg') treble_clef_pix = treble_clef_pix.scaledToHeight(640) self.treble_clef_label.setPixmap(treble_clef_pix) layout.addWidget(self.treble_clef_label) self.quarter_note_label = QuarterNote(self.treble_clef_label) self.quarter_note_label.move(170, -1000) layout.setContentsMargins(200, 11, 200, 11) self.treble_clef_label.setScaledContents(True) self.setLayout(layout) self.target_line_number = -1000 self.threadpool = QThreadPool() self.midi_worker = MidiWorker() self.midi_worker.signal.note_recieved.connect(self.checkIfCorrect) self.note_generator = GenerateNoteWorker('C', "medium") self.note_generator.signal.note_generated.connect(self.setTargetLineNumber) self.threadpool.start(self.midi_worker) self.threadpool.start(self.note_generator) for synth in self.midi_worker.synths: self.threadpool.start(synth)
def __init__(self): super().__init__() self.w = QtGui.QWidget() # Plot Widgets self.plotWidget = pg.PlotWidget() self.plotWidget2 = pg.PlotWidget() # Plot objects self.trace = self.plotWidget.plot() self.avgTrace = self.plotWidget.plot(pen='c') self.stats = self.plotWidget2.plot(pen='r', symbol='o', symbolPen='r', symbolBrush='r') # Add data properties to plot objects to store data self.stats.data = [] # Button for initiating sockets with Mantis self.commsButton = QtWidgets.QPushButton('Start Mantis Comms', self) self.commsButton.clicked.connect(self.startPlot) # UI layout self.layout = QtGui.QGridLayout() self.w.setLayout(self.layout) self.layout.addWidget(self.plotWidget) self.layout.addWidget(self.plotWidget2) self.layout.addWidget(self.commsButton) self.w.show() # Ininiate the thread pool self.threadpool = QThreadPool() print("Multithreading with maximum %d threads" % self.threadpool.maxThreadCount())
def __init__(self, completeAction=None, exceptionAction=None, parent=None): """ Creates a wrapper around GUI Thread management that displays loading spinner """ self.threadPool = QThreadPool() self.thread_worker = QThread() self.exceptionAction = exceptionAction self.completeAction = completeAction """ part below sets up loading bar """ self.movie = QMovie('red_big.gif') self.movie.setCacheMode(QMovie.CacheAll) self.movie.setSpeed(100) self.movie_screen = QLabel(parent=parent) width = 320 height = 200 left = parent.width() / 2 - width / 2 top = parent.height() / 2 - height / 2 self.movie_screen.setGeometry(left, top, width, height) self.movie_screen.setAlignment(Qt.AlignCenter) self.movie_screen.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.movie_screen.setAttribute(Qt.WA_TranslucentBackground, True) self.movie_screen.setStyleSheet( "QLabel::item { border: 0px solid black };") self.movie_screen.setMovie(self.movie)
def __init__(self): super().__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) ## Variables self.changed = False self.threadpool = QThreadPool() ## Connections self.ui.titleCombo.addItems(self.getTitles()) # self.ui.getDataButton.clicked.connect(self.getDataCMD) self.ui.getDataButton.clicked.connect(self.get_data_cmd) self.ui.searchButton.clicked.connect(self.searchCMD) self.ui.moreInfoButton.clicked.connect(self.showMoreInfo) self.ui.searchForCombo.currentIndexChanged.connect(self.change_scrapers_in_combo) self.ui.scraperCombo.currentIndexChanged.connect(self.make_scaper_combo_changes) self.ui.showStatusCheck.clicked.connect(self.show_status_callback) self.ui.clearButton.clicked.connect(lambda: self.ui.loggingConsole.clear()) self.ui.backButton.clicked.connect(lambda: self.ui.stackedWidget_2.setCurrentIndex(0)) ## SETUP TABLES for table in [self.ui.showResutlTable, self.ui.moviesResutlTable, self.ui.animeResutlTable, self.ui.subtitleResutlTable]: header = table.horizontalHeader() header.setSectionResizeMode(0, QHeaderView.ResizeToContents) header.setSectionResizeMode(1, QHeaderView.ResizeToContents) header.setSectionResizeMode(2, QHeaderView.ResizeToContents) # header.setSectionResizeMode(3, QHeaderView.Stretch) table.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) table.customContextMenuRequested.connect(self.on_customContextMenuRequested) ## get the current database title and set the "dataNameLable" self.get_current_db_title()
def __init__(self): super().__init__(None, Qt.WindowFlags()) self.window().setWindowTitle(APP_NAME) self.setMinimumWidth(APP_MIN_WIDTH) self.setMinimumHeight(APP_MIN_HEIGHT) self.thread_pool = QThreadPool() self._initial_point = None self._drown_points = None self._canvas = Canvas( initial_point_handler=self._initial_point_handler) self._btn_draw = QPushButton(self.tr('Draw'), 90, 30, self._draw_points) self._btn_draw.setEnabled(False) self._btn_reset = QPushButton(self.tr('Reset'), 90, 30, self._reset_canvas) self._btn_reset.setEnabled(False) self._btn_save = QPushButton(self.tr('Save'), 90, 30, self._save_canvas) self._btn_save.setEnabled(False) self._points_count_line_edit = QLineEdit() self._segment_div_line_edit = QLineEdit() main_widget = self.init_main_widget() self.setCentralWidget(main_widget) # self.setup_navigation_menu() self.setFont(QFont('SansSerif', APP_FONT))
def __init__(self, maxWorkerCount=None): super(BCWorkerPool, self).__init__() self.__threadpool = QThreadPool() #self.__threadpool = QThreadPool.globalInstance() if isinstance( maxWorkerCount, int ) and maxWorkerCount >= 1 and maxWorkerCount <= self.__threadpool.maxThreadCount( ): self.__maxWorkerCount = maxWorkerCount else: self.__maxWorkerCount = self.__threadpool.maxThreadCount() self.__current = 0 self.__locked = 0 self.__started = 0 self.__allStarted = False self.__size = 0 self.__nbWorkers = self.__threadpool.maxThreadCount() self.__workers = [] self.__stopProcess = False self.__dataList = [] self.__results = [] self.__mapResults = BCWorkerPool.__MAP_MODE_OFF self.signals = BCWorkerSignals()
def __init__(self, background_changer, *args, **kwargs): super(MainWindow, self).__init__(*args, **kwargs) # Load the UI Page uic.loadUi("../resources/mainwindow.ui", self) self.create_storage_setup() # Setting up the internal model that handles the list of subreddits. self.model = SubredditModel(self) self.load_subreddits() self.subredditView.setModel(self.model) # Connecting buttons to the corresponding functionality. self.addButton.clicked.connect(self.add) self.updateButton.clicked.connect(self.update_subreddit) self.deleteButton.clicked.connect(self.delete) # Used to restart the timer if the change frequency was changed in the settings. self.background_changer = background_changer self.settings_dialog = SettingsDialog(background_changer) self.settingsButton.clicked.connect(self.settings_dialog.show) # Updating the shown subreddit settings in the UI when a subreddit from the listView is selected. self.subredditView.selectionModel().selectionChanged.connect(self.update_settings) # Setting up the thread pool that will handle the threads that are created when getting images. self.threadpool = QThreadPool() # Number that keeps track of how many workers that are currently getting images from reddit. self.getting_images = 0
def __init__(self, parent, logger=None): super(Configuration, self).__init__(parent) # Initializing object uic.loadUi(configurationUi, self) # Loading the main UI self.parent = parent self.threadPool = QThreadPool() self.logger = logger self.data = None self.dataType = None self.downloadThread = None self.tokenPass = False self.chatPass = False self.credentialsFolder = "Credentials" self.configFolder = 'Configuration' self.basicFilePath = os.path.join(helpers.ROOT_DIR, 'state.json') self.categoryTabs = [ self.mainConfigurationTabWidget, self.simulationConfigurationTabWidget, self.backtestConfigurationTabWidget, ] self.strategies = get_strategies_dictionary(Strategy.__subclasses__()) self.strategyDict = { } # We will store all the strategy slot information in this dictionary. self.lossDict = {} # We will store stop loss settings here. self.takeProfitDict = {} # We will store take profit settings here. self.load_combo_boxes( ) # Primarily used for backtest interval changer logic. self.load_slots( ) # Loads stop loss, take profit, and strategies slots. self.load_credentials() # Load credentials if they exist.
def __init__(self): super(MainUI, self).__init__() self.config = ReadConfig() self.taryShow = self.config.read_isHide() # 控制进入原来的主窗口退出 self.setupUi(self) self.set_style() self.files_list = [] self._connect() self.threadpool = QThreadPool() self.set_missionLable_icon() self.textEdit.dragEnterEvent = lambda a0: self._textEdit_dragEnterEvent( a0) self.textEdit.dropEvent = lambda a0: self._textEdit_dropEvent(a0) # 转换状态线程初始化 self.th_pr = FileThread() # 更新检查子线程的初始化 self.update = UpdateCheck(float(self.config.read_version())) # 更新下载子线程的初始化 self.update_get = UpdateGet() print(self.taryShow) # 禁用主窗口的关闭,实际上还是会触发closeEvent self.tray = AppTray(self) self.thread_work_deal() QApplication.setQuitOnLastWindowClosed(self.taryShow)