Skip to content

Commit bb84818

Browse files
committed
- default openers detection will not stop at xdg-open
- PyRadioOpenDir: always open dir (convert str to list) - PyRadioRecordingDir: adding key 'd' to revert to deault
1 parent c5714d3 commit bb84818

File tree

5 files changed

+32
-13
lines changed

5 files changed

+32
-13
lines changed

docs/themes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ <h2 id="pyradio-themes-1">PyRadio Themes <span style="padding-left: 10px;"><sup
9797
<p>Furthermore, a number of themes (these are actual files saved in the <strong>themes</strong> installation directory) are also available:</p>
9898
<ul>
9999
<li><strong>AM_by_amski1</strong><br />
100-
A simple green on dark theme, created for Window.</li>
100+
A simple green on dark theme, created for Windows.</li>
101101
<li><strong>blue-by-boxer</strong><br />
102102
A reddish on blue theme by user <strong>Boxer</strong> at <a target="_blank" href="https://forum.maboxlinux.org/">Mabox Forum</a>.</li>
103103
<li><strong>catppuccin-frappe</strong>, <strong>catppuccin-latte</strong>, <strong>catppuccin-macchiato</strong> and <strong>catppuccin-mocha</strong><br />

docs/themes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ A theme for light terminal background settings.
4646
Furthermore, a number of themes (these are actual files saved in the **themes** installation directory) are also available:
4747

4848
- **AM_by_amski1** \
49-
A simple green on dark theme, created for Window.
49+
A simple green on dark theme, created for Windows.
5050
- **blue-by-boxer** \
5151
A reddish on blue theme by user **Boxer** at [Mabox Forum](https://forum.maboxlinux.org/).
5252
- **catppuccin-frappe**, **catppuccin-latte**, **catppuccin-macchiato** and **catppuccin-mocha** \

pyradio/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,6 +1860,8 @@ def open_a_dir(self, a_dir):
18601860
Popen([which('open'), a_dir])
18611861
else:
18621862
xdg_open_path = self._linux_resource_opener if self._linux_resource_opener else get_a_linux_resource_opener()
1863+
if isinstance(xdg_open_path, str):
1864+
xdg_open_path = xdg_open_path.split(' ')
18631865
if xdg_open_path:
18641866
try:
18651867
Popen(

pyradio/edit.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,9 +1281,12 @@ def __init__(self, opener, parent, global_functions=None):
12811281
self._parent_win = parent
12821282
self.initial_enabled = [True, False, True]
12831283
self._title = ' Select Resource Opener '
1284-
self._global_functions = global_functions
1285-
if self._global_functions is None:
1284+
if global_functions is None:
12861285
self._global_functions = {}
1286+
else:
1287+
self._global_functions = dict(global_functions)
1288+
self._global_functions[ord('d')] = self._revert_to_default
1289+
# self._global_functions[ord('s')] = self._get_result
12871290

12881291
def __del__(self):
12891292
try:
@@ -1332,7 +1335,7 @@ def _string_changed(self):
13321335
tmp = self._widgets[0].string.strip().split(' ')
13331336
if tmp[0] == 'auto':
13341337
self._error_string = ''
1335-
self._widgets[-2].enabled = False
1338+
self._widgets[-2].enabled = True
13361339
else:
13371340
w_file = find_executable_basename(tmp[0])
13381341
stripped_string = self._widgets[0].string.strip()
@@ -1475,13 +1478,17 @@ def show(self):
14751478
self._win.addstr(14 + adjust_line_Y, 23, 'Cancel operation.', curses.color_pair(5))
14761479

14771480

1478-
self._win.addstr(15 + adjust_line_Y, 5, 's', curses.color_pair(4))
1481+
self._win.addstr(15 + adjust_line_Y, 5, 'd', curses.color_pair(4))
1482+
self._win.addstr(15 + adjust_line_Y, 23, 'Revert to default (', curses.color_pair(5))
1483+
self._win.addstr(r'\d', curses.color_pair(4))
1484+
self._win.addstr(' in Line Editor).', curses.color_pair(5))
1485+
self._win.addstr(16 + adjust_line_Y, 5, 's', curses.color_pair(4))
14791486
self._win.addstr(' / ', curses.color_pair(5))
14801487
self._win.addstr('q', curses.color_pair(4))
1481-
self._win.addstr(15 + adjust_line_Y, 23, 'Exeute / Cancel operation (not in Line Editor).', curses.color_pair(5))
1488+
self._win.addstr(16 + adjust_line_Y, 23, 'Exeute / Cancel operation (not in Line Editor).', curses.color_pair(5))
14821489

1483-
self._win.addstr(16 + adjust_line_Y, 5, '?', curses.color_pair(4))
1484-
self._win.addstr(16 + adjust_line_Y, 23, 'Help or Line editor help.', curses.color_pair(5))
1490+
self._win.addstr(17 + adjust_line_Y, 5, '?', curses.color_pair(4))
1491+
self._win.addstr(17 + adjust_line_Y, 23, 'Help or Line editor help.', curses.color_pair(5))
14851492

14861493
adjust_line_Y -= 1
14871494
if self.maxY > 22 + adjust_line_Y and self.maxX > 76:
@@ -1574,7 +1581,7 @@ def _focus_previous(self):
15741581
self.focus = focus
15751582
# logger.error('pp o self.focus = {}'.format(self.focus))
15761583

1577-
def _get_result(self, ret):
1584+
def _get_result(self):
15781585
tmp = self._widgets[0].string.strip().split(' ')
15791586
if tmp[0] == 'auto':
15801587
return 1, 'auto'
@@ -1585,6 +1592,13 @@ def _get_result(self, ret):
15851592
# tmp[0] = w_file
15861593
return 1, ' '.join(tmp)
15871594

1595+
def _revert_to_default(self):
1596+
self._widgets[0].string = 'auto'
1597+
self._widgets[0].keep_restore_data()
1598+
self._widgets[0].show(self._win, opening=True)
1599+
self._widgets[-2].enabled = True
1600+
return 0, None
1601+
15881602
def keypress(self, char):
15891603
""" Returns:
15901604
-1: Cancel (-1, None)
@@ -1624,13 +1638,16 @@ def keypress(self, char):
16241638
self._focus_next()
16251639
elif self._focus == 1:
16261640
# ok, execute
1627-
return self._get_result(ret)
1641+
return self._get_result()
16281642
elif self._focus == 2:
16291643
# cancel
16301644
return -1, None
16311645
elif char == ord('s') and self._focus > 0:
16321646
# s, execute
1633-
return self._get_result(ret)
1647+
return self._get_result()
1648+
elif char == ord('d') and self._focus > 0:
1649+
# d, revert to default
1650+
return self._revert_to_default()
16341651
elif self._focus == 0:
16351652
"""
16361653
Returns:

pyradio/install.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ def get_a_linux_resource_opener():
443443
return [which_str] + a_prog[1].split(' ')
444444
else:
445445
return [which_str]
446-
return None
446+
return None
447447

448448
def open_cache_dir():
449449
c = PyRadioCache()

0 commit comments

Comments
 (0)