def _save_uiux(self): request_reload = False current_applocale = applocales.get_current_applocale() if self.applocales_cb.SelectedItem: for applocale in applocales.APP_LOCALES: if str(applocale) == self.applocales_cb.SelectedItem: user_config.user_locale = applocale.locale_code if current_applocale != applocale \ and not self.reload_requested: request_reload = forms.alert( 'UI language has changed. Reloading pyRevit is ' 'required for this change to take effect. Do you ' 'want to reload now?', yes=True, no=True, ) # colorize docs user_config.colorize_docs = self.colordocs_cb.IsChecked revit.ui.toggle_doc_colorizer(user_config.colorize_docs) # output settings output.set_stylesheet(self.cur_stylesheet_tb.Text) if self.cur_stylesheet_tb.Text != output.get_default_stylesheet(): user_config.output_stylesheet = self.cur_stylesheet_tb.Text return request_reload
def _save_uiux(self): request_reload = False current_applocale = applocales.get_current_applocale() if self.applocales_cb.SelectedItem: for applocale in applocales.APP_LOCALES: if str(applocale) == self.applocales_cb.SelectedItem: user_config.user_locale = applocale.locale_code if current_applocale != applocale \ and not self.reload_requested: request_reload = forms.alert( 'UI language has changed. Reloading pyRevit is ' 'required for this change to take effect. Do you ' 'want to reload now?', yes=True, no=True) # colorize docs user_config.colorize_docs = self.colordocs_cb.IsChecked # save colorize theme tabs.set_tabcoloring_theme(user_config, self.tab_theme) tabs.init_doc_colorizer(user_config) # output settings output.set_stylesheet(self.cur_stylesheet_tb.Text) if self.cur_stylesheet_tb.Text != output.get_default_stylesheet(): user_config.output_stylesheet = self.cur_stylesheet_tb.Text # pyrevit gui settings if self.loadtooltipex_cb.IsChecked != user_config.tooltip_debug_info \ and not self.reload_requested: request_reload = forms.alert( 'pyRevit UI Configuration has changed. Reloading pyRevit is ' 'required for this change to take effect. Do you ' 'want to reload now?', yes=True, no=True) user_config.tooltip_debug_info = self.loadtooltipex_cb.IsChecked return request_reload
def savesettings(self, sender, args): """Callback method for saving pyRevit settings """ # update the logging system changes first and update. if self.verbose_rb.IsChecked: logger.set_verbose_mode() if self.debug_rb.IsChecked: logger.set_debug_mode() # set config values to values set in ui items user_config.core.checkupdates = self.checkupdates_cb.IsChecked user_config.core.verbose = self.verbose_rb.IsChecked user_config.core.debug = self.debug_rb.IsChecked user_config.core.filelogging = self.filelogging_cb.IsChecked user_config.core.bincache = self.bincache_rb.IsChecked user_config.core.compilecsharp = self.compilecsharp_cb.IsChecked user_config.core.compilevb = self.compilevb_cb.IsChecked user_config.core.requiredhostbuild = self.requiredhostbuild_tb.Text try: min_freespace = int(self.minhostdrivefreespace_tb.Text) user_config.core.minhostdrivefreespace = min_freespace except ValueError: logger.error('Minimum free space value must be an integer.') user_config.core.minhostdrivefreespace = 0 user_config.core.loadbeta = self.loadbetatools_cb.IsChecked user_config.core.startuplogtimeout = self.startup_log_timeout.Text user_config.core.rocketmode = self.rocketmode_cb.IsChecked # set extension folders from the list, after cleanup empty items if isinstance(self.extfolders_lb.ItemsSource, list): user_config.core.userextensions = \ coreutils.filter_null_items(self.extfolders_lb.ItemsSource) else: user_config.core.userextensions = [] # set usage logging configs user_config.usagelogging.active = self.usagelogging_cb.IsChecked user_config.usagelogging.logfilepath = self.usagelogfile_tb.Text user_config.usagelogging.logserverurl = self.usagelogserver_tb.Text # output settings output.set_stylesheet(self.cur_stylesheet_tb.Text) if self.cur_stylesheet_tb.Text != output.get_default_stylesheet(): user_config.core.outputstylesheet = self.cur_stylesheet_tb.Text else: user_config.core.remove_option('outputstylesheet') # save all new values into config file user_config.save_changes() # set dynamo compatibility mode addinfiles.set_dynamocompat(self.dynamocompatmode_cb.IsChecked) # update usage logging and addin files self.update_usagelogging() self.update_addinfiles() self.Close()