diff --git a/gnome/src/logger.js b/gnome/src/logger.js index 8bc1881..50450c1 100644 --- a/gnome/src/logger.js +++ b/gnome/src/logger.js @@ -44,7 +44,7 @@ export const Logger = GObject.registerClass({ constructor(params = {}) { super(params); - this._log_file_dir = `${GLib.get_user_data_dir()}/${LOG_DIR_NAME}/` + this._log_file_dir = `${GLib.get_user_state_dir()}/${LOG_DIR_NAME}/` this._first_log = true; } diff --git a/ui/build-aux/start-breezy-desktop.sh b/ui/build-aux/start-breezy-desktop.sh index 988ec3f..ba65e8a 100644 --- a/ui/build-aux/start-breezy-desktop.sh +++ b/ui/build-aux/start-breezy-desktop.sh @@ -4,6 +4,7 @@ # https://gitlab.gnome.org/GNOME/dconf-editor/-/blob/master/build-aux/start-dconf-editor.sh IFS=: read -ra host_data_dirs < <(flatpak-spawn --host sh -c 'echo "$XDG_DATA_DIRS"') +IFS=: read -ra HOST_XDG_STATE_HOME < <(flatpak-spawn --host sh -c 'echo "$XDG_STATE_HOME"') # To avoid potentially muddying up $XDG_DATA_DIRS too much, we link the schema paths # into a temporary directory. @@ -33,5 +34,12 @@ if [[ ! -z "${HOST_XDG_DATA_DIRS}" ]]; then XDG_DATA_DIRS="${HOST_XDG_DATA_DIRS:1}:${XDG_DATA_DIRS}" fi +if [[ ! -z "${HOST_XDG_STATE_HOME}" ]]; then + XDG_STATE_HOME="${HOST_XDG_STATE_HOME}" +else + XDG_STATE_HOME="${USER_HOME}/.local/state" +fi + export XDG_DATA_DIRS +export XDG_STATE_HOME exec breezydesktop "$@" \ No newline at end of file diff --git a/ui/com.xronlinux.BreezyDesktop.json b/ui/com.xronlinux.BreezyDesktop.json index 5c87a57..bc4dc9e 100644 --- a/ui/com.xronlinux.BreezyDesktop.json +++ b/ui/com.xronlinux.BreezyDesktop.json @@ -32,6 +32,7 @@ ], "modules" : [ "python3-pydbus.json", + "python3-requests.json", { "name": "dconf", "buildsystem": "meson", diff --git a/ui/meson.build b/ui/meson.build index 9dffea0..e0beda9 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -1,5 +1,5 @@ project('breezydesktop', - version: '0.1.0', + version: '0.1.1', meson_version: '>= 0.62.0', default_options: [ 'warning_level=2', 'werror=false', ], ) diff --git a/ui/modules/PyXRLinuxDriverIPC b/ui/modules/PyXRLinuxDriverIPC index 831a31d..b95aaee 160000 --- a/ui/modules/PyXRLinuxDriverIPC +++ b/ui/modules/PyXRLinuxDriverIPC @@ -1 +1 @@ -Subproject commit 831a31d3b8ac74964be5506b4cd9b81f6755d634 +Subproject commit b95aaeeaaaf8ae8e0da25594f332c7a040262aa8 diff --git a/ui/python3-requests.json b/ui/python3-requests.json new file mode 100644 index 0000000..edb77fc --- /dev/null +++ b/ui/python3-requests.json @@ -0,0 +1,34 @@ +{ + "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/ba/06/a07f096c664aeb9f01624f858c3add0a4e913d6c96257acb4fce61e7de14/certifi-2024.2.2-py3-none-any.whl", + "sha256": "dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/63/09/c1bc53dab74b1816a00d8d030de5bf98f724c52c1635e07681d312f20be8/charset-normalizer-3.3.2.tar.gz", + "sha256": "f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/e5/3e/741d8c82801c347547f8a2a06aa57dbb1992be9e948df2ea0eda2c8b79e8/idna-3.7-py3-none-any.whl", + "sha256": "82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/c3/20/748e38b466e0819491f0ce6e90ebe4184966ee304fe483e2c414b0f4ef07/requests-2.32.2-py3-none-any.whl", + "sha256": "fc06670dd0ed212426dfeb94fc1b983d917c4f9847c863f313c9dfaaffb7c23c" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/a2/73/a68704750a7679d0b6d3ad7aa8d4da8e14e151ae82e6fee774e6e0d05ec8/urllib3-2.2.1-py3-none-any.whl", + "sha256": "450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d" + } + ] +} diff --git a/ui/src/main.py b/ui/src/main.py index 9901e88..0d02168 100644 --- a/ui/src/main.py +++ b/ui/src/main.py @@ -17,17 +17,43 @@ # # SPDX-License-Identifier: GPL-3.0-or-later +import logging +import os import sys import gi +from logging.handlers import TimedRotatingFileHandler + gi.require_version('Gtk', '4.0') gi.require_version('Adw', '1') gi.require_version('Gio', '2.0') +gi.require_version('GLib', '2.0') -from gi.repository import Adw, Gtk, Gio +from gi.repository import Adw, Gtk, Gio, GLib from .licensedialog import LicenseDialog from .statemanager import StateManager from .window import BreezydesktopWindow +from .xrdriveripc import XRDriverIPC + +state_dir = os.path.expanduser("~/.local/state") +log_dir = os.path.join(state_dir, 'breezy_gnome/logs/ui') +os.makedirs(log_dir, exist_ok=True) + +logger = logging.getLogger('breezy_ui') +logger.setLevel(logging.INFO) +logname = os.path.join(log_dir, "breezy_desktop.log") +handler = TimedRotatingFileHandler(logname, when="midnight", backupCount=30) +handler.suffix = "%Y%m%d" +formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') +handler.setFormatter(formatter) +logger.addHandler(handler) + +def excepthook(exc_type, exc_value, exc_traceback): + logger.error('Unhandled exception', exc_info=(exc_type, exc_value, exc_traceback)) + +sys.excepthook = excepthook + +XRDriverIPC.set_instance(XRDriverIPC(logger)) class BreezydesktopApplication(Adw.Application): """The main application singleton class.""" @@ -58,7 +84,7 @@ class BreezydesktopApplication(Adw.Application): modal=True, program_name='Breezy Desktop', logo_icon_name='com.xronlinux.BreezyDesktop', - version='0.1.0', + version='0.1.1', authors=['Wayne Heaney'], copyright='© 2024 Wayne Heaney') about.present() @@ -93,6 +119,5 @@ class BreezydesktopApplication(Adw.Application): def main(version): - """The application's entry point.""" app = BreezydesktopApplication() return app.run(sys.argv)