Skip to content
This repository was archived by the owner on Nov 6, 2024. It is now read-only.

Commit c4bac07

Browse files
authored
4.0.3
made more scroll menus be able to loop (go up on top element and select the bottom element) made more scroll menus keep their selected option after leaving a nested menu or pressing enter on an option added config option to force show Ultra Chaos as a diff to be selected, by default it is off
1 parent 20999fa commit c4bac07

1 file changed

Lines changed: 63 additions & 18 deletions

File tree

CrabChampionSaveManager.py

Lines changed: 63 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
isExe = False
2323
isLinux = False
2424

25-
VERSION = "4.0.2"
25+
VERSION = "4.0.3"
2626

2727
if platform.system() == "Linux":
2828
isLinux = True
@@ -354,7 +354,7 @@ def restoreBackup():
354354
options = "Go back to main menu"
355355
for i in range(len(foldersInfo)):
356356
options += "\n" + str(foldersInfo[i])
357-
choice = scrollSelectMenu(prompt, options, -1, 1)
357+
choice = scrollSelectMenu(prompt, options, -1, 1, loop=True)
358358
if parseInt(choice) == 0:
359359
return
360360
start = time.time()
@@ -419,7 +419,7 @@ def deleteBackup():
419419
options = "Go back to main menu"
420420
for i in range(len(foldersInfo)):
421421
options += "\n" + str(foldersInfo[i])
422-
choice = scrollSelectMenu(prompt, options, -1, 1)
422+
choice = scrollSelectMenu(prompt, options, -1, 1, loop=True)
423423
if parseInt(choice) == 0:
424424
return
425425

@@ -461,7 +461,9 @@ def listBackups(lastChoice=0):
461461
else:
462462
backups += "\n" + str(name)
463463

464-
choice = scrollSelectMenu(prompt, backups, wrapMode=2, startChoice=lastChoice)
464+
choice = scrollSelectMenu(
465+
prompt, backups, wrapMode=2, startChoice=lastChoice, loop=True
466+
)
465467
if choice == 0:
466468
return
467469
choice -= 1
@@ -610,7 +612,7 @@ def updateBackup():
610612
options = "Go back to main menu"
611613
for i in range(len(foldersInfo)):
612614
options += "\n" + str(foldersInfo[i])
613-
choice = scrollSelectMenu(prompt, options, -1, 1)
615+
choice = scrollSelectMenu(prompt, options, -1, 1, loop=True)
614616
if parseInt(choice) == 0:
615617
return
616618
saveGame = os.path.join(current_directory, "SaveGames")
@@ -707,7 +709,7 @@ def scrollSelectMenu(
707709
win_height=-1,
708710
buffer_size=1,
709711
wrapMode=1,
710-
loop=False,
712+
loop=True,
711713
skip=[],
712714
startChoice=0,
713715
returnMore=False,
@@ -1187,6 +1189,7 @@ def settings():
11871189
global EPICCOLOR
11881190
global LEGENDARYCOLOR
11891191
global GREEDCOLOR
1192+
global ForceShowUC
11901193
defaultJSON = '{"Start_Up":{"Terminal_Size":{"Height":30,"Width":120}},"UI":{"Colors":{"RareColor":3,"EpicColor":13,"LegendaryColor":14,"GreedColor":12}}}'
11911194
configPath = owd + "/CrabChampionSaveManager/config.json"
11921195
configPath = configPath.replace("\\", "/")
@@ -1203,25 +1206,34 @@ def settings():
12031206

12041207
prompt = "Select setting to edit"
12051208
options = "Back to main menu\nStart Up Settings\nUI\nCustom Paths"
1209+
lastChoice = 0
12061210
while True:
1207-
choice = scrollSelectMenu(prompt, options)
1211+
choice = scrollSelectMenu(prompt, options, startChoice=lastChoice)
1212+
lastChoice = choice
12081213
if choice == 0:
12091214
break
12101215
elif choice == 1:
12111216
promptSUS = "Select setting to edit"
12121217
optionsSUS = "Back\nTerminal Size"
1218+
lastChoiceSUS = 0
12131219
while True:
1214-
choice = scrollSelectMenu(promptSUS, optionsSUS)
1220+
choice = scrollSelectMenu(
1221+
promptSUS, optionsSUS, startChoice=lastChoiceSUS
1222+
)
1223+
lastChoiceSUS = choice
12151224
if choice == 0:
12161225
break
12171226
elif choice == 1:
12181227
promptTS = "Select setting to edit"
1219-
1228+
lastChoiceTS = 0
12201229
while True:
12211230
height = configJSON["Start_Up"]["Terminal_Size"]["Height"]
12221231
width = configJSON["Start_Up"]["Terminal_Size"]["Width"]
12231232
optionsTS = f"Back\nHeight - {height}\nWidth - {width}\nManuel"
1224-
choice = scrollSelectMenu(promptTS, optionsTS)
1233+
choice = scrollSelectMenu(
1234+
promptTS, optionsTS, startChoice=lastChoiceTS
1235+
)
1236+
lastChoiceTS = choice
12251237
if choice == 0:
12261238
break
12271239
elif choice == 1:
@@ -1286,14 +1298,19 @@ def settings():
12861298
saveSettings()
12871299

12881300
elif choice == 2:
1301+
lastChoiceUI = 0
12891302
while True:
12901303
promptUI = "Select setting to edit"
1291-
optionsUI = "Back\nRarity Colors"
1292-
choice = scrollSelectMenu(promptUI, optionsUI)
1304+
optionsUI = "Back\nRarity Colors\nForce Show Ultra Chaos - " + str(
1305+
configJSON["UI"]["ForceShowUC"]
1306+
)
1307+
choice = scrollSelectMenu(promptUI, optionsUI, startChoice=lastChoiceUI)
1308+
lastChoiceUI = choice
12931309
if choice == 0:
12941310
break
12951311
elif choice == 1:
12961312
promptUI = "Select setting to edit"
1313+
lastChoiceColors = 0
12971314
while True:
12981315
optionsUIColors = [
12991316
"Back",
@@ -1322,7 +1339,10 @@ def settings():
13221339
1,
13231340
],
13241341
]
1325-
choice = scrollSelectMenu(promptUI, optionsUIColors)
1342+
choice = scrollSelectMenu(
1343+
promptUI, optionsUIColors, startChoice=lastChoiceColors
1344+
)
1345+
lastChoiceColors = choice
13261346
if choice == 0:
13271347
break
13281348
elif choice == 1:
@@ -1348,22 +1368,35 @@ def settings():
13481368
GREEDCOLOR = col
13491369
saveSettings()
13501370

