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


Python webview.AnkiWebView类代码示例

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


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

示例1: focusInEvent

 def focusInEvent(self, evt):
     AnkiWebView.focusInEvent(self, evt)
     if evt.reason() == Qt.TabFocusReason:
         self.eval("focusField(0);")
     elif evt.reason() == Qt.BacktabFocusReason:
         n = len(self.editor.note.fields) - 1
         self.eval("focusField(%d);" % n)
开发者ID:ospalh,项目名称:ankiqt,代码行数:7,代码来源:editor.py

示例2: __init__

 def __init__(self, parent, editor):
     AnkiWebView.__init__(self)
     self.editor = editor
     self.strip = self.editor.mw.pm.profile['stripHTML']
     self.setAcceptDrops(True)
     self._markInternal = False
     clip = self.editor.mw.app.clipboard()
     clip.dataChanged.connect(self._onClipboardChange)
开发者ID:bbugyi200,项目名称:anki,代码行数:8,代码来源:editor.py

示例3: mouseReleaseEvent

 def mouseReleaseEvent(self, evt):
     if not isMac and not isWin and evt.button() == Qt.MidButton:
         # middle click on x11; munge the clipboard before standard
         # handling
         mime = self.prepareClip(mode=QClipboard.Selection)
         AnkiWebView.mouseReleaseEvent(self, evt)
         self.restoreClip(mime, mode=QClipboard.Selection)
     else:
         AnkiWebView.mouseReleaseEvent(self, evt)
开发者ID:AidanJones,项目名称:anki,代码行数:9,代码来源:editor.py

示例4: focusInEvent

 def focusInEvent(self, evt):
     window = False
     if evt.reason() in (Qt.ActiveWindowFocusReason, Qt.PopupFocusReason):
         # editor area got focus again; need to tell js not to adjust cursor
         self.eval("mouseDown++;")
         window = True
     AnkiWebView.focusInEvent(self, evt)
     if evt.reason() == Qt.TabFocusReason:
         self.eval("focusField(0);")
     elif evt.reason() == Qt.BacktabFocusReason:
         n = len(self.editor.note.fields) - 1
         self.eval("focusField(%d);" % n)
     elif window:
         self.eval("mouseDown--;")
开发者ID:AidanJones,项目名称:anki,代码行数:14,代码来源:editor.py

示例5: onhanziStats

def onhanziStats():
    mw.progress.start(immediate=True)
    rep = genhanziStats()
    d = QDialog(mw)
    l = QVBoxLayout()
    w = AnkiWebView()
    l.addWidget(w)
    css = "font{word-wrap:break-word;} div{display:none;}"
    w.stdHtml(rep, css)
    d.setLayout(l)
    d.resize(500, 400)
    restoreGeom(d, "hanzistats")
    mw.progress.finish()
    d.exec_()
    saveGeom(d, "hanzistats")
开发者ID:trevorld,项目名称:Hanzi_Stats,代码行数:15,代码来源:__init__.py

示例6: __init__

    def __init__(self,reader):
        GenericProfile.__init__(self,reader)
        self.history = []
        self.currentIndex = 0
        self.dockVocab = QtGui.QDockWidget(reader)
        self.dockVocab.setObjectName(fromUtf8("dockVocab"))
        self.dockWidgetContents = QtGui.QWidget()
        self.dockWidgetContents.setObjectName(fromUtf8("dockWidgetContents"))
        self.verticalLayout = QtGui.QVBoxLayout(self.dockWidgetContents)
        self.verticalLayout.setObjectName(fromUtf8("verticalLayout"))
        self.previousExpression = None
        self.textField = AnkiWebView()
        self.textField.setAcceptDrops(False)
        self.textField.setObjectName("textField")
        self.keyFilter = VocabKeyFilter()
        self.keyFilter.obj = self
        self.keyFilter.textField = self.textField
        self.textField.installEventFilter(self.keyFilter)
        self.verticalLayout.addWidget(self.textField)
        self.dockVocab.setWidget(self.dockWidgetContents)
        reader.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockVocab)
        self.dockVocab.visibilityChanged.connect(self.onVisibilityChanged)
        self.dockVocab.setWindowTitle(translate("MainWindowReader", "Vocabulary", None))
        self.textField.setLinkHandler(self.onAnchorClicked)

        # menu entries to toggle visibility of the vocabulary dock
        self.actionToggleVocab = QtGui.QAction(reader)
        self.actionToggleVocab.setCheckable(True)
        self.actionToggleVocab.setObjectName("actionToggleVocab")
        self.actionToggleVocab.setText("&Vocabulary")
        self.actionToggleVocab.setToolTip("Toggle vocabulary")
        reader.menuView.insertAction(reader.menuView.actions()[2],self.actionToggleVocab)
        QtCore.QObject.connect(self.actionToggleVocab, QtCore.SIGNAL("toggled(bool)"), self.dockVocab.setVisible)
        self.dockVocab.installEventFilter(self.reader.keyFilter)
