prevent json layout and profile from being saved to the global config file
This commit is contained in:
parent
42b1915065
commit
b669996180
|
@ -696,14 +696,20 @@ class ConfigBase(Borg):
|
|||
section = getattr(self, section_name)
|
||||
parser[section_name] = dict_diff(DEFAULTS[section_name], section)
|
||||
|
||||
from .configjson import JSON_PROFILE_NAME, JSON_LAYOUT_NAME
|
||||
|
||||
parser['profiles'] = {}
|
||||
for profile in self.profiles:
|
||||
if profile == JSON_PROFILE_NAME:
|
||||
continue
|
||||
dbg('ConfigBase::save: Processing profile: %s' % profile)
|
||||
parser['profiles'][profile] = dict_diff(
|
||||
DEFAULTS['profiles']['default'], self.profiles[profile])
|
||||
|
||||
parser['layouts'] = {}
|
||||
for layout in self.layouts:
|
||||
if layout == JSON_LAYOUT_NAME:
|
||||
continue
|
||||
dbg('ConfigBase::save: Processing layout: %s' % layout)
|
||||
parser['layouts'][layout] = self.layouts[layout]
|
||||
|
||||
|
|
|
@ -5,10 +5,11 @@ import json
|
|||
import copy
|
||||
from .config import Config
|
||||
|
||||
class ConfigJson(object):
|
||||
JSON_PROFILE_NAME = "__internal_json_profile__"
|
||||
JSON_LAYOUT_NAME = "__internal_json_layout__"
|
||||
|
||||
class ConfigJson(object):
|
||||
|
||||
profile_to_use = 'default'
|
||||
|
||||
def build_single_tab_layout(self, layoutjson, vertical):
|
||||
|
@ -158,13 +159,13 @@ class ConfigJson(object):
|
|||
if 'profile' in configjson:
|
||||
profile = self.get_profile(configjson['profile'], config.base.profiles['default'])
|
||||
if profile:
|
||||
config.base.profiles[self.JSON_PROFILE_NAME] = profile
|
||||
self.profile_to_use = self.JSON_PROFILE_NAME
|
||||
config.base.profiles[JSON_PROFILE_NAME] = profile
|
||||
self.profile_to_use = JSON_PROFILE_NAME
|
||||
|
||||
if 'layout' in configjson:
|
||||
layout = self.get_layout(configjson['layout'])
|
||||
if layout:
|
||||
config.base.layouts[self.JSON_LAYOUT_NAME] = layout
|
||||
return self.JSON_LAYOUT_NAME
|
||||
config.base.layouts[JSON_LAYOUT_NAME] = layout
|
||||
return JSON_LAYOUT_NAME
|
||||
|
||||
return None
|
||||
|
|
Loading…
Reference in New Issue