Python PyQt5.QtCore.QThread.__init__() Examples

The following are 30 code examples for showing how to use PyQt5.QtCore.QThread.__init__(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module PyQt5.QtCore.QThread , or try the search function .

Example 1
Project: raspiblitz   Author: rootzoll   File: main.py    License: MIT License 6 votes vote down vote up
def create_new_invoice(self, memo="Pay to RaspiBlitz", amt=0):
        if IS_DEV_ENV:
            # Fake an invoice for dev
            class FakeAddInvoiceResponse(object):
                def __init__(self):
                    self.add_index = 145
                    self.payment_request = "lnbc47110n1pwmfqcdpp5k55n5erv60mg6u4c8s3qggnw3dsn267e80ypjxxp6gj593" \
                                           "p3c25sdq9vehk7cqzpgprn0ytv6ukxc2vclgag38nmsmlyggmd4zand9qay2l3gc5at" \
                                           "ecxjynydyzhvxsysam9d46y5lgezh2nkufvn23403t3tz3lyhd070dgq625xp0"
                    self.r_hash = b'\xf9\xe3(\xf5\x84\xdad\x88\xe4%\xa7\x1c\x95\xbe\x8baJ\x1c\xc1\xad*\xed\xc8' \
                                  b'\x158\x13\xdf\xffF\x9c\x95\x84'

            new_invoice = FakeAddInvoiceResponse()

        else:
            with InvoiceStub(network=self.rb_cfg.network, chain=self.rb_cfg.chain) as stub_invoice:
                new_invoice = create_invoice(stub_invoice, memo, amt)

        log.info("#{}: {}".format(new_invoice.add_index, new_invoice.payment_request))

        invoice_r_hash_hex_str = convert_r_hash_hex_bytes(new_invoice.r_hash)
        self.invoice_to_check = invoice_r_hash_hex_str
        log.info("noting down for checking: {}".format(invoice_r_hash_hex_str))

        return new_invoice 
Example 2
Project: dunya-desktop   Author: MTG   File: query.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        QThread.__init__(self, parent)
        self.stopped = False

        self.mid = None
        self.uid = None
        self.fid = None
        self.cmbid = None
        self.ambid = None
        self.iid = None

        self.parent = self.parent()
        self.fetching_completed.connect(self.parent.work_received)
        self.combobox_results.connect(self.parent.change_combobox_backgrounds)
        self.progress_number.connect(self.parent.set_progress_number)
        self.query_completed.connect(self.parent.query_finished) 
Example 3
Project: dash-masternode-tool   Author: Bertrand256   File: dashd_intf.py    License: MIT License 6 votes vote down vote up
def __init__(self):
        AttrsProtected.__init__(self)
        self.ident = None
        self.status = None
        self.payee = None
        self.lastseen = None
        self.activeseconds = None
        self.lastpaidtime = None
        self.lastpaidblock = None
        self.ip = None
        self.protx_hash: Optional[str] = None
        self.registered_height: Optional[int] = None
        self.db_id = None
        self.marker = None
        self.modified = False
        self.monitor_changes = False
        self.queue_position = None
        self.set_attr_protection() 
Example 4
Project: guppy-proxy   Author: roglew   File: proxy.py    License: MIT License 6 votes vote down vote up
def __init__(self, url):
        parsed = urlparse(url)
        if url is not None:
            parsed = urlparse(url)
            self.scheme = parsed.scheme
            self.netloc = parsed.netloc
            self.path = parsed.path
            self.params = parsed.params
            self.query = parsed.query
            self.fragment = parsed.fragment
        else:
            self.scheme = ""
            self.netloc = ""
            self.path = "/"
            self.params = ""
            self.query = ""
            self.fragment = "" 
Example 5
Project: guppy-proxy   Author: roglew   File: proxy.py    License: MIT License 6 votes vote down vote up
def __init__(self, status_code=200, reason="OK", proto_major=1, proto_minor=1,
                 headers=None, body=bytes(), db_id="", headers_only=False, storage_id=0):
        self.status_code = status_code
        self.reason = reason
        self.proto_major = proto_major
        self.proto_minor = proto_minor

        self.headers = Headers()
        if headers is not None:
            for k, vs in headers.items():
                for v in vs:
                    self.headers.add(k, v)

        self.headers_only = headers_only
        self._body = bytes()
        if not headers_only:
            self.body = body

        self.unmangled = None
        self.db_id = db_id
        self.storage = storage_id 
Example 6
Project: guppy-proxy   Author: roglew   File: proxy.py    License: MIT License 6 votes vote down vote up
def __init__(self, kind="", addr=""):
        self.connid = ProxyConnection.next_id
        ProxyConnection.next_id += 1
        self.sbuf = None
        self.buf = bytes()
        self.parent_client = None
        self.debug = False
        self.is_interactive = False
        self.closed = True
        self.message_lock = threading.Lock()
        self.kind = None
        self.addr = None
        self.int_thread = None

        if kind.lower() == "tcp":
            tcpaddr, port = addr.rsplit(":", 1)
            self.connect_tcp(tcpaddr, int(port))
        elif kind.lower() == "unix":
            self.connect_unix(addr) 
Example 7
Project: pyparrot   Author: amymcgovern   File: DroneVisionGUI.py    License: MIT License 6 votes vote down vote up
def __init__(self, vlc_player, drone_gui):
        """
        Create a UI window for the VLC player
        :param vlc_player: the VLC player (created outside the function)
        """
        QMainWindow.__init__(self)
        self.setWindowTitle("VLC Drone Video Player")

        # save the media player
        self.mediaplayer = vlc_player

        # need a reference to the main drone vision class
        self.drone_vision = drone_gui

        # create the GUI
        self.createUI() 
Example 8
Project: raspiblitz   Author: rootzoll   File: file_watcher.py    License: MIT License 5 votes vote down vote up
def __init__(self, dir_names, file_names, *args, **kwargs):
        QThread.__init__(self, *args, **kwargs)
        self.dir_names = dir_names
        self.file_names = file_names 
Example 9
Project: raspiblitz   Author: rootzoll   File: main.py    License: MIT License 5 votes vote down vote up
def __init__(self, event, interval=0.5, *args, **kwargs):
        QThread.__init__(self, *args, **kwargs)

        self.stopped = event
        self.interval = interval
        # atomic (?!) counter
        self.ctr = itertools.count() 
Example 10
Project: raspiblitz   Author: rootzoll   File: main.py    License: MIT License 5 votes vote down vote up
def __init__(self):
        QThread.__init__(self)
        self.data = None 
Example 11
Project: dunya-desktop   Author: MTG   File: utilities.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, docid, step, n_progress):
        QObject.__init__(self)

        self.docid = docid
        self.step = step
        self.n_progress = n_progress 
