def run(self): self.exec_() but = self.clickedButton().text() if but == "Help": # FIXME stop dialog closing? aqt.openHelp(self.help) return self.clickedButton().text()
def setup(self): import anki.consts as c self.form.newOrder.insertItems(0, c.newCardOrderLabels().values()) self.form.newSpread.insertItems(0, c.newCardSchedulingLabels().values()) self.form.revOrder.insertItems(0, c.revCardOrderLabels().values()) self.connect(self.form.buttonBox, SIGNAL("helpRequested()"), lambda: aqt.openHelp("StudyOptions"))
def askUser(text, parent=None, help="", defaultno=False): "Show a yes/no question. Return true if yes." if not parent: parent = aqt.mw.app.activeWindow() sb = QMessageBox.Yes | QMessageBox.No if help: sb |= QMessageBox.Help while 1: if defaultno: default = QMessageBox.No else: default = QMessageBox.Yes r = QMessageBox.question(parent, "Anki", text, sb, default) if r == QMessageBox.Help: aqt.openHelp(help) else: break return r == QMessageBox.Yes
def setup(self): import anki.consts as c self.form.newOrder.insertItems( 0, c.newCardOrderLabels().values()) self.form.newSpread.insertItems( 0, c.newCardSchedulingLabels().values()) self.form.revOrder.insertItems( 0, c.revCardOrderLabels().values()) self.connect(self.form.buttonBox, SIGNAL("helpRequested()"), lambda: aqt.openHelp("StudyOptions"))
def onHtmlEdit(self): self.saveNow() d = QDialog(self.widget) form = aqt.forms.edithtml.Ui_Dialog() form.setupUi(d) d.connect(form.buttonBox, SIGNAL("helpRequested()"), lambda: aqt.openHelp("HtmlEditor")) form.textEdit.setPlainText(self.fact.fields[self.currentField]) form.textEdit.moveCursor(QTextCursor.End) d.exec_() self.fact.fields[self.currentField] = unicode(form.textEdit.toPlainText()) self.loadFact(self.currentField)
def onHtmlEdit(self): self.saveNow() d = QDialog(self.widget) form = aqt.forms.edithtml.Ui_Dialog() form.setupUi(d) d.connect(form.buttonBox, SIGNAL("helpRequested()"), lambda: aqt.openHelp("HtmlEditor")) form.textEdit.setPlainText(self.fact.fields[self.currentField]) form.textEdit.moveCursor(QTextCursor.End) d.exec_() self.fact.fields[self.currentField] = unicode( form.textEdit.toPlainText()) self.loadFact(self.currentField)
def __init__(self, mw, gcid, parent=None): QDialog.__init__(self, parent or mw) self.mw = mw self.gcid = gcid self.form = aqt.forms.groupconf.Ui_Dialog() self.form.setupUi(self) (self.name, self.conf) = self.mw.deck.db.first("select name, conf from gconf where id = ?", self.gcid) self.conf = simplejson.loads(self.conf) self.setWindowTitle(self.name) self.setup() self.connect(self.form.buttonBox, SIGNAL("helpRequested()"), lambda: aqt.openHelp("GroupOptions")) self.connect(self.form.buttonBox.button(QDialogButtonBox.RestoreDefaults), SIGNAL("clicked()"), self.onRestore) self.exec_()
def addButtons(self): box = self.form.buttonBox def button(w, func): w.connect(w, SIGNAL("clicked()"), func) return w f = self.form # selection button(f.selAll, self.onSelectAll).setShortcut("a") button(f.selNone, self.onSelectNone).setShortcut("n") button(f.opts, self.onEdit).setShortcut("o") button(f.rename, self.onRename).setShortcut("r") button(f.delete_2, self.onDelete) self.connect(self.form.buttonBox, SIGNAL("helpRequested()"), lambda: aqt.openHelp("Groups"))
def __init__(self, mw): QDialog.__init__(self, mw, Qt.Window) self.mw = mw self.config = mw.config self.form = aqt.forms.preferences.Ui_Preferences() self.form.setupUi(self) self.needDeckClose = False self.connect(self.form.buttonBox, SIGNAL("helpRequested()"), lambda: aqt.openHelp("Preferences")) self.setupLang() self.setupNetwork() self.setupBackup() self.setupOptions() self.setupMedia() self.show()
def __init__(self, mw, gcid, parent=None): QDialog.__init__(self, parent or mw) self.mw = mw self.gcid = gcid self.form = aqt.forms.groupconf.Ui_Dialog() self.form.setupUi(self) (self.name, self.conf) = self.mw.deck.db.first( "select name, conf from gconf where id = ?", self.gcid) self.conf = simplejson.loads(self.conf) self.setWindowTitle(self.name) self.setup() self.connect(self.form.buttonBox, SIGNAL("helpRequested()"), lambda: aqt.openHelp("GroupOptions")) self.connect( self.form.buttonBox.button(QDialogButtonBox.RestoreDefaults), SIGNAL("clicked()"), self.onRestore) self.exec_()
def showInfo(text, parent=None, help="", type="info"): "Show a small info window with an OK button." if not parent: parent = aqt.mw.app.activeWindow() or aqt.mw if type == "warning": icon = QMessageBox.Warning elif type == "critical": icon = QMessageBox.Critical else: icon = QMessageBox.Information mb = QMessageBox(parent) mb.setText(text) mb.setIcon(icon) mb.setWindowModality(Qt.WindowModal) b = mb.addButton(QMessageBox.Ok) b.setDefault(True) if help: b = mb.addButton(QMessageBox.Help) b.connect(b, SIGNAL("clicked()"), lambda: aqt.openHelp(help)) b.setAutoDefault(False) return mb.exec_()
def onHelp(self): aqt.openHelp("AddModel")
def helpRequested(self): aqt.openHelp("DeckOptions")
def onHelp(self): aqt.openHelp("SelectiveStudy")
def helpRequested(self): aqt.openHelp(self.help)
def onHelp(self): aqt.openHelp("CardLayout")
def mouseReleaseEvent(self, evt): aqt.openHelp("ProgressBars")