def openPreferences(mw, config, notifier, mediamanager): # NB: must import these lazily to break a loop between preferencescontroller and here import pinyin.forms.preferences import pinyin.forms.preferencescontroller log.info("User opened preferences dialog") # Instantiate and show the preferences dialog modally preferences = pinyin.forms.preferences.Preferences(mw) controller = pinyin.forms.preferencescontroller.PreferencesController(preferences, notifier, mediamanager, config) result = preferences.exec_() if result == QDialog.Accepted: config.settings = controller.model.settings saveconfig()
def triggered(self): # NB: must import these lazily to break a loop between preferencescontroller and here import pinyin.forms.preferences import pinyin.forms.preferencescontroller log.info("User opened preferences dialog") # Instantiate and show the preferences dialog modally preferences = pinyin.forms.preferences.Preferences(self.mw) controller = pinyin.forms.preferencescontroller.PreferencesController(preferences, self.notifier, self.mediamanager, self.config) result = preferences.exec_() # We only need to change the configuration if the user accepted the dialog if result == QtGui.QDialog.Accepted: # Update by the simple method of replacing the settings dictionaries: better make sure that no # other part of the code has cached parts of the configuration self.config.settings = controller.model.settings # Ensure this is saved in Anki's configuration utils.persistconfig(self.mw, self.config)
def triggered(self): # NB: must import these lazily to break a loop between preferencescontroller and here import pinyin.forms.preferences import pinyin.forms.preferencescontroller log.info("User opened preferences dialog") # Instantiate and show the preferences dialog modally preferences = pinyin.forms.preferences.Preferences(self.mw) controller = pinyin.forms.preferencescontroller.PreferencesController( preferences, self.notifier, self.mediamanager, self.config) result = preferences.exec_() # We only need to change the configuration if the user accepted the dialog if result == QtGui.QDialog.Accepted: # Update by the simple method of replacing the settings dictionaries: better make sure that no # other part of the code has cached parts of the configuration self.config.settings = controller.model.settings # Ensure this is saved in Anki's configuration utils.persistconfig(self.mw, self.config)