def on_ok_button_clicked(self, widget): settings = self.get_profile_settings() if not self.settings_valid(settings): return from vmc.common.config import config prof_manager = get_profile_manager(self.model.get_device()) prof = prof_manager.create_profile(settings['profile_name'], settings) config.set_current_profile(prof) if self.startup: self.aux_ctrl.start() elif self.hotplug: self.aux_ctrl.model.wrapper.start_behaviour(self.aux_ctrl) # now hide self.hide_ourselves()
def on_ok_button_clicked(self, widget): settings = self.get_profile_settings() if not settings: # preferred connection or auth not specified return if settings['staticdns']: if not self.dns1_entry.isvalid() or not self.dns2_entry.isvalid(): # DNS must be valid return if not settings['profile_name'] or settings['profile_name'] == '': self.view['profile_name_entry'].grab_focus() return if self.is_profile_name_insane(): message = _('Invalid characters in profile name') details = _(""" The following characters are not allowed in a profile name: %s""") % ' '.join(INVALID_CHARS) dialogs.open_warning_dialog(message, details) return from vmc.common.config import config prof_manager = get_profile_manager(self.model.get_device()) prof = prof_manager.create_profile(settings['profile_name'], settings) config.set_current_profile(prof) if self.startup: self.aux_ctrl.start() elif self.hotplug: self.aux_ctrl.model.wrapper.start_behaviour(self.aux_ctrl) # now hide self.hide_ourselves()