本文整理汇总了Python中anki.lang._属性的典型用法代码示例。如果您正苦于以下问题:Python lang._属性的具体用法?Python lang._怎么用?Python lang._使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类anki.lang
的用法示例。
在下文中一共展示了lang._属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from anki import lang [as 别名]
# 或者: from anki.lang import _ [as 别名]
def __init__(self, mw, note):
QDialog.__init__(self, None, Qt.Window)
mw.setupDialogGC(self)
self.mw = mw
self.form = aqt.forms.editcurrent.Ui_Dialog()
self.form.setupUi(self)
self.form.buttonBox.button(QDialogButtonBox.Close).setShortcut(QKeySequence("Ctrl+Return"))
self.editor = aqt.editor.Editor(self.mw, self.form.fieldsArea, self)
self.setWindowTitle(_("Edit Note"))
self.setMinimumHeight(400)
self.setMinimumWidth(500)
self.resize(500, 850)
self.editor.setNote(note, focusTo=0)
addHook("reset", self.onReset)
self.mw.requireReset()
self.show()
self.mw.progress.timer(100, lambda: self.editor.web.setFocus(), False)
示例2: load_menu
# 需要导入模块: from anki import lang [as 别名]
# 或者: from anki.lang import _ [as 别名]
def load_menu():
for k, v in PHONETIC_TARGETS.items():
add_menu_item(
'Chinese::Phonetics',
k,
partial(config.update, {'target': v}),
checkable=True,
checked=bool(config['target'] == v),
)
for k, v in SPEECH_ENGINES.items():
add_menu_item(
'Chinese::Speech Engine',
k,
partial(config.update, {'speech': v}),
checkable=True,
checked=bool(config['speech'] == v),
)
add_menu('Chinese::Bulk Fill')
add_menu_item('Chinese::Bulk Fill', _('Hanzi'), bulk_fill_hanzi)
add_menu_item(
'Chinese::Bulk Fill', _('Transcription'), bulk_fill_transcript
)
add_menu_item('Chinese::Bulk Fill', _('Definitions'), bulk_fill_defs)
add_menu_item('Chinese::Bulk Fill', _('Classifiers'), bulk_fill_classifiers)
add_menu_item('Chinese::Bulk Fill', _('Sound'), bulk_fill_sound)
add_menu_item('Chinese::Bulk Fill', _('Silhouette'), bulk_fill_silhouette)
add_menu_item('Chinese::Bulk Fill', _('All'), bulk_fill_all)
add_menu('Chinese::Help')
add_menu_item(
'Chinese::Help',
_('Report a bug or make a feature request'),
lambda: openLink(CSR_GITHUB_URL + '/issues'),
)
add_menu_item('Chinese::Help', _('About...'), showAbout)
示例3: _
# 需要导入模块: from anki import lang [as 别名]
# 或者: from anki.lang import _ [as 别名]
def _(text):
try:
return trans.gettext(text)
except Exception as e:
print(e)
return fallback_translation(text)
示例4: alert
# 需要导入模块: from anki import lang [as 别名]
# 或者: from anki.lang import _ [as 别名]
def alert(info):
showWarning(_(info))
示例5: snake_case
# 需要导入模块: from anki import lang [as 别名]
# 或者: from anki.lang import _ [as 别名]
def snake_case(camel_case):
return re.sub('(?!^)([A-Z]+)', r'_\1', camel_case).lower()
示例6: exportRules
# 需要导入模块: from anki import lang [as 别名]
# 或者: from anki.lang import _ [as 别名]
def exportRules(self):
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
fileName, _ = QFileDialog.getSaveFileName(self,"Save Overwrite Rules List", 'overwriterules.json', 'JSON Files (*.json)', options=options)
if fileName:
self.ueMng.exportUEList(fileName)
示例7: minimumSize
# 需要导入模块: from anki import lang [as 别名]
# 或者: from anki.lang import _ [as 别名]
def minimumSize(self):
size = QSize()
for item in self.itemList:
size = size.expandedTo(item.minimumSize())
margin, _, _, _ = self.getContentsMargins()
size += QSize(2 * margin, 2 * margin)
return size
示例8: column_header
# 需要导入模块: from anki import lang [as 别名]
# 或者: from anki.lang import _ [as 别名]
def column_header(heading, colpos):
return f"""
<th class = "count ui-draggable ui-draggable-handle ui-droppable" colpos = "{colpos}">
<a onclick = "return pycmd('optsColumn:{colpos}');">
{_(heading)}
</a>
</th>"""
示例9: columnOptions
# 需要导入模块: from anki import lang [as 别名]
# 或者: from anki.lang import _ [as 别名]
def columnOptions(self, colpos):
m = QMenu(self.mw)
a = m.addAction(_("Delete"))
a.triggered.connect(lambda: deleteColumn(self, colpos))
m.exec_(QCursor.pos())
示例10: deleteColumn
# 需要导入模块: from anki import lang [as 别名]
# 或者: from anki.lang import _ [as 别名]
def deleteColumn(self, colpos):
if not askUser(_("""Are you sure you wish to delete this column ?""")):
return
colpos = int(colpos)
print("They are sure.")
columns = getUserOption("columns")
column = columns[colpos]
column["present"] = False
writeConfig()
self.show()
示例11: _line_now
# 需要导入模块: from anki import lang [as 别名]
# 或者: from anki.lang import _ [as 别名]
def _line_now(self, i, a, b, bold=True):
colon = _(":")
if bold:
i.append(("<tr><td align=right>%s%s</td><td><b>%s</b></td></tr>") % (a,colon,b))
else:
i.append(("<tr><td align=right>%s%s</td><td>%s</td></tr>") % (a,colon,b))
示例12: insert_reviewer_more_action
# 需要导入模块: from anki import lang [as 别名]
# 或者: from anki.lang import _ [as 别名]
def insert_reviewer_more_action(self, m):
#self is Reviewer
if mw.state != "review":
return
a = m.addAction('Browse Creation of This Card')
a.setShortcut(QKeySequence("c"))
a.triggered.connect(lambda _, s=mw.reviewer: browse_this_card(s))
a = m.addAction('Browse Creation of Last Card')
a.triggered.connect(lambda _, s=mw.reviewer: browse_last_card(s))
示例13: setupMenu
# 需要导入模块: from anki import lang [as 别名]
# 或者: from anki.lang import _ [as 别名]
def setupMenu(self):
try:
# used by multiple add-ons, so we check for its existence first
menu = self.menuTags
except:
self.menuTags = QMenu(_("Tags"))
action = self.menuBar().insertMenu(self.mw.form.menuTools.menuAction(), self.menuTags)
menu = self.menuTags
menu.addSeparator()
a = menu.addAction('Replace Tag...')
a.setShortcut(QKeySequence("Ctrl+Alt+Shift+T"))
a.triggered.connect(lambda _, b=self: replaceTag(b))
示例14: show
# 需要导入模块: from anki import lang [as 别名]
# 或者: from anki.lang import _ [as 别名]
def show(self):
if not self.shown:
class ThinAnkiWebView(AnkiWebView):
def sizeHint(self):
return QSize(200, 100)
self.web = ThinAnkiWebView()
self.shown = self._addDockable(_("Card Info"), self.web)
self.shown.closed.connect(self._onClosed)
self._update()
示例15: _update
# 需要导入模块: from anki import lang [as 别名]
# 或者: from anki.lang import _ [as 别名]
def _update(self):
if not self.shown:
return
txt = ""
r = self.mw.reviewer
d = self.mw.col
cs = CardStats(d, r.card)
cc = r.card
if cc:
txt += _("<h3>Current</h3>")
txt += d.cardStats(cc)
txt += "<p>"
txt += self._revlogData(cc, cs)
lc = r.lastCard()
if lc:
txt += _("<h3>Last</h3>")
txt += d.cardStats(lc)
txt += "<p>"
txt += self._revlogData(lc, cs)
if not txt:
txt = _("No current card or last card.")
style = self._style()
self.web.setHtml("""
<html><head>
</head><style>%s</style>
<body><center>%s</center></body></html>"""% (style, txt))