Skip to content

Commit d70ea98

Browse files
committed
If a resource opener is not found on linux, \o will display a list of PyRadio's dirs
1 parent 998bc55 commit d70ea98

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

pyradio/radio.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
from .themes import *
4141
from .cjkwrap import cjklen, cjkcenter, cjkslices
4242
from . import player
43-
from .install import version_string_to_list, get_github_tag, fix_pyradio_win_exe
43+
from .install import version_string_to_list, get_github_tag, fix_pyradio_win_exe, get_a_linux_resource_opener
4444
from .html_help import HtmlHelp
4545
from .browser import RadioBrowserConfig, RadioBrowserConfigWindow
4646
from .schedule_win import PyRadioSimpleScheduleWindow
@@ -9007,6 +9007,11 @@ def _can_display_help_msg(self, msg):
90079007
return ret
90089008

90099009
def _show_open_dir_window(self):
9010+
if not platform.startswith('win'):
9011+
prog = self._cnf.linux_resource_opener if self._cnf.linux_resource_opener else get_a_linux_resource_opener()
9012+
if prog is None:
9013+
self._show_dirs_list()
9014+
return
90109015
if self._open_dir_win is None:
90119016
self._open_dir_win = PyRadioOpenDir(
90129017
self._cnf,
@@ -9016,6 +9021,21 @@ def _show_open_dir_window(self):
90169021
self.ws.operation_mode = self.ws.OPEN_DIR_MODE
90179022
self._open_dir_win.show(parent=self.bodyWin)
90189023

9024+
def _show_dirs_list(self):
9025+
out = ['|____Config Dir:| ' + self._cnf.stations_dir]
9026+
out.append('|______Data Dir:| ' + self._cnf.data_dir)
9027+
if self._cnf.data_dir != self._cnf.state_dir:
9028+
out.append('|_____State Dir:| ' + self._cnf.state_dir)
9029+
out.append('|______Code Dir:| ' + path.dirname(__file__))
9030+
out.append('|Recordings Dir:| ' + self._cnf.recording_dir)
9031+
txt = '\n'.join(out)
9032+
self._messaging_win.set_a_message(
9033+
'UNIVERSAL', (
9034+
'PyRadio Dirs',
9035+
'\n' + txt.replace(path.expanduser('~'), '~') + '\n\n')
9036+
)
9037+
self._open_simple_message_by_key('UNIVERSAL')
9038+
90199039
def _show_delayed_notification(self, txt, delay=.75):
90209040
if not (self._limited_height_mode or self._limited_width_mode):
90219041
self._show_notification_with_delay(

0 commit comments

Comments
 (0)