diff --git a/.github/workflows/flatpak-nightly.yml b/.github/workflows/flatpak-nightly.yml index a24e57dc2..d8df61f54 100644 --- a/.github/workflows/flatpak-nightly.yml +++ b/.github/workflows/flatpak-nightly.yml @@ -31,5 +31,5 @@ jobs: - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4 with: bundle: com.github.GradienceTeam.Gradience.Devel.flatpak - manifest-path: com.github.GradienceTeam.Gradience.Devel.json + manifest-path: build-aux/flatpak/com.github.GradienceTeam.Gradience.Devel.json cache-key: flatpak-builder-${{ github.sha }}-nightly diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml index 52aa6c3a9..19686507a 100644 --- a/.github/workflows/flatpak.yml +++ b/.github/workflows/flatpak.yml @@ -46,6 +46,6 @@ jobs: - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4 with: bundle: com.github.GradienceTeam.Gradience.flatpak - manifest-path: com.github.GradienceTeam.Gradience.json + manifest-path: build-aux/flatpak/com.github.GradienceTeam.Gradience.json cache-key: flatpak-builder-${{ github.sha }} arch: ${{ matrix.arch }} diff --git a/.gitignore b/.gitignore index 30dd603cf..2c4d807e4 100644 --- a/.gitignore +++ b/.gitignore @@ -211,4 +211,6 @@ cython_debug/ # End of https://www.toptal.com/developers/gitignore/api/meson,flatpak,python -.vscode/ \ No newline at end of file +.vscode/ + +flatpak-pip-generator diff --git a/README.md b/README.md index 01744e5b7..e45a9188f 100644 --- a/README.md +++ b/README.md @@ -70,9 +70,8 @@ ninja -C builddir run 1. Open Terminal 2. Run `git clone https://github.com/GradienceTeam/Gradience.git && cd Gradience` -3. Add the `gnome-nightly` Flatpak repository `flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo` -4. Install the `master` version of GNOME SDK: `flatpak install org.gnome.Sdk/x86_64/master org.gnome.Platform/x86_64/master` -5. Run `flatpak-builder --install --user --force-clean repo/ com.github.GradienceTeam.Gradience.json` +3. Install the `42` version of GNOME SDK: `flatpak install org.gnome.Sdk/x86_64/42 org.gnome.Platform/x86_64/42` +4. Run: `flatpak-builder --install --user --force-clean repo/ build-aux/flatpak/com.github.GradienceTeam.Gradience.Devel.json` Alternatively, open the project with GNOME Builder, then build and run it. diff --git a/com.github.GradienceTeam.Gradience.Devel.json b/build-aux/flatpak/com.github.GradienceTeam.Gradience.Devel.json similarity index 97% rename from com.github.GradienceTeam.Gradience.Devel.json rename to build-aux/flatpak/com.github.GradienceTeam.Gradience.Devel.json index fbaed9b7e..6bc0c9bf0 100644 --- a/com.github.GradienceTeam.Gradience.Devel.json +++ b/build-aux/flatpak/com.github.GradienceTeam.Gradience.Devel.json @@ -128,9 +128,8 @@ ], "sources" : [ { - "type" : "git", - "path" : ".", - "branch": "next" + "type" : "dir", + "path" : "../../." } ] } diff --git a/com.github.GradienceTeam.Gradience.json b/build-aux/flatpak/com.github.GradienceTeam.Gradience.json similarity index 99% rename from com.github.GradienceTeam.Gradience.json rename to build-aux/flatpak/com.github.GradienceTeam.Gradience.json index 6a99af270..07175153f 100644 --- a/com.github.GradienceTeam.Gradience.json +++ b/build-aux/flatpak/com.github.GradienceTeam.Gradience.json @@ -129,7 +129,7 @@ "sources" : [ { "type" : "dir", - "path" : "." + "path" : "../../." } ] } diff --git a/pypi-dependencies.json b/build-aux/flatpak/pypi-dependencies.json similarity index 67% rename from pypi-dependencies.json rename to build-aux/flatpak/pypi-dependencies.json index 7fc22802d..e0248052b 100644 --- a/pypi-dependencies.json +++ b/build-aux/flatpak/pypi-dependencies.json @@ -17,20 +17,6 @@ } ] }, - { - "name": "python3-regex", - "buildsystem": "simple", - "build-commands": [ - "pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"regex\" --no-build-isolation" - ], - "sources": [ - { - "type": "file", - "url": "https://files.pythonhosted.org/packages/f7/e1/8b46ff54516faea4ea9469c4f5b50f2e9e73131f54d19e6827141698a822/regex-2022.8.17.tar.gz", - "sha256": "5c77eab46f3a2b2cd8bbe06467df783543bf7396df431eb4a144cc4b89e9fb3c" - } - ] - }, { "name": "python3-material-color-utilities-python", "buildsystem": "simple", @@ -112,40 +98,6 @@ "sha256": "48c24706c23bb4262173b6fa49eabb10afa15b8412f14283120549517ccfa314" } ] - }, - { - "name": "python3-requests", - "buildsystem": "simple", - "build-commands": [ - "pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"requests\" --no-build-isolation" - ], - "sources": [ - { - "type": "file", - "url": "https://files.pythonhosted.org/packages/6f/de/5be2e3eed8426f871b170663333a0f627fc2924cc386cd41be065e7ea870/urllib3-1.26.12-py2.py3-none-any.whl", - "sha256": "b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997" - }, - { - "type": "file", - "url": "https://files.pythonhosted.org/packages/04/a2/d918dcd22354d8958fe113e1a3630137e0fc8b44859ade3063982eacd2a4/idna-3.3-py3-none-any.whl", - "sha256": "84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff" - }, - { - "type": "file", - "url": "https://files.pythonhosted.org/packages/db/51/a507c856293ab05cdc1db77ff4bc1268ddd39f29e7dc4919aa497f0adbec/charset_normalizer-2.1.1-py3-none-any.whl", - "sha256": "83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f" - }, - { - "type": "file", - "url": "https://files.pythonhosted.org/packages/e9/06/d3d367b7af6305b16f0d28ae2aaeb86154fa91f144f036c2d5002a5a202b/certifi-2022.6.15-py3-none-any.whl", - "sha256": "fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412" - }, - { - "type": "file", - "url": "https://files.pythonhosted.org/packages/ca/91/6d9b8ccacd0412c08820f72cebaa4f0c0441b5cda699c90f618b6f8a1b42/requests-2.28.1-py3-none-any.whl", - "sha256": "8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349" - } - ] } ] } \ No newline at end of file diff --git a/data/com.github.GradienceTeam.Gradience.gschema.xml.in b/data/com.github.GradienceTeam.Gradience.gschema.xml.in index d199de1e9..4d46187a1 100644 --- a/data/com.github.GradienceTeam.Gradience.gschema.xml.in +++ b/data/com.github.GradienceTeam.Gradience.gschema.xml.in @@ -16,10 +16,8 @@ true - [] - - + \ No newline at end of file diff --git a/data/gradience.gresource.xml b/data/gradience.gresource.xml new file mode 100644 index 000000000..f71f508f4 --- /dev/null +++ b/data/gradience.gresource.xml @@ -0,0 +1,70 @@ + + + + presets/adwaita.json + presets/adwaita-dark.json + presets/pretty-purple.json + + ui/error.ui + ui/palette_shades.ui + ui/option.ui + ui/window.ui + ui/app_type_dialog.ui + ui/custom_css_group.ui + ui/builtin_preset_row.ui + ui/explore_preset_row.ui + ui/preset_row.ui + ui/presets_manager_window.ui + ui/plugin_row.ui + ui/welcome.ui + + images/welcome.svg + images/welcome-dark.svg + + + icons/scalable/actions/com.github.GradienceTeam.Gradience-adw-gtk3-warning-symbolic.svg + icons/scalable/actions/com.github.GradienceTeam.Gradience-palette-symbolic.svg + icons/scalable/actions/com.github.GradienceTeam.Gradience-larger-brush-symbolic.svg + icons/scalable/actions/com.github.GradienceTeam.Gradience-color-picker-symbolic.svg + icons/scalable/actions/com.github.GradienceTeam.Gradience-code-symbolic.svg + icons/scalable/actions/com.github.GradienceTeam.Gradience-drive-symbolic.svg + icons/scalable/actions/com.github.GradienceTeam.Gradience-drive-unsaved-symbolic.svg + icons/scalable/actions/com.github.GradienceTeam.Gradience-settings-symbolic.svg + icons/scalable/actions/com.github.GradienceTeam.Gradience-download-symbolic.svg + icons/scalable/actions/com.github.GradienceTeam.Gradience-remove-symbolic.svg + icons/scalable/actions/com.github.GradienceTeam.Gradience-checkmark-small-symbolic.svg + + diff --git a/src/icons/com.github.GradienceTeam.Gradience-adw-gtk3-warning-symbolic.svg b/data/icons/scalable/actions/com.github.GradienceTeam.Gradience-adw-gtk3-warning-symbolic.svg similarity index 100% rename from src/icons/com.github.GradienceTeam.Gradience-adw-gtk3-warning-symbolic.svg rename to data/icons/scalable/actions/com.github.GradienceTeam.Gradience-adw-gtk3-warning-symbolic.svg diff --git a/src/icons/com.github.GradienceTeam.Gradience-checkmark-small-symbolic.svg b/data/icons/scalable/actions/com.github.GradienceTeam.Gradience-checkmark-small-symbolic.svg similarity index 100% rename from src/icons/com.github.GradienceTeam.Gradience-checkmark-small-symbolic.svg rename to data/icons/scalable/actions/com.github.GradienceTeam.Gradience-checkmark-small-symbolic.svg diff --git a/src/icons/com.github.GradienceTeam.Gradience-code-symbolic.svg b/data/icons/scalable/actions/com.github.GradienceTeam.Gradience-code-symbolic.svg similarity index 100% rename from src/icons/com.github.GradienceTeam.Gradience-code-symbolic.svg rename to data/icons/scalable/actions/com.github.GradienceTeam.Gradience-code-symbolic.svg diff --git a/src/icons/com.github.GradienceTeam.Gradience-color-picker-symbolic.svg b/data/icons/scalable/actions/com.github.GradienceTeam.Gradience-color-picker-symbolic.svg similarity index 100% rename from src/icons/com.github.GradienceTeam.Gradience-color-picker-symbolic.svg rename to data/icons/scalable/actions/com.github.GradienceTeam.Gradience-color-picker-symbolic.svg diff --git a/src/icons/com.github.GradienceTeam.Gradience-download-symbolic.svg b/data/icons/scalable/actions/com.github.GradienceTeam.Gradience-download-symbolic.svg similarity index 100% rename from src/icons/com.github.GradienceTeam.Gradience-download-symbolic.svg rename to data/icons/scalable/actions/com.github.GradienceTeam.Gradience-download-symbolic.svg diff --git a/src/icons/com.github.GradienceTeam.Gradience-drive-symbolic.svg b/data/icons/scalable/actions/com.github.GradienceTeam.Gradience-drive-symbolic.svg similarity index 100% rename from src/icons/com.github.GradienceTeam.Gradience-drive-symbolic.svg rename to data/icons/scalable/actions/com.github.GradienceTeam.Gradience-drive-symbolic.svg diff --git a/src/icons/com.github.GradienceTeam.Gradience-drive-unsaved-symbolic.svg b/data/icons/scalable/actions/com.github.GradienceTeam.Gradience-drive-unsaved-symbolic.svg similarity index 100% rename from src/icons/com.github.GradienceTeam.Gradience-drive-unsaved-symbolic.svg rename to data/icons/scalable/actions/com.github.GradienceTeam.Gradience-drive-unsaved-symbolic.svg diff --git a/src/icons/com.github.GradienceTeam.Gradience-larger-brush-symbolic.svg b/data/icons/scalable/actions/com.github.GradienceTeam.Gradience-larger-brush-symbolic.svg similarity index 100% rename from src/icons/com.github.GradienceTeam.Gradience-larger-brush-symbolic.svg rename to data/icons/scalable/actions/com.github.GradienceTeam.Gradience-larger-brush-symbolic.svg diff --git a/src/icons/com.github.GradienceTeam.Gradience-palette-symbolic.svg b/data/icons/scalable/actions/com.github.GradienceTeam.Gradience-palette-symbolic.svg similarity index 100% rename from src/icons/com.github.GradienceTeam.Gradience-palette-symbolic.svg rename to data/icons/scalable/actions/com.github.GradienceTeam.Gradience-palette-symbolic.svg diff --git a/src/icons/com.github.GradienceTeam.Gradience-remove-symbolic.svg b/data/icons/scalable/actions/com.github.GradienceTeam.Gradience-remove-symbolic.svg similarity index 100% rename from src/icons/com.github.GradienceTeam.Gradience-remove-symbolic.svg rename to data/icons/scalable/actions/com.github.GradienceTeam.Gradience-remove-symbolic.svg diff --git a/src/icons/com.github.GradienceTeam.Gradience-settings-symbolic.svg b/data/icons/scalable/actions/com.github.GradienceTeam.Gradience-settings-symbolic.svg similarity index 100% rename from src/icons/com.github.GradienceTeam.Gradience-settings-symbolic.svg rename to data/icons/scalable/actions/com.github.GradienceTeam.Gradience-settings-symbolic.svg diff --git a/data/meson.build b/data/meson.build index dc40c1b7d..e4e1e3d27 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,3 +1,7 @@ +gnome = import('gnome') + +subdir('ui') + desktop_file = i18n.merge_file( input: configure_file( input: '@0@.desktop.in.in'.format(PROJECT_RDNN_NAME), @@ -14,10 +18,19 @@ desktop_file = i18n.merge_file( desktop_utils = find_program('desktop-file-validate', required: false) if desktop_utils.found() test('Validate desktop file', desktop_utils, - args: [desktop_file] + args: [desktop_file.full_path()] ) endif +gnome.compile_resources('gradience', + 'gradience.gresource.xml', + gresource_bundle: true, + source_dir: meson.current_build_dir(), + install: true, + install_dir: PKGDATA_DIR, + dependencies: blueprints, +) + appstream_file = i18n.merge_file( input: configure_file( input: '@0@.appdata.xml.in.in'.format(PROJECT_RDNN_NAME), @@ -39,7 +52,7 @@ appstream_file = i18n.merge_file( appstream_util = find_program('appstream-util', required: false) if appstream_util.found() test('Validate appstream file', appstream_util, - args: ['validate', appstream_file] + args: ['validate', appstream_file.full_path()] ) endif diff --git a/src/presets/adwaita-dark.json b/data/presets/adwaita-dark.json similarity index 100% rename from src/presets/adwaita-dark.json rename to data/presets/adwaita-dark.json diff --git a/src/presets/adwaita.json b/data/presets/adwaita.json similarity index 100% rename from src/presets/adwaita.json rename to data/presets/adwaita.json diff --git a/src/presets/pretty-purple.json b/data/presets/pretty-purple.json similarity index 100% rename from src/presets/pretty-purple.json rename to data/presets/pretty-purple.json diff --git a/src/ui/app_type_dialog.blp b/data/ui/app_type_dialog.blp similarity index 100% rename from src/ui/app_type_dialog.blp rename to data/ui/app_type_dialog.blp diff --git a/src/ui/builtin_preset_row.blp b/data/ui/builtin_preset_row.blp similarity index 100% rename from src/ui/builtin_preset_row.blp rename to data/ui/builtin_preset_row.blp diff --git a/src/ui/custom_css_group.blp b/data/ui/custom_css_group.blp similarity index 100% rename from src/ui/custom_css_group.blp rename to data/ui/custom_css_group.blp diff --git a/src/ui/error.blp b/data/ui/error.blp similarity index 100% rename from src/ui/error.blp rename to data/ui/error.blp diff --git a/src/ui/explore_preset_row.blp b/data/ui/explore_preset_row.blp similarity index 100% rename from src/ui/explore_preset_row.blp rename to data/ui/explore_preset_row.blp diff --git a/data/ui/meson.build b/data/ui/meson.build new file mode 100644 index 000000000..d1be6485f --- /dev/null +++ b/data/ui/meson.build @@ -0,0 +1,18 @@ +blueprints = custom_target('blueprints', + input: files( + 'error.blp', + 'palette_shades.blp', + 'option.blp', + 'window.blp', + 'app_type_dialog.blp', + 'custom_css_group.blp', + 'presets_manager_window.blp', + 'plugin_row.blp', + 'welcome.blp', + 'preset_row.blp', + 'builtin_preset_row.blp', + 'explore_preset_row.blp' + ), + output: '.', + command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], +) diff --git a/src/ui/option.blp b/data/ui/option.blp similarity index 100% rename from src/ui/option.blp rename to data/ui/option.blp diff --git a/src/ui/palette_shades.blp b/data/ui/palette_shades.blp similarity index 100% rename from src/ui/palette_shades.blp rename to data/ui/palette_shades.blp diff --git a/src/ui/plugin_row.blp b/data/ui/plugin_row.blp similarity index 100% rename from src/ui/plugin_row.blp rename to data/ui/plugin_row.blp diff --git a/src/ui/preset_row.blp b/data/ui/preset_row.blp similarity index 100% rename from src/ui/preset_row.blp rename to data/ui/preset_row.blp diff --git a/src/ui/presets_manager_window.blp b/data/ui/presets_manager_window.blp similarity index 98% rename from src/ui/presets_manager_window.blp rename to data/ui/presets_manager_window.blp index ad5b3cbce..771d4520a 100644 --- a/src/ui/presets_manager_window.blp +++ b/data/ui/presets_manager_window.blp @@ -114,7 +114,7 @@ template GradiencePresetWindow : Adw.Window { Gtk.StackPage { name: "page_offline"; - child: Gtk.Label offline_label { + child: Gtk.Label { label: _("Offline"); valign: start; halign: center; diff --git a/src/ui/welcome.blp b/data/ui/welcome.blp similarity index 100% rename from src/ui/welcome.blp rename to data/ui/welcome.blp diff --git a/src/ui/window.blp b/data/ui/window.blp similarity index 100% rename from src/ui/window.blp rename to data/ui/window.blp diff --git a/src/explore_preset_row.py b/src/explore_preset_row.py index f51cf20eb..a8d595bdb 100644 --- a/src/explore_preset_row.py +++ b/src/explore_preset_row.py @@ -52,10 +52,11 @@ def __init__(self, name, url, win, author="", **kwargs): def on_apply_button_clicked(self, *_args): try: download_preset(to_slug_case(self.name), self.url) - except Exception: + except Exception as exception: self.toast_overlay.add_toast( Adw.Toast(title=_("Preset could not be downloaded")) ) + buglog(exception) else: self.app.load_preset_from_file(os.path.join( os.environ.get("XDG_CONFIG_HOME", @@ -67,20 +68,22 @@ def on_apply_button_clicked(self, *_args): self.toast_overlay.add_toast( Adw.Toast(title=_("Preset downloaded")) ) - - buglog("Apply and download compeleted") + self.win.reload_pref_group() + + buglog("Apply and download compeleted") @Gtk.Template.Callback() def on_download_button_clicked(self, *_args): try: download_preset(to_slug_case(self.name), self.url) - except Exception: + except Exception as exception: self.toast_overlay.add_toast( Adw.Toast(title=_("Preset could not be downloaded")) ) + buglog(exception) else: self.toast_overlay.add_toast( Adw.Toast(title=_("Preset downloaded")) ) self.win.reload_pref_group() - buglog("Download compeleted") + buglog("Download compeleted") diff --git a/src/gradience.gresource.xml b/src/gradience.gresource.xml deleted file mode 100644 index 6f02ea3af..000000000 --- a/src/gradience.gresource.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - presets/adwaita.json - presets/adwaita-dark.json - presets/pretty-purple.json - ui/error.ui - ui/palette_shades.ui - ui/option.ui - ui/window.ui - ui/app_type_dialog.ui - ui/custom_css_group.ui - ui/builtin_preset_row.ui - ui/explore_preset_row.ui - ui/preset_row.ui - ui/presets_manager_window.ui - ui/plugin_row.ui - ui/welcome.ui - ../data/images/welcome.svg - ../data/images/welcome-dark.svg - - - - icons/com.github.GradienceTeam.Gradience-adw-gtk3-warning-symbolic.svg - icons/com.github.GradienceTeam.Gradience-palette-symbolic.svg - icons/com.github.GradienceTeam.Gradience-larger-brush-symbolic.svg - icons/com.github.GradienceTeam.Gradience-color-picker-symbolic.svg - icons/com.github.GradienceTeam.Gradience-code-symbolic.svg - icons/com.github.GradienceTeam.Gradience-drive-symbolic.svg - icons/com.github.GradienceTeam.Gradience-drive-unsaved-symbolic.svg - icons/com.github.GradienceTeam.Gradience-settings-symbolic.svg - icons/com.github.GradienceTeam.Gradience-download-symbolic.svg - icons/com.github.GradienceTeam.Gradience-remove-symbolic.svg - icons/com.github.GradienceTeam.Gradience-checkmark-small-symbolic.svg - - - - diff --git a/src/meson.build b/src/meson.build index bcd60ba32..bf51ca265 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,32 +1,3 @@ -gnome = import('gnome') - -blueprints = custom_target('blueprints', - input: files( - 'ui/error.blp', - 'ui/palette_shades.blp', - 'ui/option.blp', - 'ui/window.blp', - 'ui/app_type_dialog.blp', - 'ui/custom_css_group.blp', - 'ui/presets_manager_window.blp', - 'ui/plugin_row.blp', - 'ui/welcome.blp', - 'ui/preset_row.blp', - 'ui/builtin_preset_row.blp', - 'ui/explore_preset_row.blp' - ), - output: '.', - command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], -) - -gnome.compile_resources('gradience', - 'gradience.gresource.xml', - gresource_bundle: true, - install: true, - install_dir: PKGDATA_DIR, - dependencies: blueprints, -) - configure_file( input: 'gradience.in', output: 'gradience', diff --git a/src/presets_manager_window.py b/src/presets_manager_window.py index 89dca2dfd..b14ed9feb 100644 --- a/src/presets_manager_window.py +++ b/src/presets_manager_window.py @@ -84,7 +84,8 @@ def setup_explore(self): self.explore_presets, urls = fetch_presets() if not self.explore_presets: # offline - self.search_stack.set_visible("page_offline") + self.search_spinner.props.visible = False + self.search_stack.set_visible_child_name("page_offline") else: self.search_spinner.props.visible = False