def pickcmdpath(self):
     # mod of aqt.utils getFile
     d = QFileDialog()
     mode = QFileDialog.ExistingFile
     d.setFileMode(mode)
     if isWin:
         d.setDirectory("C:\\")
     if isMac:
         d.setDirectory("/Applications")
     else:
         d.setDirectory(os.path.expanduser("~"))
     d.setWindowTitle("Anki Add-on: Select Executable")
     if d.exec():
         self.dialog.le_cmd.setText(d.selectedFiles()[0])
Exemplo n.º 2
0
    def browse_for_wiki(self):
        "Use a file browser dialog to replace the path to a wiki."
        dlg = QFileDialog(self,
                          caption="Browse for wiki",
                          filter="HTML files (*.html);;All files (*)")
        if self.form.type_.currentText().lower() == 'folder':
            mode = QFileDialog.Directory
        else:
            mode = QFileDialog.ExistingFile
        dlg.setFileMode(mode)

        retval = dlg.exec()
        if retval != 0:
            filename = dlg.selectedFiles()[0]
            self.form.path_.setText(filename)
Exemplo n.º 3
0
def select_adhoc_script():
    dlg = QFileDialog()
    dlg.setAcceptMode(QFileDialog.AcceptOpen)
    dlg.setFileMode(QFileDialog.Directory)
    if dlg.exec():
        Parser.parse(dlg.selectedFiles()[0], AdHocExecution())