diff --git a/README.md b/README.md index 63ea8caf..83e5e383 100644 --- a/README.md +++ b/README.md @@ -276,7 +276,7 @@ environment: - name: name that will be displayed on the interface. It supports translations by adding additional `name` keys with brackets and the language code (e.g: `name[es]=Mi tema`) - description: theme's description that will be displayed on the interface. It supports translations like `name` (e.g: description[es] = Mi tema). - version: theme's version. It just works as information at the moment. (e.g: 1.0) - - root_sheet: optional attribute that points to a theme that must be preloaded before the theme. It supports the default theme keys (e.g: default, light, ...) or a file path (e.g: `/path/to/root/file.qss`). + - root_theme: optional attribute that points to a theme that must be loaded before the theme. It supports the bauh's default theme keys (e.g: default, light, ...) or a file path (e.g: `/path/to/root/file.qss`). - **my_theme.vars**: optional file defining `key=value` pairs of variables that will be available for the .qss file (can be referenced through the symbol **@**. e.g `@my_var`). Full example: [light.vars](https://raw.githubusercontent.com/vinifmor/bauh/qss/bauh/view/resources/style/light/light.vars) - common theme variables available: - **style_dir**: path to the .qss file directory. Example: @style_dir/my_icon.svg diff --git a/bauh/stylesheet.py b/bauh/stylesheet.py index 708a8535..d1bb6fe9 100644 --- a/bauh/stylesheet.py +++ b/bauh/stylesheet.py @@ -18,12 +18,12 @@ class ThemeMetadata: def __init__(self, file_path: str, default: bool, default_name: Optional[str] = None, default_description: Optional[str] = None, version: Optional[str] = None, - root_sheet: Optional[str] = None, abstract: bool = False): + root_theme: Optional[str] = None, abstract: bool = False): self.names = {} self.default_name = default_name self.descriptions = {} self.default_description = default_description - self.root_sheet = root_sheet + self.root_theme = root_theme self.version = version self.file_path = file_path self.file_dir = '/'.join(file_path.split('/')[0:-1]) @@ -83,8 +83,8 @@ def read_theme_metada(key: str, file_path: str) -> ThemeMetadata: for field, val in meta_dict.items(): if field == 'version': meta_obj.version = val - elif field == 'root_sheet': - meta_obj.root_sheet = val + elif field == 'root_theme': + meta_obj.root_theme = val elif field == 'name': meta_obj.default_name = val elif field == 'description': @@ -133,15 +133,15 @@ def process_theme(file_path: str, theme_str: str, metadata: ThemeMetadata, available_themes: Optional[Dict[str, str]]) -> Optional[Tuple[str, ThemeMetadata]]: if theme_str and metadata: root_theme = None - if metadata.root_sheet and metadata.root_sheet in available_themes: - root_file = available_themes[metadata.root_sheet] + if metadata.root_theme and metadata.root_theme in available_themes: + root_file = available_themes[metadata.root_theme] if os.path.isfile(root_file): with open(root_file) as f: root_theme_str = f.read() if root_theme_str: - root_metadata = read_theme_metada(key=metadata.root_sheet, file_path=root_file) + root_metadata = read_theme_metada(key=metadata.root_theme, file_path=root_file) root_theme = process_theme(file_path=root_file, theme_str=root_theme_str, metadata=root_metadata, diff --git a/bauh/view/resources/style/darcula/darcula.meta b/bauh/view/resources/style/darcula/darcula.meta index 9eb0e8ec..641fb933 100644 --- a/bauh/view/resources/style/darcula/darcula.meta +++ b/bauh/view/resources/style/darcula/darcula.meta @@ -3,4 +3,4 @@ description=Dark based on Darcula theme (JetBrains) description[pt]=Escuro baseada no tema Darcula (JetBrains) description[es]=Oscuro basado en el tema Darcula (JetBrains) version=1.0 -root_sheet=default +root_theme=default diff --git a/bauh/view/resources/style/light/light.meta b/bauh/view/resources/style/light/light.meta index 5f87b579..e1728a3b 100644 --- a/bauh/view/resources/style/light/light.meta +++ b/bauh/view/resources/style/light/light.meta @@ -5,4 +5,4 @@ description=Default light theme description[pt]=Tema padrĂ£o claro description[es]=Tema predeterminado claro version=1.0 -root_sheet=default \ No newline at end of file +root_theme=default \ No newline at end of file diff --git a/bauh/view/resources/style/sublime/sublime.meta b/bauh/view/resources/style/sublime/sublime.meta index f88e7909..40580775 100644 --- a/bauh/view/resources/style/sublime/sublime.meta +++ b/bauh/view/resources/style/sublime/sublime.meta @@ -3,4 +3,4 @@ description=Dark based on Sublime Text's editor theme description[pt]=Escuro baseado no tema do editor Sublime Text description[es]=Oscuro basado en el tema del editor Sublime Text version=1.0 -root_sheet=default \ No newline at end of file +root_theme=default \ No newline at end of file