我们从Python开源项目中,提取了以下41个代码示例,用于说明如何使用PyQt4.QtCore.QThread()。
def __init__(self,pic,label_num): QtCore.QThread.__init__(self) self.picn = pic self.label_num = label_num self.interval = 1
def __init__(self,mainwindow,parent=None): QtCore.QThread.__init__(self,parent) self.exiting = False self.mainwindow = mainwindow self.scene_len = PLAY_LEN self.ppq = -1 self.cur_ppq = -1 self.input_buffer = [0]*256 self.cur_step = 0 self.note = 0 self.repeats = 0 self.cur_note = 0 self.rest = 0 self.midi_channel = MIDI_CHANNEL self.kb_channel = MIDIKB_CHANNEL self.midi_input = None self.midi_output = None self.num_steps = 16 self.key_ppq = [0]*127 self.key_last = [0]*127
def __init__(self,mainwindow,parent=None): QtCore.QThread.__init__(self,parent) self.exiting = False self.mainwindow = mainwindow self.ppq = -1 self.cur_ppq = -1 self.input_buffer = [0]*256 self.cur_step = 0 self.note = 0 self.repeats = 0 self.cur_note = 0 self.rest = 0 self.midi_channel =0 self.kb_channel = 0 self.midi_input = None self.midi_output = None self.num_steps = 16 self.key_ppq = [0]*127 self.key_last = [0]*127
def __init__(self, ip, port, parent = None): QtCore.QThread.__init__(self, parent) self.ip = ip self.port = port
def __init__(self): QtCore.QThread.__init__(self)
def __init__(self,url): QtCore.QThread.__init__(self) self.url = url self.interval = 1
def __init__(self,site,name,pgn,p,n): QtCore.QThread.__init__(self) self.site = site self.name = name self.pgn = pgn self.pic = p self.label = n
def __init__(self, series_name, refresh): QtCore.QThread.__init__(self) self.series_name = series_name self.refresh = refresh self.error_code = None
def __init__(self, identifier): QtCore.QThread.__init__(self) self.identifier = identifier self.identifier.setOutputFunction( self.logOutput ) self.identifier.setProgressCallback( self.progressCallback )
def __init__(self, ca, page_num ): QtCore.QThread.__init__(self) self.ca = ca self.page_num = page_num self.abandoned = False # remove any old instances, and then add ourself PageLoader.mutex.lock() PageLoader.reapInstances() PageLoader.instanceList.append( self ) PageLoader.mutex.unlock()
def __init__(self, parent=None): QtCore.QThread.__init__(self)
def __init__(self, connection, app): qtcore.QThread.__init__(self, parent=app) self.threadID = 1 self.name = "ImgThread" self.conn = connection
def __init__(self, parent): """ Initialize a new instance of this class. Retrieve configuration from the main dialog to make a new hosts file. :param parent: An instance of :class:`~gui.qdialog_d.QDialogDaemon` class to fetch settings from. :type parent: :class:`~gui.qdialog_d.QDialogDaemon` .. warning:: :attr:`parent` MUST NOT be set as `None`. """ QtCore.QThread.__init__(self, parent) MakeHosts.__init__(self, parent)
def __init__(self, url, path_to_save, options_chain, progress_bar): QtCore.QThread.__init__(self) self.obj_thread = QtCore.QThread() self.url = url self.path_to_save = path_to_save self.options_chain = options_chain self.progress_bar = progress_bar # def run(self): # self.client.create_download_connection(self, None, None, None, None) # def create_download_connection(self, url, path_to_save, options_chain, progress_bar):
def __init__(self): QThread.__init__(self) self.url = "http://movie.douban.com/subject/{0}/" self.timeout = 15 self.movie_ids = [] self.log = log.FinalLogger.getLogger() # ????logger?????? self.__create_images_folder() self.max_year_process = int(conn.SqliteConn().max_year_and_count_from_process()['max_year']) self.count_process = int(conn.SqliteConn().max_year_and_count_from_process()['count']) self.current_year = int(time.strftime('%Y',time.localtime(time.time())))+1 # 2016 # ??requests?????????????????
def __init__(self, path, maxAge=DEFAULT_MAX_AGE): QtCore.QThread.__init__(self) self.path = path self.maxAge = maxAge self.files = {} self.updateWatchedFiles() self.qtfw = QtCore.QFileSystemWatcher() self.qtfw.directoryChanged.connect(self.directoryChanged) self.qtfw.addPath(path) self.paused = True self.active = True
def quit(self): self.active = False QtCore.QThread.quit(self)
def __init__(self, parent): """ As filters are applied, update the text as results are required. This is basically a worker thread to help make the GUI appear more responsive. :param parent: LogParer - the LogParser instance (i.e. the GUI application) """ QtCore.QThread.__init__(self, parent) self.parent = parent # Create Lock self._lock = threading.Lock() # Custom signal / slot for updating the results text as it's found self.signal = QtCore.SIGNAL('Update text') # Flag used to end the current filter search self.running = False
def __init__(self, parent): QtCore.QThread.__init__(self) self.parent = parent
def create_version_request(self, silent=True): self.version_request = VersionRequest(self) self.version_thread = QtCore.QThread() self.version_request.moveToThread(self.version_thread) self.version_thread.started.connect(self.version_request.run) self.version_request.done.connect(self.version_thread.quit) self.version_request.done.connect(self.version_request_dialog.hide) self.version_request.error.connect(self.version_request_dialog.hide) self.version_request_dialog.rejected.connect(self.version_request.stop)
def __init__(self, function, *args, **kwargs): QtCore.QThread.__init__(self) self.function = function self.args = args self.kwargs = kwargs
def __init__(self, sim, endtime): QtCore.QThread.__init__(self) self.sim = sim self.endtime = endtime
def __init__(self, icon, parent=None): QtGui.QSystemTrayIcon.__init__(self, icon, parent) menu = QtGui.QMenu(parent) s = os.popen("nsaway --plugins").read().split("\n") # Magic s = s[2].split("[")[1].replace("]", "").split(", ") s = [si.replace("'","") for si in s] # It's clean # Plugin for item in s: entry = menu.addAction(item) self.connect(entry,QtCore.SIGNAL('triggered()'), lambda item=item: self.exec_plugin(item)) # Finished plugin loading menu.addSeparator() changeicon = menu.addAction("Reset Status") menu.addSeparator() exitAction = menu.addAction("Exit") self.setContextMenu(menu) exitAction.triggered.connect(self.quit) changeicon.triggered.connect(self.reset_icon) self.thread = QtCore.QThread() self.listener = Listener() self.listener.moveToThread(self.thread) self.thread.started.connect(self.listener.loop) self.listener.message.connect(self.signal_received) QtCore.QTimer.singleShot(0, self.thread.start)
def __init__(self, parent, work_name, signal_name): QtCore.QThread.__init__(self, parent=parent) self.signal = QtCore.SIGNAL(signal_name)
def __init__(self,parent,n): QtCore.QThread.__init__(self,parent) self.n=n
def __init__(self,ip,port): global thread_signal QtCore.QThread.__init__(self) self.ip = ip self.port = int(port)
def __init__(self,v1,v2,v3,v4): QtCore.QThread.__init__(self) self.handle = v1 self.cnt = v2 self.cnt_limit = v3 self.session = v4 self.session_signal.connect(session_finished)
def __init__(self,ip,port): QtCore.QThread.__init__(self) self.ip = ip self.port = int(port)
def __init__(self,name): QtCore.QThread.__init__(self) self.name1 = name self.interval = 1
def __init__(self, parent): QtCore.QThread.__init__(self, parent)
def runSearch(self): '''Called when the user pushes the Search button''' selectedLayer = self.layerListComboBox.currentIndex() comparisonMode = self.comparisonComboBox.currentIndex() self.noSelection = True try: str = unicode(self.findStringEdit.text()).strip() except: self.showErrorMessage('Invalid Search String') return if str == '': self.showErrorMessage('Search string is empty') return if selectedLayer == 0: # Include all vector layers layers = self.iface.legendInterface().layers() elif selectedLayer == 1: # Include all selected vector layers layers = self.iface.legendInterface().selectedLayers() else: # Only search on the selected vector layer layers = [self.searchLayers[selectedLayer]] self.vlayers=[] # Find the vector layers that are to be searched for layer in layers: if isinstance(layer, QgsVectorLayer): self.vlayers.append(layer) if len(self.vlayers) == 0: self.showErrorMessage('There are no vector layers to search through') return # vlayers contains the layers that we will search in self.searchButton.setEnabled(False) self.stopButton.setEnabled(True) self.doneButton.setEnabled(False) self.clearButton.setEnabled(False) self.clearResults() self.resultsLabel.setText('') infield = self.searchFieldComboBox.currentIndex() >= 1 if infield is True: selectedField = unicode(self.searchFieldComboBox.currentText()) else: selectedField = None # Because this could take a lot of time, set up a separate thread # for a worker function to do the searching. thread = QThread() worker = Worker(self.vlayers, infield, str, comparisonMode, selectedField, self.maxResults) worker.moveToThread(thread) thread.started.connect(worker.run) worker.finished.connect(self.workerFinished) worker.foundmatch.connect(self.addFoundItem) worker.error.connect(self.workerError) self.thread = thread self.worker = worker self.noSelection = False thread.start()
def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig) #################################################################################################################### # class GameThread(QtCore.QThread): # def __init__(self): # QtCore.QThread.__init__(self) # def __del__(self): # self.wait() # def run(self): # self.emit( QtCore.SIGNAL('update(QString)'), str(GAMENUMBER)) # return # class GameThread(QtCore.QThread): # def __init__(self): # QtCore.QThread.__init__(self) # # def __del__(self): # self.wait() # # def run(self): # self.emit( QtCore.SIGNAL('update(QString)'), str(GAMENUMBER)) # return # # # class StopThread(QtCore.QThread): # def __init__(self): # QtCore.QThread.__init__(self) # # def __del__(self): # self.wait() # # def run(self): # # self.emit( QtCore.SIGNAL('update(QString)'), "IM GONNA STOP NOW KYA?" ) # return ############################################################################################################################