Python PyQt5.QtCore.QThread() Examples
The following are 30
code examples of PyQt5.QtCore.QThread().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtCore
, or try the search function
.
Example #1
Source File: socket_test.py From socket-test with GNU General Public License v3.0 | 8 votes |
def on_udp_server_start_stop_button_clicked(self): if self.ui.button_Udp.text() == 'Start': self.ui.button_Udp.setEnabled(False) self.ui.lineEdit_UdpListenPort.setEnabled(False) self.udp_thread = QThread() self.udp_server = UDPServer( self.ui.label_LocalIP.text(), int(self.ui.lineEdit_UdpListenPort.text())) self.udp_thread.started.connect(self.udp_server.start) self.udp_server.status.connect(self.on_udp_server_status_update) self.udp_server.message.connect(self.on_udp_server_message_ready) self.udp_server.moveToThread(self.udp_thread) self.udp_thread.start() self.config['UDP_Listen_Port'] = self.ui.lineEdit_UdpListenPort.text() self.save_config() elif self.ui.button_Udp.text() == 'Stop': self.ui.button_Udp.setEnabled(False) self.udp_server.close()
Example #2
Source File: find_toolbar.py From pandasgui with MIT License | 7 votes |
def __init__(self, df, text, match_flags, parent=None): ''' Thread to search DataFrame for a string. Args: df: Type pd.DataFrame text: Text to search for. Type string. match_flags: User enabled match flags. Can match case, regex, or exact. Type dict. ''' QtCore.QThread.__init__(self, parent=parent) self.isRunning = True self.df = df self.text = text self.match_flags = match_flags self.max_chunk_size = 10000 self.chunks = self.split_chunks()
Example #3
Source File: DownloadRunner.py From DownloaderForReddit with GNU General Public License v3.0 | 7 votes |
def start_extractor(self): """ Initializes an Extractor object, starts a separate thread, and then runs the extractor from the new thread so that content can be simultaneously extracted, validated, and downloaded. """ self.extraction_runner = ExtractionRunner(self.queue, self.validated_objects, self.queued_posts, self.user_run) self.stop.connect(self.extraction_runner.stop) self.extraction_thread = QThread() self.extraction_runner.moveToThread(self.extraction_thread) self.extraction_thread.started.connect(self.extraction_runner.run_extraction) self.extraction_runner.update_progress_bar.connect(self.update_progress_bar) self.extraction_runner.send_failed_extract.connect(self.send_failed_extract) self.extraction_runner.finished.connect(self.extraction_thread.quit) self.extraction_runner.finished.connect(self.extraction_runner.deleteLater) self.extraction_thread.finished.connect(self.extraction_thread.deleteLater) self.extraction_thread.start()
Example #4
Source File: DownloadRunner.py From DownloaderForReddit with GNU General Public License v3.0 | 7 votes |
def start_downloader(self): """ Initializes a Downloader object, starts a separate thread, and then runds the downloader from the new thread so that content can be simultaneously downloaded, extracted and validated. :return: """ self.downloader = Downloader(self.queued_posts, self.settings_manager.max_download_thread_count) self.stop.connect(self.downloader.stop) self.downloader_thread = QThread() self.downloader.moveToThread(self.downloader_thread) self.downloader_thread.started.connect(self.downloader.download) self.downloader.download_count_signal.connect(self.set_final_download_count) self.downloader.send_downloaded.connect(self.add_downloaded_object) self.downloader.finished.connect(self.downloader_thread.quit) self.downloader.finished.connect(self.downloader.deleteLater) self.downloader_thread.finished.connect(self.downloader_thread.deleteLater) self.downloader_thread.finished.connect(self.downloads_finished) self.downloader_thread.start()
Example #5
Source File: media_server.py From kawaii-player with GNU General Public License v3.0 | 6 votes |
def __init__(self, ip, port, ui_widget=None, hm=None, logr=None, window=None): global ui, MainWindow, home, logger, html_default_arr, getdb global BASEDIR, TMPDIR, OSNAME QtCore.QThread.__init__(self) self.ip = ip self.port = int(port) self.cert_signal.connect(generate_ssl_cert) self.media_server_start.connect(media_server_started) self.httpd = None logger = logr ui = ui_widget home = hm MainWindow = window arg_dict = ui.get_parameters_value( r='html_default_arr', b='BASEDIR', t='TMPDIR') #logger.info(arg_dict) html_default_arr = arg_dict['html_default_arr'] BASEDIR = arg_dict['BASEDIR'] TMPDIR = arg_dict['TMPDIR'] OSNAME = os.name if ui.getdb is None: getdb = ServerLib(ui, home, BASEDIR, TMPDIR, logger) elif isinstance(ui.getdb, ServerLib): logger.info('--server--initiated---2477--') getdb = ui.getdb
Example #6
Source File: sandbox_model.py From kite with GNU General Public License v3.0 | 6 votes |
def __init__(self, sandbox_model=None, *args, **kwargs): QtCore.QObject.__init__(self) self.model = sandbox_model self.log = SceneLogModel(self) self.sources = SourceModel(self) self.cursor_tracker = CursorTracker(self) self._log_handler = logging.Handler() self._log_handler.setLevel(logging.DEBUG) self._log_handler.emit = self.sigLogRecord.emit logging.root.setLevel(logging.DEBUG) logging.root.addHandler(self._log_handler) self.worker_thread = QtCore.QThread() self.moveToThread(self.worker_thread) self.worker_thread.start() if self.model: self.setModel(self.model)
Example #7
Source File: main.py From DownloaderForReddit with GNU General Public License v3.0 | 6 votes |
def main(): Logger.make_logger() sys.excepthook = log_unhandled_exception app = QtWidgets.QApplication(sys.argv) queue = Injector.get_queue() thread = QtCore.QThread() receiver = MessageReceiver(queue) window = DownloaderForRedditGUI(queue, receiver) receiver.output_signal.connect(window.update_output) receiver.moveToThread(thread) thread.started.connect(receiver.run) receiver.finished.connect(thread.quit) receiver.finished.connect(receiver.deleteLater) thread.finished.connect(thread.deleteLater) thread.start() window.show() sys.exit(app.exec_())
Example #8
Source File: thread_modules.py From kawaii-player with GNU General Public License v3.0 | 6 votes |
def __init__( self, ui_widget, logr, tmp, name, url=None, direct_url=None, copy_fanart=None, copy_poster=None, copy_summary=None, use_search=None, video_dir=None): QtCore.QThread.__init__(self) global ui, logger, TMPDIR, site, siteName ui = ui_widget logger = logr TMPDIR = tmp self.name = name self.url = url self.direct_url = direct_url self.copy_fanart = copy_fanart self.copy_poster = copy_poster self.copy_summary = copy_summary self.use_search = use_search self.video_dir = video_dir self.image_dict_list = {} self.dest_dir = '' self.summary_signal.connect(copy_information) self.thumb_signal.connect(update_playlist_widget) self.imagesignal.connect(update_image_list) site = ui.get_parameters_value(s='site')['site'] siteName = ui.get_parameters_value(s='siteName')['siteName'] self.site = site
Example #9
Source File: DownloaderForRedditGUI.py From DownloaderForReddit with GNU General Public License v3.0 | 6 votes |
def check_for_updates(self, from_menu): """ Opens and runs the update checker on a separate thread. Sets self.from_menu so that other dialogs know the updater has been ran by the user, this will result in different dialog behaviour """ self.update_thread = QtCore.QThread() self.update_checker = UpdateChecker(self.version) self.update_checker.moveToThread(self.update_thread) self.update_thread.started.connect(self.update_checker.run) if from_menu: self.update_checker.update_available_signal.connect(self.update_dialog) self.update_checker.no_update_signal.connect(self.no_update_available_dialog) else: self.update_checker.update_available_signal.connect(self.display_update) self.update_checker.finished.connect(self.update_thread.quit) self.update_checker.finished.connect(self.update_checker.deleteLater) self.update_thread.finished.connect(self.update_thread.deleteLater) self.update_thread.start()
Example #10
Source File: UserFinderGUI_Obsolete.py From DownloaderForReddit with GNU General Public License v3.0 | 6 votes |
def download_user_samples(self): """ Creates an instance of the DownloadRunner class and moves it to another thread where it then downloads the specified number of posts from the found users """ if len(self.found_users) > 0 and self.watchlist_download_sample_spinbox_2.value() > 0: self.found_user_output.append('Starting Download\n') self.reddit_extractor = DownloadRunner(self.found_users, None, self.queue, self.watchlist_download_sample_spinbox_2.value(), self.save_path, None, None, False, False, None, None, None) self.user_finder_download_thread = QtCore.QThread() self.reddit_extractor.moveToThread(self.user_finder_download_thread) self.user_finder_download_thread.started.connect(self.reddit_extractor.validate_users) self.reddit_extractor.finished.connect(self.user_finder_download_thread.quit) self.reddit_extractor.finished.connect(self.reddit_extractor.deleteLater) self.user_finder_download_thread.finished.connect(self.user_finder_download_thread.deleteLater) self.user_finder_download_thread.finished.connect(self.download_finished) self.user_finder_download_thread.start() elif len(self.found_users) > 0 >= self.watchlist_download_sample_spinbox_2.value(): pass else: self.found_user_output.append('No users found that meet criteria\n') self.download_finished()
Example #11
Source File: common.py From eddy with GNU General Public License v3.0 | 6 votes |
def stopThread(self, name_or_qthread): """ Stop a running thread. :type name_or_qthread: T <= str | QThread """ if name_or_qthread: name = name_or_qthread if not isinstance(name, str): name = name_or_qthread.objectName() if name in self._threads: try: #LOGGER.debug("Terminate thread: %s (runtime=%.2fms)", name, time.monotonic() - self._started[name]) qthread = self._threads[name] qthread.quit() if not qthread.wait(2000): qthread.terminate() qthread.wait() except Exception as e: LOGGER.exception('Thread shutdown could not be completed: %s', e) del self._threads[name] if name in self._workers: del self._workers[name] if name in self._started: del self._started[name]
Example #12
Source File: interSubs.py From interSubs with MIT License | 6 votes |
def __init__(self): super().__init__() self.thread_subs = QThread() self.obj = thread_subtitles() self.obj.update_subtitles.connect(self.render_subtitles) self.obj.moveToThread(self.thread_subs) self.thread_subs.started.connect(self.obj.main) self.thread_subs.start() self.thread_translations = QThread() self.obj2 = thread_translations() self.obj2.get_translations.connect(self.render_popup) self.obj2.moveToThread(self.thread_translations) self.thread_translations.started.connect(self.obj2.main) self.thread_translations.start() # start the forms self.subtitles_base() self.subtitles_base2() self.popup_base()
Example #13
Source File: thread_modules.py From kawaii-player with GNU General Public License v3.0 | 6 votes |
def __init__(self, ui_widget, url, img_list=None, get_text=None): QtCore.QThread.__init__(self) global ui self.url = url self.interval = 1 self.picn = 'picn' ui = ui_widget if img_list: """img_list=[img_url, date, ep_url, local_path, site, img_key, dest_dir]""" self.img_list = img_list.copy() else: self.img_list = [] if get_text: self.get_text = True else: self.get_text = False
Example #14
Source File: Screenshooter.py From legion with GNU General Public License v3.0 | 5 votes |
def __init__(self, timeout): QtCore.QThread.__init__(self, parent=None) self.urls = [] self.processing = False self.timeout = timeout # screenshooter timeout (ms)
Example #15
Source File: common.py From eddy with GNU General Public License v3.0 | 5 votes |
def threads(self): """ Returns a list of QThread instances in the form (name, QThread). :rtype: list """ return [(name, qthread) for name, qthread in self._threads.items()]
Example #16
Source File: ui_main_window.py From EliteQuant_Python with Apache License 2.0 | 5 votes |
def __init__(self): QtCore.QThread.__init__(self)
Example #17
Source File: auxiliary.py From legion with GNU General Public License v3.0 | 5 votes |
def __init__(self): QtCore.QThread.__init__(self, parent=None) self.urls = [] self.processing = False
Example #18
Source File: gui.py From soapy with GNU General Public License v3.0 | 5 votes |
def __init__(self,guiObj): self.sim = guiObj.sim self.guiObj = guiObj QtCore.QThread.__init__(self)
Example #19
Source File: PythonImporter.py From legion with GNU General Public License v3.0 | 5 votes |
def __init__(self): QtCore.QThread.__init__(self, parent=None) self.output = '' self.hostIp = '' self.pythonScriptDispatch = {'pyShodan': pyShodan.PyShodanScript(), 'macvendors': macvendors.macvendorsScript()} self.pythonScriptObj = None
Example #20
Source File: NmapImporter.py From legion with GNU General Public License v3.0 | 5 votes |
def __init__(self, updateProgressObservable: AbstractUpdateProgressObservable, hostRepository: HostRepository): QtCore.QThread.__init__(self, parent=None) self.output = '' self.updateProgressObservable = updateProgressObservable self.hostRepository = hostRepository
Example #21
Source File: gui.py From soapy with GNU General Public License v3.0 | 5 votes |
def __init__(self,guiObj): QtCore.QThread.__init__(self) self.guiObj = guiObj self.sim = guiObj.sim
Example #22
Source File: mbusb_gui.py From multibootusb with GNU General Public License v2.0 | 5 votes |
def __init__(self): QtCore.QThread.__init__(self)
Example #23
Source File: common.py From eddy with GNU General Public License v3.0 | 5 votes |
def thread(self, name): """ Returns the reference to a running QThread. :type name: str :rtype: QtCore.QThread """ return self._threads.get(name, None)
Example #24
Source File: common.py From eddy with GNU General Public License v3.0 | 5 votes |
def startThread(self, name, worker): """ Start a thread using the given worker. :type name: str :type worker: QtCore.QObject """ if not isinstance(worker, AbstractWorker): raise ValueError('worker class must be subclass of eddy.core.threading.AbstractWorker') if name not in self._threads and name not in self._workers: #LOGGER.debug("Requested threaded execution of worker instance: %s", worker.__class__.__name__) # START THE WORKER THREAD qthread = QtCore.QThread() qthread.setObjectName(name) #LOGGER.debug("Moving worker '%s' in a new thread '%s'", worker.__class__.__name__, name) worker.moveToThread(qthread) connect(qthread.finished, self.onQThreadFinished) connect(qthread.finished, qthread.deleteLater) connect(worker.finished, qthread.quit) connect(worker.finished, worker.deleteLater) connect(qthread.started, worker.run) #LOGGER.debug("Starting thread: %s", name) qthread.start() # STORE LOCALLY self._started[name] = time.monotonic() self._threads[name] = qthread self._workers[name] = worker
Example #25
Source File: common.py From eddy with GNU General Public License v3.0 | 5 votes |
def onQThreadFinished(self): """ Executed when a QThread finish it's job. """ self.stopThread(self.sender()) ############################################# # INTERFACE #################################
Example #26
Source File: AddRedditObjectListModel.py From DownloaderForReddit with GNU General Public License v3.0 | 5 votes |
def start_name_check_thread(self): """Initializes a NameChecker object, then runs it in another thread.""" self.name_checker = NameChecker(self.object_type, self.queue) self.thread = QThread(self) self.name_checker.moveToThread(self.thread) self.name_checker.name_validation.connect(self.validate_name) self.name_checker.finished.connect(self.thread.quit) self.name_checker.finished.connect(self.name_checker.deleteLater) self.thread.finished.connect(self.thread.deleteLater) self.thread.started.connect(self.name_checker.run) self.thread.start()
Example #27
Source File: DownloaderForRedditGUI.py From DownloaderForReddit with GNU General Public License v3.0 | 5 votes |
def start_reddit_extractor_thread(self, download_type): """Moves the extractor to a different thread and calls the appropriate function for the type of download""" self.stop_download.connect(self.download_runner.stop_download) self.thread = QtCore.QThread() self.download_runner.moveToThread(self.thread) if download_type == 'USER': self.thread.started.connect(self.download_runner.validate_users) elif download_type == 'SUBREDDIT': self.thread.started.connect(self.download_runner.validate_subreddits) elif download_type == 'USERS_AND_SUBREDDITS': self.thread.started.connect(self.download_runner.validate_users_and_subreddits) elif download_type == 'UNFINISHED': self.thread.started.connect(self.download_runner.finish_downloads) self.download_runner.remove_invalid_object.connect(self.remove_invalid_reddit_object) self.download_runner.remove_forbidden_object.connect(self.remove_forbidden_reddit_object) self.download_runner.downloaded_objects_signal.connect(self.fill_downloaded_objects_list) self.download_runner.failed_download_signal.connect(self.handle_failed_download_object) self.download_runner.setup_progress_bar.connect(self.setup_progress_bar) self.download_runner.update_progress_bar_signal.connect(self.update_progress_bar) self.download_runner.unfinished_downloads_signal.connect(self.set_unfinished_downloads) self.download_runner.finished.connect(self.thread.quit) self.download_runner.finished.connect(self.download_runner.deleteLater) self.thread.finished.connect(self.thread.deleteLater) self.thread.finished.connect(self.finished_download_gui_shift) for dialog in self.open_object_dialogs: dialog.started_download_gui_shift() self.thread.finished.connect(dialog.finished_download_gui_shift) self.started_download_gui_shift() self.thread.start() self.logger.info('Downloader thread started')
Example #28
Source File: arrayanalysis.py From antenna-array-analysis with GNU General Public License v3.0 | 5 votes |
def __init__(self): super().__init__() super(QtWidgets.QMainWindow, self).__init__() """Constants""" self.window_list = ['Square', 'Chebyshev', 'Taylor', 'Hamming', 'Hann'] self.plot_list = ['3D (Az-El-Amp)', '2D Cartesian', '2D Polar', 'Array layout'] self.array_config = dict() self.fix_azimuth = False """Load UI""" self.ui = uic.loadUi('ui_array_analysis.ui', self) """Antenna array configuration""" self.calpattern = CalPattern() self.calpattern_thread = QThread() self.calpattern.patternReady.connect(self.update_figure) self.calpattern_thread.started.connect( self.calpattern.cal_pattern) self.calpattern.moveToThread(self.calpattern_thread) self.calpattern_thread.start() """Init UI""" self.init_ui() self.init_figure() self.new_params() self.ui.show()
Example #29
Source File: pypipboyapp.py From PyPipboyApp with GNU General Public License v3.0 | 5 votes |
def startAutoDiscovery(self, busyDialog = True): if not self.networkChannel.isConnected: if busyDialog: self._autodiscoverMessageBox = QtWidgets.QMessageBox(self.mainWindow) self._autodiscoverMessageBox.setWindowTitle('Autodiscovery') self._autodiscoverMessageBox.setText('Searching for host, please wait.') self._autodiscoverMessageBox.setStandardButtons(QtWidgets.QMessageBox.NoButton) self._autodiscoverMessageBox.show() else: self._autodiscoverMessageBox = None parentself = self # Capture self for inner class class _AutodiscoverThread(QtCore.QThread): def run(self): try: parentself._logger.debug('Starting Autodiscovery Thread') parentself._autodiscoverHosts = NetworkChannel.discoverHosts() parentself._signalAutodiscoveryFinished.emit() parentself._logger.debug('Autodiscovery Thread finished') except: traceback.print_exc(file=sys.stdout) time.sleep(1) # Just to make sure that the error is correctly written into the log file self._autodiscoverThread = _AutodiscoverThread() self._autodiscoverThread.start() return True else: return False # internal slot connected to the 'auto discovery thread is finished' signal
Example #30
Source File: gui.py From BAG_framework with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, parent): QtCore.QThread.__init__(self, parent=parent) self.stop = False