header: Add a header bar to the window
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
5f23e34972
commit
5fc2944aec
|
@ -0,0 +1,4 @@
|
|||
# Copyright 2021 (c) Anna Schumaker.
|
||||
from gi.repository import Gtk
|
||||
|
||||
Header = Gtk.HeaderBar()
|
|
@ -0,0 +1,8 @@
|
|||
# Copyright 2021 (c) Anna Schumaker.
|
||||
from . import header
|
||||
from gi.repository import Gtk
|
||||
import unittest
|
||||
|
||||
class TestHeader(unittest.TestCase):
|
||||
def test_header_init(self):
|
||||
self.assertIsInstance(header.Header, Gtk.HeaderBar)
|
|
@ -2,6 +2,7 @@
|
|||
from lib import settings
|
||||
from lib import version
|
||||
from . import window
|
||||
from . import header
|
||||
from gi.repository import Gtk
|
||||
import unittest
|
||||
|
||||
|
@ -16,6 +17,8 @@ class TestUIWindow(unittest.TestCase):
|
|||
|
||||
def test_window_init(self):
|
||||
self.assertIsInstance(window.Window, Gtk.ApplicationWindow)
|
||||
|
||||
self.assertEqual(window.Window.get_titlebar(), header.Header)
|
||||
window.Window.present()
|
||||
|
||||
self.assertEqual(window.Window.get_title(), version.string())
|
||||
|
|
|
@ -4,6 +4,7 @@ from lib import version
|
|||
import gi
|
||||
gi.require_version("Gtk", "4.0")
|
||||
from gi.repository import Gtk
|
||||
from . import header
|
||||
|
||||
Window = Gtk.ApplicationWindow()
|
||||
|
||||
|
@ -31,3 +32,9 @@ Window.connect("notify::default-height", on_change_height)
|
|||
def on_maximized(window, maximized):
|
||||
settings.set("window.maximized", window.is_maximized())
|
||||
Window.connect("notify::maximized", on_maximized)
|
||||
|
||||
|
||||
#
|
||||
# Set up the window's header bar
|
||||
#
|
||||
Window.set_titlebar(header.Header)
|
||||
|
|
Loading…
Reference in New Issue