开发者ID:dayjaby,项目名称:yomisama,代码行数:34,代码来源:vocabulary.py

示例7: __init__

    def __init__(self,reader):
        GenericProfile.__init__(self,reader)

        self.dockKanji = QtGui.QDockWidget(reader)
        self.dockKanji.setObjectName(fromUtf8("dockKanji"))
        self.dockWidgetContents = QtGui.QWidget()
        self.dockWidgetContents.setObjectName(fromUtf8("dockWidgetContents"))
        self.verticalLayout = QtGui.QVBoxLayout(self.dockWidgetContents)
        self.verticalLayout.setObjectName(fromUtf8("verticalLayout"))
        self.textField = AnkiWebView()
        self.textField.setAcceptDrops(False)
        self.textField.setObjectName("textField")
        self.verticalLayout.addWidget(self.textField)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName(fromUtf8("horizontalLayout_3"))
        self.verticalLayout.addLayout(self.horizontalLayout_3)
        self.dockKanji.setWidget(self.dockWidgetContents)
        reader.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockKanji)
        self.dockKanji.visibilityChanged.connect(self.onVisibilityChanged)
        self.dockKanji.setWindowTitle(translate("MainWindowReader", "Kanji", None))
        self.textField.setLinkHandler(self.onAnchorClicked)


        # menu entries to toggle visibility of the Kanji dock
        self.actionToggleKanji = QtGui.QAction(reader)
        self.actionToggleKanji.setCheckable(True)
        self.actionToggleKanji.setObjectName("actionToggleKanji")
        self.actionToggleKanji.setText("&Kanji")
        self.actionToggleKanji.setToolTip("Toggle Kanji")
        reader.menuView.insertAction(reader.menuView.actions()[2],self.actionToggleKanji)
        QtCore.QObject.connect(self.actionToggleKanji, QtCore.SIGNAL("toggled(bool)"), self.dockKanji.setVisible)
开发者ID:dayjaby,项目名称:yomisama,代码行数:31,代码来源:kanji.py

示例8: show

 def show(self):
     if not self.shown:
         self.web = AnkiWebView(self.mw)
         self.web.setMaximumWidth(400)
         self.shown = self.mw.addDockable(_("Card Info"), self.web)
         self.shown.connect(self.shown, SIGNAL("visibilityChanged(bool)"),
                            self._visChange)
     self._update()
开发者ID:ChYi,项目名称:ankiqt,代码行数:8,代码来源:stats.py

示例9: onRevlog

 def onRevlog(self):
     data = self._revlogData()
     d = QDialog(self)
     l = QVBoxLayout()
     l.setMargin(0)
     w = AnkiWebView()
     l.addWidget(w)
     w.stdHtml(data)
     bb = QDialogButtonBox(QDialogButtonBox.Close)
     l.addWidget(bb)
     bb.connect(bb, SIGNAL("rejected()"), d, SLOT("reject()"))
     d.setLayout(l)
     d.setWindowModality(Qt.WindowModal)
     d.resize(500, 400)
     restoreGeom(d, "revlog")
     d.exec_()
     saveGeom(d, "revlog")
开发者ID:lahorichargha,项目名称:ankiqt,代码行数:17,代码来源:browser.py

示例10: CardStats

class CardStats(object):
    def __init__(self, mw):
        self.mw = mw
        self.shown = False
        addHook("showQuestion", self._update)
        addHook("deckClosing", self.hide)
        addHook("reviewCleanup", self.hide)

    def show(self):
        if not self.shown:
            self.web = AnkiWebView(self.mw)
            self.web.setMaximumWidth(400)
            self.shown = self.mw.addDockable(_("Card Info"), self.web)
            self.shown.connect(self.shown, SIGNAL("visibilityChanged(bool)"),
                               self._visChange)
        self._update()

    def hide(self):
        if self.shown:
            self.mw.rmDockable(self.shown)
            self.shown = None

    def _visChange(self, vis):
        if not vis:
            # schedule removal for after evt has finished
            self.mw.progress.timer(100, self.hide, False)

    def _update(self):
        if not self.shown:
            return
        txt = ""
        r = self.mw.reviewer
        d = self.mw.deck
        if r.card:
            txt += _("<h1>Current</h1>")
            txt += d.cardStats(r.card)
        lc = r.lastCard()
        if lc:
            txt += _("<h1>Last</h1>")
            txt += d.cardStats(lc)
        if not txt:
            txt = _("No current card or last card.")
        self.web.setHtml("""
<html><head>
<style>table { font-size: 12px; } h1 { font-size: 14px; }</style>
</head><body><center>%s</center></body></html>"""%txt)
开发者ID:ChYi,项目名称:ankiqt,代码行数:46,代码来源:stats.py

