Ejemplo n.º 1
0
 def load_settings_from_file(filepath, settings):
     with open(filepath, 'r') as file:
         line = file.readline()
         while line:
             setting = line.rstrip('\n').split('=', 1)
             prop = setting[0].strip()
             if prop in settings:
                 if CONF.has(prop) or prop.find('/') != -1:
                     if prop == GeneralProperties.USER_LAYOUT.value:
                         pass
                     elif prop == GeneralProperties.FONT.value and not setting[1]:
                         # if the font setting is empty removing it will make workbench use the default
                         CONF.remove(prop)
                     else:
                         try:
                             value = ast.literal_eval(setting[1])
                         except (SyntaxError, ValueError):
                             value = setting[1]
                         CONF.set(setting[0].strip(), value)
                 else:
                     ConfigService.setString(prop, setting[1])
             line = file.readline()
Ejemplo n.º 2
0
    def action_peak_added(self, function_name, set_global_default=False):
        self.peak_type_changed.emit(function_name)
        self.mouse_state.transition_to('add_peak')

        if set_global_default:
            ConfigService.setString('curvefitting.defaultPeak', function_name)