Skip to content

Commit faec2e8

Browse files
committed
- RadioBrowser: Better navigation in the Search Window
- SimpleCursesWidgetColumns: added rows and function handlers to execute at cursor extremes
1 parent 15208a8 commit faec2e8

File tree

11 files changed

+224
-118
lines changed

11 files changed

+224
-118
lines changed

Changelog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* RadioBrowser: added hidebroken to all queries
55
* RadioBrowser: if limit=0, disable result limit
66
* RadioBrowser: finalized config save / read function
7+
* RadioBrowser: Better navigation in the Search Window
8+
* Updating docs
79

810
2021-08-15
911
* Version 0.8.9.6 (0.9-beta3)

README.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ <h2 id="controls">Controls <span style="padding-left: 10px;"><sup style="font-si
184184
H M L Jump to the top / middle bottom of the list [Valid] -
185185
P Jump to playing station Jump to playing playlist -
186186
Enter/Right/l Play selected station Open selected playlist Apply selected theme
187+
^N / ^P Play next/previous station - -
188+
(if already in playback)
187189
r Select and play a random station Re-read playlists from disk -
188190
Space/Left/h Stop/start playing selected station - -
189191
Space - - Apply theme and make it default
@@ -195,6 +197,7 @@ <h2 id="controls">Controls <span style="padding-left: 10px;"><sup style="font-si
195197
e Edit current station - -
196198
E Change station&#39;s encoding - -
197199
DEL,x Delete selected station - -
200+
O Open RadioBrowser - -
198201
t T Load theme / Toggle transparency [Valid] [Valid]
199202
c Open Configuration window. - -
200203
/ n N Search, go to next / previous result [Valid] [Valid]

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ The following options can also be set in **PyRadio**'s [configuration file](#con
141141
H M L Jump to the top / middle bottom of the list [Valid] -
142142
P Jump to playing station Jump to playing playlist -
143143
Enter/Right/l Play selected station Open selected playlist Apply selected theme
144+
^N / ^P Play next/previous station - -
145+
(if already in playback)
144146
r Select and play a random station Re-read playlists from disk -
145147
Space/Left/h Stop/start playing selected station - -
146148
Space - - Apply theme and make it default
@@ -152,6 +154,7 @@ The following options can also be set in **PyRadio**'s [configuration file](#con
152154
e Edit current station - -
153155
E Change station's encoding - -
154156
DEL,x Delete selected station - -
157+
O Open RadioBrowser - -
155158
t T Load theme / Toggle transparency [Valid] [Valid]
156159
c Open Configuration window. - -
157160
/ n N Search, go to next / previous result [Valid] [Valid]

pyradio/browser.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,7 +1871,11 @@ def show(self):
18711871
color_cursor_selection=curses.color_pair(6),
18721872
color_cursor_active=curses.color_pair(9),
18731873
margin=1,
1874-
max_width=self._half_width
1874+
max_width=self._half_width,
1875+
on_up_callback_function=self._focus_up,
1876+
on_down_callback_function=self._focus_down,
1877+
on_left_callback_function=self._focus_previous,
1878+
on_right_callback_function=self._focus_next
18751879
))
18761880

18771881
''' sort by (index = 2) '''
@@ -1886,7 +1890,11 @@ def show(self):
18861890
color_active=curses.color_pair(4),
18871891
color_cursor_selection=curses.color_pair(6),
18881892
color_cursor_active=curses.color_pair(9),
1889-
margin=1
1893+
margin=1,
1894+
on_up_callback_function=self._focus_up,
1895+
on_down_callback_function=self._focus_down,
1896+
on_left_callback_function=self._focus_previous,
1897+
on_right_callback_function=self._focus_next
18901898
))
18911899

