Skip to content

Commit 6fae44a

Browse files
committed
Version 0.8.9.2
Using subwin to eliminate flickering
1 parent c8e47a7 commit 6fae44a

File tree

6 files changed

+107
-43
lines changed

6 files changed

+107
-43
lines changed

Changelog

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
2021-04-20 s-n-g
1+
2021-05-11 s-n-g
2+
* Screen flickering when moving within the stations' list eliminated
3+
* VLC player is available again (disabled by unreported bug)
4+
* Advancing Radio Browser support
25
* Fixing python 2 return from Radio Browser TUI breakage
3-
* Adding dnspython module existence check
6+
* Adding dnspython module availability check
47

58
2021-04-14 s-n-g
69
* Version 0.8.9.1

devel/build_install_pyradio

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ set -- "${POSITIONAL[@]}" # restore positional parameters
219219
#done
220220

221221
# check dependencies :)
222-
for prog in git sed ;do
222+
# for prog in git sed ;do
223+
for prog in sed ;do
223224
${prog} --version 2>/dev/null 1>&2 || {
224225
if [ "${prog}" = "sed" ];then
225226
sed 's/a/b/' LICENCE > /dev/null ||{

pyradio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" pyradio -- Console radio player. "
22

3-
version_info = (0, 8, 9, 1)
3+
version_info = (0, 8, 9, 2)
44

55
# Application state:
66
# New stable version: ''

pyradio/browser.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def initialize(self):
288288
'term': '',
289289
'post_data': {'name': 'jaz'},
290290
})
291-
self._search_history_index = 1
291+
self._search_history_index = 0
292292
return True
293293
return False
294294

@@ -1238,7 +1238,7 @@ def show(self):
12381238
self.TITLE,
12391239
curses.color_pair(4))
12401240
self._win.refresh()
1241-
self._erase_win(self.maxY, self.maxX, self.Y, self.X)
1241+
# self._erase_win(self.maxY, self.maxX, self.Y, self.X)
12421242

12431243
''' start displaying things '''
12441244
self._win.addstr(1, 2, 'Search for', curses.color_pair(5))
@@ -1369,14 +1369,6 @@ def _update_focus(self):
13691369
else:
13701370
x._focused = False
13711371

1372-
def _erase_win(self, pY, pX, Y, X):
1373-
empty_win = curses.newwin(
1374-
pY - 2, pX - 2,
1375-
Y + 1, X + 1
1376-
)
1377-
empty_win.bkgdset(' ', curses.color_pair(5))
1378-
empty_win.erase()
1379-
empty_win.refresh()
13801372

