本文整理汇总了Python中PySide.QtCore.QThread方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QThread方法的具体用法?Python QtCore.QThread怎么用?Python QtCore.QThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtCore
的用法示例。
在下文中一共展示了QtCore.QThread方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QThread [as 别名]
def __init__(self):
QtCore.QObject.__init__(self)
self.WorkerThread = WorkerThread(self)
self.t = QtCore.QThread(self, objectName='workerThread')
self.WorkerThread.moveToThread(self.t)
self.t.start()
self.PassedHere = False
self.currency = None
self.soldcount = 0
self.start = 0
self.logging = 0
self.WorkerThread.progresscount = 0
self.WorkerThread.SetStatus.connect(lambda x: self.StatusLabel.setText(x))
self.WorkerThread.progressSignal.connect(lambda x: self.progressBar_2.setProperty("value", x))
self.WorkerThread.StartEn.connect(lambda x: self.StartButton.setEnabled(x))
self.WorkerThread.StartDis.connect(lambda x: self.StartButton.setDisabled(x))
self.WorkerThread.PauseEn.connect(lambda x: self.PauseButton.setEnabled(x))
self.WorkerThread.PauseDis.connect(lambda x: self.PauseButton.setDisabled(x))
self.WorkerThread.RetrieveEn.connect(lambda x: self.RetrieveButton.setEnabled(x))
self.WorkerThread.RetrieveDis.connect(lambda x: self.RetrieveButton.setDisabled(x))
self.WorkerThread.TableSorting.connect(lambda x: self.tableWidget.setSortingEnabled(x))
self.WorkerThread.NewRow.connect(lambda x: self.tableWidget.insertRow(x))
self.WorkerThread.SetTableItem.connect(self.SetTable)
self.WorkerThread.ShowError.connect(self.showError)
self.WorkerThread.ShowInfo.connect(self.showInfo)
self.WorkerThread.SetCurrHeader.connect(self.setCurrHeader)
self.WorkerThread.display_error.connect(lambda x: self.display_error(x))
self.WorkerThread.log_event.connect(lambda x: self.logEvent(x))
self.WorkerThread.MainLogin.connect(self.login)
self.init_login.emit(True)
示例2: run
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QThread [as 别名]
def run(self):
QtCore.QThread.sleep(4)
print('Done sleeping')
示例3: __init__
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QThread [as 别名]
def __init__(self, session, parent=None):
QtCore.QThread.__init__(self, parent)
self.session = session
self.file_path = None
self.incoming_file = ()
示例4: load
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QThread [as 别名]
def load(self, file_path):
self.file_path = file_path
if file_path.endswith(".ag"):
self.incoming_file = (file_path, 'SESSION')
else:
file_type = androconf.is_android(file_path)
self.incoming_file = (file_path, file_type)
self.start(QtCore.QThread.LowestPriority)
示例5: __init__
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QThread [as 别名]
def __init__(self, receivePipe, tableModel, rawData, useTimestamp=True):
# Call the superclass constructor
QtCore.QThread.__init__(self)
# Attributes to manage the sniffer process
self.receivePipe = receivePipe
self.tableModel = tableModel
self.useTimestamp = useTimestamp
self.rawData = rawData
self.enabled = True
示例6: __init__
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QThread [as 别名]
def __init__(self, packets, sleepTime, CANData, threadName):
QtCore.QThread.__init__(self)
self.packets = packets
self.sleepTime = sleepTime
self.CANData = CANData
self.threadName = threadName
self.enabled = True
self.logger = Logger(Strings.senderThreadLoggerName + " (" +
self.threadName + ")").getLogger()
示例7: __init__
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QThread [as 别名]
def __init__(self, snifferReceivePipe, sharedEnabledFlag, curSampleIndex):
# Call the superclass constructor
QtCore.QThread.__init__(self)
self.curSampleIndex = curSampleIndex
# Attributes to manage the sniffer process
self.sharedEnabledFlag = sharedEnabledFlag
self.snifferReceivePipe = snifferReceivePipe
示例8: _simulate
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QThread [as 别名]
def _simulate(self):
''' Starts the simulation of the current model with the current settings in the GUI '''
self.models[self.currentNumberedModelName].integrationStatistics.finished = False
self.run.setEnabled(False)
self.closebutton.setEnabled(False)
# Delete pluginData because new simulation will start
self.models[self.currentNumberedModelName].pluginData.clear()
self._setSettingsFromIntegratorControlGUI(self.currentNumberedModelName)
# Close the corresponding result file to have write access
self.models[self.currentNumberedModelName].integrationResults.close()
try:
os.remove(self.models[self.currentNumberedModelName].integrationResults.fileName)
except:
pass
self.models[self.currentNumberedModelName].integrationResultFileSemaphore = threading.Semaphore()
if hasattr(self.models[self.currentNumberedModelName], 'integrationResults'):
self.models[self.currentNumberedModelName].integrationResults.fileName = ''
# Define some variables before simulation can start
self.models[self.currentNumberedModelName].integrationStatistics.cpuTime = None
self.models[self.currentNumberedModelName].integrationStatistics.nTimeEvents = 0
self.models[self.currentNumberedModelName].integrationStatistics.nStateEvents = 0
self.models[self.currentNumberedModelName].integrationStatistics.nGridPoints = 0
self.models[self.currentNumberedModelName].integrationStatistics.reachedTime = self.models[self.currentNumberedModelName].integrationSettings.startTime
# Define Timers for result updates and simulation info updates
self.updateData = QtCore.QTimer()
self.updateData.timeout.connect(self.triggerdResultUpdate)
self.updateSimulationInfo = QtCore.QTimer()
self.updateSimulationInfo.timeout.connect(self.showSimulationInfo)
# Define a new thread for the simulation task
self._simThread = simulationThread(self)
self._simThread.model = self.models[self.currentNumberedModelName]
self._simThread.model.simulationStopRequest = False
self.lastCurrentTime = self._simThread.model.integrationStatistics.reachedTime
self.showSimulationInfo()
# Start the timers and the simulation thread
self._simThread.SimulationFinished = self.SimulationFinished
self.updateData.start(1000)
self.updateSimulationInfo.start(500)
self._cpuStartTime = time.clock()
self.stop.setEnabled(True)
self._simThread.start(QtCore.QThread.LowPriority)