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


Python i18n._函数代码示例

本文整理汇总了Python中vialectrum.i18n._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_library_not_available_message

 def get_library_not_available_message(self) -> str:
     if hasattr(self, 'libraries_available_message'):
         message = self.libraries_available_message
     else:
         message = _("Missing libraries for {}.").format(self.name)
     message += '\n' + _("Make sure you install it with python3")
     return message
开发者ID:vialectrum,项目名称:vialectrum,代码行数:7,代码来源:plugin.py

示例2: create_menu

 def create_menu(self, position):
     idx = self.indexAt(position)
     item = self.model().itemFromIndex(idx)
     # TODO use siblingAtColumn when min Qt version is >=5.11
     item_addr = self.model().itemFromIndex(idx.sibling(idx.row(), self.Columns.ADDRESS))
     if not item_addr:
         return
     addr = item_addr.text()
     req = self.wallet.receive_requests.get(addr)
     if req is None:
         self.update()
         return
     column = idx.column()
     column_title = self.model().horizontalHeaderItem(column).text()
     column_data = item.text()
     menu = QMenu(self)
     if column != self.Columns.SIGNATURE:
         if column == self.Columns.AMOUNT:
             column_data = column_data.strip()
         menu.addAction(_("Copy {}").format(column_title), lambda: self.parent.app.clipboard().setText(column_data))
     menu.addAction(_("Copy URI"), lambda: self.parent.view_and_paste('URI', '', self.parent.get_request_URI(addr)))
     menu.addAction(_("Save as BIP70 file"), lambda: self.parent.export_payment_request(addr))
     menu.addAction(_("Delete"), lambda: self.parent.delete_payment_request(addr))
     run_hook('receive_list_menu', menu, addr)
     menu.exec_(self.viewport().mapToGlobal(position))
开发者ID:vialectrum,项目名称:vialectrum,代码行数:25,代码来源:request_list.py

示例3: add_cosigner_dialog

 def add_cosigner_dialog(self, run_next, index, is_valid):
     title = _("Add Cosigner") + " %d"%index
     message = ' '.join([
         _('Please enter the master public key (xpub) of your cosigner.'),
         _('Enter their master private key (xprv) if you want to be able to sign for them.')
     ])
     return self.text_input(title, message, is_valid)
开发者ID:vialectrum,项目名称:vialectrum,代码行数:7,代码来源:installwizard.py

示例4: __init__

    def __init__(self, parent):
        super(MatrixDialog, self).__init__(parent)
        self.setWindowTitle(_("Trezor Matrix Recovery"))
        self.num = 9
        self.loop = QEventLoop()

        vbox = QVBoxLayout(self)
        vbox.addWidget(WWLabel(MATRIX_RECOVERY))

        grid = QGridLayout()
        grid.setSpacing(0)
        self.char_buttons = []
        for y in range(3):
            for x in range(3):
                button = QPushButton('?')
                button.clicked.connect(partial(self.process_key, ord('1') + y * 3 + x))
                grid.addWidget(button, 3 - y, x)
                self.char_buttons.append(button)
        vbox.addLayout(grid)

        self.backspace_button = QPushButton("<=")
        self.backspace_button.clicked.connect(partial(self.process_key, Qt.Key_Backspace))
        self.cancel_button = QPushButton(_("Cancel"))
        self.cancel_button.clicked.connect(partial(self.process_key, Qt.Key_Escape))
        buttons = Buttons(self.backspace_button, self.cancel_button)
        vbox.addSpacing(40)
        vbox.addLayout(buttons)
        self.refresh()
        self.show()
开发者ID:vialectrum,项目名称:vialectrum,代码行数:29,代码来源:qt.py

示例5: show_address

 def show_address(self, sequence, txin_type):
     client = self.get_client()
     address_path = self.get_derivation()[2:] + "/%d/%d"%sequence
     self.handler.show_message(_("Showing address ..."))
     segwit = is_segwit_script_type(txin_type)
     segwitNative = txin_type == 'p2wpkh'
     try:
         client.getWalletPublicKey(address_path, showOnScreen=True, segwit=segwit, segwitNative=segwitNative)
     except BTChipException as e:
         if e.sw == 0x6985:  # cancelled by user
             pass
         elif e.sw == 0x6982:
             raise  # pin lock. decorator will catch it
         elif e.sw == 0x6b00:  # hw.1 raises this
             self.handler.show_error('{}\n{}\n{}'.format(
                 _('Error showing address') + ':',
                 e,
                 _('Your device might not have support for this functionality.')))
         else:
             self.logger.exception('')
             self.handler.show_error(e)
     except BaseException as e:
         self.logger.exception('')
         self.handler.show_error(e)
     finally:
         self.handler.finished()
