Skip to content

Commit 3f2af22

Browse files
committed
- main.py: force curses termination on Windows
- install.py: fixing a bug and adding temporary debug info - build_install_pyradio.bat: actuall uninstall pyradio after answering no to question to delete user files - unreg.py: fixing a SyntaxWarning on rkey (Windows) - win.py: fixing a couple of bugs - keyboard.py: fix ^Y curses code
1 parent dd1d40f commit 3f2af22

File tree

6 files changed

+28
-9
lines changed

6 files changed

+28
-9
lines changed

devel/build_install_pyradio.bat

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,7 @@ ECHO User files are under "%APPDATA%\pyradio"
246246
SET /p ANS="Do you want to remove them (y/n)?: "
247247
:: ECHO %ANS%
248248
IF "%ANS%" == "y" GOTO :addtobat
249-
IF "%ANS%" == "n" (
250-
IF EXIST "DOPAUSE" ( GOTO endofscript )
251-
GOTO endnopause
252-
)
249+
IF "%ANS%" == "n" GOTO :addtobat
253250
GOTO :readit
254251
:addtobat
255252

devel/unreg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import winreg
33

44
hkey = winreg.HKEY_CURRENT_USER
5-
rkey = 'Software\Microsoft\Windows\CurrentVersion\Run'
5+
rkey = r'Software\Microsoft\Windows\CurrentVersion\Run'
66

77
rhandle = winreg.OpenKey(hkey, rkey, 0, winreg.KEY_ALL_ACCESS)
88

pyradio/install.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,6 @@ def _change_git_discription_in_config_py(self):
10801080

10811081
def _download_pyradio(self):
10821082
os.chdir(self._dir)
1083-
VERSION == ''
10841083
if self._package == 0:
10851084
try:
10861085
VERSION == ''
@@ -1120,6 +1119,7 @@ def _download_pyradio(self):
11201119
with open(os.path.join(self._dir, self.ZIP_DIR[self._package], 'DEV'), 'w', encoding='utf-8'):
11211120
pass
11221121
# input('Please update files as needed. Then press ENTER to continue...')
1122+
sys.exit()
11231123

11241124
def _mkdir(self, name, dir_exist_function=None, _permission_error_function=None):
11251125
if os.path.isdir(name):
@@ -1387,9 +1387,11 @@ def _do_it(self, mode='update'):
13871387
sys.exit(1)
13881388

13891389
''' download official release '''
1390+
print('-- start')
13901391
package = 0
13911392
tag_name = github_long_description = None
13921393
if args.sng_master:
1394+
print('== sng-master')
13931395
''' sng master '''
13941396
args.force = True
13951397
package = 1
@@ -1400,6 +1402,7 @@ def _do_it(self, mode='update'):
14001402
# github_long_description = github_long_description.replace('-', '-r', 1)
14011403
# github_long_description += '-sng'
14021404
elif args.sng_devel:
1405+
print('== sng-devel')
14031406
'''' sng devel '''
14041407
args.force = True
14051408
package = 2
@@ -1410,24 +1413,31 @@ def _do_it(self, mode='update'):
14101413
# github_long_description = github_long_description.replace('-', '-r', 1)
14111414
# github_long_description += '-sng-dev'
14121415
elif args.devel:
1416+
print('== devel')
14131417
''' official devel '''
14141418
package = 3
14151419
''' go back to master '''
14161420
args.force = True
14171421
package = 0
14181422
VERSION = get_github_tag()
14191423
elif args.master or args.git:
1424+
print('== master / devel')
14201425
''' official master '''
14211426
args.force = True
14221427
package = 4
14231428
VERSION, github_long_description = get_github_long_description()
14241429
else:
1430+
print('== normal')
14251431
VERSION = get_github_tag()
14261432

14271433
if VERSION is None:
14281434
VERSION = PyRadioInstallPyReleaseVersion
14291435

