sidebar: Create a TableWindow scrolled window
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
2e4062a515
commit
31695863de
|
@ -36,6 +36,20 @@ class TestTableView(unittest.TestCase):
|
|||
self.assertEqual(table.get_factory(), row.LibraryFactory)
|
||||
|
||||
|
||||
class TestTableWindow(unittest.TestCase):
|
||||
def test_init(self):
|
||||
window = view.TableWindow(db.artist.Table)
|
||||
self.assertIsInstance(window, Gtk.ScrolledWindow)
|
||||
self.assertIsInstance(window.get_child(), view.TableView)
|
||||
self.assertEqual(window.get_table(), db.artist.Table)
|
||||
|
||||
def test_selection(self):
|
||||
artist = db.artist.Table.find("Test Artist", "Test Sort")
|
||||
window = view.TableWindow(db.artist.Table)
|
||||
self.assertEqual(window.get_selection(), window.get_child().get_selection())
|
||||
self.assertEqual(window.get_selected_playlist(), artist)
|
||||
|
||||
|
||||
class TestUserView(unittest.TestCase):
|
||||
def test_init(self):
|
||||
user = view.UserView()
|
||||
|
|
|
@ -28,6 +28,21 @@ class TableView(Gtk.ListView):
|
|||
return self.get_model().get_table()
|
||||
|
||||
|
||||
class TableWindow(Gtk.ScrolledWindow):
|
||||
def __init__(self, table):
|
||||
Gtk.ScrolledWindow.__init__(self)
|
||||
self.set_child(TableView(table))
|
||||
|
||||
def get_selection(self):
|
||||
return self.get_child().get_selection()
|
||||
|
||||
def get_selected_playlist(self):
|
||||
return self.get_child().get_selected_playlist()
|
||||
|
||||
def get_table(self):
|
||||
return self.get_child().get_table()
|
||||
|
||||
|
||||
class UserView(Gtk.ListView):
|
||||
def __init__(self):
|
||||
Gtk.ListView.__init__(self)
|
||||
|
|
Loading…
Reference in New Issue