1371+
elif choice == 2:
1372+
if configJSON["UI"]["ForceShowUC"]:
1373+
configJSON["UI"]["ForceShowUC"] = False
1374+
else:
1375+
configJSON["UI"]["ForceShowUC"] = True
1376+
saveSettings()
1377+
13511378
elif choice == 3:
1379+
lastChoiceCP = 0
13521380
while True:
13531381
promptUI = "Select setting to edit"
13541382
optionsUI = [
13551383
["Back", 0, 0],
13561384
["Save Game Path - Currently at " + str(SaveGamePath), 0, 2],
13571385
]
1358-
choice = scrollSelectMenu(promptUI, optionsUI)
1386+
choice = scrollSelectMenu(promptUI, optionsUI, startChoice=lastChoiceCP)
1387+
lastChoiceCP = choice
13591388
if choice == 0:
13601389
break
13611390
if choice == 1:
1391+
lastChoiceCP2 = 0
13621392
while True:
13631393
promptUI = "Select option - Currently at " + str(SaveGamePath)
13641394
custom = "Choose folder"
13651395
optionsUI = [["Back", 0, 0], ["Automatic", 0, 0]] # [custom,0,0]
1366-
choice = scrollSelectMenu(promptUI, optionsUI)
1396+
choice = scrollSelectMenu(
1397+
promptUI, optionsUI, startChoice=lastChoiceCP2
1398+
)
1399+
lastChoiceCP2 = choice
13671400
if choice == 0:
13681401
break
13691402
elif choice == 1:
@@ -1376,6 +1409,9 @@ def settings():
13761409
SaveGamePath = folder
13771410
saveSettings()
13781411

1412+
saveSettings()
1413+
loadSettings()
1414+
13791415

13801416
def folderSelect(startDir="Automatic"):
13811417
global isLinux
@@ -1443,8 +1479,9 @@ def loadSettings():
14431479
global EPICCOLOR
14441480
global LEGENDARYCOLOR
14451481
global GREEDCOLOR
1482+
global ForceShowUC
14461483
global SaveGamePath
1447-
defaultJSON = '{"Start_Up":{"Terminal_Size":{"Height":30,"Width":120}},"UI":{"Colors":{"RareColor":3,"EpicColor":13,"LegendaryColor":14,"GreedColor":12}}}'
1484+
defaultJSON = '{"Start_Up":{"Terminal_Size":{"Height":30,"Width":120}},"UI":{"ForceShowUC":false,"Colors":{"RareColor":3,"EpicColor":13,"LegendaryColor":14,"GreedColor":12}}}'
14481485
configPath = owd + "/CrabChampionSaveManager/config.json"
14491486

14501487
configPath = configPath.replace("\\", "/")
@@ -1524,6 +1561,13 @@ def loadSettings():
15241561
configJSON["CustomPaths"]["SaveGamePath"] = "Automatic"
15251562
SaveGamePath = "Automatic"
15261563

1564+
try:
1565+
ForceShowUC = configJSON["UI"]["ForceShowUC"]
1566+
except BaseException:
1567+
configJSON.setdefault("UI", {})
1568+
configJSON["UI"]["ForceShowUC"] = False
1569+
ForceShowUC = False
1570+
15271571
file.seek(0)
15281572
file.write(json.dumps(configJSON, indent=4))
15291573
file.truncate()
@@ -3425,6 +3469,7 @@ def editPreset(
34253469
global PERKS
34263470
global DIFFMODS
34273471
global DIFFMODSDETAILS
3472+
global ForceShowUC
34283473
DiffModsWithDetails = []
34293474
for i in range(len(DIFFMODS)):
34303475
DiffModsWithDetails.append(DIFFMODS[i] + " - " + DIFFMODSDETAILS[i])
@@ -3674,7 +3719,7 @@ def editPreset(
36743719
"Select Difficulty\nCurrent Difficulty is " + presetJSON["Diff"] + "\n"
36753720
)
36763721
diff = ["Easy", "Normal", "Nightmare"]
3677-
if hasAllDiamond():
3722+
if hasAllDiamond() or ForceShowUC or presetJSON["Diff"] == "Ultra Chaos":
36783723
diff.append("Ultra Chaos")
36793724

36803725
presetJSON["Diff"] = diff[
@@ -4275,7 +4320,7 @@ def editPresetMenu():
42754320
else:
42764321
presets += "\n" + str(name)
42774322

4278-
choice = scrollSelectMenu(prompt, presets, wrapMode=2)
4323+
choice = scrollSelectMenu(prompt, presets, wrapMode=2, loop=True)
42794324
if choice == 0:
42804325
return
42814326
choice -= 1

0 commit comments

Comments
 (0)