[gnome-music/wip/mschraal/searchviewpep8: 2/3] searchbar: Rename {show, toggle}_bar
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/searchviewpep8: 2/3] searchbar: Rename {show, toggle}_bar
- Date: Fri, 29 Dec 2017 14:10:40 +0000 (UTC)
commit 64e32053a69f491b671692dd5593073a44cae5c9
Author: Marinus Schraal <mschraal gnome org>
Date: Thu Dec 28 23:03:12 2017 +0100
searchbar: Rename {show,toggle}_bar
Use direct naming to make functionality more obvious.
show_bar -> reveal
toggle_bar -> toggle
gnomemusic/searchbar.py | 6 +++---
gnomemusic/toolbar.py | 2 +-
gnomemusic/views/emptysearchview.py | 2 +-
gnomemusic/views/searchview.py | 6 +++---
gnomemusic/window.py | 10 +++++-----
5 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/gnomemusic/searchbar.py b/gnomemusic/searchbar.py
index b9008e2..1bac918 100644
--- a/gnomemusic/searchbar.py
+++ b/gnomemusic/searchbar.py
@@ -347,7 +347,7 @@ class Searchbar(Gtk.SearchBar):
return False
@log
- def show_bar(self, show, clear=True):
+ def reveal(self, show, clear=True):
self.set_search_mode(show)
self._search_button.set_active(show)
@@ -360,5 +360,5 @@ class Searchbar(Gtk.SearchBar):
self._drop_down_button.set_active(False)
@log
- def toggle_bar(self):
- self.show_bar(not self.get_search_mode())
+ def toggle(self):
+ self.reveal(not self.get_search_mode())
diff --git a/gnomemusic/toolbar.py b/gnomemusic/toolbar.py
index fe7f447..3861f36 100644
--- a/gnomemusic/toolbar.py
+++ b/gnomemusic/toolbar.py
@@ -140,7 +140,7 @@ class Toolbar(GObject.GObject):
else:
self._search_button.set_visible(True)
- self.searchbar.show_bar(False)
+ self.searchbar.reveal(False)
@log
def set_state(self, state, btn=None):
diff --git a/gnomemusic/views/emptysearchview.py b/gnomemusic/views/emptysearchview.py
index e81b4b4..3a82fd7 100644
--- a/gnomemusic/views/emptysearchview.py
+++ b/gnomemusic/views/emptysearchview.py
@@ -56,7 +56,7 @@ class EmptySearchView(BaseView):
@log
def _back_button_clicked(self, widget, data=None):
- self._header_bar.searchbar.show_bar(True, False)
+ self._header_bar.searchbar.reveal(True, False)
if self.get_visible_child() == self._artist_albums_widget:
self._artist_albums_widget.destroy()
self._artist_albums_widget = None
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index 004bf79..3d53baf 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -95,7 +95,7 @@ class SearchView(BaseView):
@log
def _back_button_clicked(self, widget, data=None):
- self._header_bar.searchbar.show_bar(True, False)
+ self._header_bar.searchbar.reveal(True, False)
if self.get_visible_child() == self._artist_albums_widget:
self._artist_albums_widget.destroy()
@@ -131,7 +131,7 @@ class SearchView(BaseView):
self._header_bar.header_bar.set_title(title)
self._header_bar.header_bar.sub_title = artist
self.set_visible_child(self._album_widget)
- self._header_bar.searchbar.show_bar(False)
+ self._header_bar.searchbar.reveal(False)
elif self.model[_iter][11] == 'artist':
artist = self.model[_iter][2]
albums = self._artists[artist.casefold()]['albums']
@@ -145,7 +145,7 @@ class SearchView(BaseView):
self._header_bar.set_state(ToolbarState.SEARCH_VIEW)
self._header_bar.header_bar.set_title(artist)
self.set_visible_child(self._artist_albums_widget)
- self._header_bar.searchbar.show_bar(False)
+ self._header_bar.searchbar.reveal(False)
elif self.model[_iter][11] == 'song':
if self.model[_iter][12] != DiscoveryStatus.FAILED:
c_iter = self._songs_model.convert_child_iter_to_iter(_iter)[1]
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index ba21854..16e7206 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -406,7 +406,7 @@ class Window(Gtk.ApplicationWindow):
# Open search bar on Ctrl + F
if (event.keyval == Gdk.KEY_f and
event_and_modifiers == Gdk.ModifierType.CONTROL_MASK):
- self.toolbar.searchbar.toggle_bar()
+ self.toolbar.searchbar.toggle()
# Play / Pause on Ctrl + SPACE
if (event.keyval == Gdk.KEY_space
and event_and_modifiers == Gdk.ModifierType.CONTROL_MASK):
@@ -460,7 +460,7 @@ class Window(Gtk.ApplicationWindow):
self.views[View.PLAYLIST].remove_playlist()
# Close search bar after Esc is pressed
if event.keyval == Gdk.KEY_Escape:
- self.toolbar.searchbar.show_bar(False)
+ self.toolbar.searchbar.reveal(False)
# Also disable selection
if self.toolbar._selectionMode:
self.toolbar.set_selection_mode(False)
@@ -473,7 +473,7 @@ class Window(Gtk.ApplicationWindow):
and (event_and_modifiers == Gdk.ModifierType.SHIFT_MASK
or event_and_modifiers == 0)
and not self.views[View.PLAYLIST].rename_active):
- self.toolbar.searchbar.show_bar(True)
+ self.toolbar.searchbar.reveal(True)
@log
def do_button_release_event(self, event):
@@ -508,7 +508,7 @@ class Window(Gtk.ApplicationWindow):
self.curr_view.stack.set_visible_child_name('dummy')
self.curr_view.stack.set_visible_child_name('sidebar')
if self.curr_view != self.views[View.SEARCH] and self.curr_view != self.views[View.EMPTY_SEARCH]:
- self.toolbar.searchbar.show_bar(False)
+ self.toolbar.searchbar.reveal(False)
# Toggle the selection button for the EmptySearch view
if self.curr_view == self.views[View.EMPTY_SEARCH] or \
@@ -528,7 +528,7 @@ class Window(Gtk.ApplicationWindow):
@log
def _on_search_toggled(self, button, data=None):
- self.toolbar.searchbar.show_bar(
+ self.toolbar.searchbar.reveal(
button.get_active(), self.curr_view != self.views[View.SEARCH])
if (not button.get_active()
and (self.curr_view == self.views[View.SEARCH]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]