rind: Add track filtering and pause-after widgets

I change the keyboard shortcuts up slightly with this patch:
- ctrl+m shows and hides the search widgets
- ctrl+f now shows the widgets and focuses the track filtering entry

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2019-04-08 21:17:14 -04:00
parent 7d470bbf94
commit ce302ff773
3 changed files with 173 additions and 98 deletions

View File

@ -7,6 +7,11 @@
<mime-type>inode/directory</mime-type>
</mime-types>
</object>
<object class="GtkAdjustment" id="pause_adjustment">
<property name="upper">99</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="progress_adjustment">
<property name="upper">100</property>
<property name="step_increment">5</property>
@ -257,7 +262,7 @@
</child>
</object>
</child>
<accelerator key="f" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<accelerator key="m" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">True</property>
@ -318,8 +323,8 @@ audio-volume-medium-symbolic</property>
<property name="relief">none</property>
</object>
</child>
<accelerator key="Up" signal="popup" modifiers="GDK_CONTROL_MASK"/>
<accelerator key="Down" signal="popup" modifiers="GDK_CONTROL_MASK"/>
<accelerator key="Up" signal="popup" modifiers="GDK_CONTROL_MASK"/>
<style>
<class name="default"/>
</style>
@ -424,7 +429,7 @@ audio-volume-medium-symbolic</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<property name="placeholder_text" translatable="yes">Search Playlists</property>
<property name="placeholder_text" translatable="yes">Filter Playlists</property>
<accelerator key="s" signal="grab-focus" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
@ -434,7 +439,8 @@ audio-volume-medium-symbolic</property>
</packing>
</child>
<child>
<object class="GtkSeparator" id="playlist_separator">
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
@ -447,6 +453,7 @@ audio-volume-medium-symbolic</property>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkTreeView" id="manager_treeview">
<property name="visible">True</property>
@ -501,115 +508,176 @@ audio-volume-medium-symbolic</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkTreeView" id="playlist_treeview">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscroll_policy">natural</property>
<property name="vscroll_policy">natural</property>
<property name="fixed_height_mode">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="title" translatable="yes">#</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
<object class="GtkTreeView" id="playlist_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscroll_policy">natural</property>
<property name="vscroll_policy">natural</property>
<property name="fixed_height_mode">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="fixed_width">250</property>
<property name="title" translatable="yes">Title</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="title" translatable="yes">#</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Length</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="fixed_width">250</property>
<property name="title" translatable="yes">Title</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="fixed_width">150</property>
<property name="title" translatable="yes">Artist</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Length</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="fixed_width">150</property>
<property name="title" translatable="yes">Album</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">4</attribute>
</attributes>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="fixed_width">150</property>
<property name="title" translatable="yes">Artist</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Year</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">5</attribute>
</attributes>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="fixed_width">150</property>
<property name="title" translatable="yes">Album</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">4</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="fixed_width">150</property>
<property name="title" translatable="yes">Genre</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">6</attribute>
</attributes>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Year</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">5</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="resizable">True</property>
<property name="sizing">fixed</property>
<property name="fixed_width">150</property>
<property name="title" translatable="yes">Genre</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">6</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">3</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">3</property>
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="track_search">
<property name="can_focus">True</property>
<property name="margin_left">10</property>
<property name="margin_right">10</property>
<property name="margin_top">10</property>
<property name="margin_bottom">10</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<property name="placeholder_text" translatable="yes">Filter Tracks</property>
<accelerator key="f" signal="grab-focus" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="pause_after">
<property name="can_focus">True</property>
<property name="margin_left">10</property>
<property name="margin_right">10</property>
<property name="margin_top">10</property>
<property name="margin_bottom">10</property>
<property name="caps_lock_warning">False</property>
<property name="primary_icon_name">media-playback-pause</property>
<property name="placeholder_text" translatable="yes">Keep Playing</property>
<property name="adjustment">pause_adjustment</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>

View File

@ -11,8 +11,9 @@ Builder.add_from_file("emmental.ui")
UpDown = Builder.get_object("updown_button")
UpArrow = Builder.get_object("up_arrow")
DownArrow = Builder.get_object("down_arrow")
PauseAfter = Builder.get_object("pause_after")
PlistSearch = Builder.get_object("playlist_search")
PlistSep = Builder.get_object("playlist_separator")
TrackSearch = Builder.get_object("track_search")
Window = Builder.get_object("window")
class EmmentalApplication(Gtk.Application):
@ -73,10 +74,12 @@ def updown_toggled(self, *args):
active = UpDown.get_active()
UpArrow.set_visible(active)
DownArrow.set_visible(not active)
PauseAfter.set_visible(active)
PlistSearch.set_visible(active)
PlistSep.set_visible(active)
TrackSearch.set_visible(active)
UpDown.connect("toggled", updown_toggled)
PlistSearch.connect("can-activate-accel", can_activate_entry)
TrackSearch.connect("can-activate-accel", can_activate_entry)
Application = EmmentalApplication()

View File

@ -47,28 +47,32 @@ class TestGtk(unittest.TestCase):
self.assertIsInstance(gtk.UpDown, Gtk.ToggleButton)
self.assertIsInstance(gtk.UpArrow, Gtk.Image)
self.assertIsInstance(gtk.DownArrow, Gtk.Image)
self.assertIsInstance(gtk.PauseAfter, Gtk.SpinButton)
self.assertIsInstance(gtk.PlistSearch, Gtk.SearchEntry)
self.assertIsInstance(gtk.PlistSep, Gtk.Separator)
self.assertIsInstance(gtk.TrackSearch, Gtk.SearchEntry)
self.assertFalse(gtk.UpDown.get_active())
self.assertFalse(gtk.UpArrow.is_visible())
self.assertTrue( gtk.DownArrow.is_visible())
self.assertFalse(gtk.PlistSearch.is_visible())
self.assertFalse(gtk.PlistSep.is_visible())
self.assertFalse(gtk.TrackSearch.is_visible())
self.assertFalse(gtk.PauseAfter.is_visible())
gtk.UpDown.set_active(True)
self.assertTrue( gtk.UpDown.get_active())
self.assertTrue( gtk.UpArrow.is_visible())
self.assertFalse(gtk.DownArrow.is_visible())
self.assertTrue( gtk.PlistSearch.is_visible())
self.assertTrue( gtk.PlistSep.is_visible())
self.assertTrue( gtk.TrackSearch.is_visible())
self.assertTrue(gtk.PauseAfter.is_visible())
gtk.UpDown.set_active(False)
self.assertFalse(gtk.UpDown.get_active())
self.assertFalse(gtk.UpArrow.is_visible())
self.assertTrue( gtk.DownArrow.is_visible())
self.assertFalse(gtk.PlistSearch.is_visible())
self.assertFalse(gtk.PlistSep.is_visible())
self.assertFalse(gtk.TrackSearch.is_visible())
self.assertFalse(gtk.PauseAfter.is_visible())
def test_accel(self):
play_button = gtk.Builder.get_object("play_button")