Skip to content

Commit

Permalink
RadioBrowser Search Window: Removing codec checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
s-n-g committed Aug 11, 2021
1 parent a74d60b commit dca1740
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
39 changes: 19 additions & 20 deletions pyradio/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from .player import info_dict_to_list
from .cjkwrap import cjklen, PY3
from .countries import countries
from .simple_curses_widgets import SimpleCursesLineEdit, SimpleCursesHorizontalPushButtons, SimpleCursesWidgetColumns, SimpleCursesCheckBox, SimpleCursesCounter
from .simple_curses_widgets import SimpleCursesLineEdit, SimpleCursesHorizontalPushButtons, SimpleCursesWidgetColumns, SimpleCursesCheckBox, SimpleCursesCounter, DisabledWidget

import locale
locale.setlocale(locale.LC_ALL, '') # set your locale
Expand Down Expand Up @@ -1312,7 +1312,7 @@ class RadioBrowserInfoSearchWindow(object):
'''
_left_column = (0, 1, 4, 5, 6, 11, 12, 17, 18)
_middle_column = (7, 8, 13, 14, 18)
_right_column = (2, 3, 9, 10, 15, 16, 19)
_right_column = (2, 3, 9, 10, 16, 19)

''' line editors ids '''
_line_editor_id = []
Expand Down Expand Up @@ -1699,16 +1699,14 @@ def show(self):
curses.color_pair(9), curses.color_pair(4), curses.color_pair(5)))
self._calculate_widgets_yx(Y, X)
for n in range(1,7):
# self._win.addstr(
# self.yx[n][0],
# self.yx[n][1],
# self.captions[n],
# curses.color_pair(4))
self._widgets.append(SimpleCursesCheckBox(
self.yx[n][0] + 1,
self.yx[n][1] + len(self.captions[n]) + 2,
'Exact',
curses.color_pair(9), curses.color_pair(5), curses.color_pair(5)))
if n == 6:
self._widgets.append(DisabledWidget())
else:
self._widgets.append(SimpleCursesCheckBox(
self.yx[n][0] + 1,
self.yx[n][1] + len(self.captions[n]) + 2,
'Exact',
curses.color_pair(9), curses.color_pair(5), curses.color_pair(5)))
self._widgets.append(SimpleCursesLineEdit(
parent=self._win,
width=X-2,
Expand Down Expand Up @@ -1773,14 +1771,15 @@ def show(self):

# set vertical placement variable
for i in range(0, len(self._widgets)):
if self._widgets[i].id in self._left_column:
self._widgets[i]._vert = self._left_column
elif self._widgets[i].id in self._middle_column:
self._widgets[i]._vert = self._middle_column
elif self._widgets[i].id in self._right_column:
self._widgets[i]._vert = self._right_column
self._widgets[i]._vert_id = self._widgets[i]._vert.index(self._widgets[i].id)
# logger.error('DE =======\ni = {0}\nw = {1}\nid = {2}\n_vert = {3}\n_vert_id = {4}'.format(i, self._widgets[i], self._widgets[i].id, self._widgets[i]._vert, self._widgets[i]._vert_id))
if type(self._widgets[i]).__name__ != 'DisabledWidget':
if self._widgets[i].id in self._left_column:
self._widgets[i]._vert = self._left_column
elif self._widgets[i].id in self._middle_column:
self._widgets[i]._vert = self._middle_column
elif self._widgets[i].id in self._right_column:
self._widgets[i]._vert = self._right_column
self._widgets[i]._vert_id = self._widgets[i]._vert.index(self._widgets[i].id)
# logger.error('DE =======\ni = {0}\nw = {1}\nid = {2}\n_vert = {3}\n_vert_id = {4}'.format(i, self._widgets[i], self._widgets[i].id, self._widgets[i]._vert, self._widgets[i]._vert_id))

else:
''' update up to lists '''
Expand Down
12 changes: 11 additions & 1 deletion pyradio/simple_curses_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ class DisabledWidget(object):
To be used in complex dialogs
'''
enabled = False
_enabled = False
focus = False
checked = False

def __init__(self):
pass

@property
def enabled(self):
return self._enabled

@enabled.setter
def enabled(self, value):
pass

def show(self):
pass

class SimpleCursesWidget(object):
'''An abstract widget class '''
Expand Down

0 comments on commit dca1740

Please sign in to comment.