开发者ID:vialectrum,项目名称:vialectrum,代码行数:26,代码来源:ledger.py

示例6: _initialize_device

    def _initialize_device(self, settings: TrezorInitSettings, method, device_id, wizard, handler):
        if method == TIM_RECOVER and settings.recovery_type == RECOVERY_TYPE_SCRAMBLED_WORDS:
            handler.show_error(_(
                "You will be asked to enter 24 words regardless of your "
                "seed's actual length.  If you enter a word incorrectly or "
                "misspell it, you cannot change it or go back - you will need "
                "to start again from the beginning.\n\nSo please enter "
                "the words carefully!"),
                blocking=True)

        devmgr = self.device_manager()
        client = devmgr.client_by_id(device_id)
        if not client:
            raise Exception(_("The device was disconnected."))

        if method == TIM_NEW:
            strength_from_word_count = {12: 128, 18: 192, 24: 256}
            client.reset_device(
                strength=strength_from_word_count[settings.word_count],
                passphrase_protection=settings.passphrase_enabled,
                pin_protection=settings.pin_enabled,
                label=settings.label,
                no_backup=settings.no_backup)
        elif method == TIM_RECOVER:
            client.recover_device(
                recovery_type=settings.recovery_type,
                word_count=settings.word_count,
                passphrase_protection=settings.passphrase_enabled,
                pin_protection=settings.pin_enabled,
                label=settings.label)
            if settings.recovery_type == RECOVERY_TYPE_MATRIX:
                handler.close_matrix_dialog()
        else:
            raise RuntimeError("Unsupported recovery method")
开发者ID:vialectrum,项目名称:vialectrum,代码行数:34,代码来源:trezor.py

示例7: initialize_device

 def initialize_device(self, device_id, wizard, handler):
     # Initialization method
     msg = _("Choose how you want to initialize your {}.\n\n"
             "The first two methods are secure as no secret information "
             "is entered into your computer.\n\n"
             "For the last two methods you input secrets on your keyboard "
             "and upload them to your {}, and so you should "
             "only do those on a computer you know to be trustworthy "
             "and free of malware."
     ).format(self.device, self.device)
     choices = [
         # Must be short as QT doesn't word-wrap radio button text
         (TIM_NEW, _("Let the device generate a completely new seed randomly")),
         (TIM_RECOVER, _("Recover from a seed you have previously written down")),
     ]
     def f(method):
         import threading
         settings = self.request_trezor_init_settings(wizard, method, device_id)
         t = threading.Thread(target=self._initialize_device_safe, args=(settings, method, device_id, wizard, handler))
         t.setDaemon(True)
         t.start()
         exit_code = wizard.loop.exec_()
         if exit_code != 0:
             # this method (initialize_device) was called with the expectation
             # of leaving the device in an initialized state when finishing.
             # signal that this is not the case:
             raise UserCancelled()
     wizard.choice_dialog(title=_('Initialize Device'), message=msg, choices=choices, run_next=f)
开发者ID:vialectrum,项目名称:vialectrum,代码行数:28,代码来源:trezor.py

示例8: make_cypherseed

    def make_cypherseed(self, img, rawnoise, calibration=False, is_seed = True):
        img = img.convertToFormat(QImage.Format_Mono)
        p = QPainter()
        p.begin(img)
        p.setCompositionMode(26) #xor
        p.drawImage(0, 0, rawnoise)
        p.end()
        cypherseed = self.pixelcode_2x2(img)
        cypherseed = QBitmap.fromImage(cypherseed)
        cypherseed = cypherseed.scaled(self.f_size, Qt.KeepAspectRatio)
        cypherseed = self.overlay_marks(cypherseed, True, calibration)

        if not is_seed:
            self.filename_prefix = 'custom_secret_'
            self.was = _('Custom secret')
        else:
            self.filename_prefix = self.wallet_name + '_seed_'
            self.was = self.wallet_name + ' ' + _('seed')
            if self.extension:
                self.ext_warning(self.c_dialog)


        if not calibration:
            self.toPdf(QImage(cypherseed))
            QDesktopServices.openUrl(QUrl.fromLocalFile(self.get_path_to_revealer_file('.pdf')))
            cypherseed.save(self.get_path_to_revealer_file('.png'))
            self.bcrypt(self.c_dialog)
        return cypherseed
