Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into shell-theming
Browse files Browse the repository at this point in the history
  • Loading branch information
tfuxu committed Dec 28, 2022
2 parents b49b1ff + 2950ee9 commit 969a1f3
Show file tree
Hide file tree
Showing 54 changed files with 1,982 additions and 1,985 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ indent_style = space
indent_size = 4

[meson.build]
indent_style = space
indent_size = 2

[*.md]
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ body:
attributes:
value: |
Thank you for taking the time to fill out this bug report!
- type: checkboxes
attributes:
label: Is there an existing issue for this?
Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
blank_issues_enabled: true
blank_issues_enabled: false
contact_links:
- name: 🎨 Preset request
- name: 🎨 Preset request
url: https://github.com/GradienceTeam/Community/issues/new?assignees=&labels=enhancement%2Cpreset+request&template=preset_request.yml&title=feat%3A+
about: Request a port of a theme into Gradience
about: Request a port of a theme into Gradience
- name: 🔌 Plug-in request
url: https://github.com/GradienceTeam/Plugins/issues/new?assignees=&labels=enhancement%2Cplugin-request&template=plugin_request.yml&title=plug%3A+
about: Request a plugin for customizing an external application or tool
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.


name: CI

on:
push:
branches: [main]
pull_request:
name: CI

jobs:
flatpak:
name: "Flatpak"
Expand Down Expand Up @@ -50,4 +52,3 @@ jobs:
manifest-path: build-aux/flatpak/com.github.GradienceTeam.Gradience.Devel.json
cache-key: flatpak-builder-${{ github.sha }}
arch: ${{ matrix.arch }}

5 changes: 2 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,10 @@ jobs:
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
Expand All @@ -77,7 +76,7 @@ jobs:
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pypi_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.10'
# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/translation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ on:

jobs:
generate:
name: Generate .pot and LINGUAS
name: Generate .pot and LINGUAS
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down
79 changes: 79 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[MAIN]

# Use multiple processes to speed up Pylint.
jobs=4


[MESSAGES CONTROL]

# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once). You can also use "--disable=all" to
# disable everything first and then re-enable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=locally-disabled,
suppressed-message,
useless-suppression,
#line-too-long,
fixme,
missing-module-docstring,
missing-function-docstring,
missing-class-docstring,
invalid-name,
no-member,
too-few-public-methods,
attribute-defined-outside-init,
logging-fstring-interpolation,
unused-argument


[FORMAT]

# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '

# Number of spaces of indent required inside a hanging or continued line.
indent-after-paren=4

# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
expected-line-ending-format=LF


[MISCELLANEOUS]

# List of note tags to take in consideration, separated by a comma.
notes=FIXME,XXX,TODO


[VARIABLES]

# Tells whether we should check for unused import in __init__ files.
init-import=no

# A regular expression matching the name of dummy variables (i.e. expectedly
# not used).
dummy-variables-rgx=(_+[a-zA-Z0-9]*?$)|dummy

# List of additional names supposed to be defined in builtins. Remember that
# you should avoid to define new builtins when possible.
additional-builtins=_


[SIMILARITIES]

# Minimum lines number of a similarity.
min-similarity-lines=4

# Ignore comments when computing similarities.
ignore-comments=yes

# Ignore docstrings when computing similarities.
ignore-docstrings=yes