13811373
def keypress(self, char):
13821374
''' RadioBrowserInfoSearchWindow keypress

pyradio/common.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,14 @@ def BACKGROUND(): return 1
3333
': Playback stopped',
3434
': Player terminated abnormally!')
3535

36+
def erase_curses_win(self, Y, X, beginY, beginX, char=' ', color=5):
37+
''' empty a part of the screen
38+
'''
39+
empty_win = curses.newwin(
40+
Y - 2, X - 2,
41+
beginY + 1, beginX + 1
42+
)
43+
empty_win.bkgdset(char, curses.color_pair(color))
44+
empty_win.erase()
45+
empty_win.refresh()
46+

pyradio/radio.py

Lines changed: 86 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ def __del__(self):
456456
self.transientWin = None
457457

458458
def setup(self, stdscr):
459+
# curses.savetty()
459460
self.setup_return_status = True
460461
if not curses.has_colors():
461462
self.setup_return_status = False
@@ -499,7 +500,6 @@ def setup(self, stdscr):
499500
self.playbackTimeoutCounter,
500501
self.connectionFailed,
501502
self._show_station_info_from_thread)
502-
logger.error('DE \n\nNEW_PROFILE_STRING = {}\n\n'.format(self.player.NEW_PROFILE_STRING))
503503
except:
504504
''' no player '''
505505
self.ws.operation_mode = self.ws.NO_PLAYER_ERROR_MODE
@@ -593,7 +593,7 @@ def setupAndDrawScreen(self, init_from_setup=False):
593593
self.bodyWinEndY = self.maxY - 1
594594
if logger.isEnabledFor(logging.DEBUG):
595595
logger.debug('body starts at line {0}, ends at line {1}'.format(self.bodyWinStartY, self.bodyWinEndY))
596-
self.bodyWin = curses.newwin(
596+
self.bodyWin = self.outerBodyWin.subwin(
597597
self.maxY - 4 - self._cnf.internal_header_height,
598598
self.maxX - 2,
599599
self.bodyWinStartY,
@@ -615,6 +615,7 @@ def setupAndDrawScreen(self, init_from_setup=False):
615615
''' for light color scheme '''
616616
# TODO
617617
self.outerBodyWin.bkgdset(' ', curses.color_pair(5))
618+
self.outerBodyWin.erase()
618619
self.bodyWin.bkgdset(' ', curses.color_pair(5))
619620
self.initBody()
620621

@@ -880,11 +881,11 @@ def __displayBodyLine(self, lineNum, pad, station, return_line=False):
880881
except:
881882
pass
882883

883-
if station and self._cnf.browsing_station_service and sep_col:
884-
ticks = self._cnf.online_browser.get_columns_separators(self.bodyMaxX, adjust_for_body=True)
885-
if ticks:
886-
for n in ticks:
887-
self.bodyWin.chgat(lineNum, n, 1, sep_col)
884+
if station and self._cnf.browsing_station_service and sep_col:
885+
ticks = self._cnf.online_browser.get_columns_separators(self.bodyMaxX, adjust_for_body=True)
886+
if ticks:
887+
for n in ticks:
888+
self.bodyWin.chgat(lineNum, n, 1, sep_col)
888889

889890
def run(self):
890891
self._register_signals_handlers()
@@ -5883,6 +5884,8 @@ def keypress(self, char):
58835884
self._cnf.jump_tag = -1
58845885
self._update_status_bar_right(status_suffix='')
58855886
if self._cnf.browsing_station_service:
5887+
self._print_not_implemented_yet()
5888+
return
58865889
self.ws.operation_mode = self.ws.BROWSER_SEARCH_MODE
58875890
self._browser_init_search(parent=self.outerBodyWin)
58885891
else:
@@ -6476,51 +6479,103 @@ def _find_renamed_selection(self, mode, search_path, search_file):
64766479
def _redisplay_stations_and_playlists(self):
64776480
if self._limited_height_mode:
64786481
return
6479-
self.outerBodyWin.erase()
64806482
if self._redisplay_list[-1][0] ==self.ws.BROWSER_SEARCH_MODE and \
64816483
self._redisplay_list[-2][0] == self.ws.NORMAL_MODE:
64826484
if logger.isEnabledFor(logging.DEBUG):
64836485
logger.debug('---=== Not displaying stations (Radio Browser window follows) ===---')
64846486
self.outerBodyWin.refresh()
64856487
return
6486-
self.bodyWin.erase()
6488+
6489+
# self.bodyWin.erase()
64876490
if self.maxY > 2:
64886491
self.outerBodyWin.box()
64896492
try:
64906493
self.bodyWin.move(1, 1)
64916494
self.bodyWin.move(0, 0)
64926495
except:
6496+
if logger.isEnabledFor(logging.DEBUG):
6497+
logger.debug('====---- cursrm move failed ----====')
64936498
pass
64946499
self._print_body_header()
64956500
pad = len(str(self.startPos + self.bodyMaxY))
64966501

6497-
''' display the content '''
6498-
if self.number_of_items > 0:
6499-
for lineNum in range(self.bodyMaxY):
6500-
i = lineNum + self.startPos
6501-
if i < len(self.stations):
6502-
self.__displayBodyLine(lineNum, pad, self.stations[i])
6503-
else:
6504-
''' display browser empty lines (station=None) '''
6505-
line = self.__displayBodyLine(0, pad, None, return_line = True)
6506-
if self._cnf.browsing_station_service:
6507-
for n in range(i+1, self.bodyMaxY + 1):
6508-
try:
6509-
self.bodyWin.addstr(lineNum, 0, line, curses.color_pair(5))
6510-
except:
6511-
pass
6512-
lineNum += 1
6513-
break
6514-
else:
6515-
''' we have no stations to display '''
6502+
if self.number_of_items == 0:
65166503
if self._cnf.browsing_station_service:
6517-
''' we have to display emplty lines '''
6504+
''' we have to fill the screen with emplty lines '''
65186505
line = self.__displayBodyLine(0, pad, None, return_line = True)
65196506
for n in range(0, self.bodyMaxY + 1):
65206507
try:
65216508
self.bodyWin.addstr(n, 0, line, curses.color_pair(5))
65226509
except:
65236510
pass
6511+
pass
6512+
else:
6513+
self.bodyWin.erase()
6514+
else:
6515+
for lineNum in range(self.bodyMaxY):
6516+
i = lineNum + self.startPos
6517+
if i < len(self.stations):
6518+
if not self._cnf.browsing_station_service and \
6519+
self.ws.operation_mode == self.ws.NORMAL_MODE:
6520+
try:
6521+
self.bodyWin.move(lineNum, 0)
6522+
self.bodyWin.clrtoeol()
6523+
except:
6524+
if logger.isEnabledFor(logging.DEBUG):
6525+
logger.debug('====---- clear line move failed----====')
6526+
self.__displayBodyLine(lineNum, pad, self.stations[i])
6527+
else:
6528+
if self._cnf.browsing_station_service:
6529+
''' display browser empty lines (station=None) '''
6530+
line = self.__displayBodyLine(0, pad, None, return_line = True)
6531+
if self._cnf.browsing_station_service:
6532+
for n in range(i+1, self.bodyMaxY + 1):
6533+
try:
6534+
self.bodyWin.addstr(lineNum, 0, line, curses.color_pair(5))
6535+
except:
6536+
pass
6537+
lineNum += 1
6538+
break
6539+
else:
6540+
logger.error('clearing window from line {} to end.'.format(i))
6541+
try:
6542+
self.bodyWin.move(i, 0)
6543+
self.bodyWin.clrtobot()
6544+
except:
6545+
if logger.isEnabledFor(logging.DEBUG):
6546+
logger.debug('====---- clear to end of window failed----====')
6547+
break
6548+
6549+
6550+
6551+
6552+
#''' display the content '''
6553+
#if self.number_of_items > 0:
6554+
# for lineNum in range(self.bodyMaxY):
6555+
# i = lineNum + self.startPos
6556+
# if i < len(self.stations):
6557+
# self.__displayBodyLine(lineNum, pad, self.stations[i])
6558+
# else:
6559+
# ''' display browser empty lines (station=None) '''
6560+
# line = self.__displayBodyLine(0, pad, None, return_line = True)
6561+
# if self._cnf.browsing_station_service:
6562+
# for n in range(i+1, self.bodyMaxY + 1):
6563+
# try:
6564+
# self.bodyWin.addstr(lineNum, 0, line, curses.color_pair(5))
6565+
# except:
6566+
# pass
6567+
# lineNum += 1
6568+
# break
6569+
#else:
6570+
# ''' we have no stations to display '''
6571+
# if self._cnf.browsing_station_service:
6572+
# ''' we have to display emplty lines '''
6573+
# line = self.__displayBodyLine(0, pad, None, return_line = True)
6574+
# for n in range(0, self.bodyMaxY + 1):
6575+
# try:
6576+
# self.bodyWin.addstr(n, 0, line, curses.color_pair(5))
6577+
# except:
6578+
# pass
65246579

65256580
if self._cnf.browsing_station_service:
65266581
if self._cnf.internal_header_height > 0:
@@ -6551,7 +6606,9 @@ def _redisplay_stations_and_playlists(self):
65516606
self.outerBodyWin.addstr(column_name[j], curses.color_pair(2))
65526607
except:
65536608
pass
6609+
self.outerBodyWin.touchwin()
65546610
self.outerBodyWin.refresh()
6611+
self.bodyWin.touchwin()
65556612
self.bodyWin.refresh()
65566613

65576614
def _redisplay_config(self):

0 commit comments

Comments
 (0)