示例11: onKanjiStats

def onKanjiStats():
    mw.progress.start(immediate=True)
    rep = genKanjiStats()
    d = QDialog(mw)
    l = QVBoxLayout()
    l.setMargin(0)
    w = AnkiWebView()
    l.addWidget(w)
    w.stdHtml(rep)
    bb = QDialogButtonBox(QDialogButtonBox.Close)
    l.addWidget(bb)
    bb.connect(bb, SIGNAL("rejected()"), d, SLOT("reject()"))
    d.setLayout(l)
    d.resize(500, 400)
    restoreGeom(d, "kanjistats")
    mw.progress.finish()
    d.exec_()
    saveGeom(d, "kanjistats")
开发者ID:igorfarias,项目名称:ankiplugins,代码行数:18,代码来源:stats.py

示例12: onhanziStats

def onhanziStats():
    mw.progress.start(immediate=True)
    rep = genhanziStats()
    d = QDialog(mw)
    l = QVBoxLayout()
    l.setMargin(0)
    w = AnkiWebView()
    l.addWidget(w)
    css = "font{word-wrap:break-word;} div{display:none;}"
    w.stdHtml(rep, css)
    bb = QDialogButtonBox(QDialogButtonBox.Close)
    l.addWidget(bb)
    bb.connect(bb, SIGNAL("rejected()"), d, SLOT("reject()"))
    d.setLayout(l)
    d.resize(500, 400)
    restoreGeom(d, "hanzistats")
    mw.progress.finish()
    d.exec_()
    saveGeom(d, "hanzistats")
开发者ID:trevorld,项目名称:Hanzi_Stats,代码行数:19,代码来源:Hanzi_Stats.py

示例13: showCardInfo

 def showCardInfo(self):
     if not self.card:
         return
     info, cs = self._cardInfoData()
     reps = self._revlogData(cs)
     d = QDialog(self)
     l = QVBoxLayout()
     l.setMargin(0)
     w = AnkiWebView()
     l.addWidget(w)
     w.stdHtml(info + "<p>" + reps)
     bb = QDialogButtonBox(QDialogButtonBox.Close)
     l.addWidget(bb)
     bb.connect(bb, SIGNAL("rejected()"), d, SLOT("reject()"))
     d.setLayout(l)
     d.setWindowModality(Qt.WindowModal)
     d.resize(500, 400)
     restoreGeom(d, "revlog")
     d.exec_()
     saveGeom(d, "revlog")
开发者ID:lahorichargha,项目名称:ankiqt,代码行数:20,代码来源:browser.py

示例14: showHTML

def showHTML(html, modality=Qt.WindowModal):
	m = QMainWindow(mw.app.activeWindow())
	d = QDialog(m)
	l = QVBoxLayout()
	l.setMargin(0)
	w = AnkiWebView()
	l.addWidget(w)
	bb = QDialogButtonBox(QDialogButtonBox.Close)
	l.addWidget(bb)
	bb.connect(bb, SIGNAL("rejected()"), d, SLOT("reject()"))
	d.setLayout(l)
	d.setWindowModality(modality)
	d.resize(500, 400) 
	restoreGeom(d, "htmlview")
	w.stdHtml(html)
	if modality == Qt.WindowModal :
		d.exec_()
	else :
		d.show()
	saveGeom(d, "htmlview")
开发者ID:albertly,项目名称:TTS,代码行数:20,代码来源:Colorful+toolbar.py

示例15: __init__

 def __init__(self, reviewer, card, parent=None):
     QDialog.__init__(self, parent=None)
     self.card = card
     self.reviewer = reviewer
     self.mw = reviewer.mw
     self.col = self.mw.col
     info, cs = self._cardInfoData()
     reps = self._revlogData(cs)
     l = QVBoxLayout()
     l.setMargin(0)
     w = AnkiWebView()
     l.addWidget(w)
     w.stdHtml(info + "<p>" + reps)
     bb = QDialogButtonBox(QDialogButtonBox.Close)
     l.addWidget(bb)
     bb.connect(bb, SIGNAL("rejected()"), self, SLOT("reject()"))
     self.setLayout(l)
     self.setWindowModality(Qt.WindowModal)
     self.resize(500, 400)
     restoreGeom(self, "CardStatShowDialog")
开发者ID:steveaw,项目名称:anki_addons,代码行数:20,代码来源:reviewer_show_cardinfo.py


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