def rerunWizard(self): wizard = Wizard(self, self.db) wizard.exec_()
def __init__(self, db, configfile, version): super().__init__() # This will deactivate the unused warning in vim if icons: pass self.setUnifiedTitleAndToolBarOnMac(True) self.version = version self.db = db self.configfile = configfile self.config = {} self.config['backend'] = 'internal' self.config['custom'] = 'html2pdf $INPUT $OUTPUT' self.config['prince_path'] = '/usr/bin/prince' self.config['filters'] = { 'selected_only': False, 'descriptors': [], 'schools': [], 'subschools': [], 'rulebooks': [] } self.config['recents'] = [] self.firstRun = True if os.path.exists(self.configfile): with open(self.configfile) as f: self.config.update(json.load(f)) self.firstRun = False else: with open(self.configfile,'w') as f: json.dump(self.config, f, indent=2) # Setting up the window self.setWindowTitle("PySpellbook") self.setWindowIcon(QtGui.QIcon(":icons/pySpellbook.png")) self.cw = QtGui.QWidget() self.setCentralWidget(self.cw) self.cw.setLayout(QtGui.QVBoxLayout()) self.cw.layout().setContentsMargins(0,0,0,0) self.spellArea = QtGui.QWidget(self.cw) self.cw.layout().addWidget(self.spellArea) self.spellArea.setLayout(QtGui.QHBoxLayout()) self.spellArea.layout().setContentsMargins(0,0,0,0) self.spellAreaSplitter = QtGui.QSplitter(self.spellArea) self.spellAreaSplitter.setHandleWidth(2) self.d20classArea = QtGui.QWidget(self.spellArea) self.d20classArea.setLayout(QtGui.QVBoxLayout()) self.d20classArea.layout().setContentsMargins(0,0,0,0) self.d20classArea.layout().setSpacing(0) #self.d20filterEdit = QtGui.QLineEdit() #self.d20filterEdit.setPlaceholderText("Filter classes") #self.d20classArea.layout().addWidget(self.d20filterEdit) self.d20classlist = QtGui.QListView(self.spellArea) self.d20classArea.layout().addWidget(self.d20classlist) self.d20classlist.setAlternatingRowColors(True) self.d20classlist.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.levellist = QtGui.QListView(self.spellArea) self.levellist.setAlternatingRowColors(True) self.levellist.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.spelllist = QtGui.QListView(self.spellArea) self.spelllist.setAlternatingRowColors(True) self.spelllist.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.spelldetails = QtGui.QTextEdit() self.spelldetails.setReadOnly(True) self.spellArea.layout().addWidget(self.spellAreaSplitter) self.spellAreaSplitter.addWidget(self.d20classArea) self.spellAreaSplitter.addWidget(self.levellist) self.spellAreaSplitter.addWidget(self.spelllist) self.spellAreaSplitter.addWidget(self.spelldetails) self.spellAreaSplitter.setStretchFactor(0,0) self.spellAreaSplitter.setStretchFactor(1,0) self.spellAreaSplitter.setStretchFactor(2,0) self.spellAreaSplitter.setStretchFactor(3,1) #self.d20filterEdit.textChanged.connect(self.filterClasses) self.d20classlist.clicked.connect(self.showLevels) self.levellist.clicked.connect(self.showSpells) # Setting up menus self.menuBar = QtGui.QMenuBar(self) if sys.platform != "darwin" else QtGui.QMenuBar() self.setMenuBar(self.menuBar) self.filterSpellsEdit = QtGui.QLineEdit() self.filterSpellsEdit.setPlaceholderText(self.tr("Search...")) self.fileMenu = self.menuBar.addMenu(self.tr("&File")) self.spellBookMenu = self.menuBar.addMenu(self.tr("Spell&book")) self.dbMenu = self.menuBar.addMenu(self.tr("&Database")) self.filterMenu = self.menuBar.addMenu(self.tr("F&ilter")) self.filterSystemMenu = self.filterMenu.addMenu(self.tr("&Rulebooks")) self.filterSchoolMenu = self.filterMenu.addMenu(self.tr("&School")) self.filterSubschoolMenu = self.filterMenu.addMenu(self.tr("Su&bschool")) self.filterDescriptorMenu = self.filterMenu.addMenu(self.tr("&Descriptor")) self.filterSelectedAction = self.filterMenu.addAction(self.tr("Show &only selected")) self.filterSelectedAction.setCheckable(True) self.newAction = QtGui.QAction(self.tr("&New"), self) self.newAction.setIcon(QtGui.QIcon.fromTheme("document-new", QtGui.QIcon(":icons/document-new.png"))) self.newAction.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_N) self.fileMenu.addAction(self.newAction) self.openAction = QtGui.QAction(self) self.openAction.setText(self.tr("&Open...")) self.openAction.setIcon(QtGui.QIcon.fromTheme("document-open", QtGui.QIcon(":icons/document-open.png"))) self.openAction.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_O) self.fileMenu.addAction(self.openAction) self.openRecentsMenu = self.fileMenu.addMenu(self.tr("Open &Recents...")) self.fileMenu.addSeparator() self.saveAction = QtGui.QAction(self) self.saveAction.setText(self.tr("&Save...")) self.saveAction.setIcon(QtGui.QIcon.fromTheme("document-save", QtGui.QIcon(":icons/document-save.png"))) self.saveAction.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_S) self.fileMenu.addAction(self.saveAction) self.saveasAction = QtGui.QAction(self) self.saveasAction.setIcon(QtGui.QIcon.fromTheme("document-save-as", QtGui.QIcon(":icons/document-save-as.png"))) self.saveasAction.setText(self.tr("&Save As...")) self.fileMenu.addAction(self.saveasAction) self.fileMenu.addSeparator() self.rerunWizardAction = self.fileMenu.addAction(self.tr("Run Wizard")) self.fileMenu.addSeparator() self.quitAction = QtGui.QAction(self) self.quitAction.setIcon(QtGui.QIcon.fromTheme("application-exit", QtGui.QIcon(":icons/application-exit.png"))) self.quitAction.setText(self.tr("&Quit")) self.quitAction.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_Q) self.fileMenu.addAction(self.quitAction) self.setNameAction = QtGui.QAction(self.tr("Set &title..."), self) self.spellBookMenu.addAction(self.setNameAction) self.setAuthorAction = QtGui.QAction(self.tr("Set &author..."), self) self.spellBookMenu.addAction(self.setAuthorAction) #self.selectImageAction = QtGui.QAction("Select &Image...", self) #self.spellBookMenu.addAction(self.selectImageAction) self.spellBookMenu.addSeparator() #self.selectTemplateAction = QtGui.QAction("Select &Template...", self) #self.spellBookMenu.addAction(self.selectTemplateAction) self.configExportAction = self.spellBookMenu.addAction(self.tr("&Configure export...")) self.configExportAction.setIcon(QtGui.QIcon.fromTheme("preferences-system", QtGui.QIcon(":icons/preferences-system.png"))) self.spellBookMenu.addSeparator() self.exportBookAction = QtGui.QAction(self.tr("&Export to PDF..."), self) self.exportBookAction.setIcon(QtGui.QIcon.fromTheme("office-book", QtGui.QIcon(":icons/office-book.png"))) self.exportBookAction.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_E) self.spellBookMenu.addAction(self.exportBookAction) self.exportAsBookAction = QtGui.QAction(self.tr("Export to PDF &as..."), self) self.spellBookMenu.addAction(self.exportAsBookAction) self.addSpellAction = QtGui.QAction(self.tr("&Add spell..."), self) self.addSpellAction.setIcon(QtGui.QIcon.fromTheme("list-add", QtGui.QIcon(":icons/list-add.png"))) self.dbMenu.addAction(self.addSpellAction) self.dbMenu.addSeparator() self.importDBAction = QtGui.QAction(self.tr("&Import dataset..."), self) self.dbMenu.addAction(self.importDBAction) self.exportDBAction = self.dbMenu.addAction(self.tr("&Export dataset...")) self.exportSelectedDBAction = self.dbMenu.addAction(self.tr("Export &selected dataset..")) self.dbMenu.addSeparator() self.clearDBAction = self.dbMenu.addAction(self.tr("Clear database")) self.selectAllLevelAction = QtGui.QAction(self.tr("Select All"), self) self.selectAllClassAction = QtGui.QAction(self.tr("Select All"), self) self.deselectAllLevelAction = QtGui.QAction(self.tr("Deselect All"), self) self.deselectAllClassAction = QtGui.QAction(self.tr("Deselect All"), self) self.editSpellAction = QtGui.QAction(self.tr("Edit..."), self) self.deleteSpellAction = QtGui.QAction(self.tr("Delete"), self) self.spelllist.addAction(self.editSpellAction) self.spelllist.addAction(self.deleteSpellAction) self.levellist.addAction(self.selectAllLevelAction) self.levellist.addAction(self.deselectAllLevelAction) self.d20classlist.addAction(self.selectAllClassAction) self.d20classlist.addAction(self.deselectAllClassAction) self.editSpellAction.triggered.connect(self.showEditSpell) self.deleteSpellAction.triggered.connect(self.deleteSpell) self.selectAllClassAction.triggered.connect(self.selectAllClass) self.deselectAllClassAction.triggered.connect(self.deselectAllClass) self.selectAllLevelAction.triggered.connect(self.selectAllLevel) self.deselectAllLevelAction.triggered.connect(self.deselectAllLevel) self.filterSpellsEdit.textChanged.connect(self.search) self.newAction.triggered.connect(self.new) self.openAction.triggered.connect(self.openBook) self.saveAction.triggered.connect(self.saveBook) self.saveasAction.triggered.connect(self.saveAsBook) self.rerunWizardAction.triggered.connect(self.rerunWizard) self.quitAction.triggered.connect(self.close) self.setAuthorAction.triggered.connect(self.setAuthor) self.setNameAction.triggered.connect(self.setName) self.exportBookAction.triggered.connect(self.exportBook) self.exportAsBookAction.triggered.connect(self.exportAsBook) self.addSpellAction.triggered.connect(self.showAddSpell) self.importDBAction.triggered.connect(self.importDB) self.exportDBAction.triggered.connect(self.exportDB) self.exportSelectedDBAction.triggered.connect(self.exportSelectedDB) self.clearDBAction.triggered.connect(self.clearDB) self.configExportAction.triggered.connect(self.showConfig) self.filterSelectedAction.toggled.connect(self.filterSelected) # Tooolbar self.toolbar = self.addToolBar(self.tr("Toolbar")) self.toolbar.setFloatable(False) self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon) self.toolbar.addAction(self.newAction) self.toolbar.addAction(self.openAction) self.toolbar.addAction(self.saveAction) self.toolbar.addSeparator() self.toolbar.addAction(self.exportBookAction) self.toolbar.addSeparator() self.toolbar.addAction(self.addSpellAction) self.emptyWidget = QtGui.QWidget() self.emptyWidget.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) self.updateNotify = QtGui.QLabel("") self.updateThread = UpdateNotifier(self.version) self.updateThread.updateAvailable.connect(self.setUpdate) self.updateThread.start() self.updateNotify.setOpenExternalLinks(True) self.toolbar.addWidget(self.emptyWidget) self.toolbar.addWidget(self.updateNotify) self.toolbar.addWidget(self.filterSpellsEdit) self.resize(1024,600) self.classFilter = "" self.searchText = "" self.filterRulebooks = set() self.filterSchools = set() self.filterSubschools = set() self.filterDescriptors = set() self.pauseFilters = False self.model = SpellModel(self.db) self.filtermodel = FilterModel() self.filtermodel.setSourceModel(self.model) self.connectModels() self.fillSystems() self.fillSchools() self.fillSubschools() self.fillDescriptors() self.filename = "" self.pdffilename = "" self.spellBookName=self.tr("New Spellbook") self.spellBookAuthor=self.tr("Unknown Author") self.modified = False self.updateWindowName() if self.firstRun: wizard = Wizard(self, db) wizard.exec_()
def __init__(self, db, configfile, version): super().__init__() # This will deactivate the unused warning in vim if icons: pass self.setUnifiedTitleAndToolBarOnMac(True) self.version = version self.db = db self.configfile = configfile self.config = {} self.config['backend'] = 'internal' self.config['custom'] = 'html2pdf $INPUT $OUTPUT' self.config['prince_path'] = '/usr/bin/prince' self.config['filters'] = { 'selected_only': False, 'descriptors': [], 'schools': [], 'subschools': [], 'rulebooks': [] } self.config['recents'] = [] self.firstRun = True if os.path.exists(self.configfile): with open(self.configfile) as f: self.config.update(json.load(f)) self.firstRun = False else: with open(self.configfile, 'w') as f: json.dump(self.config, f, indent=2) # Setting up the window self.setWindowTitle("PySpellbook") self.setWindowIcon(QtGui.QIcon(":icons/pySpellbook.png")) self.cw = QtGui.QWidget() self.setCentralWidget(self.cw) self.cw.setLayout(QtGui.QVBoxLayout()) self.cw.layout().setContentsMargins(0, 0, 0, 0) self.spellArea = QtGui.QWidget(self.cw) self.cw.layout().addWidget(self.spellArea) self.spellArea.setLayout(QtGui.QHBoxLayout()) self.spellArea.layout().setContentsMargins(0, 0, 0, 0) self.spellAreaSplitter = QtGui.QSplitter(self.spellArea) self.spellAreaSplitter.setHandleWidth(2) self.d20classArea = QtGui.QWidget(self.spellArea) self.d20classArea.setLayout(QtGui.QVBoxLayout()) self.d20classArea.layout().setContentsMargins(0, 0, 0, 0) self.d20classArea.layout().setSpacing(0) #self.d20filterEdit = QtGui.QLineEdit() #self.d20filterEdit.setPlaceholderText("Filter classes") #self.d20classArea.layout().addWidget(self.d20filterEdit) self.d20classlist = QtGui.QListView(self.spellArea) self.d20classArea.layout().addWidget(self.d20classlist) self.d20classlist.setAlternatingRowColors(True) self.d20classlist.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.levellist = QtGui.QListView(self.spellArea) self.levellist.setAlternatingRowColors(True) self.levellist.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.spelllist = QtGui.QListView(self.spellArea) self.spelllist.setAlternatingRowColors(True) self.spelllist.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.spelldetails = QtGui.QTextEdit() self.spelldetails.setReadOnly(True) self.spellArea.layout().addWidget(self.spellAreaSplitter) self.spellAreaSplitter.addWidget(self.d20classArea) self.spellAreaSplitter.addWidget(self.levellist) self.spellAreaSplitter.addWidget(self.spelllist) self.spellAreaSplitter.addWidget(self.spelldetails) self.spellAreaSplitter.setStretchFactor(0, 0) self.spellAreaSplitter.setStretchFactor(1, 0) self.spellAreaSplitter.setStretchFactor(2, 0) self.spellAreaSplitter.setStretchFactor(3, 1) #self.d20filterEdit.textChanged.connect(self.filterClasses) self.d20classlist.clicked.connect(self.showLevels) self.levellist.clicked.connect(self.showSpells) # Setting up menus self.menuBar = QtGui.QMenuBar( self) if sys.platform != "darwin" else QtGui.QMenuBar() self.setMenuBar(self.menuBar) self.filterSpellsEdit = QtGui.QLineEdit() self.filterSpellsEdit.setPlaceholderText(self.tr("Search...")) self.fileMenu = self.menuBar.addMenu(self.tr("&File")) self.spellBookMenu = self.menuBar.addMenu(self.tr("Spell&book")) self.dbMenu = self.menuBar.addMenu(self.tr("&Database")) self.filterMenu = self.menuBar.addMenu(self.tr("F&ilter")) self.filterSystemMenu = self.filterMenu.addMenu(self.tr("&Rulebooks")) self.filterSchoolMenu = self.filterMenu.addMenu(self.tr("&School")) self.filterSubschoolMenu = self.filterMenu.addMenu( self.tr("Su&bschool")) self.filterDescriptorMenu = self.filterMenu.addMenu( self.tr("&Descriptor")) self.filterSelectedAction = self.filterMenu.addAction( self.tr("Show &only selected")) self.filterSelectedAction.setCheckable(True) self.newAction = QtGui.QAction(self.tr("&New"), self) self.newAction.setIcon( QtGui.QIcon.fromTheme("document-new", QtGui.QIcon(":icons/document-new.png"))) self.newAction.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_N) self.fileMenu.addAction(self.newAction) self.openAction = QtGui.QAction(self) self.openAction.setText(self.tr("&Open...")) self.openAction.setIcon( QtGui.QIcon.fromTheme("document-open", QtGui.QIcon(":icons/document-open.png"))) self.openAction.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_O) self.fileMenu.addAction(self.openAction) self.openRecentsMenu = self.fileMenu.addMenu( self.tr("Open &Recents...")) self.fileMenu.addSeparator() self.saveAction = QtGui.QAction(self) self.saveAction.setText(self.tr("&Save...")) self.saveAction.setIcon( QtGui.QIcon.fromTheme("document-save", QtGui.QIcon(":icons/document-save.png"))) self.saveAction.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_S) self.fileMenu.addAction(self.saveAction) self.saveasAction = QtGui.QAction(self) self.saveasAction.setIcon( QtGui.QIcon.fromTheme("document-save-as", QtGui.QIcon(":icons/document-save-as.png"))) self.saveasAction.setText(self.tr("&Save As...")) self.fileMenu.addAction(self.saveasAction) self.fileMenu.addSeparator() self.rerunWizardAction = self.fileMenu.addAction(self.tr("Run Wizard")) self.fileMenu.addSeparator() self.quitAction = QtGui.QAction(self) self.quitAction.setIcon( QtGui.QIcon.fromTheme("application-exit", QtGui.QIcon(":icons/application-exit.png"))) self.quitAction.setText(self.tr("&Quit")) self.quitAction.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_Q) self.fileMenu.addAction(self.quitAction) self.setNameAction = QtGui.QAction(self.tr("Set &title..."), self) self.spellBookMenu.addAction(self.setNameAction) self.setAuthorAction = QtGui.QAction(self.tr("Set &author..."), self) self.spellBookMenu.addAction(self.setAuthorAction) #self.selectImageAction = QtGui.QAction("Select &Image...", self) #self.spellBookMenu.addAction(self.selectImageAction) self.spellBookMenu.addSeparator() #self.selectTemplateAction = QtGui.QAction("Select &Template...", self) #self.spellBookMenu.addAction(self.selectTemplateAction) self.configExportAction = self.spellBookMenu.addAction( self.tr("&Configure export...")) self.configExportAction.setIcon( QtGui.QIcon.fromTheme( "preferences-system", QtGui.QIcon(":icons/preferences-system.png"))) self.spellBookMenu.addSeparator() self.exportBookAction = QtGui.QAction(self.tr("&Export to PDF..."), self) self.exportBookAction.setIcon( QtGui.QIcon.fromTheme("office-book", QtGui.QIcon(":icons/office-book.png"))) self.exportBookAction.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_E) self.spellBookMenu.addAction(self.exportBookAction) self.exportAsBookAction = QtGui.QAction( self.tr("Export to PDF &as..."), self) self.spellBookMenu.addAction(self.exportAsBookAction) self.addSpellAction = QtGui.QAction(self.tr("&Add spell..."), self) self.addSpellAction.setIcon( QtGui.QIcon.fromTheme("list-add", QtGui.QIcon(":icons/list-add.png"))) self.dbMenu.addAction(self.addSpellAction) self.dbMenu.addSeparator() self.importDBAction = QtGui.QAction(self.tr("&Import dataset..."), self) self.dbMenu.addAction(self.importDBAction) self.exportDBAction = self.dbMenu.addAction( self.tr("&Export dataset...")) self.exportSelectedDBAction = self.dbMenu.addAction( self.tr("Export &selected dataset..")) self.dbMenu.addSeparator() self.clearDBAction = self.dbMenu.addAction(self.tr("Clear database")) self.selectAllLevelAction = QtGui.QAction(self.tr("Select All"), self) self.selectAllClassAction = QtGui.QAction(self.tr("Select All"), self) self.deselectAllLevelAction = QtGui.QAction(self.tr("Deselect All"), self) self.deselectAllClassAction = QtGui.QAction(self.tr("Deselect All"), self) self.editSpellAction = QtGui.QAction(self.tr("Edit..."), self) self.deleteSpellAction = QtGui.QAction(self.tr("Delete"), self) self.spelllist.addAction(self.editSpellAction) self.spelllist.addAction(self.deleteSpellAction) self.levellist.addAction(self.selectAllLevelAction) self.levellist.addAction(self.deselectAllLevelAction) self.d20classlist.addAction(self.selectAllClassAction) self.d20classlist.addAction(self.deselectAllClassAction) self.editSpellAction.triggered.connect(self.showEditSpell) self.deleteSpellAction.triggered.connect(self.deleteSpell) self.selectAllClassAction.triggered.connect(self.selectAllClass) self.deselectAllClassAction.triggered.connect(self.deselectAllClass) self.selectAllLevelAction.triggered.connect(self.selectAllLevel) self.deselectAllLevelAction.triggered.connect(self.deselectAllLevel) self.filterSpellsEdit.textChanged.connect(self.search) self.newAction.triggered.connect(self.new) self.openAction.triggered.connect(self.openBook) self.saveAction.triggered.connect(self.saveBook) self.saveasAction.triggered.connect(self.saveAsBook) self.rerunWizardAction.triggered.connect(self.rerunWizard) self.quitAction.triggered.connect(self.close) self.setAuthorAction.triggered.connect(self.setAuthor) self.setNameAction.triggered.connect(self.setName) self.exportBookAction.triggered.connect(self.exportBook) self.exportAsBookAction.triggered.connect(self.exportAsBook) self.addSpellAction.triggered.connect(self.showAddSpell) self.importDBAction.triggered.connect(self.importDB) self.exportDBAction.triggered.connect(self.exportDB) self.exportSelectedDBAction.triggered.connect(self.exportSelectedDB) self.clearDBAction.triggered.connect(self.clearDB) self.configExportAction.triggered.connect(self.showConfig) self.filterSelectedAction.toggled.connect(self.filterSelected) # Tooolbar self.toolbar = self.addToolBar(self.tr("Toolbar")) self.toolbar.setFloatable(False) self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon) self.toolbar.addAction(self.newAction) self.toolbar.addAction(self.openAction) self.toolbar.addAction(self.saveAction) self.toolbar.addSeparator() self.toolbar.addAction(self.exportBookAction) self.toolbar.addSeparator() self.toolbar.addAction(self.addSpellAction) self.emptyWidget = QtGui.QWidget() self.emptyWidget.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) self.updateNotify = QtGui.QLabel("") self.updateThread = UpdateNotifier(self.version) self.updateThread.updateAvailable.connect(self.setUpdate) self.updateThread.start() self.updateNotify.setOpenExternalLinks(True) self.toolbar.addWidget(self.emptyWidget) self.toolbar.addWidget(self.updateNotify) self.toolbar.addWidget(self.filterSpellsEdit) self.resize(1024, 600) self.classFilter = "" self.searchText = "" self.filterRulebooks = set() self.filterSchools = set() self.filterSubschools = set() self.filterDescriptors = set() self.pauseFilters = False self.model = SpellModel(self.db) self.filtermodel = FilterModel() self.filtermodel.setSourceModel(self.model) self.connectModels() self.fillSystems() self.fillSchools() self.fillSubschools() self.fillDescriptors() self.filename = "" self.pdffilename = "" self.spellBookName = self.tr("New Spellbook") self.spellBookAuthor = self.tr("Unknown Author") self.modified = False self.updateWindowName() if self.firstRun: wizard = Wizard(self, db) wizard.exec_()