set default profile from the json file

This commit is contained in:
David Levanon 2020-09-24 15:19:58 +03:00
parent b669996180
commit f387f4886c
2 changed files with 7 additions and 2 deletions

View File

@ -70,9 +70,12 @@ if __name__ == '__main__':
OPTIONS,dbus_options = terminatorlib.optionparse.parse_options() OPTIONS,dbus_options = terminatorlib.optionparse.parse_options()
if OPTIONS.configjson: if OPTIONS.configjson:
layoutname = ConfigJson().extend_config(OPTIONS.configjson) configjson = ConfigJson()
layoutname = configjson.extend_config(OPTIONS.configjson)
if layoutname and ((not OPTIONS.layout) or OPTIONS.layout == 'default'): if layoutname and ((not OPTIONS.layout) or OPTIONS.layout == 'default'):
OPTIONS.layout = layoutname OPTIONS.layout = layoutname
if not OPTIONS.profile:
OPTIONS.profile = configjson.get_profile_to_use()
TERMINATOR = Terminator() TERMINATOR = Terminator()
TERMINATOR.set_origcwd(ORIGCWD) TERMINATOR.set_origcwd(ORIGCWD)

View File

@ -9,9 +9,11 @@ JSON_PROFILE_NAME = "__internal_json_profile__"
JSON_LAYOUT_NAME = "__internal_json_layout__" JSON_LAYOUT_NAME = "__internal_json_layout__"
class ConfigJson(object): class ConfigJson(object):
profile_to_use = 'default' profile_to_use = 'default'
def get_profile_to_use(self):
return self.profile_to_use
def build_single_tab_layout(self, layoutjson, vertical): def build_single_tab_layout(self, layoutjson, vertical):
dbg ('Budiling a single tab layout from json: %s ' % layoutjson) dbg ('Budiling a single tab layout from json: %s ' % layoutjson)