From dec2f47b15adbc241bcc8dc096585312b3f3c059 Mon Sep 17 00:00:00 2001 From: mirkobrombin Date: Mon, 5 Sep 2022 12:35:34 +0200 Subject: [PATCH] add gui --- .../scalable/apps/pm.mirko.UbuntuSmoother.svg | 18 +++ .../apps/pm.mirko.UbuntuSmoother-symbolic.svg | 18 +++ data/icons/meson.build | 13 ++ data/meson.build | 43 ++++++ data/pm.mirko.UbuntuSmoother.appdata.xml.in | 30 +++++ data/pm.mirko.UbuntuSmoother.desktop.in | 8 ++ data/pm.mirko.UbuntuSmoother.gschema.xml | 5 + meson.build | 21 +++ po/POTFILES | 0 po/meson.build | 1 + ubuntu_smoother/__init__.py | 0 ubuntu_smoother/gtk/window.ui | 122 ++++++++++++++++++ ubuntu_smoother/main.py | 70 ++++++++++ ubuntu_smoother/meson.build | 34 +++++ ubuntu_smoother/ubuntu-smoother.gresource.xml | 6 + ubuntu_smoother/ubuntu-smoother.in | 43 ++++++ ubuntu_smoother/window.py | 25 ++++ 17 files changed, 457 insertions(+) create mode 100644 data/icons/hicolor/scalable/apps/pm.mirko.UbuntuSmoother.svg create mode 100644 data/icons/hicolor/symbolic/apps/pm.mirko.UbuntuSmoother-symbolic.svg create mode 100644 data/icons/meson.build create mode 100644 data/meson.build create mode 100644 data/pm.mirko.UbuntuSmoother.appdata.xml.in create mode 100644 data/pm.mirko.UbuntuSmoother.desktop.in create mode 100644 data/pm.mirko.UbuntuSmoother.gschema.xml create mode 100644 meson.build create mode 100644 po/POTFILES create mode 100644 po/meson.build create mode 100644 ubuntu_smoother/__init__.py create mode 100644 ubuntu_smoother/gtk/window.ui create mode 100644 ubuntu_smoother/main.py create mode 100644 ubuntu_smoother/meson.build create mode 100644 ubuntu_smoother/ubuntu-smoother.gresource.xml create mode 100644 ubuntu_smoother/ubuntu-smoother.in create mode 100644 ubuntu_smoother/window.py diff --git a/data/icons/hicolor/scalable/apps/pm.mirko.UbuntuSmoother.svg b/data/icons/hicolor/scalable/apps/pm.mirko.UbuntuSmoother.svg new file mode 100644 index 0000000..76381fb --- /dev/null +++ b/data/icons/hicolor/scalable/apps/pm.mirko.UbuntuSmoother.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/icons/hicolor/symbolic/apps/pm.mirko.UbuntuSmoother-symbolic.svg b/data/icons/hicolor/symbolic/apps/pm.mirko.UbuntuSmoother-symbolic.svg new file mode 100644 index 0000000..76381fb --- /dev/null +++ b/data/icons/hicolor/symbolic/apps/pm.mirko.UbuntuSmoother-symbolic.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/icons/meson.build b/data/icons/meson.build new file mode 100644 index 0000000..d8f11c9 --- /dev/null +++ b/data/icons/meson.build @@ -0,0 +1,13 @@ +application_id = 'pm.mirko.UbuntuSmoother' + +scalable_dir = join_paths('hicolor', 'scalable', 'apps') +install_data( + join_paths(scalable_dir, ('@0@.svg').format(application_id)), + install_dir: join_paths(get_option('datadir'), 'icons', scalable_dir) +) + +symbolic_dir = join_paths('hicolor', 'symbolic', 'apps') +install_data( + join_paths(symbolic_dir, ('@0@-symbolic.svg').format(application_id)), + install_dir: join_paths(get_option('datadir'), 'icons', symbolic_dir) +) \ No newline at end of file diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 0000000..fe7b42a --- /dev/null +++ b/data/meson.build @@ -0,0 +1,43 @@ +desktop_file = i18n.merge_file( + input: 'pm.mirko.UbuntuSmoother.desktop.in', + output: 'pm.mirko.UbuntuSmoother.desktop', + type: 'desktop', + po_dir: '../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'applications') +) + +desktop_utils = find_program('desktop-file-validate', required: false) +if desktop_utils.found() + test('Validate desktop file', desktop_utils, + args: [desktop_file] + ) +endif + +appstream_file = i18n.merge_file( + input: 'pm.mirko.UbuntuSmoother.appdata.xml.in', + output: 'pm.mirko.UbuntuSmoother.appdata.xml', + po_dir: '../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'appdata') +) + +appstream_util = find_program('appstream-util', required: false) +if appstream_util.found() + test('Validate appstream file', appstream_util, + args: ['validate', appstream_file] + ) +endif + +install_data('pm.mirko.UbuntuSmoother.gschema.xml', + install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas') +) + +compile_schemas = find_program('glib-compile-schemas', required: false) +if compile_schemas.found() + test('Validate schema file', compile_schemas, + args: ['--strict', '--dry-run', meson.current_source_dir()] + ) +endif + +subdir('icons') \ No newline at end of file diff --git a/data/pm.mirko.UbuntuSmoother.appdata.xml.in b/data/pm.mirko.UbuntuSmoother.appdata.xml.in new file mode 100644 index 0000000..541d72c --- /dev/null +++ b/data/pm.mirko.UbuntuSmoother.appdata.xml.in @@ -0,0 +1,30 @@ + + + pm.mirko.UbuntuSmoother.desktop + CC0-1.0 + GPL-3.0-only + Ubuntu Smoother + Tweak your Ubuntu Vanilla GNOME installation. + Mirko Brombin + +

No description

+
+ + pm.mirko.UbuntuSmoother + + + pointing + keyboard + touch + + + 768 + + + + +

First release

+
+
+
+
\ No newline at end of file diff --git a/data/pm.mirko.UbuntuSmoother.desktop.in b/data/pm.mirko.UbuntuSmoother.desktop.in new file mode 100644 index 0000000..ebb52b2 --- /dev/null +++ b/data/pm.mirko.UbuntuSmoother.desktop.in @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Ubuntu Smoother +Exec=ubuntu-smoother +Icon=pm.mirko.UbuntuSmoother +Terminal=false +Type=Application +Categories=GTK; +StartupNotify=true \ No newline at end of file diff --git a/data/pm.mirko.UbuntuSmoother.gschema.xml b/data/pm.mirko.UbuntuSmoother.gschema.xml new file mode 100644 index 0000000..35bbc28 --- /dev/null +++ b/data/pm.mirko.UbuntuSmoother.gschema.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..1a285f0 --- /dev/null +++ b/meson.build @@ -0,0 +1,21 @@ +project('pm.mirko.UbuntuSmoother', + version: '0.0.1', + meson_version: '>= 0.59.0', + default_options: [ 'warning_level=2', + 'werror=false', + ], +) + +i18n = import('i18n') + +gnome = import('gnome') + +subdir('data') +subdir('ubuntu_smoother') +subdir('po') + +gnome.post_install( + glib_compile_schemas: true, + gtk_update_icon_cache: true, + update_desktop_database: true, +) \ No newline at end of file diff --git a/po/POTFILES b/po/POTFILES new file mode 100644 index 0000000..e69de29 diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000..7342ab1 --- /dev/null +++ b/po/meson.build @@ -0,0 +1 @@ +i18n.gettext('ubuntu-smoother', preset: 'glib') \ No newline at end of file diff --git a/ubuntu_smoother/__init__.py b/ubuntu_smoother/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ubuntu_smoother/gtk/window.ui b/ubuntu_smoother/gtk/window.ui new file mode 100644 index 0000000..80618d5 --- /dev/null +++ b/ubuntu_smoother/gtk/window.ui @@ -0,0 +1,122 @@ + + + + + + \ No newline at end of file diff --git a/ubuntu_smoother/main.py b/ubuntu_smoother/main.py new file mode 100644 index 0000000..8825bbc --- /dev/null +++ b/ubuntu_smoother/main.py @@ -0,0 +1,70 @@ +# main.py +# +# Copyright 2022 mirkobrombin +# +# 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 Foundationat version 3 of the License. +# +# 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 . + +import sys +import gi + +gi.require_version('Gtk', '4.0') +gi.require_version('Adw', '1') + +from gi.repository import Gtk, Gio, Adw + +from ubuntu_smoother.window import UbuntuSmootherWindow + + +class UbuntuSmootherApplication(Adw.Application): + """The main application singleton class.""" + + def __init__(self): + super().__init__(application_id='pm.mirko.UbuntuSmoother', + flags=Gio.ApplicationFlags.FLAGS_NONE) + self.create_action('quit', self.close, ['q']) + + def do_activate(self): + """Called when the application is activated. + + We raise the application's main window, creating it if + necessary. + """ + win = self.props.active_window + if not win: + win = UbuntuSmootherWindow(application=self) + win.present() + + def create_action(self, name, callback, shortcuts=None): + """Add an application action. + + Args: + name: the name of the action + callback: the function to be called when the action is + activated + shortcuts: an optional list of accelerators + """ + action = Gio.SimpleAction.new(name, None) + action.connect("activate", callback) + self.add_action(action) + if shortcuts: + self.set_accels_for_action(f"app.{name}", shortcuts) + + def close(self, *args): + """Close the application.""" + self.quit() + + +def main(version): + """The application's entry point.""" + app = UbuntuSmootherApplication() + return app.run(sys.argv) \ No newline at end of file diff --git a/ubuntu_smoother/meson.build b/ubuntu_smoother/meson.build new file mode 100644 index 0000000..11b2058 --- /dev/null +++ b/ubuntu_smoother/meson.build @@ -0,0 +1,34 @@ +pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name()) +moduledir = join_paths(pkgdatadir, 'ubuntu_smoother') +gnome = import('gnome') + +gnome.compile_resources('ubuntu-smoother', + 'ubuntu-smoother.gresource.xml', + gresource_bundle: true, + install: true, + install_dir: pkgdatadir, +) + +python = import('python') + +conf = configuration_data() +conf.set('PYTHON', python.find_installation('python3').path()) +conf.set('VERSION', meson.project_version()) +conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir'))) +conf.set('pkgdatadir', pkgdatadir) + +configure_file( + input: 'ubuntu-smoother.in', + output: 'ubuntu-smoother', + configuration: conf, + install: true, + install_dir: get_option('bindir') +) + +ubuntu_smoother_sources = [ + '__init__.py', + 'main.py', + 'window.py', +] + +install_data(ubuntu_smoother_sources, install_dir: moduledir) \ No newline at end of file diff --git a/ubuntu_smoother/ubuntu-smoother.gresource.xml b/ubuntu_smoother/ubuntu-smoother.gresource.xml new file mode 100644 index 0000000..842d528 --- /dev/null +++ b/ubuntu_smoother/ubuntu-smoother.gresource.xml @@ -0,0 +1,6 @@ + + + + gtk/window.ui + + \ No newline at end of file diff --git a/ubuntu_smoother/ubuntu-smoother.in b/ubuntu_smoother/ubuntu-smoother.in new file mode 100644 index 0000000..4e92fec --- /dev/null +++ b/ubuntu_smoother/ubuntu-smoother.in @@ -0,0 +1,43 @@ +#!@PYTHON@ + +# ubuntu-smoother.in +# +# Copyright 2022 mirkobrombin +# +# 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 Foundationat version 3 of the License. +# +# 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 . + +import os +import sys +import signal +import locale +import gettext + +VERSION = '@VERSION@' +pkgdatadir = '@pkgdatadir@' +localedir = '@localedir@' + +sys.path.insert(1, pkgdatadir) +signal.signal(signal.SIGINT, signal.SIG_DFL) +locale.bindtextdomain('ubuntu_smoother', localedir) +locale.textdomain('ubuntu_smoother') +gettext.install('ubuntu_smoother', localedir) + +if __name__ == '__main__': + import gi + + from gi.repository import Gio + resource = Gio.Resource.load(os.path.join(pkgdatadir, 'ubuntu-smoother.gresource')) + resource._register() + + from ubuntu_smoother import main + sys.exit(main.main(VERSION)) \ No newline at end of file diff --git a/ubuntu_smoother/window.py b/ubuntu_smoother/window.py new file mode 100644 index 0000000..57fcda3 --- /dev/null +++ b/ubuntu_smoother/window.py @@ -0,0 +1,25 @@ +# window.py +# +# Copyright 2022 mirkobrombin +# +# 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 Foundationat version 3 of the License. +# +# 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 . + +from gi.repository import Gtk, Gio, Adw + + +@Gtk.Template(resource_path='/pm/mirko/UbuntuSmoother/gtk/window.ui') +class UbuntuSmootherWindow(Adw.ApplicationWindow): + __gtype_name__ = 'UbuntuSmootherWindow' + + def __init__(self, **kwargs): + super().__init__(**kwargs)