gtk: Add a TagList to the Sidebar

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
This commit is contained in:
Anna Schumaker 2023-11-03 17:16:17 -04:00
parent 11941c3bd3
commit 3cc3412c6d
5 changed files with 53 additions and 0 deletions

View File

@ -224,9 +224,23 @@ class TestSidebar(unittest.TestCase):
self.assertEqual(page.props.title, "Calendar")
self.assertEqual(page.props.icon_name, "month-symbolic")
def test_tag_page(self):
"""Test the Sidebar tag view page."""
self.assertIsInstance(self.sidebar._tags,
xfstestsdb.gtk.sidebar.RunidView)
self.assertEqual(self.sidebar._stack.get_child_by_name("tags"),
self.sidebar._tags)
page = self.sidebar._stack.get_page(self.sidebar._tags)
self.assertEqual(page.props.title, "Tags")
self.assertEqual(page.props.icon_name, "tag-symbolic")
def test_runid(self):
"""Test the runid property."""
self.assertEqual(self.sidebar.runid, 0)
self.sidebar._calendar.runid = 1
self.assertEqual(self.sidebar.runid, 1)
self.sidebar._tags.runid = 2
self.assertEqual(self.sidebar.runid, 2)

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg7384"
height="16"
width="16"
version="1.1">
<title
id="title9167">Gnome Symbolic Icon Theme</title>
<defs
id="defs9" />
<metadata
id="metadata90">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Gnome Symbolic Icon Theme</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<path
id="path855"
d="m 1,1 v 6.0008052 l 7.9783226,7.9783228 c 0.5857862,0.585786 1.5355344,0.585786 2.1213204,0 l 0.0097,-0.0097 3.87942,-3.87942 0.0097,-0.0097 c 0.585786,-0.585786 0.585786,-1.535534 0,-2.1213204 L 7.0394752,1 Z m 2.4775289,2.4403054 c 0.271447,-0.271447 0.6464468,-0.4391799 1.0606602,-0.4391797 0.8284268,3e-7 1.4998395,0.671413 1.4998398,1.4998398 4e-7,0.8284269 -0.6714131,1.4998403 -1.4998399,1.49984 -0.8284275,4e-7 -1.4998402,-0.6714123 -1.4998398,-1.4998399 -2e-7,-0.4142134 0.1677334,-0.7892139 0.4391797,-1.0606602 z"
style="display:inline;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1">
<title
id="title864">tag-symbolic</title>
</path>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -6,5 +6,6 @@
<file preprocess="xml-stripblanks">test-fail-symbolic.svg</file>
<file preprocess="xml-stripblanks">down-large-symbolic.svg</file>
<file preprocess="xml-stripblanks">month-symbolic.svg</file>
<file preprocess="xml-stripblanks">tag-symbolic.svg</file>
</gresource>
</gresources>

View File

@ -112,10 +112,13 @@ class Sidebar(Gtk.Box):
margin_top=6, margin_bottom=6,
margin_start=80, margin_end=80)
self._calendar = CalendarView(sql)
self._tags = RunidView(model=tree.TagList(sql))
self._calendar.bind_property("runid", self, "runid")
self._tags.bind_property("runid", self, "runid")
self.__add_page(self._calendar, "Calendar", "month-symbolic")
self.__add_page(self._tags, "Tags", "tag-symbolic")
self._switcher.add_css_class("large-icons")