Get working UI templates import

This commit is contained in:
Luke Murphy 2020-10-11 12:29:25 +02:00
parent c5c6e41df5
commit 7631bfe02a
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
2 changed files with 11 additions and 5 deletions

View File

@ -11,7 +11,9 @@ require_version("Gdk", "3.0")
from gi.repository import Gdk, GLib, Gtk 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: class DropShip:
@ -19,9 +21,8 @@ class DropShip:
def __init__(self, nursery): def __init__(self, nursery):
"""Object initialisation.""" """Object initialisation."""
self.CWD = Path(__file__).absolute().parent self.GLADE_FILE = f"{CWD}/ui/dropship.ui"
self.GLADE_FILE = f"{self.CWD}/ui/dropship.ui" self.CSS_FILE = f"{CWD}/ui/dropship.css"
self.CSS_FILE = f"{self.CWD}/ui/dropship.css"
self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
self.nursery = nursery self.nursery = nursery

View File

@ -1,10 +1,15 @@
from pathlib import Path
import gi import gi
gi.require_version("Gtk", "3.0") gi.require_version("Gtk", "3.0")
from gi.repository import Gdk, GLib, Gtk 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): class pendingTransferRow(Gtk.ListBoxRow):
__gtype_name__ = "PendingTransferRow" __gtype_name__ = "PendingTransferRow"