1436+
print(f'== {package = }')
1437+
14301438
if args.uninstall:
1439+
print('** uninstall')
1440+
print(f'** {package = }')
14311441
if platform.system().lower().startswith('win'):
14321442
''' ok, create BAT file on Windows'''
14331443
uni = PyRadioUpdateOnWindows(package=package)
@@ -1438,6 +1448,8 @@ def _do_it(self, mode='update'):
14381448
uni.remove_pyradio()
14391449
sys.exit()
14401450
elif args.update:
1451+
print('** update')
1452+
print(f'** {package = }')
14411453
if platform.system().lower().startswith('win'):
14421454
''' ok, create BAT file on Windows'''
14431455
upd = PyRadioUpdateOnWindows(
@@ -1459,6 +1471,8 @@ def _do_it(self, mode='update'):
14591471
upd.update_pyradio()
14601472
sys.exit()
14611473
elif args.do_uninstall:
1474+
print('** do uninstall')
1475+
print(f'** {package = }')
14621476
''' coming from uninstall BAT file on Windows'''
14631477
uni = PyRadioUpdateOnWindows(
14641478
package=package,
@@ -1467,6 +1481,8 @@ def _do_it(self, mode='update'):
14671481
uni.remove_pyradio()
14681482
sys.exit()
14691483
elif args.do_update:
1484+
print('** do update')
1485+
print(f'** {package = }')
14701486
''' coming from update BAT file on Windows'''
14711487
upd = PyRadioUpdateOnWindows(
14721488
package=package,
@@ -1476,6 +1492,8 @@ def _do_it(self, mode='update'):
14761492
upd.update_pyradio()
14771493
sys.exit()
14781494

1495+
print('** installation')
1496+
print(f'** {package = }')
14791497
''' Installation!!! '''
14801498
if platform.system().lower().startswith('win'):
14811499
exe = find_pyradio_win_exe()

pyradio/keyboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
kbkey_orig['rb_p_prev'] = ( ord('[') , 'Go to previous search results page: ')
132132
kbkey_orig['rb_h_next'] = ( curses.ascii.SO , 'Go to next search item: ') # default: ^N
133133
kbkey_orig['rb_h_prev'] = ( curses.ascii.DLE , 'Go to previous search item: ') # default: ^P
134-
kbkey_orig['rb_h_add'] = ( curses.ascii.ENQ , 'Add search item: ') # default: ^Y
134+
kbkey_orig['rb_h_add'] = ( curses.ascii.EM , 'Add search item: ') # default: ^Y
135135
kbkey_orig['rb_h_del'] = ( curses.ascii.CAN , 'Delete search item: ') # default: ^X
136136
kbkey_orig['rb_h_def'] = ( curses.ascii.STX , 'Make item default: ') # default: ^B
137137
kbkey_orig['rb_h_0'] = ( curses.ascii.ACK , 'Go to template (item 0): ') # default: ^F

pyradio/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,10 @@ def shell():
945945
https://github.com/zephyrproject-rtos/windows-curses/issues/50#issuecomment-1840485627
946946
'''
947947
pyradio.setup(_win_python_3_12())
948+
try:
949+
curses.endwin()
950+
except:
951+
pass
948952
else:
949953
curses.wrapper(pyradio.setup)
950954

pyradio/win.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def get_latest_x86_64_mplayer_url():
231231
if n.startswith('r'):
232232
rev = n.split('"')[0][1:]
233233
try:
234-
r = int(rev)
234+
int(rev)
235235
except ValueError:
236236
return None
237237
existing = zurl[1].split('-svn-')[1].split('-')[0]
@@ -355,7 +355,7 @@ def download_player(output_folder=None, package=1, do_not_exit=False):
355355
along with the archive named "{0}".'''.format(basename(out_file)))
356356
if player_name == 'mpv':
357357
if exists(join(output_folder, 'mpv')):
358-
print(''' Please extract the archive in the "[rev]mpv[/red]" folder
358+
print(''' Please extract the archive in the "[red]mpv[/red]" folder
359359
(overwriting any existing files).''')
360360
else:
361361
print(''' Please create a folder named "[red]mpv[/red]" and extract

0 commit comments

Comments
 (0)