本文整理汇总了Python中scallop.i18n._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, transaction_id, parent):
super(TransactionWindow, self).__init__()
self.tx_id = str(transaction_id)
self.parent = parent
self.setModal(True)
self.resize(200,100)
self.setWindowTitle(_("Transaction successfully sent"))
self.layout = QGridLayout(self)
history_label = "%s\n%s" % (_("Your transaction has been sent."), _("Please enter a label for this transaction for future reference."))
self.layout.addWidget(QLabel(history_label))
self.label_edit = QLineEdit()
self.label_edit.setPlaceholderText(_("Transaction label"))
self.label_edit.setObjectName("label_input")
self.label_edit.setAttribute(Qt.WA_MacShowFocusRect, 0)
self.label_edit.setFocusPolicy(Qt.ClickFocus)
self.layout.addWidget(self.label_edit)
self.save_button = QPushButton(_("Save"))
self.layout.addWidget(self.save_button)
self.save_button.clicked.connect(self.set_label)
self.exec_()
示例2: mouseReleaseEvent
def mouseReleaseEvent(self, event):
dialog = QDialog(self)
dialog.setWindowTitle(_('Electrum update'))
dialog.setModal(1)
main_layout = QGridLayout()
main_layout.addWidget(QLabel(_("A new version of Electrum is available:")+" " + self.latest_version), 0,0,1,3)
ignore_version = QPushButton(_("Ignore this version"))
ignore_version.clicked.connect(self.ignore_this_version)
ignore_all_versions = QPushButton(_("Ignore all versions"))
ignore_all_versions.clicked.connect(self.ignore_all_version)
open_website = QPushButton(_("Goto download page"))
open_website.clicked.connect(self.open_website)
main_layout.addWidget(ignore_version, 1, 0)
main_layout.addWidget(ignore_all_versions, 1, 1)
main_layout.addWidget(open_website, 1, 2)
dialog.setLayout(main_layout)
self.dialog = dialog
if not dialog.exec_(): return
示例3: qr_input
def qr_input(self):
from scallop import qrscanner
try:
data = qrscanner.scan_qr(self.win.config)
except BaseException, e:
QMessageBox.warning(self, _('Error'), _(e), _('OK'))
return ""
示例4: build_tray_menu
def build_tray_menu(self):
m = QMenu()
m.addAction(_("Show/Hide"), self.show_or_hide)
m.addAction(_("Dark/Light"), self.toggle_tray_icon)
m.addSeparator()
m.addAction(_("Exit Electrum"), self.close)
self.tray.setContextMenu(m)
示例5: context_menu
def context_menu(self):
view_menu = QMenu()
themes_menu = view_menu.addMenu(_("&Themes"))
selected_theme = self.actuator.selected_theme()
theme_group = QActionGroup(self)
for theme_name in self.actuator.theme_names():
theme_action = themes_menu.addAction(theme_name)
theme_action.setCheckable(True)
if selected_theme == theme_name:
theme_action.setChecked(True)
class SelectThemeFunctor:
def __init__(self, theme_name, toggle_theme):
self.theme_name = theme_name
self.toggle_theme = toggle_theme
def __call__(self, checked):
if checked:
self.toggle_theme(self.theme_name)
delegate = SelectThemeFunctor(theme_name, self.toggle_theme)
theme_action.toggled.connect(delegate)
theme_group.addAction(theme_action)
view_menu.addSeparator()
show_receiving = view_menu.addAction(_("Show Receiving addresses"))
show_receiving.setCheckable(True)
show_receiving.toggled.connect(self.toggle_receiving_layout)
show_receiving.setChecked(self.config.get("gui_show_receiving",False))
show_history = view_menu.addAction(_("Show History"))
show_history.setCheckable(True)
show_history.toggled.connect(self.show_history)
show_history.setChecked(self.config.get("gui_show_history",False))
return view_menu
示例6: before_send
def before_send(self):
'''
Change URL to address before making a send.
IMPORTANT:
return False to continue execution of the send
return True to stop execution of the send
'''
if self.win.payto_e.is_multiline(): # only supports single line entries atm
return False
if self.win.payto_e.is_pr:
return
payto_e = str(self.win.payto_e.toPlainText())
regex = re.compile(r'^([^\s]+) <([A-Za-z0-9]+)>') # only do that for converted addresses
try:
(url, address) = regex.search(payto_e).groups()
except AttributeError:
return False
if not self.validated:
msgBox = QMessageBox()
msgBox.setText(_('WARNING: the address ' + address + ' could not be validated via an additional security check, DNSSEC, and thus may not be correct.'))
msgBox.setInformativeText(_('Do you wish to continue?'))
msgBox.setStandardButtons(QMessageBox.Cancel | QMessageBox.Ok)
msgBox.setDefaultButton(QMessageBox.Cancel)
reply = msgBox.exec_()
if reply != QMessageBox.Ok:
return True
return False
示例7: load_wallet
def load_wallet(self, wallet):
if self.btchip_is_connected():
if not self.wallet.check_proper_device():
QMessageBox.information(self.window, _('Error'), _("This wallet does not match your BTChip device"), _('OK'))
self.wallet.force_watching_only = True
else:
QMessageBox.information(self.window, _('Error'), _("BTChip device not detected.\nContinuing in watching-only mode."), _('OK'))
self.wallet.force_watching_only = True
示例8: verify_seed
def verify_seed(self, seed, sid, func=None):
r = self.enter_seed_dialog(MSG_VERIFY_SEED, sid, func)
if not r:
return
if prepare_seed(r) != prepare_seed(seed):
QMessageBox.warning(None, _('Error'), _('Incorrect seed'), _('OK'))
return False
else:
return True
示例9: give_error
def give_error(self, message, clear_client = False):
if not self.signing:
QMessageBox.warning(QDialog(), _('Warning'), _(message), _('OK'))
else:
self.signing = False
if clear_client and self.client is not None:
self.client.bad = True
self.device_checked = False
raise Exception(message)
示例10: __init__
def __init__(self, win, text=""):
super(ScanQRTextEdit,self).__init__(text)
self.setReadOnly(0)
self.win = win
assert win, "You must pass a window with access to the config to ScanQRTextEdit constructor."
if win:
assert hasattr(win,"config"), "You must pass a window with access to the config to ScanQRTextEdit constructor."
self.addButton(":icons/file.png", self.file_input, _("Read file"))
self.addButton(":icons/qrcode.png", self.qr_input, _("Read QR code"))
run_hook('scan_text_edit', self)
示例11: installwizard_restore
def installwizard_restore(self, wizard, storage):
if storage.get('wallet_type') != 'btchip':
return
wallet = BTChipWallet(storage)
try:
wallet.create_main_account(None)
except BaseException as e:
QMessageBox.information(None, _('Error'), str(e), _('OK'))
return
return wallet
示例12: __init__
def __init__(self, parent, seed, imported_keys):
QDialog.__init__(self, parent)
self.setModal(1)
self.setMinimumWidth(400)
self.setWindowTitle('Electrum' + ' - ' + _('Seed'))
vbox = show_seed_box_msg(seed)
if imported_keys:
vbox.addWidget(QLabel("<b>"+_("WARNING")+":</b> " + _("Your wallet contains imported keys. These keys cannot be recovered from seed.") + "</b><p>"))
vbox.addLayout(Buttons(CloseButton(self)))
self.setLayout(vbox)
示例13: ok_cancel_buttons
def ok_cancel_buttons(dialog):
row_layout = QHBoxLayout()
row_layout.addStretch(1)
ok_button = QPushButton(_("OK"))
row_layout.addWidget(ok_button)
ok_button.clicked.connect(dialog.accept)
cancel_button = QPushButton(_("Cancel"))
row_layout.addWidget(cancel_button)
cancel_button.clicked.connect(dialog.reject)
return row_layout
示例14: append
def append(self, address, amount, date):
if address is None:
address = _("Unknown")
if amount is None:
amount = _("Unknown")
if date is None:
date = _("Unknown")
item = QTreeWidgetItem([amount, address, date])
if float(amount) < 0:
item.setForeground(0, QBrush(QColor("#BC1E1E")))
self.insertTopLevelItem(0, item)
示例15: __init__
def __init__(self, owner=None):
self.owner = owner
self.editing = False
QTreeWidget.__init__(self, owner)
self.setColumnCount(3)
self.setHeaderLabels([_("Address"), _("Label"), _("Used")])
self.setIndentation(0)
self.hide_used = True
self.setColumnHidden(2, True)