当前位置: 首页>>代码示例>>Python>>正文


Python QtCore.QThread类代码示例

本文整理汇总了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)
开发者ID:UncleRus,项目名称:MultiConf,代码行数:7,代码来源:stk500.py

示例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
开发者ID:phil888,项目名称:Design3,代码行数:28,代码来源:ProgrammeThread.py

示例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']
开发者ID:alberand,项目名称:Logger_GUI,代码行数:27,代码来源:model.py

示例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()
开发者ID:asymworks,项目名称:python-divelog,代码行数:35,代码来源:qdcxfer.py

示例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": {},
        }
开发者ID:Ingener74,项目名称:Small-Screwdriver,代码行数:25,代码来源:ScreamingMercury.py

示例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)
开发者ID:Hasimir,项目名称:PySide,代码行数:7,代码来源:qobject_protected_methods_test.py

示例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()
开发者ID:math4youbyusgroupillinois,项目名称:LN_Digital_Emulator,代码行数:27,代码来源:gui.py

示例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()
开发者ID:asymworks,项目名称:python-divelog,代码行数:34,代码来源:add_dc.py

示例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
开发者ID:Rogueleader89,项目名称:server,代码行数:7,代码来源:createPatch.py

示例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)
开发者ID:Jonney,项目名称:Khweeteur,代码行数:27,代码来源:retriever.py

示例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
开发者ID:GeorgeIoak,项目名称:rasPyCNCController,代码行数:8,代码来源:GCodeRunner.py

示例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)
开发者ID:MiguelCarrilhoGT,项目名称:snippets,代码行数:8,代码来源:thread_progress.py

示例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__)
开发者ID:juanchitot,项目名称:jaimeboot,代码行数:8,代码来源:human_event.py

示例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
开发者ID:pymontecarlo,项目名称:pymontecarlo-gui,代码行数:8,代码来源:wrapper.py

示例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)
开发者ID:EdwardBetts,项目名称:PythonLab,代码行数:9,代码来源:scripts.py


注:本文中的PySide.QtCore.QThread类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。