18921900
'''' sort ascending / descending (index = 3) '''
@@ -2007,7 +2015,7 @@ def show(self):
20072015
self._widgets[2].Y - 1,
20082016
self._widgets[2].X - 2,
20092017
'Sort by', curses.color_pair(4))
2010-
# logger.error('\n\n== 0 widget[{0}].Y = {1}'.format(3, self._widgets[3].Y))
2018+
20112019
''' Two lines under the lists '''
20122020
Y = max(self._widgets[2].Y, self._widgets[1].Y + self._widgets[1].height, self._widgets[3].Y) + 2
20132021
''' place search check box '''
@@ -2025,7 +2033,7 @@ def show(self):
20252033
''' Search check box not moved, will be handled by show '''
20262034
self._win.refresh()
20272035
self._calculate_widgets_yx(Y, X)
2028-
# logger.error('== 1 widget[{0}].Y = {1}'.format(3, self._widgets[3].Y))
2036+
20292037
for n in range(0, 6):
20302038
''' place editors' captions '''
20312039
# self._win.addstr(
@@ -2059,7 +2067,6 @@ def show(self):
20592067
self._h_buttons.move(self.yx[-1][0])
20602068
self._win.refresh()
20612069

2062-
# logger.error('== 2 widget[{0}].Y = {1}'.format(3, self._widgets[3].Y))
20632070
self._h_buttons.calculate_buttons_position()
20642071
self._print_history_legend()
20652072
self._display_all_widgets()

pyradio/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ def move_station(self, source, target):
885885
source >= self.number_of_stations or \
886886
target >= self.number_of_stations or \
887887
self.number_of_stations == 0:
888-
# logger.error('\n\nreturning False\n\n')
888+
# logger.error('DE \n\nreturning False\n\n')
889889
return False
890890
if source < target:
891891
step = 1

pyradio/config_window.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1995,7 +1995,7 @@ def refresh_selection(self, resizing=False):
19951995
pad = len(str(self.startPos + self.maxY - 2 - self.pad_adjustment))
19961996
# logger.error('DE \n\npos = {0}, pad = {1}\n\n'.format(self.startPos + self.maxY - 2 - self.pad_adjustment, pad))
19971997
for i in range(0, self.maxY - 2):
1998-
# logger.error('de i = {0}, startPos = {1}'.format(i, self.startPos))
1998+
# logger.error('DE i = {0}, startPos = {1}'.format(i, self.startPos))
19991999
if i + self.startPos < self._num_of_items:
20002000
line, pad = self._format_line(i, pad)
20012001
colour = self._get_color(i)

