Python PyQt5.QtCore.Qt.TextSelectableByMouse() Examples

The following are 5 code examples of PyQt5.QtCore.Qt.TextSelectableByMouse(). 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 also want to check out all available functions/classes of the module PyQt5.QtCore.Qt , or try the search function .
Example #1
Source File: player.py    From MusicBox with MIT License 5 votes vote down vote up
def __init__(self, myTime, lyric, myOrder, signal, parent=None):
        super(_LyricLabel, self).__init__(lyric)
        self.setObjectName('lyric')
        self.parent = parent
        self.myTime = myTime[:myTime.rfind('.')]
        self.myLyric = lyric
        self.myOrder = myOrder

        signal.connect(self.lightMe)
        
        self.setMinimumHeight(40)

        # 设置为可复制状态。
        self.setTextInteractionFlags(Qt.TextSelectableByMouse) 
Example #2
Source File: table.py    From FeelUOwn with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent=parent)

        self.setContentsMargins(30, 15, 30, 10)
        self.setWordWrap(True)
        self.setTextFormat(Qt.RichText)
        self.setTextInteractionFlags(Qt.TextSelectableByMouse) 
Example #3
Source File: hue_ui.py    From hue-plus with GNU General Public License v3.0 5 votes vote down vote up
def excepthook(excType, excValue, tracebackobj):
    """Rewritten "excepthook" function, to display a message box with details about the exception.
    @param excType exception type
    @param excValue exception value
    @param tracebackobj traceback object
    """
    separator = '-' * 40
    notice = "An unhandled exception has occurred\n"

    tbinfofile = io.StringIO()
    traceback.print_tb(tracebackobj, None, tbinfofile)
    tbinfofile.seek(0)
    tbinfo = tbinfofile.read()
    errmsg = '%s: \n%s' % (str(excType), str(excValue))
    sections = [separator, errmsg, separator, tbinfo]
    msg = '\n'.join(sections)

    # Create a QMessagebox
    error_box = QMessageBox()

    error_box.setText(str(notice)+str(msg))
    error_box.setWindowTitle("Hue-plus - unhandled exception")
    error_box.setIcon(QMessageBox.Critical)
    error_box.setStandardButtons(QMessageBox.Ok)
    error_box.setTextInteractionFlags(Qt.TextSelectableByMouse)

    # Show the window
    error_box.exec_()
    sys.exit(1) 
Example #4
Source File: masternode_details.py    From dash-masternode-tool with MIT License 4 votes vote down vote up
def get_collateral_tx_address_thread(self, ctrl: CtrlObject,
                                         bip44_wallet: Bip44Wallet,
                                         check_break_scanning_ext: Callable[[], bool],
                                         src_address: str):
        utxos = []
        break_scanning = False
        txes_cnt = 0
        msg = 'Scanning wallet transactions for 1000 Dash UTXOs.<br>' \
              'This may take a while (<a href="break">break</a>)....'
        ctrl.dlg_config_fun(dlg_title="Scanning wallet", show_progress_bar=False)
        ctrl.display_msg_fun(msg)

        def check_break_scanning():
            nonlocal break_scanning
            if break_scanning:
                # stop the scanning process if the dialog finishes or the address/bip32path has been found
                raise BreakFetchTransactionsException()
            if check_break_scanning_ext is not None and check_break_scanning_ext():
                raise BreakFetchTransactionsException()

        def fetch_txes_feeback(tx_cnt: int):
            nonlocal msg, txes_cnt
            txes_cnt += tx_cnt
            ctrl.display_msg_fun(msg + '<br><br>' + 'Number of transactions fetched so far: ' + str(txes_cnt))

        def on_msg_link_activated(link: str):
            nonlocal break_scanning
            if link == 'break':
                break_scanning = True

        lbl = ctrl.get_msg_label_control()
        if lbl:
            def set():
                lbl.setOpenExternalLinks(False)
                lbl.setTextInteractionFlags(lbl.textInteractionFlags() & ~Qt.TextSelectableByMouse)
                lbl.linkActivated.connect(on_msg_link_activated)
                lbl.repaint()

            WndUtils.call_in_main_thread(set)

        try:
            bip44_wallet.on_fetch_account_txs_feedback = fetch_txes_feeback
            if src_address:
                # limit transactions only to the specific address
                # addr = bip44_wallet.get_address_item(src_address, False)
                addr = bip44_wallet.scan_wallet_for_address(src_address, check_break_scanning,
                                                            feedback_fun=fetch_txes_feeback)

                if addr and addr.tree_id == bip44_wallet.get_tree_id():
                    bip44_wallet.fetch_addresses_txs([addr], check_break_scanning)
                    for utxo in bip44_wallet.list_utxos_for_addresses([addr.id], filter_by_satoshis=int(1e11)):
                        utxos.append(utxo)

            if not utxos:
                bip44_wallet.fetch_all_accounts_txs(check_break_scanning)
                for utxo in bip44_wallet.list_utxos_for_account(account_id=None, filter_by_satoshis=int(1e11)):
                    utxos.append(utxo)

        except BreakFetchTransactionsException:
            return None
        return utxos 
Example #5
Source File: bip44_wallet.py    From dash-masternode-tool with MIT License 4 votes vote down vote up
def get_tx_address_thread(ctrl: CtrlObject, addresses: List[str], bip44_wallet: Bip44Wallet) -> \
        List[Optional[Bip44AddressType]]:
    ret_addresses = []
    break_scanning = False
    txes_cnt = 0
    msg = 'Looking for a BIP32 path of the Dash address related to the masternode collateral.<br>' \
          'This may take a while (<a href="break">break</a>)....'
    ctrl.dlg_config_fun(dlg_title="Looking for address", show_progress_bar=False)
    ctrl.display_msg_fun(msg)

    def check_break_scanning():
        nonlocal break_scanning
        if break_scanning:
            # stop the scanning process if the dialog finishes or the address/bip32path has been found
            raise BreakFetchTransactionsException()

    def fetch_txes_feeback(tx_cnt: int):
        nonlocal msg, txes_cnt
        txes_cnt += tx_cnt
        ctrl.display_msg_fun(msg + '<br><br>' + 'Number of transactions fetched so far: ' + str(txes_cnt))

    def on_msg_link_activated(link: str):
        nonlocal break_scanning
        if link == 'break':
            break_scanning = True

    lbl = ctrl.get_msg_label_control()
    if lbl:
        def set():
            lbl.setOpenExternalLinks(False)
            lbl.setTextInteractionFlags(lbl.textInteractionFlags() & ~Qt.TextSelectableByMouse)
            lbl.linkActivated.connect(on_msg_link_activated)
            lbl.repaint()
        WndUtils.call_in_main_thread(set)

    # fetch the transactions that involved the addresses stored in the wallet - during this
    # all the used addresses are revealed
    for a in addresses:
        addr = bip44_wallet.scan_wallet_for_address(a, check_break_scanning, fetch_txes_feeback)
        if not addr and break_scanning:
            raise CancelException
        ret_addresses.append(addr)
    return ret_addresses