From 478ee66d0e74a7385707ea20b647917df708a93e Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 9 Apr 2019 18:48:50 +1000 Subject: [PATCH] fix issue preventing profile rename/delete qtwebengineprocess.exe inherits the current working directory, so if it is started after the profile is loaded, it prevents the profile media folder from being renamed/deleted also, load profile on first run at the same point we normally load the profile --- aqt/main.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/aqt/main.py b/aqt/main.py index 9723e8530..6fce4509a 100644 --- a/aqt/main.py +++ b/aqt/main.py @@ -39,12 +39,6 @@ class AnkiQt(QMainWindow): aqt.mw = self self.app = app self.pm = profileManager - # running 2.0 for the first time? - if self.pm.meta['firstRun']: - # load the new deck user profile - self.pm.load(self.pm.profiles()[0]) - self.pm.meta['firstRun'] = False - self.pm.save() # init rest of app self.safeMode = self.app.queryKeyboardModifiers() & Qt.ShiftModifier try: @@ -108,6 +102,12 @@ class AnkiQt(QMainWindow): self.closeFires = True def setupProfile(self): + if self.pm.meta['firstRun']: + # load the new deck user profile + self.pm.load(self.pm.profiles()[0]) + self.pm.meta['firstRun'] = False + self.pm.save() + self.pendingImport = None self.restoringBackup = False # profile not provided on command line? @@ -607,6 +607,11 @@ title="%s" %s>%s''' % ( self.mainLayout.addWidget(sweb) self.form.centralwidget.setLayout(self.mainLayout) + # force webengine processes to load before cwd is changed + if isWin: + self.web._page.setHtml("") + self.bottomWeb._page.setHtml("") + def closeAllWindows(self, onsuccess): aqt.dialogs.closeAll(onsuccess)