Example 12
Project: dunya-desktop   Author: MTG   File: utilities.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, queue, callback, parent=None):
        QThread.__init__(self, parent)
        self.queue = queue
        self.step_completed.connect(callback) 
Example 13
Project: dunya-desktop   Author: MTG   File: query.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, work):
        QObject.__init__(self)
        self.work = work 
Example 14
Project: dunya-desktop   Author: MTG   File: query.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, results):
        QObject.__init__(self)
        self.results = results 
Example 15
Project: dunya-desktop   Author: MTG   File: query.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, status):
        QObject.__init__(self)
        self.status = status 
Example 16
Project: persepolis   Author: persepolisdm   File: browser_plugin_queue.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, dict):
        QThread.__init__(self)
        self.dict = dict 
Example 17
Project: persepolis   Author: persepolisdm   File: progress.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, gid, password=None):
        QThread.__init__(self)
        self.gid = gid
        self.password = password
        self.parent = parent 
Example 18
Project: persepolis   Author: persepolisdm   File: windows_notification.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, time):
        QThread.__init__(self)
        self.time = float(int(time)/1000) 
Example 19
Project: persepolis   Author: persepolisdm   File: windows_notification.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, time, text1, text2, persepolis_setting):
        super().__init__(parent, persepolis_setting)

        # run timer and close notification after time is up.
        timer = TimerThread(time)
        parent.threadPool.append(timer)
        parent.threadPool[len(parent.threadPool) - 1].start()
        parent.threadPool[len(parent.threadPool) - 1].TIMEISUP.connect(self.close)

        # set text to the labels
        self.label1.setText(str(text1))
        self.label2.setText(str(text2)) 
Example 20
Project: persepolis   Author: persepolisdm   File: video_finder_progress.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, category, password=None):
        QThread.__init__(self)
        self.category = category
        self.password = password
        self.parent = parent 
Example 21
Project: persepolis   Author: persepolisdm   File: text_queue.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, dict):
        QThread.__init__(self)
        self.dict = dict 
Example 22
Project: dash-masternode-tool   Author: Bertrand256   File: thread_fun_dlg.py    License: MIT License 5 votes vote down vote up
def __init__(self):
        self.display_msg_fun: Callable[[str], None] = None
        self.set_progress_value_fun: Callable[[int], None] = None
        self.dlg_config_fun: Callable[[bool, bool, str, int],None] = None
        self.show_dialog_fun: Callable[[bool], None] = None
        self.finish: bool = False
        self.__msg_label = None 
Example 23
Project: dash-masternode-tool   Author: Bertrand256   File: thread_fun_dlg.py    License: MIT License 5 votes vote down vote up
def __init__(self, dialog, worker_fun, worker_fun_args, display_msg_signal, set_progress_value_signal,
                 dlg_config_signal, show_dialog_signal):
        """
        Constructor.
        :param worker_fun: external function which will be executed from inside a thread 
        :param worker_fun_args: dictionary passed to worker_fun as it's argument's
        :param display_msg_signal: signal from owner's dialog to display text
        :param set_progress_value_signal: signal from owner's dialog to set a progressbar's value
        :param dlg_config_signal: signal from owner's dialog to configure dialog
        """
        super(WorkerDlgThread, self).__init__()
        self.dialog = dialog
        self.worker_fun = worker_fun
        self.worker_fun_args = worker_fun_args
        self.display_msg_signal = display_msg_signal
        self.set_progress_value_signal = set_progress_value_signal
        self.show_dialog_signal = show_dialog_signal
        self.dlg_config_signal = dlg_config_signal

        # prepare control object passed to a thread function
        self.ctrl_obj = CtrlObject()
        self.ctrl_obj.display_msg_fun = self.display_msg
        self.ctrl_obj.msg_link_activated_callback = None
        self.ctrl_obj.set_progress_value_fun = self.set_progress_value
        self.ctrl_obj.dlg_config_fun = self.dlg_config
        self.ctrl_obj.show_dialog_fun = self.show_dialog
        self.ctrl_obj.finish = False 
