def load_profiles_from_file(self): caption = _('Load Profiles From a File') filters = _('Profiles file (*.ini)') path = QFileDialog.getOpenFileName(self, caption, 'profiles', filters) if not path: logger.debug('Could not load profiles from file; no path.') return self.profiles = fetch_profiles(from_file=path) if self.profiles: store_profiles(self.profiles) os.execv(sys.executable, [sys.executable] + sys.argv)
def select_database(app_admin): profiles_dict = fetch_profiles() if not profiles_dict: create_new_profile(app_admin, profiles_dict) selected = select_profile(profiles_dict) if selected in profiles_dict: use_chosen_profile(selected) elif selected == NEW_PROFILE_LABEL: create_new_profile(app_admin, profiles_dict) else: sys.exit(0)
def set_widgets_values(self): self.dialect_editor.clear() self.profile_editor.clear() if self.dialects: dialects = self.dialects else: import sqlalchemy.dialects dialects = [name for _importer, name, is_package in \ pkgutil.iter_modules(sqlalchemy.dialects.__path__) \ if is_package] self.dialect_editor.set_choices([(dialect, dialect.capitalize()) \ for dialect in dialects]) self.profile_editor.insertItems(1, [''] + \ [item for item in fetch_profiles()]) self.profile_editor.setFocus() self.update_wizard_values()