pyradio/edit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ def __init__(self, filename, parent, create=False,
655655
else:
656656
self._to_path = self._from_path
657657
self._display_from_file = self._from_file
658-
# logger.error('filename = {0}\nfrom path = {1}\nfrom file = {2}\nto path = {3}\ndisplay name = {4}'.format(
658+
# logger.error('DE filename = {0}\nfrom path = {1}\nfrom file = {2}\nto path = {3}\ndisplay name = {4}'.format(
659659
# filename,
660660
# self._from_path,
661661
# self._from_file,

pyradio/player.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ def updateStatus(self, *args):
547547
subsystemOut = subsystemOutRaw.decode('utf-8', 'replace')
548548
if subsystemOut == '':
549549
break
550-
# logger.error('subsystemOut = "{0}"'.format(subsystemOut))
550+
# logger.error('DE subsystemOut = "{0}"'.format(subsystemOut))
551551
if not self._is_accepted_input(subsystemOut):
552552
continue
553553
subsystemOut = subsystemOut.strip()
@@ -663,10 +663,10 @@ def updateStatus(self, *args):
663663
if logger.isEnabledFor(logging.INFO):
664664
logger.info('*** updateStatus(): Start of playback detected (Icy audio token received) ***')
665665
self.playback_is_on = True
666-
# logger.error(' DE token = "{}"'.format(a_token))
667-
# logger.error(' DE icy_audio_tokens[a_token] = "{}"'.format(self.icy_audio_tokens[a_token]))
666+
# logger.error('DE token = "{}"'.format(a_token))
667+
# logger.error('DE icy_audio_tokens[a_token] = "{}"'.format(self.icy_audio_tokens[a_token]))
668668
a_str = subsystemOut.split(a_token)
669-
# logger.error(' DE str = "{}"'.format(a_str))
669+
# logger.error('DE str = "{}"'.format(a_str))
670670
with self.status_update_lock:
671671
if self.icy_audio_tokens[a_token] == 'icy-br':
672672
self._icy_data[self.icy_audio_tokens[a_token]] = a_str[1].replace('kbit/s', '')
@@ -780,7 +780,7 @@ def updateMPVStatus(self, *args):
780780
sock.close()
781781
if not stop():
782782
''' haven't been asked to stop '''
783-
# logger.error('\n\nDE NOT ASKED TO STOP\n\n')
783+
# logger.error('DE\n\n NOT ASKED TO STOP\n\n')
784784
# poll = process.poll()
785785
# logger.error('DE poll = {}'.format(poll))
786786
# if poll is not None:
@@ -835,10 +835,10 @@ def updateWinVLCStatus(self, *args):
835835
subsystemOut = subsystemOut.replace('\r', '').replace('\n', '')
836836
if subsystemOut == '':
837837
continue
838-
# logger.error('subsystemOut = "{0}"'.format(subsystemOut))
838+
# logger.error('DE subsystemOut = "{0}"'.format(subsystemOut))
839839
if not self._is_accepted_input(subsystemOut):
840840
continue
841-
logger.error('accepted inp = "{0}"'.format(subsystemOut))
841+
# logger.error('DE accepted inp = "{0}"'.format(subsystemOut))
842842
if self.oldUserInput['Input'] != subsystemOut:
843843
if stop():
844844
break
@@ -959,10 +959,10 @@ def updateWinVLCStatus(self, *args):
959959
if logger.isEnabledFor(logging.INFO):
960960
logger.info('*** updateWinVLCStatus(): Start of playback detected (Icy audio token received) ***')
961961
self.playback_is_on = True
962-
# logger.error(' DE token = "{}"'.format(a_token))
963-
# logger.error(' DE icy_audio_tokens[a_token] = "{}"'.format(self.icy_audio_tokens[a_token]))
962+
# logger.error('DE token = "{}"'.format(a_token))
963+
# logger.error('DE icy_audio_tokens[a_token] = "{}"'.format(self.icy_audio_tokens[a_token]))
964964
a_str = subsystemOut.split(a_token)
965-
# logger.error(' DE str = "{}"'.format(a_str))
965+
# logger.error('DE str = "{}"'.format(a_str))
966966
with self.status_update_lock:
967967
if self.icy_audio_tokens[a_token] == 'icy-br':
968968
self._icy_data[self.icy_audio_tokens[a_token]] = a_str[1].replace('kbit/s', '')
@@ -1182,7 +1182,6 @@ def updateTitle(self, *arg, **karg):
11821182
arg[0].write(msg=self.title_prefix + self._format_title_string(self.oldUserInput['Title']))
11831183

11841184
def _is_icy_entry(self, a_string):
1185-
# logger.error("**** a_string = {}".format(a_string))
11861185
for a_token in self.icy_tokens:
11871186
if a_token in a_string:
11881187
return True
@@ -2122,7 +2121,8 @@ def pause(self):
21222121

21232122
def _stop(self):
21242123
''' kill vlc instance '''
2125-
logger.error('setting self.stop_win_vlc_status_update_thread = True')
2124+
if logger.isEnabledFor(logging.INFO):
2125+
logger.info('setting self.stop_win_vlc_status_update_thread = True')
21262126
self.stop_win_vlc_status_update_thread = True
21272127
if self.ctrl_c_pressed:
21282128
return
@@ -2145,7 +2145,7 @@ def _remove_vlc_stdout_log_file(self):
21452145
logger.debug('vlc log file removed: "' + file_to_remove + "'")
21462146
except:
21472147
pass
2148-
# logger.error('Failed {}'.format(count))
2148+
# logger.error('DE Failed {}'.format(count))
21492149

21502150
def _volume_up(self):
21512151
''' increase vlc's volume '''

0 commit comments

Comments
 (0)