From 7631bfe02a08b7c7968b7ed78f8d975297da148e Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Sun, 11 Oct 2020 12:29:25 +0200 Subject: [PATCH] Get working UI templates import --- dropship/dropship.py | 9 +++++---- dropship/ui_templates.py | 7 ++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/dropship/dropship.py b/dropship/dropship.py index 01095e1..e1ac2a6 100644 --- a/dropship/dropship.py +++ b/dropship/dropship.py @@ -11,7 +11,9 @@ require_version("Gdk", "3.0") from gi.repository import Gdk, GLib, Gtk -from dropship.templates import pendingTransferRow +from dropship.ui_templates import pendingTransferRow + +CWD = Path(__file__).absolute().parent class DropShip: @@ -19,9 +21,8 @@ class DropShip: def __init__(self, nursery): """Object initialisation.""" - self.CWD = Path(__file__).absolute().parent - self.GLADE_FILE = f"{self.CWD}/ui/dropship.ui" - self.CSS_FILE = f"{self.CWD}/ui/dropship.css" + self.GLADE_FILE = f"{CWD}/ui/dropship.ui" + self.CSS_FILE = f"{CWD}/ui/dropship.css" self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) self.nursery = nursery diff --git a/dropship/ui_templates.py b/dropship/ui_templates.py index 8c1fd0b..f553e6a 100644 --- a/dropship/ui_templates.py +++ b/dropship/ui_templates.py @@ -1,10 +1,15 @@ +from pathlib import Path + import gi gi.require_version("Gtk", "3.0") + from gi.repository import Gdk, GLib, Gtk +CWD = Path(__file__).absolute().parent + -@Gtk.Template.from_file("pendingTransferRow.ui") +@Gtk.Template.from_file(f"{CWD}/ui/pendingTransferRow.ui") class pendingTransferRow(Gtk.ListBoxRow): __gtype_name__ = "PendingTransferRow"