本文整理汇总了Python中PySide.QtCore.QThread类的典型用法代码示例。如果您正苦于以下问题:Python QThread类的具体用法?Python QThread怎么用?Python QThread使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QThread类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reset
def reset (self):
self.serial.setDTR (False)
self.serial.setRTS (False)
QThread.msleep (250)
self.serial.setDTR (True)
self.serial.setRTS (True)
QThread.msleep (50)
示例2: __init__
def __init__(self):
QThread.__init__(self)
self.code = ""
self.carte = Carte()
self.planification = Cheminement(self.carte)
self.voltageRestant = ""
self.ileCible = -1
self.positionTresor = []
self.destination = []
self.pause = True
self.reset = False
self.startCycle = False
self.demiCercle = 180
self.tempAttenteRotation = 9
self.delaiAjustement = 4.5
self.metreSeconde = 15
self.metre = 100
self.actionPrecedente = ""
self.actionCourrante = ""
self.nouvelleAction = False
self.finCycle = False
self.connected = False
self.noPathFound = False
self.aIle = False
self.diametreIle = 2.125
self.deltaPosition = 15
self.deltaAngle = 4
self.deltaDiametreIle = 0.125
示例3: __init__
def __init__(self):
QThread.__init__(self)
self.running = True
self.queue = queue.Queue()
# If we have internet connetction we can receive dat from server
self.data_from_server = True
# Offsets period
self.p_offsets = config['p_offsets']
# Offsets stack size
self.n_samples = config['o_buffer']
# Offsets list
self.offsets = None
# Socket
self.sock_con = None
# Graph density. Send to pipeline every n-th sample
self.density = calculateDensity(config['time_axe_range']) # self.calculateDensity(2)
# Data server
if self.data_from_server:
self.host = config['host']
# self.host = 'localhost'
self.port = config['port']
示例4: _btnTransferClicked
def _btnTransferClicked(self):
'Transfer Dives'
idx = self._cbxComputer.currentIndex()
dc = self._cbxComputer.itemData(idx, Qt.UserRole+0)
if self._logbook.session.dirty:
print "Flushing dirty session"
self._logbook.rollback()
self._txtLogbook.setEnabled(False)
self._btnBrowse.setEnabled(False)
self._cbxComputer.setEnabled(False)
self._btnAddComputer.setEnabled(False)
self._btnRemoveComputer.setEnabled(False)
self._btnTransfer.setEnabled(False)
self._btnExit.setEnabled(False)
self._txtStatus.clear()
thread = QThread(self)
#FIXME: ZOMG HAX: Garbage Collector will eat TransferWorker when moveToThread is called
#NOTE: Qt.QueuedConnection is important...
self.worker = None
self.worker = TransferWorker(dc)
thread.started.connect(self.worker.start, Qt.QueuedConnection)
self.worker.moveToThread(thread)
self.worker.finished.connect(self._transferFinished, Qt.QueuedConnection)
self.worker.finished.connect(self.worker.deleteLater, Qt.QueuedConnection)
self.worker.finished.connect(thread.deleteLater, Qt.QueuedConnection)
self.worker.progress.connect(self._transferProgress, Qt.QueuedConnection)
self.worker.started.connect(self._transferStart, Qt.QueuedConnection)
self.worker.status.connect(self._transferStatus, Qt.QueuedConnection)
thread.start()
示例5: __init__
def __init__(self):
QThread.__init__(self)
Bin.exporter = JupiterExporter()
BinPacking.bin_packing_progress = self
self.directory = None
self.images = []
self.method = BinPackingThread.METHODS[0]
self.bin_size = BinPackingThread.SIZES[0]
self.bin_parameter = {
"next_fit_shelf": {},
"first_fit_shelf": {
"selection_variant": FirstFitShelfBin.BEST_VARIANTS,
"selection_heuristic": FirstFitShelfBin.SHORT_SIDE_FIT,
},
"guillotine": {
"selection_variant": GuillotineBin.BEST_VARIANTS,
"selection_heuristic": GuillotineBin.SHORT_SIDE_FIT,
"split_rule": Rect.RULE_SAS,
},
"max_rects": {},
}
示例6: testQThreadReceiversExtern
def testQThreadReceiversExtern(self):
#QThread.receivers() - Inherited protected method
obj = QThread()
self.assertEqual(obj.receivers(SIGNAL('destroyed()')), 0)
QObject.connect(obj, SIGNAL("destroyed()"), self.cb)
self.assertEqual(obj.receivers(SIGNAL("destroyed()")), 1)
示例7: start_q_watcher
def start_q_watcher(app, emu_window, proc_comms_q_to_em, proc_comms_q_from_em):
# need to spawn a worker thread that watches the proc_comms_q
# need to seperate queue function from queue thread
# http://stackoverflow.com/questions/4323678/threading-and-signals-problem
# -in-pyqt
q_watcher = QueueWatcher(
app, emu_window, proc_comms_q_to_em, proc_comms_q_from_em)
q_watcher_thread = QThread()
q_watcher.moveToThread(q_watcher_thread)
q_watcher_thread.started.connect(q_watcher.check_queue)
# now that we've set up the thread, let's set up rest of signals/slots
q_watcher.set_out_enable.connect(emu_window.set_output_enable)
q_watcher.set_out_disable.connect(emu_window.set_output_disable)
q_watcher.get_in.connect(emu_window.get_input)
q_watcher.get_out.connect(emu_window.get_output)
emu_window.send_output.connect(q_watcher.send_get_out_pin_result)
emu_window.send_input.connect(q_watcher.send_get_in_pin_result)
emu_window.interrupt_flagger.connect(q_watcher.handle_interrupt)
# not sure why this doesn't work by connecting to q_watcher_thread.quit
def about_to_quit():
q_watcher_thread.quit()
app.aboutToQuit.connect(about_to_quit)
q_watcher_thread.start()
示例8: _refresh
def _refresh(self):
'Refresh the list of Computers'
self._btnRefresh.setEnabled(False)
self._btnRefresh.setText('Scanning...')
self._model.clear()
typ = self.wizard().field('type')
if typ == len(ComputerTypes):
# Custom Computer Type
didx = self.wizard().field('driver')
drvr = list_drivers().keys()[didx]
dopt = self.wizard().field('driveropt')
else:
# Predefined Computer Type
drvr = ComputerTypes[typ]['driver']
dopt = ComputerTypes[typ]['driveropt']
dclass = list_drivers()[drvr]['class']
doptions = [] if dopt == '' else dopt.split(':')
thread = QThread(self)
#FIXME: ZOMG HAX: Garbage Collector will eat DiscoveryWorker when moveToThread is called
#NOTE: Qt.QueuedConnection is important...
self.worker = None
self.worker = DiscoveryWorker(dclass, doptions)
self.worker.moveToThread(thread)
thread.started.connect(self.worker.start, Qt.QueuedConnection)
self.worker.foundDevice.connect(self._model.addItem, Qt.QueuedConnection)
self.worker.finished.connect(self._discoverFinished, Qt.QueuedConnection)
self.worker.finished.connect(self.worker.deleteLater, Qt.QueuedConnection)
self.worker.finished.connect(thread.deleteLater, Qt.QueuedConnection)
thread.start()
示例9: __init__
def __init__(self, patches, db, parent=None):
QThread.__init__(self, parent)
self.logger = logging.getLogger(__name__)
self.process = None
self.patches = patches
self.parentDb = db
示例10: __init__
def __init__(
self,
account,
call,
#dbus_handler,
):
"""
account: An account.
call is one of
'HomeTimeline': Fetch the home time line
'Mentions': Fetch user mentions
'DMs': Fetch direct messages
'Search:*': Fetch search results where * is the terms to search for
'RetrieveLists': Retrive lists
'List:*:*': The first * should be replace with the user and
the second with the id
'Near:*:*': Fetch tweets near (1km) a the specified
location. The first start is the the first
geocode and the second * is the second geocode.
"""
QThread.__init__(self)
self.account = account
self.call = call
#self.dbus_handler = dbus_handler
socket.setdefaulttimeout(60)
示例11: __init__
def __init__(self):
QThread.__init__(self)
self.grblWriter = None
self.gcode = None
self.stopFlag = False
self.pauseFlag = False
self.currentLine = 0
self.waitForPause = False
示例12: __init__
def __init__(self, maximum, parent=None):
QThread.__init__(self, parent)
self.maximum = maximum
# this semaphore is used to stop the thread from outside. As long
# as the thread is permitted to run, it has yet a single resource
# available. If the thread is stopped, this resource is acquired,
# and the thread breaks its counting loop at the next iteration.
self._run_semaphore = QSemaphore(1)
示例13: __init__
def __init__(self, *params):
QThread.__init__(self)
self.parms = params
self.ret_code = None
self.output = StringIO()
self.procs = []
self.procs_str = ''
Logger.getLoggerFor(self.__class__)
示例14: __init__
def __init__(self, monitorable, args=(), kwargs=None):
QThread.__init__(self)
self._monitorable = monitorable
self._args = args
if kwargs is None:
kwargs = {}
self._kwargs = kwargs
self._is_cancelled = False
示例15: __init__
def __init__(self, script):
"""
This is a wrapper for scripts that are not QThread, to execute them on a different thread than the gui
Args:
script: script to be executed
"""
self.script = script
QThread.__init__(self)