From be2dddbd5fccec24cebf0a708307ea581d0f2825 Mon Sep 17 00:00:00 2001 From: Bernat Arlandis Date: Fri, 11 Sep 2020 09:48:33 +0200 Subject: [PATCH] Init Gdk, fixes #32 --- oversteer/application.py | 2 +- oversteer/gtk_ui.py | 3 ++- oversteer/gui.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/oversteer/application.py b/oversteer/application.py index 61dda10..900aaf9 100644 --- a/oversteer/application.py +++ b/oversteer/application.py @@ -103,7 +103,7 @@ def run(self, argv): self.device_manager = device_manager self.device = device from oversteer.gui import Gui - Gui(self) + Gui(self, argv) device_manager.stop() diff --git a/oversteer/gtk_ui.py b/oversteer/gtk_ui.py index a67c774..061ec08 100644 --- a/oversteer/gtk_ui.py +++ b/oversteer/gtk_ui.py @@ -10,11 +10,12 @@ class GtkUi: - def __init__(self, gui): + def __init__(self, gui, argv): self.gui = gui self.ffbmeter_timer = False self.overlay_window_pos = (20, 20) + Gdk.init(argv) style_provider = Gtk.CssProvider() style_provider.load_from_path(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'main.css')) Gtk.StyleContext.add_provider_for_screen( diff --git a/oversteer/gui.py b/oversteer/gui.py index 947ab30..ec589b2 100644 --- a/oversteer/gui.py +++ b/oversteer/gui.py @@ -16,7 +16,7 @@ class Gui: - def __init__(self, application): + def __init__(self, application, argv): self.app = application self.locale = '' self.device_manager = self.app.device_manager @@ -67,7 +67,7 @@ def __init__(self, application): if not os.path.isdir(self.profile_path): os.makedirs(self.profile_path, 0o700) - self.ui = GtkUi(self) + self.ui = GtkUi(self, argv) self.ui.set_app_version(self.app.version) self.ui.set_app_icon(os.path.join(self.app.icondir, 'org.berarma.Oversteer.svg')) self.ui.set_languages(self.languages)