开发者ID:vialectrum,项目名称:vialectrum,代码行数:28,代码来源:qt.py

示例9: toggle_passphrase

 def toggle_passphrase(self):
     if self.features.passphrase_protection:
         self.msg = _("Confirm on your {} device to disable passphrases")
     else:
         self.msg = _("Confirm on your {} device to enable passphrases")
     enabled = not self.features.passphrase_protection
     self.apply_settings(use_passphrase=enabled)
开发者ID:vialectrum,项目名称:vialectrum,代码行数:7,代码来源:clientbase.py

示例10: set_pin

 def set_pin(self, remove):
     if remove:
         self.msg = _("Confirm on your {} device to disable PIN protection")
     elif self.features.pin_protection:
         self.msg = _("Confirm on your {} device to change your PIN")
     else:
         self.msg = _("Confirm on your {} device to set a PIN")
     self.change_pin(remove)
开发者ID:vialectrum,项目名称:vialectrum,代码行数:8,代码来源:clientbase.py

示例11: create_password_layout

 def create_password_layout(self, wallet, is_encrypted, OK_button):
     if not is_encrypted:
         msg = _('Your wallet file is NOT encrypted.')
     else:
         msg = _('Your wallet file is encrypted.')
     msg += '\n' + _('Note: If you enable this setting, you will need your hardware device to open your wallet.')
     msg += '\n' + _('Use this dialog to toggle encryption.')
     self.playout = PasswordLayoutForHW(msg)
开发者ID:vialectrum,项目名称:vialectrum,代码行数:8,代码来源:password_dialog.py

示例12: setup_device

 def setup_device(self, device_info, wizard, purpose):
     devmgr = self.device_manager()
     device_id = device_info.device.id_
     client = devmgr.client_by_id(device_id)
     if client is None:
         raise UserFacingException(_('Failed to create a client for this device.') + '\n' +
                                   _('Make sure it is in the correct state.'))
     client.handler = self.create_handler(wizard)
开发者ID:vialectrum,项目名称:vialectrum,代码行数:8,代码来源:coldcard.py

示例13: restore_seed_dialog

 def restore_seed_dialog(self, run_next, test):
     options = []
     if self.opt_ext:
         options.append('ext')
     if self.opt_bip39:
         options.append('bip39')
     title = _('Enter Seed')
     message = _('Please enter your seed phrase in order to restore your wallet.')
     return self.seed_input(title, message, test, options)
开发者ID:vialectrum,项目名称:vialectrum,代码行数:9,代码来源:installwizard.py

示例14: setup_device

 def setup_device(self, device_info, wizard, purpose):
     devmgr = self.device_manager()
     device_id = device_info.device.id_
     client = devmgr.client_by_id(device_id)
     if client is None:
         raise UserFacingException(_('Failed to create a client for this device.') + '\n' +
                                   _('Make sure it is in the correct state.'))
     client.handler = self.create_handler(wizard)
     client.get_xpub("m/44'/2'", 'standard') # TODO replace by direct derivation once Nano S > 1.1
开发者ID:vialectrum,项目名称:vialectrum,代码行数:9,代码来源:ledger.py

示例15: bcrypt

 def bcrypt(self, dialog):
     self.rawnoise = False
     version = self.versioned_seed.version
     code_id = self.versioned_seed.checksum
     dialog.show_message(''.join([_("{} encrypted for Revealer {}_{} saved as PNG and PDF at: ").format(self.was, version, code_id),
                                  "<b>", self.get_path_to_revealer_file(), "</b>", "<br/>",
                                  "<br/>", "<b>", _("Always check your backups.")]),
                         rich_text=True)
     dialog.close()
开发者ID:vialectrum,项目名称:vialectrum,代码行数:9,代码来源:qt.py


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