Example 24
Project: dash-masternode-tool   Author: Bertrand256   File: thread_fun_dlg.py    License: MIT License 5 votes vote down vote up
def __init__(self, parent, worker_fun, worker_fun_args):
        """
        """
        QThread.__init__(self, parent=parent)
        self.worker_fun = worker_fun
        self.worker_fun_args = worker_fun_args

        # prepare control object passed to external thread function
        self.ctrl_obj = CtrlObject()
        self.ctrl_obj.finish = False
        self.worker_result = None
        self.worker_exception = None 
Example 25
Project: dash-masternode-tool   Author: Bertrand256   File: dashd_intf.py    License: MIT License 5 votes vote down vote up
def __init__(self, local_port, remote_ip, remote_port, transport, ready_event,
                 on_connection_broken_callback=None, on_finish_thread_callback=None):
        QThread.__init__(self)
        self.local_port = local_port
        self.remote_ip = remote_ip
        self.remote_port = remote_port
        self.transport = transport
        self.ready_event = ready_event
        self.forward_server = None
        self.on_connection_broken_callback = on_connection_broken_callback
        self.on_finish_thread_callback = on_finish_thread_callback
        self.setObjectName('SSHTunnelThread') 
Example 26
Project: dash-masternode-tool   Author: Bertrand256   File: dashd_intf.py    License: MIT License 5 votes vote down vote up
def __init__(self, host, port, username, on_connection_broken_callback=None, auth_method: str = 'password',
                 private_key_path: str = ''):
        self.host = host
        self.port = port
        self.username = username
        self.ssh = None
        self.channel = None
        self.fw_channel = None
        self.connected = False
        self.connection_broken = False
        self.ssh_thread = None
        self.auth_method = auth_method  #  'any', 'password', 'key_pair', 'ssh_agent'
        self.private_key_path = private_key_path
        self.on_connection_broken_callback = on_connection_broken_callback 
Example 27
Project: dash-masternode-tool   Author: Bertrand256   File: dashd_intf.py    License: MIT License 5 votes vote down vote up
def __init__(self, parent_exception):
        JSONRPCException.__init__(self, parent_exception.error)
        self.message = self.message + \
                       '\n\nMake sure the dash daemon you are connecting to has the following options enabled in ' \
                       'its dash.conf:\n\n' + \
                       'addressindex=1\n' + \
                       'spentindex=1\n' + \
                       'timestampindex=1\n' + \
                       'txindex=1\n\n' + \
                       'Changing these parameters requires to execute dashd with "-reindex" option (linux: ./dashd -reindex)' 
Example 28
Project: dash-masternode-tool   Author: Bertrand256   File: dashd_intf.py    License: MIT License 5 votes vote down vote up
def __init__(self, window,
                 on_connection_initiated_callback=None,
                 on_connection_failed_callback=None,
                 on_connection_successful_callback=None,
                 on_connection_disconnected_callback=None):
        WndUtils.__init__(self, app_config=None)

        self.app_config = None
        self.db_intf = None
        self.connections = []
        self.cur_conn_index = 0
        self.cur_conn_def: Optional['DashNetworkConnectionCfg'] = None

        # below is the connection with which particular RPC call has started; if connection is switched because of
        # problems with some nodes, switching stops if we close round and return to the starting connection
        self.starting_conn = None

        self.masternodes = []  # cached list of all masternodes (Masternode object)
        self.masternodes_by_ident = {}
        self.masternodes_by_ip_port = {}
        self.protx_by_mn_ident: Dict[str, Dict] = {}

        self.ssh = None
        self.window = window
        self.active = False
        self.rpc_url = None
        self.proxy = None
        self.http_conn = None  # HTTPConnection object passed to the AuthServiceProxy (for convinient connection reset)
        self.on_connection_initiated_callback = on_connection_initiated_callback
        self.on_connection_failed_callback = on_connection_failed_callback
        self.on_connection_successful_callback = on_connection_successful_callback
        self.on_connection_disconnected_callback = on_connection_disconnected_callback
        self.last_error_message = None
        self.mempool_txes:Dict[str, Dict] = {}
        self.http_lock = threading.RLock() 
Example 29
Project: Blender-Version-Manager   Author: DotBow   File: version_layout.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent):
        QThread.__init__(self)
        self.parent = parent 
Example 30
Project: Blender-Version-Manager   Author: DotBow   File: build_loader.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, url, strptime):
        QThread.__init__(self)
        self.parent = parent
        self.url = url
        self.strptime = strptime
        self.root_folder = self.parent.settings.value('root_folder')
        self.is_running = False
        self.platform = get_platform()