From 4c3b3c0d4a1b654143c38c56702cdd5c55a7f8e0 Mon Sep 17 00:00:00 2001 From: Wintermute0110 Date: Tue, 22 Jun 2021 19:33:36 +0900 Subject: [PATCH] Improvements from the Python 2 branch. --- changelog.txt | 4 ++-- resources/constants.py | 6 ++++-- resources/main.py | 5 ++--- resources/utils.py | 10 +++++----- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/changelog.txt b/changelog.txt index 7822214e..8d811dc7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -150,7 +150,7 @@ WIP FIX Fix launching of ROMs with Windows network filenames. See https://forum.kodi.tv/showthread.php?tid=287826&pid=2919639#pid2919639 -[B]Advanced Emulator Launcher | version 0.10.0 | xx xxxxx 2021[/B] +[B]Advanced Emulator Launcher | version 0.10.0 | 22 June 2021[/B] NOTE Python 3 version for Matrix in branch release-0.10.x-python3 @@ -161,7 +161,7 @@ FEATURE Create a Python 3 Matrix version 0.10.x to track release 0.9.x. FEATURE Port release 0.9.10 to Python 3. -[B]Advanced Emulator Launcher | version 0.9.10 | xx xxxxx 2021[/B] +[B]Advanced Emulator Launcher | version 0.9.10 | 22 June 2021[/B] NOTE Python 2 version for Leia/Krypon in branch release-0.9.x-python2 Have a look at AML code to ease the conversion. diff --git a/resources/constants.py b/resources/constants.py index e8db418a..2e73848b 100644 --- a/resources/constants.py +++ b/resources/constants.py @@ -31,11 +31,13 @@ # Addon options and tuneables. # ------------------------------------------------------------------------------------------------- # Compact, smaller size, non-human readable JSON. False forces human-readable JSON for development. -# In AEL speed is not as critical so False. In AML this must be True when releasing. +# In AEL speed is not as critical so False is OK. +# In AML this must be True when releasing. OPTION_COMPACT_JSON = False # Use less memory when writing big JSON files, but writing is slower. -# In AEL this can be False when releasing. In AML it must be True. +# In AEL this can be False when releasing. +# In AML it must be True when releasing. OPTION_LOWMEM_WRITE_JSON = False # The addon name in the GUI. Title of Kodi dialogs (yesno, progress, etc.) and used also in log functions. diff --git a/resources/main.py b/resources/main.py index 3afd7990..598cd7f8 100644 --- a/resources/main.py +++ b/resources/main.py @@ -2678,9 +2678,8 @@ def _command_add_roms(self, launcher): # Note that categoryID = VCATEGORY_FAVOURITES_ID, launcherID = VLAUNCHER_FAVOURITES_ID # if we are editing a ROM in Favourites. def _command_edit_rom(self, categoryID, launcherID, romID): - # --- --- if romID == UNKNOWN_ROMS_PARENT_ID: - kodi_dialog_OK('You cannot edit this ROM!') + kodi_dialog_OK('You cannot edit this ROM! (Unknown parent ROM)') return # --- Load ROMs --- @@ -2981,7 +2980,7 @@ def _command_edit_rom(self, categoryID, launcherID, romID): # --- Edit ROM Assets (all) --- elif mindex == 2: sDialog = KodiSelectDialog('Edit ROM assets (all)', [ - 'Scrape all assets', + 'Scrape all assets (choose scraper)', 'Unset all assets', ]) mindex2 = sDialog.executeDialog() diff --git a/resources/utils.py b/resources/utils.py index 69f9126a..8de030bb 100644 --- a/resources/utils.py +++ b/resources/utils.py @@ -362,13 +362,13 @@ def utils_load_JSON_file(json_filename, default_obj = {}, verbose = True): # Note that there is a bug in the json module where the ensure_ascii=False flag can produce # a mix of unicode and str objects. # See http://stackoverflow.com/questions/18337407/saving-utf-8-texts-in-json-dumps-as-utf8-not-as-u-escape-sequence -def utils_write_JSON_file(json_filename, json_data, verbose = True, pprint = False, lowmem = False): +def utils_write_JSON_file(json_filename, json_data, verbose = True, pprint = False): l_start = time.time() if verbose: log_debug('utils_write_JSON_file() "{}"'.format(json_filename)) # Choose JSON iterative encoder or normal encoder. - if lowmem: - if verbose: log_debug('utils_write_JSON_file() Using lowmem option') + if OPTION_LOWMEM_WRITE_JSON: + if verbose: log_debug('utils_write_JSON_file() Using OPTION_LOWMEM_WRITE_JSON option') if pprint: jobj = json.JSONEncoder(ensure_ascii = False, sort_keys = True, indent = JSON_INDENT, separators = JSON_SEP) @@ -393,7 +393,7 @@ def utils_write_JSON_file(json_filename, json_data, verbose = True, pprint = Fal # Write JSON to disk try: with io.open(json_filename, 'wt', encoding = 'utf-8') as file: - if lowmem: + if OPTION_LOWMEM_WRITE_JSON: # Chunk by chunk JSON writer, uses less memory but takes longer. for chunk in jobj.iterencode(json_data): file.write(chunk) @@ -1288,4 +1288,4 @@ def kodi_update_image_cache(img_path): lod_error('(OSError) Cannot update cached image') # Is this really needed? - # xbmc.executebuiltin('XBMC.ReloadSkin()') + # xbmc.executebuiltin('ReloadSkin()')