def run(self): prefs = Utility.loadPrefs(Globals.options).get(PLUGIN_NAME) if prefs is not None: license = prefs.get('license') if license: setLicense(license) return False # no need to run again
def promptLicense(): dialog = LicenseDialog(wx.GetApp().mainFrame, -1) dialog.CenterOnScreen() if dialog.ShowModal() == wx.ID_OK: params = dialog.getParameters() else: params = None dialog.Destroy() if params is not None: license = params['license'] if license: prefs = Utility.loadPrefs(Globals.options) pluginPrefs = prefs.setdefault(PLUGIN_NAME, {}) pluginPrefs['license'] = license prefs.write() setLicense(license) return True return False