Пример #1
0
    def __init__(self, config, hku_config_file, market='SH'):
        super(self.__class__, self).__init__()
        self.working = True
        self._config = config
        self.hku_config_file = hku_config_file
        self.market = market.lower()
        self.marketid = None
        self._interval = TimeDelta(seconds=config.getint('collect', 'interval', fallback=60 * 60))
        self._phase1_start_time = Datetime(
            datetime.datetime.combine(
                datetime.date.today(),
                datetime.time.fromisoformat(
                    (config.get('collect', 'phase1_start', fallback='09:05'))
                )
            )
        )
        self._phase1_end_time = Datetime(
            datetime.datetime.combine(
                datetime.date.today(),
                datetime.time.fromisoformat(
                    (config.get('collect', 'phase1_end', fallback='09:05'))
                )
            )
        )
        self._use_zhima_proxy = config.getboolean('collect', 'use_zhima_proxy', fallback=False)

        self.cond = QWaitCondition()
        self.mutex = QMutex()
Пример #2
0
    def __init__(self, *args, **kwargs):
        super(MyThread, self).__init__(*args, **kwargs)
        self._isPause = False
        self._value = 0

        self.cond = QWaitCondition()
        self.mutex = QMutex()
Пример #3
0
 def __init__(self):
     # QThread.__init__(self)
     super().__init__()
     self.cond = QWaitCondition()
     self.mutex = QMutex()
     self.cnt = 0
     self._status = True
Пример #4
0
    def __init__(self, interval, project, vcs, parent=None):
        """
        Constructor
        
        @param interval new interval in seconds (integer)
        @param project reference to the project object (Project)
        @param vcs reference to the version control object
        @param parent reference to the parent object (QObject)
        """
        super(VcsStatusMonitorThread, self).__init__(parent)
        self.setObjectName("VcsStatusMonitorThread")

        self.setTerminationEnabled(True)

        self.projectDir = project.getProjectPath()
        self.project = project
        self.vcs = vcs

        self.interval = interval
        self.autoUpdate = False

        self.statusList = []
        self.reportedStates = {}
        self.shouldUpdate = False

        self.monitorMutex = QMutex()
        self.monitorCondition = QWaitCondition()
        self.__stopIt = False
Пример #5
0
 def __init__(self, do_sync=True):
     self.sync_devices = set()
     self.do_sync = do_sync
     self.wc = QWaitCondition()
     self.mutex = QMutex()
     self.arrived = 0
     self.buffer_maps = dict()
Пример #6
0
 def __init__(self):
     QThread.__init__(self)
     self.cond = QWaitCondition()
     self.mutex = QMutex()
     self.cnt = 0
     self._status = True
     self.sub = rospy.Subscriber("get_action", Float32MultiArray, self.get_array)
Пример #7
0
 def __init__(self, parent, limit):
     QThread.__init__(self)
     self.cond = QWaitCondition()
     self.mutex = QMutex()
     self.is_running = True
     self.limit = limit
     self.parent = parent
    def shown(self):
        # Disable mouse handler
        ctx.mainScreen.dontAskCmbAgain = True
        ctx.mainScreen.theme_shortcut.setEnabled(False)
        ctx.mainScreen.ui.system_menu.setEnabled(False)

        # start installer thread
        ctx.logger.debug("PkgInstaller is creating...")
        self.mutex = QMutex()
        self.wait_condition = QWaitCondition()
        self.queue = Queue()
        self.pkg_installer = PkgInstaller(self.queue, self.mutex,
                                          self.wait_condition,
                                          self.retry_answer)

        self.poll_timer.start(500)

        # start installer polling
        ctx.logger.debug("Calling PkgInstaller.start...")
        self.pkg_installer.start()

        ctx.mainScreen.disableNext()
        ctx.mainScreen.disableBack()

        # start 30 seconds
        self.timer.start(1000 * 30)

        self.installProgress.showInstallProgress()
Пример #9
0
 def __init__(self, recording_time=5):
     super().__init__()
     self._rec_time = recording_time
     # self._is_active = False
     self._mutex = QMutex()
     self._abort = False
     self._condition = QWaitCondition()
Пример #10
0
    def __init__(self):
        self.logger = logging.getLogger(constants.General.NAME)

        self.__mutex = QMutex()
        self.__condition = QWaitCondition()

        self.__data = None
Пример #11
0
    def __init__(self, logger=None):
        QThread.__init__(self)

        self.cond = QWaitCondition()
        self.mutex = QMutex()

        if logger is None:
            exit(-1)

        self.logger = logger

        self.wakereason = self.REASON_NONE
        self.uievent = ''

        self.state = None
        self.statePhase = None

        self.timer = QTimer()
        self.timer.setSingleShot(False)
        self.timer.timeout.connect(self.__timerTick)

        self.timerStart.connect(self.timer.start)
        self.timerStop.connect(self.timer.stop)

        self.quit = False
Пример #12
0
    def __init__(self, sequencelistmodel, parent=None, *args):
        super().__init__(parent=parent, *args)

        self.seqlist = sequencelistmodel
        self._hwsoc = HWSOC()
        self.mark = 0
        self._steps = 0
        self._sequence_cache = None

        # thread locks
        self.lock_running = QMutex()
        self.lock_waiting = QMutex()
        self.lock_waitcond = QWaitCondition()
        self.lock_steps = QMutex()

        # state variables
        self.state_paused = False
        self.state_running = False
        self.state_waitinghwok = False

        self.startTreatment.connect(self._startTreatment)
        self.stopTreatment.connect(self._stopTreatment)
        self.restartTreatment.connect(self._restartTreatment)
        self.abortTreatment.connect(self._abortTreatment)
        self.setHWOK.connect(self._sethwok)

        # create QThread and move this object to it
        self.thread = QThread()
        self.moveToThread(self.thread)
        self.thread.start()