# Ignore imports when computing similarities.
ignore-imports=no
1 change: 0 additions & 1 deletion gradience/backend/css_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def parse_css(path):
for color_name in adw_colors:
if name.startswith(color_name): # Palette colors
palette[name[:-1]][name[-1:]] = color[:-1]
break
else: # Other color variables
variables[name] = color[:-1]
elif not_cdefine_match != None: # If CSS rules were found
Expand Down
25 changes: 13 additions & 12 deletions gradience/backend/flatpak_overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ def __user_save_keyfile(user_keyfile, filename, settings=None, gtk_ver=None, toa
try:
user_keyfile.save_to_file(filename)
except GLib.GError as e:
logging.error("Failed to save keyfile structure to override.", exc=e)
if toast_overlay:
toast_overlay.add_toast(Adw.Toast(title=_("Failed to save override")))
logging.error(f"Failed to save keyfile structure to override. Exc: {e}")
else:
if gtk_ver == "gtk4" and settings:
settings.set_boolean("user-flatpak-theming-gtk4", True)
Expand All @@ -88,9 +88,9 @@ def __global_save_keyfile(global_keyfile, filename, settings=None, gtk_ver=None,
try:
global_keyfile.save_to_file(filename)
except GLib.GError as e:
logging.error("Failed to save keyfile structure to override.", exc=e)
if toast_overlay:
toast_overlay.add_toast(Adw.Toast(title=_("Failed to save override")))
logging.error(f"Failed to save keyfile structure to override. Exc: {e}")
else:
if gtk_ver == "gtk4" and settings:
settings.set_boolean("global-flatpak-theming-gtk4", True)
Expand Down Expand Up @@ -124,7 +124,7 @@ def list_file_access():
logging.debug("Gradience overrides file doesn't exist")
return False
else:
logging.error(f"Unhandled GLib.FileError error code. Exc: {e}")
logging.error("Unhandled GLib.FileError error code.", exc=e)
raise
else:
try:
Expand Down Expand Up @@ -166,7 +166,7 @@ def allow_file_access(directory, toast_overlay=None):
dirs = Gio.File.new_for_path(override_dir)
dirs.make_directory_with_parents(None)
except GLib.GError as e:
logging.error(f"Unable to create directories. Exc: {e}")
logging.error("Unable to create directories.", exc=e)
raise
else:
logging.debug("Directories created.")
Expand All @@ -180,11 +180,12 @@ def allow_file_access(directory, toast_overlay=None):
__user_save_keyfile(user_keyfile, filename,
toast_overlay=toast_overlay)
else:
logging.error("Unhandled GLib.FileError error code.", exc=e)
if toast_overlay:
toast_overlay.add_toast(
Adw.Toast(title=_("Unexpected file error occurred"))
)
logging.error(f"Unhandled GLib.FileError error code. Exc: {e}")
raise
else:
try:
filesys_list = user_keyfile.get_string_list(
Expand Down Expand Up @@ -221,11 +222,11 @@ def disallow_file_access(directory, toast_overlay=None):
logging.debug("File doesn't exist")
return
else:
logging.error("Unhandled GLib.FileError error code.", exc=e)
if toast_overlay:
toast_overlay.add_toast(
Adw.Toast(title=_("Unexpected file error occurred"))
)
logging.error(f"Unhandled GLib.FileError error code. Exc: {e}")
raise
else:
try:
Expand Down Expand Up @@ -279,7 +280,7 @@ def create_gtk_user_override(settings, gtk_ver, toast_overlay=None):
dirs = Gio.File.new_for_path(override_dir)
dirs.make_directory_with_parents(None)
except GLib.GError as e:
logging.error(f"Unable to create directories. Exc: {e}")
logging.error("Unable to create directories.", exc=e)
if is_gtk4:
settings.set_boolean(
"user-flatpak-theming-gtk4", False)
Expand All @@ -299,11 +300,11 @@ def create_gtk_user_override(settings, gtk_ver, toast_overlay=None):
__user_save_keyfile(user_keyfile, filename,
settings, gtk_ver, toast_overlay)
else:
logging.error("Unhandled GLib.FileError error code.", exc=e)
if toast_overlay:
toast_overlay.add_toast(
Adw.Toast(title=_("Unexpected file error occurred"))
)
logging.error(f"Unhandled GLib.FileError error code. Exc: {e}")
else:
try:
filesys_list = user_keyfile.get_string_list(
Expand Down Expand Up @@ -359,11 +360,11 @@ def set_theming():
set_theming()
logging.warning("remove override: File doesn't exist")
else:
logging.error("Unhandled GLib.FileError error code.", exc=e)
if toast_overlay:
toast_overlay.add_toast(
Adw.Toast(title=_("Unexpected file error occurred"))
)
logging.error(f"Unhandled GLib.FileError error code. Exc: {e}")
else:
try:
filesys_list = user_keyfile.get_string_list(
Expand Down Expand Up @@ -421,7 +422,7 @@ def create_gtk_global_override(settings, gtk_ver, toast_overlay=None):
dirs = Gio.File.new_for_path(override_dir)
dirs.make_directory_with_parents(None)
except GLib.GError as e:
logging.error(f"Unable to create directories. Exc: {e}")
logging.error("Unable to create directories.", exc=e)
if is_gtk4:
settings.set_boolean(
"global-flatpak-theming-gtk4", False)
Expand All @@ -441,11 +442,11 @@ def create_gtk_global_override(settings, gtk_ver, toast_overlay=None):
__global_save_keyfile(global_keyfile, filename,
settings, gtk_ver, toast_overlay)
else:
logging.error("Unhandled GLib.FileError error code.", exc=e)
if toast_overlay:
toast_overlay.add_toast(
Adw.Toast(title=_("Unexpected file error occurred"))
)
logging.error(f"Unhandled GLib.FileError error code. Exc: {e}")
else:
try:
filesys_list = global_keyfile.get_string_list(
Expand Down Expand Up @@ -502,11 +503,11 @@ def set_theming():
set_theming()
logging.warning("remove override: File doesn't exist")
else:
logging.error("Unhandled GLib.FileError error code.", exc=e)
if toast_overlay:
toast_overlay.add_toast(
Adw.Toast(title=_("Unexpected file error occurred"))
)
logging.error(f"Unhandled GLib.FileError error code. Exc: {e}")
else:
try:
filesys_list = global_keyfile.get_string_list(
Expand Down
2 changes: 1 addition & 1 deletion gradience/backend/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_gtk_theme_dir(app_type):
def is_sandboxed():
portal = Xdp.Portal()

is_sandboxed = self.portal.running_under_sandbox()
is_sandboxed = portal.running_under_sandbox()

return is_sandboxed

Expand Down
Loading

0 comments on commit 969a1f3

Please sign in to comment.