mirror of
https://github.com/GradienceTeam/Gradience.git
synced 2024-09-27 14:07:54 +00:00
Move modules to new backend/frontend directories (#668)
# Description This is a yet another refactoring PR (I promise this will be the last _major_ one), this time I based it on a codebase structure used by Bottles project. The new structure should be more readable, and easier to navigate. Also, as a nice small bonus, I've included `struct.md` files inside `frontend/` and `backend/` directories with small descriptions for subdirectories. ## Type of change <!-- What type of change does your pull request introduce? Put an `x` in the box that apply. --> - [x] Refactor - [ ] Bugfix (Change which fixes a issue) - [ ] New feature (Change which adds new functionality) - [ ] Enhancement (Change which slightly improves existing code) - [ ] Breaking change (This change will introduce incompatibility with existing functionality) ## Changelog <!-- This is optional, but highly appreciated. --> - Rename `utils/css.py` to `utils/css_parser.py` and `utils/custom_presets.py` to `utils/preset_downloader.py`, - Move modules to new backend/frontend directories, - Change module name from `utils.py` to `common.py`, - Format some modules for better readability ## Testing - [x] I have tested my changes and verified that they work as expected <!-- Required, your PR won't be accepted if you don't do this step. --> ### How to test the changes Just check if everything is working as expected in every build method (I've tested this PR with manual and Flatpak methods)
This commit is contained in:
commit
3f10e87e04
53 changed files with 244 additions and 252 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -431,5 +431,5 @@ $RECYCLE.BIN/
|
|||
# The flatpak pip generator (needed for GH-Actions)
|
||||
flatpak-pip-generator
|
||||
|
||||
# Don't include constants.py in VCS since that's a generated file
|
||||
gradience/constants.py
|
||||
# Don't include constants.py in VCS since that's a generated file
|
||||
gradience/backend/constants.py
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
## Source code structure
|
||||
|
||||
```
|
||||
gradience/ - main source code folder, contains majority of Python code
|
||||
|
|
||||
|- ui/ - contains logic code for Gradience widgets (you can find .ui files for widgets in data/ui folder)
|
||||
|
|
||||
|- utils/ - contains helpers for the rest of the codebase
|
||||
```
|
|
@ -1,17 +0,0 @@
|
|||
# __init__.py
|
||||
#
|
||||
# Change the look of Adwaita, with ease
|
||||
# Copyright (C) 2022 Gradience Team
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
0
gradience/backend/__init__.py
Normal file
0
gradience/backend/__init__.py
Normal file
|
@ -1,4 +1,4 @@
|
|||
# css.py
|
||||
# css_parser.py
|
||||
#
|
||||
# Change the look of Adwaita, with ease
|
||||
# Copyright (C) 2022 Gradience Team
|
||||
|
@ -20,7 +20,7 @@ import re
|
|||
|
||||
|
||||
# Adwaita named palette colors dict
|
||||
COLORS = [
|
||||
adw_colors = [
|
||||
"blue_",
|
||||
"green_",
|
||||
"yellow_",
|
||||
|
@ -41,7 +41,7 @@ def parse_css(path):
|
|||
variables = {}
|
||||
palette = {}
|
||||
|
||||
for color in COLORS:
|
||||
for color in adw_colors:
|
||||
palette[color] = {}
|
||||
|
||||
with open(path, "r", encoding="utf-8") as sheet:
|
||||
|
@ -51,7 +51,7 @@ def parse_css(path):
|
|||
if cdefine_match != None: # If @define-color variable declarations were found
|
||||
palette_part = cdefine_match.__getitem__(1) # Get the second item of the re.Match object
|
||||
name, color = palette_part.split(" ", 1)[1].split(" ", 1)
|
||||
for color_name in COLORS:
|
||||
for color_name in adw_colors:
|
||||
if name.startswith(color_name): # Palette colors
|
||||
palette[name[:-1]][name[-1:]] = color[:-1]
|
||||
break
|
|
@ -20,7 +20,7 @@ import os
|
|||
|
||||
from gi.repository import GLib, Gio, Adw
|
||||
|
||||
from gradience.utils.utils import buglog
|
||||
from gradience.backend.utils.common import buglog
|
||||
|
||||
|
||||
""" Custom exception class """
|
31
gradience/backend/meson.build
Normal file
31
gradience/backend/meson.build
Normal file
|
@ -0,0 +1,31 @@
|
|||
backenddir = 'gradience/backend'
|
||||
|
||||
configure_file(
|
||||
input: 'constants.py.in',
|
||||
output: 'constants.py',
|
||||
configuration: configuration_data({
|
||||
'APP_ID': APPLICATION_ID,
|
||||
'RELEASE_VER': meson.project_version(),
|
||||
'VERSION': meson.project_version() + VERSION_SUFFIX,
|
||||
'BUILD_TYPE': get_option('buildtype'),
|
||||
'PROJECT_URL': PROJECT_URL,
|
||||
'BUGTRACKER_URL': BUGTRACKER_URL,
|
||||
'HELP_URL': HELP_URL,
|
||||
'TRANSLATE_URL': TRANSLATE_URL,
|
||||
'PKGDATA_DIR': PKGDATA_DIR,
|
||||
'LOCALE_DIR': conf.get('LOCALE_DIR'),
|
||||
}),
|
||||
install: true,
|
||||
install_dir: PY_INSTALLDIR.get_install_dir() / backenddir,
|
||||
)
|
||||
|
||||
subdir('models')
|
||||
subdir('utils')
|
||||
|
||||
gradience_sources = [
|
||||
'__init__.py',
|
||||
'css_parser.py',
|
||||
'flatpak_overrides.py',
|
||||
'preset_downloader.py'
|
||||
]
|
||||
PY_INSTALLDIR.install_sources(gradience_sources, subdir: backenddir)
|
0
gradience/backend/models/__init__.py
Normal file
0
gradience/backend/models/__init__.py
Normal file
8
gradience/backend/models/meson.build
Normal file
8
gradience/backend/models/meson.build
Normal file
|
@ -0,0 +1,8 @@
|
|||
modelsdir = 'gradience/backend/models'
|
||||
|
||||
gradience_sources = [
|
||||
'__init__.py',
|
||||
'preset.py',
|
||||
'repo.py'
|
||||
]
|
||||
PY_INSTALLDIR.install_sources(gradience_sources, subdir: modelsdir)
|
|
@ -19,8 +19,8 @@
|
|||
import json
|
||||
import os
|
||||
|
||||
from gradience.settings_schema import settings_schema
|
||||
from gradience.utils.utils import buglog, to_slug_case
|
||||
from gradience.frontend.settings_schema import settings_schema
|
||||
from gradience.backend.utils.common import buglog, to_slug_case
|
||||
|
||||
|
||||
presets_dir = os.path.join(
|
|
@ -16,10 +16,11 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
from gradience.utils.utils import to_slug_case
|
||||
from gradience.utils.preset import Preset, presets_dir
|
||||
import os
|
||||
|
||||
from gradience.backend.utils.common import to_slug_case
|
||||
from gradience.backend.models.preset import Preset, presets_dir
|
||||
|
||||
|
||||
class Repo:
|
||||
presets = {}
|
|
@ -1,4 +1,4 @@
|
|||
# custom_presets.py
|
||||
# preset_downloader.py
|
||||
#
|
||||
# Change the look of Adwaita, with ease
|
||||
# Copyright (C) 2022 Gradience Team
|
||||
|
@ -21,8 +21,8 @@ import json
|
|||
|
||||
from gi.repository import GLib, Soup
|
||||
|
||||
from gradience.utils.preset import presets_dir
|
||||
from gradience.utils.utils import to_slug_case, buglog
|
||||
from gradience.backend.models.preset import presets_dir
|
||||
from gradience.backend.utils.common import to_slug_case, buglog
|
||||
|
||||
|
||||
# Open Soup3 session
|
4
gradience/backend/struct.md
Normal file
4
gradience/backend/struct.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
## `backend/` directory structure:
|
||||
|
||||
- `models/` - objects containing various types of data, with logic to manipulate them
|
||||
- `utils/` - general purpose utility modules
|
0
gradience/backend/utils/__init__.py
Normal file
0
gradience/backend/utils/__init__.py
Normal file
|
@ -1,4 +1,4 @@
|
|||
# utils.py
|
||||
# common.py
|
||||
#
|
||||
# Change the look of Adwaita, with ease
|
||||
# Copyright (C) 2022 Gradience Team
|
||||
|
@ -23,7 +23,7 @@ import os
|
|||
from subprocess import run
|
||||
from anyascii import anyascii
|
||||
|
||||
from gradience.constants import build_type
|
||||
from gradience.backend.constants import build_type
|
||||
|
||||
|
||||
if build_type == "debug":
|
7
gradience/backend/utils/meson.build
Normal file
7
gradience/backend/utils/meson.build
Normal file
|
@ -0,0 +1,7 @@
|
|||
utilsdir = 'gradience/backend/utils'
|
||||
|
||||
gradience_sources = [
|
||||
'__init__.py',
|
||||
'common.py'
|
||||
]
|
||||
PY_INSTALLDIR.install_sources(gradience_sources, subdir: utilsdir)
|
0
gradience/frontend/__init__.py
Normal file
0
gradience/frontend/__init__.py
Normal file
0
gradience/frontend/dialogs/__init__.py
Normal file
0
gradience/frontend/dialogs/__init__.py
Normal file
|
@ -18,7 +18,7 @@
|
|||
|
||||
from gi.repository import Gtk, Adw
|
||||
|
||||
from gradience.constants import rootdir
|
||||
from gradience.backend.constants import rootdir
|
||||
|
||||
|
||||
@Gtk.Template(resource_path=f"{rootdir}/ui/app_type_dialog.ui")
|
8
gradience/frontend/dialogs/meson.build
Normal file
8
gradience/frontend/dialogs/meson.build
Normal file
|
@ -0,0 +1,8 @@
|
|||
dialogsdir = 'gradience/frontend/dialogs'
|
||||
|
||||
gradience_sources = [
|
||||
'__init__.py',
|
||||
'app_type_dialog.py',
|
||||
'no_plugin_window.py'
|
||||
]
|
||||
PY_INSTALLDIR.install_sources(gradience_sources, subdir: dialogsdir)
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
from gi.repository import Gtk, Adw
|
||||
|
||||
from gradience.constants import rootdir
|
||||
from gradience.backend.constants import rootdir
|
||||
|
||||
|
||||
@Gtk.Template(resource_path=f"{rootdir}/ui/no_plugin_window.ui")
|
|
@ -35,8 +35,8 @@ if is_local:
|
|||
os.environ["XDG_DATA_DIRS"] = '@SCHEMAS_DIR@:' + os.environ.get("XDG_DATA_DIRS", "")
|
||||
|
||||
shutil.copyfile(
|
||||
os.path.join('@BUILD_DIR@', "gradience", "constants.py"),
|
||||
os.path.join('@SOURCE_DIR@', "gradience", "constants.py")
|
||||
os.path.join('@BUILD_DIR@', "gradience/backend", "constants.py"),
|
||||
os.path.join('@SOURCE_DIR@', "gradience/backend", "constants.py")
|
||||
)
|
||||
|
||||
pkgdatadir = '@PKGDATA_DIR@'
|
||||
|
@ -67,5 +67,5 @@ if __name__ == '__main__':
|
|||
|
||||
sys.path.insert(1, "/usr/local/lib/python3.10/site-packages")
|
||||
|
||||
from gradience import main
|
||||
from gradience.frontend import main
|
||||
sys.exit(main.main())
|
|
@ -23,29 +23,23 @@ import threading
|
|||
|
||||
from pathlib import Path
|
||||
from material_color_utilities_python import *
|
||||
|
||||
from gi.repository import Gtk, Gdk, Gio, Adw, GLib, Xdp, XdpGtk4
|
||||
|
||||
from gradience.ui.window import GradienceMainWindow
|
||||
from gradience.ui.welcome_window import GradienceWelcomeWindow
|
||||
from gradience.ui.app_type_dialog import GradienceAppTypeDialog
|
||||
from gradience.ui.custom_css_group import GradienceCustomCSSGroup
|
||||
from gradience.ui.presets_manager_window import GradiencePresetWindow
|
||||
from gradience.ui.preferences_window import GradiencePreferencesWindow
|
||||
from gradience.utils.css import parse_css
|
||||
from gradience.utils.utils import to_slug_case, buglog, run_command
|
||||
from gradience.utils.preset import Preset, presets_dir
|
||||
from gradience.settings_schema import settings_schema
|
||||
from gradience.plugins_list import GradiencePluginsList
|
||||
from gradience.constants import (
|
||||
rootdir,
|
||||
app_id,
|
||||
rel_ver,
|
||||
version,
|
||||
bugtracker_url,
|
||||
help_url,
|
||||
project_url,
|
||||
)
|
||||
from gradience.backend.css_parser import parse_css
|
||||
from gradience.backend.models.preset import Preset, presets_dir
|
||||
from gradience.backend.utils.common import to_slug_case, buglog, run_command
|
||||
from gradience.backend.constants import *
|
||||
|
||||
from gradience.frontend.views.main_window import GradienceMainWindow
|
||||
from gradience.frontend.views.plugins_list import GradiencePluginsList
|
||||
from gradience.frontend.views.welcome_window import GradienceWelcomeWindow
|
||||
from gradience.frontend.views.presets_manager_window import GradiencePresetWindow
|
||||
from gradience.frontend.views.preferences_window import GradiencePreferencesWindow
|
||||
|
||||
from gradience.frontend.dialogs.app_type_dialog import GradienceAppTypeDialog
|
||||
from gradience.frontend.widgets.custom_css_group import GradienceCustomCSSGroup
|
||||
|
||||
from gradience.frontend.settings_schema import settings_schema
|
||||
|
||||
|
||||
class GradienceApplication(Adw.Application):
|
26
gradience/frontend/meson.build
Normal file
26
gradience/frontend/meson.build
Normal file
|
@ -0,0 +1,26 @@
|
|||
frontenddir = 'gradience/frontend'
|
||||
|
||||
configure_file(
|
||||
input: 'gradience.in',
|
||||
output: 'gradience',
|
||||
configuration: conf,
|
||||
install_dir: get_option('bindir')
|
||||
)
|
||||
|
||||
configure_file(
|
||||
input: 'gradience.in',
|
||||
output: 'local-gradience',
|
||||
configuration: local_conf
|
||||
)
|
||||
|
||||
subdir('dialogs')
|
||||
subdir('utils')
|
||||
subdir('views')
|
||||
subdir('widgets')
|
||||
|
||||
gradience_sources = [
|
||||
'__init__.py',
|
||||
'main.py',
|
||||
'settings_schema.py'
|
||||
]
|
||||
PY_INSTALLDIR.install_sources(gradience_sources, subdir: frontenddir)
|
6
gradience/frontend/struct.md
Normal file
6
gradience/frontend/struct.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
## `frontend/` directory structure:
|
||||
|
||||
- `dialogs/` - message boxes and simple popup windows
|
||||
- `utils/` - general purpose utility modules for UI related stuff
|
||||
- `views/` - more extensive widgets (eg. widget groups, lists) and windows
|
||||
- `widgets/` - general purpose graphical widgets
|
0
gradience/frontend/utils/__init__.py
Normal file
0
gradience/frontend/utils/__init__.py
Normal file
7
gradience/frontend/utils/meson.build
Normal file
7
gradience/frontend/utils/meson.build
Normal file
|
@ -0,0 +1,7 @@
|
|||
utilsdir = 'gradience/frontend/utils'
|
||||
|
||||
gradience_sources = [
|
||||
'__init__.py',
|
||||
'run_async.py'
|
||||
]
|
||||
PY_INSTALLDIR.install_sources(gradience_sources, subdir: utilsdir)
|
|
@ -22,7 +22,7 @@ import traceback
|
|||
|
||||
from gi.repository import GLib
|
||||
|
||||
from gradience.utils.utils import buglog
|
||||
from gradience.backend.utils.common import buglog
|
||||
|
||||
|
||||
class RunAsync(threading.Thread):
|
0
gradience/frontend/views/__init__.py
Normal file
0
gradience/frontend/views/__init__.py
Normal file
|
@ -1,4 +1,4 @@
|
|||
# window.py
|
||||
# main_window.py
|
||||
#
|
||||
# Change the look of Adwaita, with ease
|
||||
# Copyright (C) 2022 Gradience Team
|
||||
|
@ -18,18 +18,18 @@
|
|||
|
||||
import os
|
||||
|
||||
from gi.repository import Gtk, Adw, Gio
|
||||
|
||||
from svglib.svglib import svg2rlg
|
||||
from reportlab.graphics import renderPM
|
||||
from material_color_utilities_python import *
|
||||
from gi.repository import Gtk, Adw, Gio
|
||||
|
||||
from gradience.ui.error_list_row import GradienceErrorListRow
|
||||
from gradience.ui.palette_shades import GradiencePaletteShades
|
||||
from gradience.ui.option_row import GradienceOptionRow
|
||||
from gradience.utils.utils import buglog
|
||||
from gradience.settings_schema import settings_schema
|
||||
from gradience.constants import rootdir, app_id, build_type
|
||||
from gradience.backend.utils.common import buglog
|
||||
from gradience.backend.constants import rootdir, app_id, build_type
|
||||
|
||||
from gradience.frontend.widgets.error_list_row import GradienceErrorListRow
|
||||
from gradience.frontend.widgets.palette_shades import GradiencePaletteShades
|
||||
from gradience.frontend.widgets.option_row import GradienceOptionRow
|
||||
from gradience.frontend.settings_schema import settings_schema
|
||||
|
||||
|
||||
@Gtk.Template(resource_path=f"{rootdir}/ui/window.ui")
|
||||
|
@ -118,7 +118,7 @@ class GradienceMainWindow(Adw.ApplicationWindow):
|
|||
image_basename = self.monet_image_file.get_basename()
|
||||
self.monet_file_chooser_button.set_label(image_basename)
|
||||
self.monet_file_chooser_button.set_tooltip_text(image_basename)
|
||||
|
||||
|
||||
self.monet_file_chooser_dialog.hide()
|
||||
|
||||
if response == Gtk.ResponseType.ACCEPT:
|
12
gradience/frontend/views/meson.build
Normal file
12
gradience/frontend/views/meson.build
Normal file
|
@ -0,0 +1,12 @@
|
|||
viewsdir = 'gradience/frontend/views'
|
||||
|
||||
gradience_sources = [
|
||||
'__init__.py',
|
||||
'main_window.py',
|
||||
'plugins_list.py',
|
||||
'preferences_window.py',
|
||||
'presets_manager_window.py',
|
||||
'share_window.py',
|
||||
'welcome_window.py'
|
||||
]
|
||||
PY_INSTALLDIR.install_sources(gradience_sources, subdir: viewsdir)
|
|
@ -21,9 +21,9 @@ import os
|
|||
from gi.repository import Adw, GLib
|
||||
from yapsy.PluginManager import PluginManager
|
||||
|
||||
from gradience.ui.plugin_row import GradiencePluginRow
|
||||
from gradience.utils.utils import buglog
|
||||
from gradience.constants import pkgdatadir
|
||||
from gradience.frontend.widgets.plugin_row import GradiencePluginRow
|
||||
from gradience.backend.utils.common import buglog
|
||||
from gradience.backend.constants import pkgdatadir
|
||||
|
||||
|
||||
USER_PLUGIN_DIR = os.path.join(
|
|
@ -18,16 +18,16 @@
|
|||
|
||||
from gi.repository import Gtk, Adw
|
||||
|
||||
from gradience.constants import rootdir
|
||||
from gradience.utils.flatpak_overrides import (
|
||||
from gradience.backend.constants import rootdir
|
||||
from gradience.backend.flatpak_overrides import (
|
||||
create_gtk_user_override,
|
||||
remove_gtk_user_override,
|
||||
)
|
||||
from gradience.utils.flatpak_overrides import (
|
||||
from gradience.backend.flatpak_overrides import (
|
||||
create_gtk_global_override,
|
||||
remove_gtk_global_override,
|
||||
)
|
||||
from gradience.utils.utils import buglog
|
||||
from gradience.backend.utils.common import buglog
|
||||
|
||||
|
||||
@Gtk.Template(resource_path=f"{rootdir}/ui/preferences_window.ui")
|
|
@ -22,17 +22,18 @@ import json
|
|||
|
||||
from collections import OrderedDict
|
||||
from pathlib import Path
|
||||
|
||||
from gi.repository import Gtk, Adw, GLib
|
||||
|
||||
from gradience.ui.preset_row import GradiencePresetRow
|
||||
from gradience.ui.builtin_preset_row import GradienceBuiltinPresetRow
|
||||
from gradience.ui.explore_preset_row import GradienceExplorePresetRow
|
||||
from gradience.ui.repo_row import GradienceRepoRow
|
||||
from gradience.utils.custom_presets import fetch_presets
|
||||
from gradience.utils.preset import presets_dir
|
||||
from gradience.utils.utils import buglog
|
||||
from gradience.constants import rootdir
|
||||
from gradience.backend.preset_downloader import fetch_presets
|
||||
from gradience.backend.models.preset import presets_dir
|
||||
from gradience.backend.utils.common import buglog
|
||||
from gradience.backend.constants import rootdir
|
||||
|
||||
from gradience.frontend.widgets.preset_row import GradiencePresetRow
|
||||
from gradience.frontend.widgets.builtin_preset_row import GradienceBuiltinPresetRow
|
||||
from gradience.frontend.widgets.explore_preset_row import GradienceExplorePresetRow
|
||||
from gradience.frontend.widgets.repo_row import GradienceRepoRow
|
||||
|
||||
|
||||
@Gtk.Template(resource_path=f"{rootdir}/ui/presets_manager_window.ui")
|
||||
class GradiencePresetWindow(Adw.Window):
|
|
@ -21,10 +21,10 @@ import time
|
|||
|
||||
from gi.repository import Gtk, Adw, Gio
|
||||
|
||||
from gradience.utils.run_async import RunAsync
|
||||
from gradience.utils.utils import buglog
|
||||
from gradience.utils.flatpak_overrides import create_gtk_user_override
|
||||
from gradience.constants import rootdir, app_id, rel_ver
|
||||
from gradience.frontend.utils.run_async import RunAsync
|
||||
from gradience.backend.utils.common import buglog
|
||||
from gradience.backend.flatpak_overrides import create_gtk_user_override
|
||||
from gradience.backend.constants import rootdir, app_id, rel_ver
|
||||
|
||||
|
||||
@Gtk.Template(resource_path=f"{rootdir}/ui/share_window.ui")
|
|
@ -21,10 +21,10 @@ import time
|
|||
|
||||
from gi.repository import Gtk, Adw, Gio
|
||||
|
||||
from gradience.utils.run_async import RunAsync
|
||||
from gradience.utils.utils import buglog
|
||||
from gradience.utils.flatpak_overrides import create_gtk_user_override
|
||||
from gradience.constants import rootdir, app_id, rel_ver
|
||||
from gradience.frontend.utils.run_async import RunAsync
|
||||
from gradience.backend.utils.common import buglog
|
||||
from gradience.backend.flatpak_overrides import create_gtk_user_override
|
||||
from gradience.backend.constants import rootdir, app_id, rel_ver
|
||||
|
||||
|
||||
@Gtk.Template(resource_path=f"{rootdir}/ui/welcome_window.ui")
|
0
gradience/frontend/widgets/__init__.py
Normal file
0
gradience/frontend/widgets/__init__.py
Normal file
|
@ -18,8 +18,8 @@
|
|||
|
||||
from gi.repository import Gtk, Adw
|
||||
|
||||
from gradience.utils.utils import to_slug_case, buglog
|
||||
from gradience.constants import rootdir
|
||||
from gradience.backend.utils.common import to_slug_case, buglog
|
||||
from gradience.backend.constants import rootdir
|
||||
|
||||
|
||||
@Gtk.Template(resource_path=f"{rootdir}/ui/builtin_preset_row.ui")
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
from gi.repository import Gtk, Adw
|
||||
|
||||
from gradience.utils.utils import buglog
|
||||
from gradience.constants import rootdir
|
||||
from gradience.backend.utils.common import buglog
|
||||
from gradience.backend.constants import rootdir
|
||||
|
||||
|
||||
@Gtk.Template(resource_path=f"{rootdir}/ui/custom_css_group.ui")
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
from gi.repository import Gtk
|
||||
|
||||
from gradience.constants import rootdir
|
||||
from gradience.backend.constants import rootdir
|
||||
|
||||
|
||||
@Gtk.Template(resource_path=f"{rootdir}/ui/error_list_row.ui")
|
|
@ -20,9 +20,9 @@ import os
|
|||
|
||||
from gi.repository import Gtk, Adw
|
||||
|
||||
from gradience.utils.utils import to_slug_case, buglog
|
||||
from gradience.utils.custom_presets import download_preset
|
||||
from gradience.constants import rootdir
|
||||
from gradience.backend.utils.common import to_slug_case, buglog
|
||||
from gradience.backend.preset_downloader import download_preset
|
||||
from gradience.backend.constants import rootdir
|
||||
|
||||
|
||||
@Gtk.Template(resource_path=f"{rootdir}/ui/explore_preset_row.ui")
|
15
gradience/frontend/widgets/meson.build
Normal file
15
gradience/frontend/widgets/meson.build
Normal file
|
@ -0,0 +1,15 @@
|
|||
widgetsdir = 'gradience/frontend/widgets'
|
||||
|
||||
gradience_sources = [
|
||||
'__init__.py',
|
||||
'builtin_preset_row.py',
|
||||
'custom_css_group.py',
|
||||
'error_list_row.py',
|
||||
'explore_preset_row.py',
|
||||
'option_row.py',
|
||||
'palette_shades.py',
|
||||
'plugin_row.py',
|
||||
'preset_row.py',
|
||||
'repo_row.py'
|
||||
]
|
||||
PY_INSTALLDIR.install_sources(gradience_sources, subdir: widgetsdir)
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
from gi.repository import Gtk, Gdk, Adw
|
||||
|
||||
from gradience.constants import rootdir
|
||||
from gradience.backend.constants import rootdir
|
||||
|
||||
|
||||
@Gtk.Template(resource_path=f"{rootdir}/ui/option_row.ui")
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
from gi.repository import Gtk, Gdk, Adw
|
||||
|
||||
from gradience.constants import rootdir
|
||||
from gradience.backend.constants import rootdir
|
||||
|
||||
|
||||
@Gtk.Template(resource_path=f"{rootdir}/ui/palette_shades.ui")
|
|
@ -21,10 +21,9 @@ import os
|
|||
from pathlib import Path
|
||||
from gi.repository import Gtk, Adw
|
||||
|
||||
from gradience.ui.no_plugin_window import GradienceNoPluginPrefWindow
|
||||
from gradience.utils.utils import buglog
|
||||
from gradience.constants import rootdir
|
||||
|
||||
from gradience.frontend.dialogs.no_plugin_window import GradienceNoPluginPrefWindow
|
||||
from gradience.backend.utils.common import buglog
|
||||
from gradience.backend.constants import rootdir
|
||||
|
||||
|
||||
USER_PLUGIN_DIR = Path(
|
|
@ -20,10 +20,10 @@ import os
|
|||
|
||||
from gi.repository import Gtk, Adw, Xdp, XdpGtk4
|
||||
|
||||
from gradience.ui.share_window import GradienceShareWindow
|
||||
from gradience.utils.utils import to_slug_case, buglog
|
||||
from gradience.utils.preset import Preset, presets_dir
|
||||
from gradience.constants import rootdir
|
||||
from gradience.frontend.views.share_window import GradienceShareWindow
|
||||
from gradience.backend.utils.common import to_slug_case, buglog
|
||||
from gradience.backend.models.preset import Preset, presets_dir
|
||||
from gradience.backend.constants import rootdir
|
||||
|
||||
|
||||
@Gtk.Template(resource_path=f"{rootdir}/ui/preset_row.ui")
|
|
@ -20,8 +20,8 @@ import os
|
|||
|
||||
from gi.repository import Gtk, Adw
|
||||
|
||||
from gradience.constants import rootdir
|
||||
from gradience.utils.utils import to_slug_case
|
||||
from gradience.backend.constants import rootdir
|
||||
from gradience.backend.utils.common import to_slug_case
|
||||
|
||||
|
||||
@Gtk.Template(resource_path=f"{rootdir}/ui/repo_row.ui")
|
|
@ -1,80 +1,15 @@
|
|||
configure_file(
|
||||
input: 'gradience.in',
|
||||
output: 'gradience',
|
||||
configuration: conf,
|
||||
install_dir: get_option('bindir')
|
||||
)
|
||||
moduledir = 'gradience'
|
||||
|
||||
configure_file(
|
||||
input: 'gradience.in',
|
||||
output: 'local-gradience',
|
||||
configuration: local_conf
|
||||
)
|
||||
subdir('backend')
|
||||
subdir('frontend')
|
||||
|
||||
configure_file(
|
||||
input: 'constants.py.in',
|
||||
output: 'constants.py',
|
||||
configuration: configuration_data({
|
||||
'APP_ID': APPLICATION_ID,
|
||||
'RELEASE_VER': meson.project_version(),
|
||||
'VERSION': meson.project_version() + VERSION_SUFFIX,
|
||||
'BUILD_TYPE': get_option('buildtype'),
|
||||
'PROJECT_URL': PROJECT_URL,
|
||||
'BUGTRACKER_URL': BUGTRACKER_URL,
|
||||
'HELP_URL': HELP_URL,
|
||||
'TRANSLATE_URL': TRANSLATE_URL,
|
||||
'PKGDATA_DIR': PKGDATA_DIR,
|
||||
'LOCALE_DIR': conf.get('LOCALE_DIR'),
|
||||
}),
|
||||
install: true,
|
||||
install_dir: PY_INSTALLDIR.get_install_dir() / 'gradience',
|
||||
)
|
||||
|
||||
launcher = join_paths(meson.project_build_root(), 'gradience', 'local-' + meson.project_name())
|
||||
launcher = join_paths(meson.project_build_root(), moduledir, 'frontend', 'local-' + meson.project_name())
|
||||
|
||||
run_target('run',
|
||||
command: [launcher]
|
||||
)
|
||||
|
||||
# Install sources
|
||||
gradience_sources = [
|
||||
'__init__.py',
|
||||
'settings_schema.py',
|
||||
'main.py',
|
||||
'plugins_list.py',
|
||||
'__init__.py'
|
||||
]
|
||||
PY_INSTALLDIR.install_sources(gradience_sources, subdir: 'gradience')
|
||||
|
||||
# Install utility modules
|
||||
gradience_utils = [
|
||||
'utils/__init__.py',
|
||||
'utils/custom_presets.py',
|
||||
'utils/flatpak_overrides.py',
|
||||
'utils/utils.py',
|
||||
'utils/run_async.py',
|
||||
'utils/css.py',
|
||||
'utils/preset.py',
|
||||
'utils/repo.py',
|
||||
]
|
||||
PY_INSTALLDIR.install_sources(gradience_utils, subdir: 'gradience/utils')
|
||||
|
||||
# Install ui Python modules
|
||||
gradience_ui_modules = [
|
||||
'ui/error_list_row.py',
|
||||
'ui/palette_shades.py',
|
||||
'ui/option_row.py',
|
||||
'ui/window.py',
|
||||
'ui/app_type_dialog.py',
|
||||
'ui/custom_css_group.py',
|
||||
'ui/presets_manager_window.py',
|
||||
'ui/preferences_window.py',
|
||||
'ui/plugin_row.py',
|
||||
'ui/explore_preset_row.py',
|
||||
'ui/builtin_preset_row.py',
|
||||
'ui/preset_row.py',
|
||||
'ui/welcome_window.py',
|
||||
'ui/repo_row.py',
|
||||
'ui/no_plugin_window.py',
|
||||
'ui/share_window.py',
|
||||
]
|
||||
PY_INSTALLDIR.install_sources(gradience_ui_modules, subdir: 'gradience/ui')
|
||||
PY_INSTALLDIR.install_sources(gradience_sources, subdir: moduledir)
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
# __init__.py
|
||||
#
|
||||
# Change the look of Adwaita, with ease
|
||||
# Copyright (C) 2022 Gradience Team
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
@ -1,17 +0,0 @@
|
|||
# __init__.py
|
||||
#
|
||||
# Change the look of Adwaita, with ease
|
||||
# Copyright (C) 2022 Gradience Team
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
46
po/POTFILES
46
po/POTFILES
|
@ -14,27 +14,25 @@ data/ui/presets_manager_window.blp
|
|||
data/ui/share_window.blp
|
||||
data/ui/welcome_window.blp
|
||||
data/ui/window.blp
|
||||
gradience/utils/css.py
|
||||
gradience/utils/custom_presets.py
|
||||
gradience/utils/flatpak_overrides.py
|
||||
gradience/utils/preset.py
|
||||
gradience/utils/repo.py
|
||||
gradience/utils/run_async.py
|
||||
gradience/utils/utils.py
|
||||
gradience/ui/app_type_dialog.py
|
||||
gradience/ui/builtin_preset_row.py
|
||||
gradience/ui/custom_css_group.py
|
||||
gradience/ui/error_list_row.py
|
||||
gradience/ui/explore_preset_row.py
|
||||
gradience/ui/option_row.py
|
||||
gradience/ui/palette_shades.py
|
||||
gradience/ui/plugin_row.py
|
||||
gradience/ui/preferences_window.py
|
||||
gradience/ui/preset_row.py
|
||||
gradience/ui/presets_manager_window.py
|
||||
gradience/ui/repo_row.py
|
||||
gradience/ui/welcome_window.py
|
||||
gradience/ui/window.py
|
||||
gradience/main.py
|
||||
gradience/plugins_list.py
|
||||
gradience/settings_schema.py
|
||||
gradience/backend/preset_downloader.py
|
||||
gradience/backend/flatpak_overrides.py
|
||||
gradience/backend/models/preset.py
|
||||
gradience/backend/models/repo.py
|
||||
gradience/frontend/dialogs/app_type_dialog.py
|
||||
gradience/frontend/dialogs/no_plugin_window.py
|
||||
gradience/frontend/widgets/builtin_preset_row.py
|
||||
gradience/frontend/widgets/custom_css_group.py
|
||||
gradience/frontend/widgets/error_list_row.py
|
||||
gradience/frontend/widgets/explore_preset_row.py
|
||||
gradience/frontend/widgets/option_row.py
|
||||
gradience/frontend/widgets/palette_shades.py
|
||||
gradience/frontend/widgets/plugin_row.py
|
||||
gradience/frontend/views/preferences_window.py
|
||||
gradience/frontend/widgets/preset_row.py
|
||||
gradience/frontend/views/presets_manager_window.py
|
||||
gradience/frontend/widgets/repo_row.py
|
||||
gradience/frontend/views/welcome_window.py
|
||||
gradience/frontend/views/main_window.py
|
||||
gradience/frontend/main.py
|
||||
gradience/frontend/views/plugins_list.py
|
||||
gradience/frontend/settings_schema.py
|
||||
|
|
Loading…
Reference in a new issue