Пример #13
0
 def __init__(self, parent=None):
     super().__init__(parent)
     self._mutex = QMutex()
     self._condition = QWaitCondition()
     self.frame = None
     self.parameters = None
     self.abort = False
Пример #14
0
    def _init_multi_worker_thread(self, devices):
        """initializes a worker thread for every devicewrapper in devices"""

        # set up QWaitCondition
        self.mutex_table = {idx: QMutex() for idx in range(len(devices))}
        self.cond_table = {
            idx: QWaitCondition()
            for idx in range(len(devices))
        }

        # set up the measurement engine
        self.worker_table = {}
        for idx, devicewrapper in enumerate(devices):
            worker = TimePlotWorker(devicewrapper,
                                    self.mutex_table[idx],
                                    self.cond_table[idx],
                                    id_nr=idx)

            # connect signal and slot
            worker.reading.connect(self.newReading)
            self.start_signal.connect(worker.start)
            self.stop_signal.connect(worker.stop)
            self.pause_signal.connect(worker.pause)
            self.restart_signal.connect(worker.restart)

            self.worker_table.update({idx: worker})
Пример #15
0
 def __init__(self, max_alternatives=1):
     super().__init__()
     self.max_alter = max_alternatives
     self._mutex = QMutex()
     self._abort = False
     self._condition = QWaitCondition()
     self.client = speech.Client()
     self.file_path = None
Пример #16
0
 def __init__(self):
     # Initialize variables(s)
     self.nArrived = 0
     self.doSync = False
     self.syncSet = set()
     self.wc = QWaitCondition()
     self.imageBufferDict = dict()
     self.mutex = QMutex()
Пример #17
0
 def __init__(self, window):
     QThread.__init__(self)
     self.cond = QWaitCondition()
     self.mutex = QMutex()
     self.cnt = 0
     self._status = True
     self.window = window
     self.logger = Logger(window)
 def __init__(self, drop_if_full=True, buffer_size=8):
     self.drop_if_full = drop_if_full
     self.buffer = Buffer(buffer_size)
     self.sync_devices = set()
     self.wc = QWaitCondition()
     self.mutex = QMutex()
     self.arrived = 0
     self.current_frames = dict()
Пример #19
0
    def __init__(self, parent=None):
        super(FortuneThread, self).__init__(parent)

        self.quit = False
        self.hostName = ""
        self.cond = QWaitCondition()
        self.mutex = QMutex()
        self.port = 0
Пример #20
0
 def __init__(self, multi=10):
     QThread.__init__(self)
     self.cond = QWaitCondition()
     self.mutex = QMutex()
     self.count = 0
     self._status = True
     self.multi = multi
     print(multi)
Пример #21
0
 def __init__(self, plugin_id, address, socket):
     QThread.__init__(self)
     self.plugin_id = plugin_id
     self.address = address
     self.udp_socket = socket
     self.finished.connect(self.quit)
     self.wait = QWaitCondition()
     self.mutex = QMutex()
Пример #22
0
 def __init__(self, results, *args, **kwargs):
     super(Thread, self).__init__(*args, **kwargs)
     # results 是从raw_datas查询的所有数据 一般以城市为条件查询
     self.results = results
     self._isPause = True
     self._value = 1
     self.cond = QWaitCondition()
     self.mutex = QMutex()
    def __init__(self, widget):
        QObject.__init__(self)
        self.widget = widget
        self.tracking = self.widget.parent.tracking
        self.pause = False
        self.pauseCond = QWaitCondition()
        self.pauseMutex = QMutex()

        self.cancel = False
Пример #24
0
 def __init__(self, w,h, l,r, parent=None):
     super(DepthRenderThread, self).__init__(parent)
     self.mutex = QMutex()
     self.condition = QWaitCondition()
     self.left = l
     self.right = r
     self.image = QImage(w, h, QImage.Format_Grayscale8)
     self.restart = False
     self.abort = False
Пример #25
0
 def __init__(self, searcher, parent):
     QThread.__init__(self, parent)
     self._searcher = searcher
     self._quit = False
     self._mutex = QMutex()
     self._pending = QWaitCondition()
     self._collector = None
     self._query = None
     self._result = None
    def __init__(self, app_state):
        super().__init__()
        self.mutex = QMutex()
        self.download_paused = False
        self.wait_condition = QWaitCondition()

        self.stateful_downloader = StatefulDownloader(app_state)

        self._has_started = False
    def __init__(self, serial, write_queue: queue.Queue):

        QThread.__init__(self)

        self.cond = QWaitCondition()
        self.mutex = QMutex()
        self._status = False
        self.serial = serial
        self.write_queue = write_queue
Пример #28
0
    def __init__(self, parent=None):
        super(BackgroundThread, self).__init__(parent)

        self._mutex = QMutex()
        self._condition = QWaitCondition()

        self._activating = False
        self._input = None
        # when program is closed
        self._abort = False
Пример #29
0
    def __init__(self, parent=None):
        super(SerialThread, self).__init__(parent)
        self.port = serial_port()
        self.ser = serial.Serial()
        self.port_check()
        self.port_open()
        self._isPause = False

        self.cond = QWaitCondition()
        self.mutex = QMutex()
Пример #30
0
    def __init__(self):
        super().__init__()
        self._mutex = QMutex()
        self._abort = False
        self._condition = QWaitCondition()
        self.cur_img = None

        # load model and default graph
        self.classifier = keras.models.load_model('resnet_512.h5')
        self.graph = tf.get_default_graph()  # REALLY IMPORTANT