-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
2205 lines (2067 loc) · 141 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import pathlib
import pygubu
try:
import Tkinter as tk
import Tkinter.ttk as ttk
from Tkinter.messagebox import showinfo, showerror, askyesno, askokcancel
from Tkinter import Toplevel
from Tkinter.filedialog import askopenfilename, asksaveasfilename
except:
import tkinter as tk
import tkinter.ttk as ttk
from tkinter.messagebox import showinfo, showerror, askyesno, askokcancel
from tkinter import Toplevel
from tkinter.filedialog import askopenfilename, asksaveasfilename
from Libraries.ttkScrollableNotebook.ScrollableNotebook import *
from pygubu.widgets.editabletreeview import EditableTreeview
from pygubu.widgets.pathchooserinput import PathChooserInput
from pygubu.widgets.scrolledframe import ScrolledFrame
import pygubu.widgets.simpletooltip as tooltip
import traceback
from os import path, mkdir, listdir, remove, walk, rename, rmdir
import re
import xml.etree.ElementTree as ET
import zipfile
import rarfile
rarfile.UNRAR_TOOL = "tools/UnRAR.exe"
import py7zr
import patoolib
import shutil
from pathlib import Path as plpath
from math import ceil
from gatelib import *
from filehash import FileHash
import configparser
from dateutil.parser import parse as dateParse
import binascii
from time import sleep
from datetime import datetime
import webbrowser
versionNum = 1.22
archiveTypes = [".zip", ".rar", ".7z"]
progFolder = getCurrFolder()
sys.path.append(progFolder)
# tk.Tk().withdraw()
noSystemNamesFileFlag = False
try:
from SystemNames import *
except:
noSystemNamesFileFlag = True
from SystemNamesDefault import *
noSpecialCategoriesFileFlag = False
try:
from SpecialCategories import *
except:
noSpecialCategoriesFileFlag = True
from SpecialCategoriesDefault import *
badSpecialFolderPrefixFlag = (specialFolderPrefix != slugify(specialFolderPrefix, stripValue=False).lstrip())
specialFolderPrefix = slugify(specialFolderPrefix, stripValue=False).lstrip()
badSpecialFolderSuffixFlag = (specialFolderSuffix != slugify(specialFolderSuffix, stripValue=False).rstrip())
specialFolderSuffix = slugify(specialFolderSuffix, stripValue=False).rstrip()
specialCategoriesGeneral = [sc for sc in SpecialCategories if sc.exclusiveSystems is None]
specialCategoriesExclusive = [sc for sc in SpecialCategories if sc.exclusiveSystems is not None]
crcHasher = FileHash('crc32')
defaultSettingsFile = path.join(progFolder, "settings.ini")
regionsFile = path.join(progFolder, "regions.ini")
logFolder = path.join(progFolder, "Logs")
systemListStr = "\"\" "+" ".join(["\""+sn+"\"" for sn in systemNamesDict.keys() if systemNamesDict[sn][0] != "Advanced"])
PROJECT_PATH = pathlib.Path(__file__).parent
PROJECT_UI = PROJECT_PATH / "EzRO.ui"
class EzroApp:
def __init__(self, master=None):
# Menu Bar
menubar = tk.Menu(tk_root, tearoff=0)
fileMenu = tk.Menu(menubar, tearoff=0)
helpMenu = tk.Menu(menubar, tearoff=0)
helpMenu.add_command(label="View Help...", command=self.menu_viewHelp)
helpMenu.add_separator()
helpMenu.add_command(label="About...", command=self.menu_viewAbout)
helpMenu.add_command(label="External Libraries...", command=self.menu_viewExternalLibraries)
helpMenu.add_command(label="Get No-Intro DAT Files...", command=self.menu_getDATFiles)
menubar.add_cascade(label="Help", menu=helpMenu)
tk_root.config(menu=menubar)
# build ui
self.Main_Notebook = ttk.Notebook(master)
self.Export_Frame = ttk.Frame(self.Main_Notebook)
self.Export_System_Combobox = ttk.Combobox(self.Export_Frame)
self.systemChoice = tk.StringVar(value='')
self.Export_System_Combobox.configure(state='readonly', textvariable=self.systemChoice, values=systemListStr, width='50', height=25)
self.Export_System_Combobox.place(anchor='e', relx='.375', rely='.075', x='0', y='0')
self.Export_System_Button = ttk.Button(self.Export_Frame)
self.Export_System_Button.configure(text='Add System')
self.Export_System_Button.place(anchor='e', relx='.45', rely='.075', x='0', y='0')
self.Export_System_Button.configure(command=self.export_addSystem)
self.Export_ShowAdvancedSystems = ttk.Checkbutton(self.Export_Frame)
self.showAdvancedSystems = tk.IntVar(value=False)
self.Export_ShowAdvancedSystems.configure(text='Show Advanced Systems', variable=self.showAdvancedSystems)
self.Export_ShowAdvancedSystems.place(anchor='w', relx='.46', rely='.075', x='0', y='0')
self.Export_ShowAdvancedSystems.configure(command=self.export_toggleAdvancedSystems)
self.Export_SaveLayout_Button = ttk.Button(self.Export_Frame)
self.Export_SaveLayout_Button.configure(text='Save System Tabs')
self.Export_SaveLayout_Button.place(anchor='e', relx='.78', rely='.075', x='0', y='0')
self.Export_SaveLayout_Button.configure(command=self.export_saveSystemLoadout)
self.Export_LoadLayout_Button = ttk.Button(self.Export_Frame)
self.Export_LoadLayout_Button.configure(text='Load System Tabs')
self.Export_LoadLayout_Button.place(anchor='w', relx='.80', rely='.075', x='0', y='0')
self.Export_LoadLayout_Button.configure(command=self.export_loadSystemLoadout)
self.Export_Systems = ScrollableNotebook(self.Export_Frame, wheelscroll=True, tabmenu=True)
self.initVars()
self.Export_Systems.configure(height='200', width='200')
self.Export_Systems.place(anchor='nw', relheight='.7', relwidth='.9', relx='.05', rely='.15', x='0', y='0')
self.Export_AuditThis = ttk.Button(self.Export_Frame)
self.Export_AuditThis.configure(text='Audit This System')
self.Export_AuditThis.place(anchor='w', relx='.05', rely='.925', x='0', y='0')
self.Export_AuditThis.configure(command=self.export_auditSystem)
self.Export_AuditAll = ttk.Button(self.Export_Frame)
self.Export_AuditAll.configure(text='Audit All Open Systems')
self.Export_AuditAll.place(anchor='w', relx='.15', rely='.925', x='0', y='0')
self.Export_AuditAll.configure(command=self.export_auditAllSystems)
self.Export_TestExport = ttk.Checkbutton(self.Export_Frame)
self.isTestExport = tk.IntVar(value=False)
self.Export_TestExport.configure(text='Test Export', variable=self.isTestExport)
self.Export_TestExport.place(anchor='e', relx='.72', rely='.925', x='0', y='0')
self.Export_TestExport.configure(command=self.export_toggleTestExport)
self.Export_ExportThis = ttk.Button(self.Export_Frame)
self.Export_ExportThis.configure(text='Export This System')
self.Export_ExportThis.place(anchor='e', relx='.825', rely='.925', x='0', y='0')
self.Export_ExportThis.configure(command=self.export_exportSystem)
self.Export_ExportAll = ttk.Button(self.Export_Frame)
self.Export_ExportAll.configure(text='Export All Open Systems')
self.Export_ExportAll.place(anchor='e', relx='.95', rely='.925', x='0', y='0')
self.Export_ExportAll.configure(command=self.export_exportAllSystems)
self.Export_AuditHelp = ttk.Button(self.Export_Frame)
self.Export_AuditHelp.configure(text='?', width='2')
self.Export_AuditHelp.place(anchor='w', relx='.275', rely='.925', x='0', y='0')
self.Export_AuditHelp.configure(command=self.export_auditHelp)
self.Export_Frame.configure(height='200', width='200')
self.Export_Frame.pack(side='top')
self.Main_Notebook.add(self.Export_Frame, text='Export')
# Favorites Tab is unused
# self.Favorites_Frame = ttk.Frame(self.Main_Notebook)
# self.Favorites_Load = ttk.Button(self.Favorites_Frame)
# self.Favorites_Load.configure(text='Load Existing List...')
# self.Favorites_Load.place(anchor='w', relx='.1', rely='.075', x='0', y='0')
# self.Favorites_Load.configure(command=self.favorites_loadList)
# self.Favorites_System_Label = ttk.Label(self.Favorites_Frame)
# self.Favorites_System_Label.configure(text='System')
# self.Favorites_System_Label.place(anchor='w', relx='.1', rely='.15', x='0', y='0')
# self.Favorites_System_Combobox = ttk.Combobox(self.Favorites_Frame)
# self.favoritesSystemChoice = tk.StringVar(value='')
# self.Favorites_System_Combobox.configure(state='readonly', textvariable=self.favoritesSystemChoice, values=systemListStr, width='50')
# self.Favorites_System_Combobox.place(anchor='w', relx='.15', rely='.15', x='0', y='0')
# self.Favorites_List = EditableTreeview(self.Favorites_Frame)
# self.Favorites_List.place(anchor='nw', relheight='.65', relwidth='.8', relx='.1', rely='.2', x='0', y='0')
# self.Favorites_Add = ttk.Button(self.Favorites_Frame)
# self.Favorites_Add.configure(text='Add Files...')
# self.Favorites_Add.place(anchor='w', relx='.1', rely='.925', x='0', y='0')
# self.Favorites_Add.configure(command=self.favorites_addFiles)
# self.Favorites_Save = ttk.Button(self.Favorites_Frame)
# self.Favorites_Save.configure(text='Save List As...')
# self.Favorites_Save.place(anchor='e', relx='.9', rely='.925', x='0', y='0')
# self.Favorites_Save.configure(command=self.favorites_saveList)
# self.Favorites_Frame.configure(height='200', width='200')
# self.Favorites_Frame.pack(side='top')
# self.Main_Notebook.add(self.Favorites_Frame, text='Favorites')
self.Config_Frame = ttk.Frame(self.Main_Notebook)
self.Config_Default_SaveChanges = ttk.Button(self.Config_Frame)
self.Config_Default_SaveChanges.configure(text='Save Changes')
self.Config_Default_SaveChanges.place(anchor='e', relx='.95', rely='.925', x='0', y='0')
self.Config_Default_SaveChanges.configure(command=self.settings_saveChanges)
self.Config_Notebook = ttk.Notebook(self.Config_Frame)
self.Config_Default_Frame = ttk.Frame(self.Config_Notebook)
self.Config_Default_DATDir_Label = ttk.Label(self.Config_Default_Frame)
self.Config_Default_DATDir_Label.configure(text='Input No-Intro DAT Directory')
self.Config_Default_DATDir_Label.grid(column='0', padx='20', pady='10', row='0', sticky='w')
self.Config_Default_DATDir_PathChooser = PathChooserInput(self.Config_Default_Frame)
self.g_datFilePath = tk.StringVar(value='')
self.Config_Default_DATDir_PathChooser.configure(textvariable=self.g_datFilePath, type='directory')
self.Config_Default_DATDir_PathChooser.grid(column='0', ipadx='75', padx='200', pady='10', row='0', sticky='w')
self.Config_Default_RomsetDir_Label = ttk.Label(self.Config_Default_Frame)
self.Config_Default_RomsetDir_Label.configure(text='Input Romset Directory')
self.Config_Default_RomsetDir_Label.grid(column='0', padx='20', pady='10', row='1', sticky='w')
self.Config_Default_RomsetDir_PathChooser = PathChooserInput(self.Config_Default_Frame)
self.g_romsetFolderPath = tk.StringVar(value='')
self.Config_Default_RomsetDir_PathChooser.configure(textvariable=self.g_romsetFolderPath, type='directory')
self.Config_Default_RomsetDir_PathChooser.grid(column='0', ipadx='75', padx='200', pady='10', row='1', sticky='w')
self.Config_Default_IncludeOtherRegions = ttk.Checkbutton(self.Config_Default_Frame)
self.g_includeOtherRegions = tk.IntVar(value=False)
self.Config_Default_IncludeOtherRegions.configure(text='(1G1R) Include Games from Non-Primary Regions', variable=self.g_includeOtherRegions)
self.Config_Default_IncludeOtherRegions.grid(column='0', padx='20', pady='10', row='2', sticky='w')
self.Config_Default_Include = ttk.Labelframe(self.Config_Default_Frame)
self.Config_Default_IncludeSpecial = []
self.g_includeSpecial = []
for i in range(len(SpecialCategories)):
self.Config_Default_IncludeSpecial.append(ttk.Checkbutton(self.Config_Default_Include))
self.g_includeSpecial.append(tk.IntVar(value=False))
self.Config_Default_IncludeSpecial[i].configure(text=SpecialCategories[i].name, variable=self.g_includeSpecial[i])
currCol = i%3
currRow = i//3
self.Config_Default_IncludeSpecial[i].grid(column=currCol, padx=10, pady=10, row=currRow, sticky='w')
self.Config_Default_Include.configure(text='Include')
self.Config_Default_Include.grid(column='0', padx='20', pady='10', row='3', sticky='w')
self.Config_Default_Separator = ttk.Separator(self.Config_Default_Frame)
self.Config_Default_Separator.configure(orient='vertical')
self.Config_Default_Separator.place(anchor='center', relheight='.95', relx='.5', rely='.5', x='0', y='0')
self.Config_Default_ExtractArchives = ttk.Checkbutton(self.Config_Default_Frame)
self.g_extractArchives = tk.IntVar(value=False)
self.Config_Default_ExtractArchives.configure(text='Extract Compressed Roms', variable=self.g_extractArchives)
self.Config_Default_ExtractArchives.place(anchor='nw', relx='.651', rely='.03', x='0', y='0')
self.Config_Default_ParentFolder = ttk.Checkbutton(self.Config_Default_Frame)
self.g_parentFolder = tk.IntVar(value=False)
self.Config_Default_ParentFolder.configure(text='Create Game Folder for Each Game', variable=self.g_parentFolder)
self.Config_Default_ParentFolder.place(anchor='nw', relx='.651', rely='.132', x='0', y='0')
self.Config_Default_SortByPrimaryRegion = ttk.Checkbutton(self.Config_Default_Frame)
self.g_sortByPrimaryRegion = tk.IntVar(value=False)
self.Config_Default_SortByPrimaryRegion.configure(text='Create Region Folders', variable=self.g_sortByPrimaryRegion)
self.Config_Default_SortByPrimaryRegion.place(anchor='nw', relx='.651', rely='.234', x='0', y='0')
self.Config_Default_PrimaryRegionInRoot = ttk.Checkbutton(self.Config_Default_Frame)
self.g_primaryRegionInRoot = tk.IntVar(value=False)
self.Config_Default_PrimaryRegionInRoot.configure(text='Do Not Create Folder for Primary Regions', variable=self.g_primaryRegionInRoot)
self.Config_Default_PrimaryRegionInRoot.place(anchor='nw', relx='.651', rely='.336', x='0', y='0')
self.Config_Default_SpecialCategoryFolder = ttk.Checkbutton(self.Config_Default_Frame)
self.g_specialCategoryFolder = tk.IntVar(value=False)
self.Config_Default_SpecialCategoryFolder.configure(text='Create Folders for Special Categories', variable=self.g_specialCategoryFolder)
self.Config_Default_SpecialCategoryFolder.place(anchor='nw', relx='.651', rely='.438', x='0', y='0')
self.Config_Default_LetterFolder = ttk.Checkbutton(self.Config_Default_Frame)
self.g_letterFolder = tk.IntVar(value=False)
self.Config_Default_LetterFolder.configure(text='Create Letter Folders', variable=self.g_letterFolder)
self.Config_Default_LetterFolder.place(anchor='nw', relx='.651', rely='.540', x='0', y='0')
self.Config_Default_OverwriteDuplicates = ttk.Checkbutton(self.Config_Default_Frame)
self.g_overwriteDuplicates = tk.IntVar(value=False)
self.Config_Default_OverwriteDuplicates.configure(text='Overwrite Duplicate Files', variable=self.g_overwriteDuplicates)
self.Config_Default_OverwriteDuplicates.place(anchor='nw', relx='.651', rely='.642', x='0', y='0')
self.Config_Default_Frame.configure(height='200', width='200')
self.Config_Default_Frame.pack(side='top')
self.Config_Notebook.add(self.Config_Default_Frame, text='Default Settings')
self.Config_Region_Frame = ScrolledFrame(self.Config_Notebook, scrolltype='vertical')
self.Config_Region_Choice_RemoveButton_Tertiary = ttk.Button(self.Config_Region_Frame.innerframe)
self.Config_Region_Choice_RemoveButton_Tertiary.configure(state='disabled', text='X', width='2')
self.Config_Region_Choice_RemoveButton_Tertiary.grid(column='0', padx='20', pady='10', row='98', sticky='w')
self.Config_Region_Choice_Name_Label_Tertiary = ttk.Label(self.Config_Region_Frame.innerframe)
self.Config_Region_Choice_Name_Label_Tertiary.configure(text='Region Group')
self.Config_Region_Choice_Name_Label_Tertiary.grid(column='0', padx='130', pady='10', row='98', sticky='w')
self.Config_Region_Choice_Name_Entry_Tertiary = ttk.Entry(self.Config_Region_Frame.innerframe)
self.regionGroupTertiary = tk.StringVar(value='')
self.Config_Region_Choice_Name_Entry_Tertiary.configure(textvariable=self.regionGroupTertiary)
self.Config_Region_Choice_Name_Entry_Tertiary.grid(column='0', padx='220', pady='10', row='98', sticky='w')
self.Config_Region_Choice_Type_Label_Tertiary = ttk.Label(self.Config_Region_Frame.innerframe)
self.Config_Region_Choice_Type_Label_Tertiary.configure(text='Priority Type')
self.Config_Region_Choice_Type_Label_Tertiary.grid(column='0', padx='380', pady='10', row='98', sticky='w')
self.Config_Region_Choice_Type_Combobox_Tertiary = ttk.Combobox(self.Config_Region_Frame.innerframe)
self.Config_Region_Choice_Type_Combobox_Tertiary.configure(state='disabled', values='"Tertiary"', width='12')
self.Config_Region_Choice_Type_Combobox_Tertiary.grid(column='0', padx='465', pady='10', row='98', sticky='w')
self.Config_Region_Choice_Type_Combobox_Tertiary.current(0)
self.Config_Region_AddNewRegionCategory = ttk.Button(self.Config_Region_Frame.innerframe)
self.Config_Region_AddNewRegionCategory.configure(text='+ Add New Region Category')
self.Config_Region_AddNewRegionCategory.grid(column='0', padx='20', pady='10', row='99', sticky='w')
self.Config_Region_AddNewRegionCategory.configure(command=self.settings_region_addNewRegionCategory)
self.Config_Region_Help = ttk.Button(self.Config_Region_Frame.innerframe)
self.Config_Region_Help.configure(text='?', width='2')
self.Config_Region_Help.grid(column='0', padx='200', pady='10', row='99', sticky='w')
self.Config_Region_Help.configure(command=self.settings_region_help)
self.Config_Region_Template_Combobox = ttk.Combobox(self.Config_Region_Frame.innerframe)
self.templateChoice = tk.StringVar(value='')
self.Config_Region_Template_Combobox.configure(state='readonly', textvariable=self.templateChoice, values='"" "English" "English + Secondary" "English (USA Focus)" "English (Europe Focus)" "Japanese" "Japanese + Secondary"')
self.Config_Region_Template_Combobox.place(anchor='e', x=int(960*screenHeightMult), y=int(470*screenHeightMult))
self.Config_Region_Template_Apply = ttk.Button(self.Config_Region_Frame.innerframe)
self.Config_Region_Template_Apply.configure(text='Apply Template')
self.Config_Region_Template_Apply.place(anchor='e', x=int(1065*screenHeightMult), y=int(470*screenHeightMult))
self.Config_Region_Template_Apply.configure(command=self.config_region_applyTemplate)
self.Config_Region_Frame.configure(usemousewheel=True)
self.Config_Region_Frame.pack(side='top')
self.Config_Notebook.add(self.Config_Region_Frame, text='Region Settings')
self.Config_Notebook.configure(height='200', width='200')
self.Config_Notebook.place(anchor='nw', relheight='.8', relwidth='.9', relx='.05', rely='.05', x='0', y='0')
self.Config_Frame.configure(height='200', width='200')
self.Config_Frame.pack(side='top')
self.Main_Notebook.add(self.Config_Frame, text='Config')
self.Main_Notebook.bind('<<NotebookTabChanged>>', self.changeMainTab, add='')
# self.Main_Notebook.configure(height=int(675*screenHeightMult), width=int(1200*screenHeightMult))
self.Main_Notebook.grid(column='0', row='0')
self.Main_Notebook.place(relheight='1', relwidth='1')
if noSystemNamesFileFlag:
showerror("EzRO", "Valid SystemNames.py file not found. Using default system list.")
if noSpecialCategoriesFileFlag:
showerror("EzRO", "Valid SpecialCategories.py file not found. Using default categories list.")
if badSpecialFolderPrefixFlag:
showerror("EzRO", "Warning: Invalid special folder prefix. Please change it in SpecialCategories.py.\n\nFor now, prefix has temporarily been changed to \""+specialFolderPrefix+"\".")
if badSpecialFolderSuffixFlag:
showerror("EzRO", "Warning: Invalid special folder suffix. Please change it in SpecialCategories.py.\n\nFor now, suffix has temporarily been changed to \""+specialFolderSuffix+"\".")
# Tooltips
tooltip.create(self.Export_ShowAdvancedSystems, 'Show systems that are difficult or uncommon to emulate, and systems that often do not make use of No-Intro DAT files.')
tooltip.create(self.Export_TestExport, 'For testing; if enabled, roms will NOT be exported. This allows you to see how many roms would be exported and how much space they would take up without actually exporting anything.\n\nIf unsure, leave this disabled.')
tooltip.create(self.Config_Default_DATDir_Label, 'The directory containing No-Intro DAT files for each system. These contain information about each rom, which is used in both exporting and auditing.\n\nIf this is provided, the \"Export\" tab will attempt to automatically match DAT files from this directory with each system so you don\'t have to input them manually.')
tooltip.create(self.Config_Default_RomsetDir_Label, 'The directory containing your rom directories for each system.\n\nIf this is provided, the \"Export\" tab will attempt to automatically match folders from this directory with each system so you don\'t have to input them manually.')
tooltip.create(self.Config_Default_ExtractArchives, 'If enabled, any roms from your input romset that are contained in zipped archives (ZIP, RAR, 7z) will be extracted during export.\n\nUseful if your output device does not support zipped roms.\n\nIf unsure, leave this disabled.')
tooltip.create(self.Config_Default_ParentFolder, 'If enabled, each rom will be exported to a parent folder with the same name as its primary region release.\n\nFor example, \"Legend of Zelda, The (USA)\" and \"Zelda no Densetsu 1 - The Hyrule Fantasy (Japan)\" will both be exported to a folder titled \"Legend of Zelda, The\".\n\nIf \"Create Region Folders\" or \"Create Letter Folders\" is enabled, the game folder will be placed according to the game\'s highest-priority region.')
tooltip.create(self.Config_Default_SortByPrimaryRegion, 'If enabled, each rom will be exported to a parent folder named after its highest-priority region.\n\nFor example, if your order of region priority is USA->Europe->Japan, then \"Golden Sun (USA, Europe)\" will be exported to a folder titled \"'+specialFolderPrefix+'USA'+specialFolderSuffix+'\".')
tooltip.create(self.Config_Default_PrimaryRegionInRoot, '(Only applies if \"Create Region Folders\" is enabled.)\n\nIf enabled, a region folder will NOT be created for your primary regions.\n\nFor example, if you have Europe set as a primary region, then Europe roms will not be exported to a [Europe] folder, and will instead be placed directly in the output folder.\n\nIf unsure, leave this enabled.')
tooltip.create(self.Config_Default_SpecialCategoryFolder, 'If enabled, all exported roms that are part of a special category (Unlicensed, Unreleased, etc.) will be exported to a parent folder named after that category. There will be multiple nested folders if a game belongs to multiple special categories.\n\nIf unsure, leave this enabled.')
tooltip.create(self.Config_Default_LetterFolder, 'If enabled, each rom will be exported to a parent folder named after its first letter.\n\nFor example, \"Castlevania (USA)\" will be exported to a [C] folder.\n\nIf unsure, leave this disabled.')
tooltip.create(self.Config_Default_OverwriteDuplicates, 'If enabled: If a rom in the output directory with the same name as an exported rom already exists, it will be overwritten by the new export.\n\nIf disabled: The export will not overwrite matching roms in the output directory.\n\nIf unsure, leave this disabled.')
tooltip.create(self.Config_Default_IncludeOtherRegions, '(Only applies to 1G1R export.)\n\nIf enabled: In the event that a game does not contain a rom from your region (e.g. your primary region is USA but the game is a Japan-only release), a secondary region will be used according to your Region/Language Priority Order.\n\nIf disabled: In the event that a game does not contain a rom from your region, the game is skipped entirely.\n\nIf you only want to export roms from your own region, disable this.')
for i in range(len(SpecialCategories)):
if SpecialCategories[i].description is not None:
tooltip.create(self.Config_Default_IncludeSpecial[i], SpecialCategories[i].description)
tooltip.create(self.Config_Region_Choice_Name_Label_Tertiary, 'The name of the region group. If \"Create Region Folders\" is enabled, then games marked as one of this group\'s region tags will be exported to a folder named after this group, surround by brackets (e.g. [World], [USA], etc).')
tooltip.create(self.Config_Region_Choice_Type_Label_Tertiary, 'The type of region group.\n\nPrimary: The most significant region; 1G1R exports will prioritize this. If there are multiple Primary groups, then higher groups take priority.\n\nSecondary: \"Backup\" regions that will not be used in a 1G1R export unless no Primary-group version of a game exists, and \"Include Games from Non-Primary Regions\" is also enabled. If there are multiple Secondary groups, then higher groups take priority.\n\nTertiary: Any known region/language tag that is not part of a Primary/Secondary group is added to the Tertiary group by default. This is functionally the same as a Secondary group.')
# Main widget
self.mainwindow = self.Main_Notebook
master.protocol("WM_DELETE_WINDOW", sys.exit) # Why does this not work automatically?
# Other initialization
self.isExport = True
if not path.exists(defaultSettingsFile):
self.createDefaultSettings()
if not path.exists(regionsFile):
self.createRegionSettings()
self.loadConfig()
def run(self):
self.mainwindow.mainloop()
#########################
# EXPORT (GUI Handling) #
#########################
def initVars(self):
self.recentlyVerified = False
self.exportTabNum = 0
self.exportSystemNames = []
self.Export_ScrolledFrame_ = []
self.Export_DAT_Label_ = []
self.Export_DAT_PathChooser_ = []
self.datFilePathChoices = []
self.Export_Romset_Label_ = []
self.Export_Romset_PathChooser_ = []
self.romsetFolderPathChoices = []
self.Export_OutputDir_Label_ = []
self.Export_OutputDir_PathChooser_ = []
self.outputFolderDirectoryChoices = []
self.Export_Separator_ = []
self.Export_OutputType_Label_ = []
self.Export_OutputType_Combobox_ = []
self.outputTypeChoices = []
self.Export_includeOtherRegions_ = []
self.includeOtherRegionsChoices = []
self.Export_FromList_Label_ = []
self.Export_FromList_PathChooser_ = []
self.romListFileChoices = []
self.Export_IncludeFrame_ = []
self.Export_IncludeSpecial_ = []
self.includeSpecialChoices = []
for i in range(len(SpecialCategories)):
self.Export_IncludeSpecial_.append([])
self.includeSpecialChoices.append([])
self.Export_ExtractArchives_ = []
self.extractArchivesChoices = []
self.Export_ParentFolder_ = []
self.parentFolderChoices = []
self.Export_SortByPrimaryRegion_ = []
self.sortByPrimaryRegionChoices = []
self.Export_SpecialCategoryFolder_ = []
self.Export_LetterFolder_ = []
self.specialCategoryFolderChoices = []
self.letterFolderChoices = []
self.Export_PrimaryRegionInRoot_ = []
self.primaryRegionInRootChoices = []
self.Export_OverwriteDuplicates_ = []
self.overwriteDuplicatesChoices = []
self.Export_RemoveSystem_ = []
self.regionNum = 0
self.Config_Region_Choice_RemoveButton_ = []
self.Config_Region_Choice_UpButton_ = []
self.Config_Region_Choice_DownButton_ = []
self.Config_Region_Choice_Name_Label_ = []
self.Config_Region_Choice_Name_Entry_ = []
self.regionGroupNames = []
self.Config_Region_Choice_Type_Label_ = []
self.Config_Region_Choice_Type_Combobox_ = []
self.regionPriorityTypes = []
self.Config_Region_Choice_Tags_Label_ = []
self.Config_Region_Choice_Tags_Entry_ = []
self.regionTags = []
def export_toggleAdvancedSystems(self):
global systemListStr
if self.showAdvancedSystems.get():
systemListStr = "\"\" "+" ".join(["\""+sn+"\"" for sn in systemNamesDict.keys()])
else:
systemListStr = "\"\" "+" ".join(["\""+sn+"\"" for sn in systemNamesDict.keys() if systemNamesDict[sn][0] != "Advanced"])
self.Export_System_Combobox.configure(values=systemListStr)
def addSystemTab(self, systemName="New System", datFilePath="", romsetFolderPath="", outputFolderDirectory="",
outputType="All", includeOtherRegions=False, romList="", includeSpecial=[], extractArchives=False,
parentFolder=False, sortByPrimaryRegion=False, primaryRegionInRoot=False, specialCategoryFolder=False,
letterFolder=False, overwriteDuplicates=False):
self.exportSystemNames.append(systemName)
self.Export_ScrolledFrame_.append(ScrolledFrame(self.Export_Systems, scrolltype='both'))
self.Export_DAT_Label_.append(ttk.Label(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.Export_DAT_Label_[self.exportTabNum].configure(text='Input No-Intro DAT')
self.Export_DAT_Label_[self.exportTabNum].grid(column='0', padx='20', pady='10', row='0', sticky='w')
self.Export_DAT_PathChooser_.append(PathChooserInput(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.setSystemDAT(systemName, datFilePath)
self.Export_DAT_PathChooser_[self.exportTabNum].configure(mustexist='true', state='normal', textvariable=self.datFilePathChoices[self.exportTabNum], type='file', filetypes=[('DAT Files', '*.dat')])
self.Export_DAT_PathChooser_[self.exportTabNum].grid(column='0', ipadx='90', padx='150', pady='10', row='0', sticky='w')
self.Export_Romset_Label_.append(ttk.Label(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.Export_Romset_Label_[self.exportTabNum].configure(text='Input Romset')
self.Export_Romset_Label_[self.exportTabNum].grid(column='0', padx='20', pady='10', row='1', sticky='w')
self.Export_Romset_PathChooser_.append(PathChooserInput(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.setInputRomsetDir(systemName, romsetFolderPath)
self.Export_Romset_PathChooser_[self.exportTabNum].configure(mustexist='true', state='normal', textvariable=self.romsetFolderPathChoices[self.exportTabNum], type='directory')
self.Export_Romset_PathChooser_[self.exportTabNum].grid(column='0', ipadx='90', padx='150', pady='10', row='1', sticky='w')
self.Export_OutputDir_Label_.append(ttk.Label(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.Export_OutputDir_Label_[self.exportTabNum].configure(text='Output Directory')
self.Export_OutputDir_Label_[self.exportTabNum].grid(column='0', padx='20', pady='10', row='2', sticky='w')
self.Export_OutputDir_PathChooser_.append(PathChooserInput(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.outputFolderDirectoryChoices.append(tk.StringVar(value=''))
self.outputFolderDirectoryChoices[self.exportTabNum].set(outputFolderDirectory)
self.Export_OutputDir_PathChooser_[self.exportTabNum].configure(mustexist='true', state='normal', textvariable=self.outputFolderDirectoryChoices[self.exportTabNum], type='directory')
self.Export_OutputDir_PathChooser_[self.exportTabNum].grid(column='0', ipadx='90', padx='150', pady='10', row='2', sticky='w')
self.Export_Separator_.append(ttk.Separator(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.Export_Separator_[self.exportTabNum].configure(orient='vertical')
self.Export_Separator_[self.exportTabNum].place(anchor='center', relheight='.95', relx='.5', rely='.5', x='0', y='0')
self.Export_OutputType_Label_.append(ttk.Label(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.Export_OutputType_Label_[self.exportTabNum].configure(text='Output Type')
self.Export_OutputType_Label_[self.exportTabNum].grid(column='0', padx='20', pady='10', row='3', sticky='w')
self.Export_OutputType_Combobox_.append(ttk.Combobox(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.outputTypeChoices.append(tk.StringVar(value=''))
self.outputTypeChoices[self.exportTabNum].set(outputType)
self.Export_OutputType_Combobox_[self.exportTabNum].configure(state='readonly', textvariable=self.outputTypeChoices[self.exportTabNum], values='"All" "1G1R" "Favorites"', width='10')
self.Export_OutputType_Combobox_[self.exportTabNum].grid(column='0', padx='150', pady='10', row='3', sticky='w')
self.Export_OutputType_Combobox_[self.exportTabNum].bind('<<ComboboxSelected>>', self.export_setOutputType, add='')
if outputType == "1G1R":
self.Export_OutputType_Combobox_[self.exportTabNum].current(1)
elif outputType == "Favorites":
self.Export_OutputType_Combobox_[self.exportTabNum].current(2)
else:
self.Export_OutputType_Combobox_[self.exportTabNum].current(0)
self.Export_includeOtherRegions_.append(ttk.Checkbutton(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.includeOtherRegionsChoices.append(tk.IntVar(value=includeOtherRegions))
self.Export_includeOtherRegions_[self.exportTabNum].configure(text='Include Games from Non-Primary Regions', variable=self.includeOtherRegionsChoices[self.exportTabNum])
self.Export_includeOtherRegions_[self.exportTabNum].grid(column='0', padx='20', pady='10', row='4', sticky='w')
self.Export_FromList_Label_.append(ttk.Label(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.Export_FromList_Label_[self.exportTabNum].configure(text='Rom List')
self.Export_FromList_Label_[self.exportTabNum].grid(column='0', padx='20', pady='10', row='5', sticky='w')
self.Export_FromList_PathChooser_.append(PathChooserInput(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.romListFileChoices.append(tk.StringVar(value=''))
self.romListFileChoices[self.exportTabNum].set(romList)
self.Export_FromList_PathChooser_[self.exportTabNum].configure(mustexist='true', state='normal', textvariable=self.romListFileChoices[self.exportTabNum], type='file', filetypes=[('Text Files', '*.txt')])
self.Export_FromList_PathChooser_[self.exportTabNum].grid(column='0', ipadx='90', padx='150', pady='10', row='5', sticky='w')
self.Export_IncludeFrame_.append(ttk.Labelframe(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
numSkipped = 0
for i in range(len(SpecialCategories)):
self.Export_IncludeSpecial_.append([])
self.includeSpecialChoices.append([])
self.Export_IncludeSpecial_[i].append(ttk.Checkbutton(self.Export_IncludeFrame_[self.exportTabNum]))
if len(includeSpecial) > i:
self.includeSpecialChoices[i].append(tk.IntVar(value=includeSpecial[i]))
else:
self.includeSpecialChoices[i].append(tk.IntVar(value=False))
self.Export_IncludeSpecial_[i][self.exportTabNum].configure(text=SpecialCategories[i].name, variable=self.includeSpecialChoices[i][self.exportTabNum])
if SpecialCategories[i].exclusiveSystems is not None and systemName not in SpecialCategories[i].exclusiveSystems:
numSkipped += 1
else:
currCol = (i-numSkipped)%3
currRow = (i-numSkipped)//3
self.Export_IncludeSpecial_[i][self.exportTabNum].grid(column=currCol, padx=10, pady=10, row=currRow, sticky='w')
self.Export_IncludeFrame_[self.exportTabNum].configure(text='Include')
self.Export_IncludeFrame_[self.exportTabNum].grid(column='0', padx='20', pady='10', row='6', sticky='w')
self.Export_ExtractArchives_.append(ttk.Checkbutton(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.extractArchivesChoices.append(tk.IntVar(value=extractArchives))
self.Export_ExtractArchives_[self.exportTabNum].configure(text='Extract Compressed Roms', variable=self.extractArchivesChoices[self.exportTabNum])
self.Export_ExtractArchives_[self.exportTabNum].place(anchor='nw', relx='.651', rely='.03', x='0', y='0')
self.Export_ParentFolder_.append(ttk.Checkbutton(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.parentFolderChoices.append(tk.IntVar(value=parentFolder))
self.Export_ParentFolder_[self.exportTabNum].configure(text='Create Game Folder for Each Game', variable=self.parentFolderChoices[self.exportTabNum])
self.Export_ParentFolder_[self.exportTabNum].place(anchor='nw', relx='.651', rely='.132', x='0', y='0')
self.Export_SortByPrimaryRegion_.append(ttk.Checkbutton(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.sortByPrimaryRegionChoices.append(tk.IntVar(value=sortByPrimaryRegion))
self.Export_SortByPrimaryRegion_[self.exportTabNum].configure(text='Create Region Folders', variable=self.sortByPrimaryRegionChoices[self.exportTabNum])
self.Export_SortByPrimaryRegion_[self.exportTabNum].place(anchor='nw', relx='.651', rely='.234', x='0', y='0')
self.Export_SortByPrimaryRegion_[self.exportTabNum].configure(command=self.export_togglePrimaryRegionInRoot)
self.Export_PrimaryRegionInRoot_.append(ttk.Checkbutton(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.primaryRegionInRootChoices.append(tk.IntVar(value=primaryRegionInRoot))
self.Export_PrimaryRegionInRoot_[self.exportTabNum].configure(text='Do Not Create Folder for Primary Regions', variable=self.primaryRegionInRootChoices[self.exportTabNum])
self.Export_PrimaryRegionInRoot_[self.exportTabNum].place(anchor='nw', relx='.651', rely='.336', x='0', y='0')
self.Export_SpecialCategoryFolder_.append(ttk.Checkbutton(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.specialCategoryFolderChoices.append(tk.IntVar(value=specialCategoryFolder))
self.Export_SpecialCategoryFolder_[self.exportTabNum].configure(text='Create Folders for Special Categories', variable=self.specialCategoryFolderChoices[self.exportTabNum])
self.Export_SpecialCategoryFolder_[self.exportTabNum].place(anchor='nw', relx='.651', rely='.438', x='0', y='0')
self.Export_LetterFolder_.append(ttk.Checkbutton(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.letterFolderChoices.append(tk.IntVar(value=letterFolder))
self.Export_LetterFolder_[self.exportTabNum].configure(text='Create Letter Folders', variable=self.letterFolderChoices[self.exportTabNum])
self.Export_LetterFolder_[self.exportTabNum].place(anchor='nw', relx='.651', rely='.540', x='0', y='0')
self.Export_OverwriteDuplicates_.append(ttk.Checkbutton(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.overwriteDuplicatesChoices.append(tk.IntVar(value=overwriteDuplicates))
self.Export_OverwriteDuplicates_[self.exportTabNum].configure(text='Overwrite Duplicate Files', variable=self.overwriteDuplicatesChoices[self.exportTabNum])
self.Export_OverwriteDuplicates_[self.exportTabNum].place(anchor='nw', relx='.651', rely='.642', x='0', y='0')
self.Export_RemoveSystem_.append(ttk.Button(self.Export_ScrolledFrame_[self.exportTabNum].innerframe))
self.Export_RemoveSystem_[self.exportTabNum].configure(text='Remove System')
self.Export_RemoveSystem_[self.exportTabNum].place(anchor='se', relx='1', rely='1', x='-10', y='-10')
self.Export_RemoveSystem_[self.exportTabNum].configure(command=self.export_removeSystem)
# self.Export_ScrolledFrame_[self.exportTabNum].innerframe.configure(relief='groove')
self.Export_ScrolledFrame_[self.exportTabNum].configure(usemousewheel=True)
self.Export_ScrolledFrame_[self.exportTabNum].place(anchor='nw', relheight='.9', relwidth='.9', relx='.05', rely='.05', x='0', y='0')
self.Export_Systems.add(self.Export_ScrolledFrame_[self.exportTabNum], text=systemName)
tooltip.create(self.Export_DAT_Label_[self.exportTabNum], 'The No-Intro DAT file for the current system. This contains information about each rom, which is used in both exporting and auditing.\n\nNot needed for the \"Favorites\" output type.')
tooltip.create(self.Export_Romset_Label_[self.exportTabNum], 'The directory containing your roms for the current system.')
tooltip.create(self.Export_OutputDir_Label_[self.exportTabNum], 'The directory that your roms will be exported to. Ideally, this should be named after the current system.')
tooltip.create(self.Export_OutputType_Label_[self.exportTabNum], '\"All\": All roms will be exported.\n\n\"1G1R\" (1 Game 1 Rom): Only the latest revision of the highest-priority region group of each game will be exported (e.g. USA Revision 2). See "Region Settings" in Config for more information.\n\n\"Favorites\": Only specific roms from a provided text file will be exported; good for exporting a list of only your favorite roms.')
tooltip.create(self.Export_includeOtherRegions_[self.exportTabNum], 'If enabled: In the event that a game does not contain a rom from your region (e.g. your primary region is USA but the game is a Japan-only release), a secondary region will be used according to your Region/Language Priority Order.\n\nIf disabled: In the event that a game does not contain a rom from your region, the game is skipped entirely.\n\nIf you only want to export roms from your own region, disable this.')
tooltip.create(self.Export_FromList_Label_[self.exportTabNum], 'The text list containing your favorite roms for the current system.')
for i in range(len(SpecialCategories)):
if SpecialCategories[i].description is not None:
tooltip.create(self.Export_IncludeSpecial_[i][self.exportTabNum], SpecialCategories[i].description)
tooltip.create(self.Export_ExtractArchives_[self.exportTabNum], 'If enabled, any roms from your input romset that are contained in zipped archives (ZIP, RAR, 7z) will be extracted during export.\n\nUseful if your output device does not support zipped roms.\n\nIf unsure, leave this disabled.')
tooltip.create(self.Export_ParentFolder_[self.exportTabNum], 'If enabled, each rom will be exported to a parent folder with the same name as its primary region release.\n\nFor example, \"Legend of Zelda, The (USA)\" and \"Zelda no Densetsu 1 - The Hyrule Fantasy (Japan)\" will both be exported to a folder titled \"Legend of Zelda, The\".\n\nIf \"Create Region Folders\" or \"Create Letter Folders\" is enabled, the game folder will be placed according to the game\'s highest-priority region.')
tooltip.create(self.Export_SortByPrimaryRegion_[self.exportTabNum], 'If enabled, each rom will be exported to a parent folder named after its highest-priority region.\n\nFor example, if your order of region priority is USA->Europe->Japan, then \"Golden Sun (USA, Europe)\" will be exported to a folder titled \"'+specialFolderPrefix+'USA'+specialFolderSuffix+'\".')
tooltip.create(self.Export_SpecialCategoryFolder_[self.exportTabNum], 'If enabled, all exported roms that are part of a special category (Unlicensed, Unreleased, etc.) will be exported to a parent folder named after that category. There will be multiple nested folders if a game belongs to multiple special categories.\n\nIf unsure, leave this enabled.')
tooltip.create(self.Export_LetterFolder_[self.exportTabNum], 'If enabled, each rom will be exported to a parent folder named after its first letter.\n\nFor example, \"Castlevania (USA)\" will be exported to a [C] folder.\n\nIf unsure, leave this disabled.')
tooltip.create(self.Export_PrimaryRegionInRoot_[self.exportTabNum], '(Only applies if \"Create Region Folders\" is enabled.)\n\nIf enabled, a region folder will NOT be created for your primary regions.\n\nFor example, if you have Europe set as a primary region, then Europe roms will not be exported to a [Europe] folder, and will instead be placed directly in the output folder.\n\nIf unsure, leave this enabled.')
tooltip.create(self.Export_OverwriteDuplicates_[self.exportTabNum], 'If enabled: If a rom in the output directory with the same name as an exported rom already exists, it will be overwritten by the new export.\n\nIf disabled: The export will not overwrite matching roms in the output directory.\n\nIf unsure, leave this disabled.')
self.Export_Systems.select(self.exportTabNum)
self.export_setOutputType()
self.export_togglePrimaryRegionInRoot()
self.exportTabNum += 1
def setSystemDAT(self, systemName, datFilePath):
self.datFilePathChoices.append(tk.StringVar(value=''))
if datFilePath != "":
self.datFilePathChoices[self.exportTabNum].set(datFilePath)
return
if self.ssdHelper(systemName):
return
alternateSystemNames = systemNamesDict.get(systemName)[1]
if alternateSystemNames is not None:
for name in alternateSystemNames:
if self.ssdHelper(name):
return
def ssdHelper(self, name):
datDir = self.g_datFilePath.get()
currSystemDAT = path.join(datDir, name+".dat").replace("\\", "/")
if path.isfile(currSystemDAT):
self.datFilePathChoices[self.exportTabNum].set(currSystemDAT)
return True
if path.isdir(datDir):
expectedName = currSystemDAT.lower()
parenthesesKeeper = r'\1' if "(" in name else ''
for df in listdir(datDir):
currSystemDAT = path.join(datDir, df).replace("\\", "/")
if re.sub(r'(\s*\([^)]*\)).*', parenthesesKeeper, currSystemDAT).lower()+".dat" == expectedName:
self.datFilePathChoices[self.exportTabNum].set(currSystemDAT)
return True
return False
def setInputRomsetDir(self, systemName, romsetFolderPath):
self.romsetFolderPathChoices.append(tk.StringVar(value=''))
if romsetFolderPath != "":
self.romsetFolderPathChoices[self.exportTabNum].set(romsetFolderPath)
return
if self.sirdHelper(systemName):
return
alternateSystemNames = systemNamesDict.get(systemName)[1]
if alternateSystemNames is not None:
for name in alternateSystemNames:
if self.sirdHelper(name):
return
def sirdHelper(self, name):
currSystemInputDir = path.join(self.g_romsetFolderPath.get(), name).replace("\\", "/")
if path.isdir(currSystemInputDir):
self.romsetFolderPathChoices[self.exportTabNum].set(currSystemInputDir)
return True
if " - " in name:
currSystemInputDir = path.join(self.g_romsetFolderPath.get(), name.replace(" - ", " ")).replace("\\", "/")
if path.isdir(currSystemInputDir):
self.romsetFolderPathChoices[self.exportTabNum].set(currSystemInputDir)
return True
return False
def export_saveSystemLoadout(self):
if self.exportTabNum > 0:
loadoutFile = asksaveasfilename(defaultextension='.txt', filetypes=[("Text Files", '*.txt')],
initialdir=path.join(progFolder, "System Loadouts"),
title="Save System Tabs")
if loadoutFile == "":
return
loadout = configparser.ConfigParser(allow_no_value=True)
loadout.optionxform = str
for i in range(len(self.exportSystemNames)):
loadout[self.exportSystemNames[i]] = {}
loadout[self.exportSystemNames[i]]["Input No-Intro DAT"] = self.datFilePathChoices[i].get()
loadout[self.exportSystemNames[i]]["Input Romset"] = self.romsetFolderPathChoices[i].get()
loadout[self.exportSystemNames[i]]["Output Directory"] = self.outputFolderDirectoryChoices[i].get()
loadout[self.exportSystemNames[i]]["Output Type"] = self.outputTypeChoices[i].get()
loadout[self.exportSystemNames[i]]["Include Games from Non-Primary Regions"] = str(self.includeOtherRegionsChoices[i].get())
loadout[self.exportSystemNames[i]]["Rom List"] = self.romListFileChoices[i].get()
for j in range(len(SpecialCategories)):
if (SpecialCategories[j].exclusiveSystems is None) or (self.exportSystemNames[i] in SpecialCategories[j].exclusiveSystems):
loadout[self.exportSystemNames[i]]["Include "+SpecialCategories[j].name] = str(self.includeSpecialChoices[j][i].get())
loadout[self.exportSystemNames[i]]["Extract Compressed Roms"] = str(self.extractArchivesChoices[i].get())
loadout[self.exportSystemNames[i]]["Create Game Folder for Each Game"] = str(self.parentFolderChoices[i].get())
loadout[self.exportSystemNames[i]]["Create Region Folders"] = str(self.sortByPrimaryRegionChoices[i].get())
loadout[self.exportSystemNames[i]]["Do Not Create Folder for Primary Region"] = str(self.primaryRegionInRootChoices[i].get())
loadout[self.exportSystemNames[i]]["Create Folders for Special Categories"] = str(self.specialCategoryFolderChoices[i].get())
loadout[self.exportSystemNames[i]]["Create Letter Folders"] = str(self.letterFolderChoices[i].get())
loadout[self.exportSystemNames[i]]["Overwrite Duplicate Files"] = str(self.overwriteDuplicatesChoices[i].get())
with open(loadoutFile, 'w') as lf:
loadout.write(lf)
def keyValIsTrue(self, k, v):
return k.get(v) == "True"
def export_loadSystemLoadout(self):
if self.exportTabNum > 0:
if not askyesno("EzRO", "This will replace your current system loadout. Continue?"):
return
loadoutFile = askopenfilename(filetypes=[("System Loadouts", "*.txt")])
if loadoutFile == "":
return
if self.exportTabNum > 0:
while self.exportTabNum > 0:
self.export_removeSystem()
loadout = configparser.ConfigParser(allow_no_value=True)
loadout.optionxform = str
loadout.read(loadoutFile)
for key in loadout.keys():
if key in systemNamesDict.keys():
curr_includeSpecial = [loadout[key].get("Include "+cat.name) == "1" for cat in SpecialCategories]
self.addSystemTab(systemName=key, datFilePath=loadout[key]["Input No-Intro DAT"], romsetFolderPath=loadout[key]["Input Romset"], outputFolderDirectory=loadout[key]["Output Directory"],
outputType=loadout[key]["Output Type"], includeOtherRegions=loadout[key]["Include Games from Non-Primary Regions"], romList=loadout[key]["Rom List"],
includeSpecial=curr_includeSpecial, extractArchives=loadout[key]["Extract Compressed Roms"], parentFolder=loadout[key]["Create Game Folder for Each Game"],
sortByPrimaryRegion=loadout[key]["Create Region Folders"], primaryRegionInRoot=loadout[key]["Do Not Create Folder for Primary Region"],
specialCategoryFolder=loadout[key]["Create Folders for Special Categories"], letterFolder=loadout[key]["Create Letter Folders"], overwriteDuplicates=loadout[key]["Overwrite Duplicate Files"])
def export_addSystem(self):
currSystemChoice = self.systemChoice.get()
if (currSystemChoice.replace("-","").replace("=","") != ""):
for es in self.Export_Systems.tabs():
if self.Export_Systems.tab(es, "text") == currSystemChoice:
return
self.addSystemTab(systemName=currSystemChoice, datFilePath="", romsetFolderPath="", outputFolderDirectory="",
outputType="All", includeOtherRegions=self.g_includeOtherRegions.get(), romList="",
includeSpecial=[self.g_includeSpecial[i].get() for i in range(len(self.g_includeSpecial))], extractArchives=False, parentFolder=self.g_parentFolder.get(),
sortByPrimaryRegion=self.g_sortByPrimaryRegion.get(), primaryRegionInRoot=self.g_primaryRegionInRoot.get(),
specialCategoryFolder=self.g_specialCategoryFolder.get(), letterFolder=self.g_letterFolder.get(), overwriteDuplicates=self.g_overwriteDuplicates.get())
def export_setOutputType(self, event=None):
currIndex = self.Export_Systems.index("current")
currOutputType = self.outputTypeChoices[currIndex].get()
if currOutputType == "1G1R":
self.Export_includeOtherRegions_[currIndex].grid(column='0', padx='20', pady='10', row='4', sticky='w')
else:
self.Export_includeOtherRegions_[currIndex].grid_remove()
if currOutputType == "Favorites":
self.Export_FromList_Label_[currIndex].grid(column='0', padx='20', pady='10', row='5', sticky='w')
self.Export_FromList_PathChooser_[currIndex].grid(column='0', padx='150', pady='10', row='5', sticky='w')
else:
self.Export_FromList_Label_[currIndex].grid_remove()
self.Export_FromList_PathChooser_[currIndex].grid_remove()
def export_togglePrimaryRegionInRoot(self):
currSystemIndex = self.Export_Systems.index("current")
if self.sortByPrimaryRegionChoices[currSystemIndex].get():
self.Export_PrimaryRegionInRoot_[currSystemIndex].configure(state='enabled')
else:
self.Export_PrimaryRegionInRoot_[currSystemIndex].configure(state='disabled')
def export_removeSystem(self):
currSystemIndex = self.Export_Systems.index("current")
self.Export_Systems.forget(self.Export_Systems.tabs()[currSystemIndex])
self.exportSystemNames.pop(currSystemIndex)
self.Export_ScrolledFrame_.pop(currSystemIndex)
self.Export_DAT_Label_.pop(currSystemIndex)
self.Export_DAT_PathChooser_.pop(currSystemIndex)
self.datFilePathChoices.pop(currSystemIndex)
self.Export_Romset_Label_.pop(currSystemIndex)
self.Export_Romset_PathChooser_.pop(currSystemIndex)
self.romsetFolderPathChoices.pop(currSystemIndex)
self.Export_OutputDir_Label_.pop(currSystemIndex)
self.Export_OutputDir_PathChooser_.pop(currSystemIndex)
self.outputFolderDirectoryChoices.pop(currSystemIndex)
self.Export_Separator_.pop(currSystemIndex)
self.Export_OutputType_Label_.pop(currSystemIndex)
self.Export_OutputType_Combobox_.pop(currSystemIndex)
self.outputTypeChoices.pop(currSystemIndex)
self.Export_includeOtherRegions_.pop(currSystemIndex)
self.includeOtherRegionsChoices.pop(currSystemIndex)
self.Export_FromList_Label_.pop(currSystemIndex)
self.Export_FromList_PathChooser_.pop(currSystemIndex)
self.romListFileChoices.pop(currSystemIndex)
self.Export_IncludeFrame_.pop(currSystemIndex)
for i in range(len(SpecialCategories)):
self.Export_IncludeSpecial_[i].pop(currSystemIndex)
self.includeSpecialChoices[i].pop(currSystemIndex)
self.Export_ExtractArchives_.pop(currSystemIndex)
self.extractArchivesChoices.pop(currSystemIndex)
self.Export_ParentFolder_.pop(currSystemIndex)
self.parentFolderChoices.pop(currSystemIndex)
self.Export_SortByPrimaryRegion_.pop(currSystemIndex)
self.sortByPrimaryRegionChoices.pop(currSystemIndex)
self.Export_PrimaryRegionInRoot_.pop(currSystemIndex)
self.primaryRegionInRootChoices.pop(currSystemIndex)
self.Export_SpecialCategoryFolder_.pop(currSystemIndex)
self.Export_LetterFolder_.pop(currSystemIndex)
self.specialCategoryFolderChoices.pop(currSystemIndex)
self.letterFolderChoices.pop(currSystemIndex)
self.Export_OverwriteDuplicates_.pop(currSystemIndex)
self.overwriteDuplicatesChoices.pop(currSystemIndex)
self.Export_RemoveSystem_.pop(currSystemIndex)
self.exportTabNum -= 1
if currSystemIndex < self.exportTabNum:
self.Export_Systems.select(currSystemIndex)
elif currSystemIndex > 0:
self.Export_Systems.select(currSystemIndex - 1)
def export_auditSystem(self):
if self.exportTabNum > 0:
currSystemIndex = [self.Export_Systems.index("current")]
if self.auditCheck(currSystemIndex):
self.openAuditWindow(numSystems=1, systemIndexList=currSystemIndex)
def export_auditAllSystems(self):
if self.exportTabNum > 0:
allSystemIndices = list(range(self.exportTabNum))
if self.auditCheck(allSystemIndices):
self.openAuditWindow(numSystems=len(allSystemIndices), systemIndexList=allSystemIndices)
def auditCheck(self, systemIndices):
failureMessage = ""
for ind in systemIndices:
currSystemName = self.exportSystemNames[ind]
currSystemDAT = self.datFilePathChoices[ind].get()
currSystemFolder = self.romsetFolderPathChoices[ind].get()
if currSystemDAT == "":
failureMessage += currSystemName+":\nMissing DAT file.\n\n"
elif not path.isfile(currSystemDAT):
failureMessage += currSystemName+":\nInvalid DAT file (file not found).\n\n"
else:
tree = ET.parse(currSystemDAT)
treeRoot = tree.getroot()
systemNameFromDAT = treeRoot.find("header").find("name").text
if systemNameFromDAT is None or systemNameFromDAT == "":
failureMessage += currSystemName+":\nInvalid DAT file (Parent-Clone DAT is required).\n\n"
if systemNameFromDAT != currSystemName+" (Parent-Clone)":
if systemNameFromDAT.startswith(currSystemName) and "(Parent-Clone)" in systemNameFromDAT: # the found DAT is *probably* correct (e.g N64 has "(BigEndian)" in the name, so this is needed)
pass
else:
failureMessage += currSystemName+":\nDAT header mismatched; this is likely the incorrect DAT file.\nExpected: \""+currSystemName+" (Parent-Clone)\" (or something similar)\nGot: \""+systemNameFromDAT+"\".\n\n"
if currSystemFolder == "":
failureMessage += currSystemName+":\nMissing input romset.\n\n"
elif not path.isdir(currSystemFolder):
failureMessage += currSystemName+":\nInvalid input romset (directory not found).\n\n"
if failureMessage == "":
return True
showerror("Invalid Parameters", "Please fix the following issues before attempting an audit:\n\n"+failureMessage.strip())
return False
def openAuditWindow(self, numSystems, systemIndexList):
self.systemIndexList = systemIndexList
self.auditInProgress = False
self.Audit_Window = Toplevel()
self.Audit_Window.title("EzRO Audit")
self.Audit_Frame = ttk.Frame(self.Audit_Window)
self.Audit_MainProgress_Label = ttk.Label(self.Audit_Frame)
if numSystems == 1:
self.Audit_MainProgress_Label.configure(text='Preparing to audit system: '+self.exportSystemNames[systemIndexList[0]])
else:
self.Audit_MainProgress_Label.configure(text='Preparing to audit '+str(numSystems)+' systems')
self.Audit_MainProgress_Label.place(anchor='center', relx='.5', rely='.05', x='0', y='0')
self.Audit_MainProgress_Bar = ttk.Progressbar(self.Audit_Frame)
self.Audit_MainProgress_Bar.configure(maximum=numSystems, orient='horizontal')
self.Audit_MainProgress_Bar.place(anchor='center', relwidth='.9', relx='.5', rely='.11', x='0', y='0')
self.Audit_SubProgress_Bar = ttk.Progressbar(self.Audit_Frame)
self.Audit_SubProgress_Bar.configure(maximum='100', orient='horizontal')
self.Audit_SubProgress_Bar.place(anchor='center', relwidth='.9', relx='.5', rely='.17', x='0', y='0')
self.SubProgress_TextField = tk.Text(self.Audit_Frame)
self.SubProgress_TextField.configure(autoseparators='true', blockcursor='false', height='10', insertontime='0')
self.SubProgress_TextField.configure(insertwidth='0', state='disabled', tabstyle='tabular', takefocus=False)
self.SubProgress_TextField.configure(width='50', wrap='word')
self.SubProgress_TextField.place(anchor='n', relheight='.62', relwidth='.9', relx='.5', rely='.23', x='0', y='0')
self.Audit_StartButton = ttk.Button(self.Audit_Frame)
self.audit_startButtonText = tk.StringVar(value='Start Audit')
self.Audit_StartButton.configure(text='Start Audit', textvariable=self.audit_startButtonText)
self.Audit_StartButton.place(anchor='center', relx='.4', rely='.925', x='0', y='0')
self.Audit_StartButton.configure(command=self.audit_startAudit)
self.Audit_CancelButton = ttk.Button(self.Audit_Frame)
self.audit_cancelButtonText = tk.StringVar(value='Cancel')
self.Audit_CancelButton.configure(text='Cancel', textvariable=self.audit_cancelButtonText)
self.Audit_CancelButton.place(anchor='center', relx='.6', rely='.925', x='0', y='0')
self.Audit_CancelButton.configure(command=self.audit_cancelAudit)
self.Audit_Frame.configure(height='200', width='200')
self.Audit_Frame.place(anchor='nw', relheight='1', relwidth='1', relx='0', rely='0', x='0', y='0')
self.Audit_Window.configure(height=int(600*screenHeightMult), width=int(800*screenHeightMult))
self.Audit_Window.grab_set()
self.Audit_Window.protocol("WM_DELETE_WINDOW", self.audit_cancelAudit)
def audit_startAudit(self):
self.Audit_StartButton.configure(state='disabled')
self.updateAndAuditVerifiedRomsets(self.systemIndexList)
def audit_cancelAudit(self):
if self.auditInProgress:
if askyesno("EzRO Audit", "Cancel the audit?"):
# self.auditInProgress = False
# self.Audit_Window.destroy()
self.cancelledAudit = True
else:
self.Audit_Window.destroy()
# self.cancelledAudit = True
def export_exportSystem(self):
if self.exportTabNum > 0:
currSystemIndex = [self.Export_Systems.index("current")]
if self.exportCheck(currSystemIndex):
self.openExportWindow(numSystems=1, systemIndexList=currSystemIndex)
def export_exportAllSystems(self):
if self.exportTabNum > 0:
allSystemIndices = list(range(self.exportTabNum))
if self.exportCheck(allSystemIndices):
self.openExportWindow(numSystems=len(allSystemIndices), systemIndexList=allSystemIndices)
def exportCheck(self, systemIndices):
failureMessage = ""
warningMessage = ""
for ind in systemIndices:
currSystemName = self.exportSystemNames[ind]
currSystemDAT = self.datFilePathChoices[ind].get()
if currSystemDAT == "":
failureMessage += currSystemName+":\nMissing DAT file.\n"
elif not path.isfile(currSystemDAT):
failureMessage += currSystemName+":\nInvalid DAT file (file not found).\n"
else:
try:
tree = ET.parse(currSystemDAT)
treeRoot = tree.getroot()
systemNameFromDAT = treeRoot.find("header").find("name").text
if systemNameFromDAT is None or systemNameFromDAT == "":
failureMessage += currSystemName+":\nInvalid DAT file (Parent-Clone DAT is required).\n\n"
if systemNameFromDAT != currSystemName+" (Parent-Clone)":
if systemNameFromDAT.startswith(currSystemName) and "(Parent-Clone)" in systemNameFromDAT: # the found DAT is *probably* correct (e.g N64 has "(BigEndian)" in the name, so this is needed)
pass
else:
failureMessage += currSystemName+":\nDAT header mismatched; this is likely the incorrect DAT file.\nExpected: \""+currSystemName+" (Parent-Clone)\" (or something similar)\nGot: \""+systemNameFromDAT+"\".\n\n"
except:
failureMessage += currSystemName+":\nInvalid DAT file (Parent-Clone DAT is required).\n\n"
currSystemFolder = self.romsetFolderPathChoices[ind].get()
if currSystemFolder == "":
failureMessage += currSystemName+":\nMissing input romset.\n\n"
elif not path.isdir(currSystemFolder):
failureMessage += currSystemName+":\nInvalid input romset (directory not found).\n\n"
currOutputFolder = self.outputFolderDirectoryChoices[ind].get()
if currOutputFolder == "":
failureMessage += currSystemName+":\nMissing output directory.\n\n"
elif not path.isdir(currOutputFolder):
failureMessage += currSystemName+":\nInvalid output directory (directory not found).\n\n"
if (not (currSystemFolder == "" or currOutputFolder == "")) and (currSystemFolder == currOutputFolder):
failureMessage += currSystemName+":\nInput and output directories are the same.\n\n"
currOutputType = self.outputTypeChoices[ind].get()
if currOutputType == "Favorites":
currFavoritesList = self.romListFileChoices[ind].get()
if currFavoritesList == "":
failureMessage += currSystemName+":\nMissing Favorites rom list.\n\n"
elif not path.isfile(currFavoritesList):
failureMessage += currSystemName+":\nInvalid Favorites rom list (file not found).\n\n"
for i in range(len(self.outputFolderDirectoryChoices)):
currOutputDir = self.outputFolderDirectoryChoices[i]
for j in range(i+1, len(self.outputFolderDirectoryChoices)):
otherOutputDir = self.outputFolderDirectoryChoices[j]
if currOutputDir == otherOutputDir:
warningMessage += self.exportSystemNames[i]+" and "+self.exportSystemNames[j]+":\nThese two systems have the same output directory.\n\nYou may want to create a different directory for each system so their games don't get mixed up.\n\n"
break
if warningMessage != "":
break
if warningMessage != "":
showinfo("Warning", warningMessage.strip())
if failureMessage == "":
return True
showerror("Invalid Parameters", "Please fix the following issues before attempting an export:\n\n"+failureMessage.strip())
return False
def openExportWindow(self, numSystems, systemIndexList):
self.systemIndexList = systemIndexList
self.exportInProgress = False
self.Export_Window = Toplevel()
if self.isExport:
self.Export_Window.title("EzRO Export")
else:
self.Export_Window.title("EzRO Test Export")
self.Export_Frame = ttk.Frame(self.Export_Window)
self.Export_MainProgress_Label = ttk.Label(self.Export_Frame)
if numSystems == 1:
if self.isExport:
self.Export_MainProgress_Label.configure(text='Preparing to export system: '+self.exportSystemNames[systemIndexList[0]])
else:
self.Export_MainProgress_Label.configure(text='Preparing to test export of system: '+self.exportSystemNames[systemIndexList[0]])
else:
if self.isExport:
self.Export_MainProgress_Label.configure(text='Preparing to export '+str(numSystems)+' systems')
else:
self.Export_MainProgress_Label.configure(text='Preparing to test export of '+str(numSystems)+' systems')
self.Export_MainProgress_Label.place(anchor='center', relx='.5', rely='.05', x='0', y='0')
self.Export_MainProgress_Bar = ttk.Progressbar(self.Export_Frame)
self.Export_MainProgress_Bar.configure(maximum=numSystems, orient='horizontal')
self.Export_MainProgress_Bar.place(anchor='center', relwidth='.9', relx='.5', rely='.11', x='0', y='0')
self.Export_SubProgress_Bar = ttk.Progressbar(self.Export_Frame)
self.Export_SubProgress_Bar.configure(maximum='100', orient='horizontal')
self.Export_SubProgress_Bar.place(anchor='center', relwidth='.9', relx='.5', rely='.17', x='0', y='0')
self.SubProgress_TextField = tk.Text(self.Export_Frame)
self.SubProgress_TextField.configure(autoseparators='true', blockcursor='false', height='10', insertontime='0')
self.SubProgress_TextField.configure(insertwidth='0', state='disabled', tabstyle='tabular', takefocus=False)
self.SubProgress_TextField.configure(width='50', wrap='word')
self.SubProgress_TextField.place(anchor='n', relheight='.62', relwidth='.9', relx='.5', rely='.23', x='0', y='0')
self.Export_StartButton = ttk.Button(self.Export_Frame)
self.export_startButtonText = tk.StringVar(value='Start Export')
self.Export_StartButton.configure(text='Start Export', textvariable=self.export_startButtonText)
self.Export_StartButton.place(anchor='center', relx='.4', rely='.925', x='0', y='0')
self.Export_StartButton.configure(command=self.export_startExport)
self.Export_CancelButton = ttk.Button(self.Export_Frame)
self.export_cancelButtonText = tk.StringVar(value='Cancel')
self.Export_CancelButton.configure(text='Cancel', textvariable=self.export_cancelButtonText)
self.Export_CancelButton.place(anchor='center', relx='.6', rely='.925', x='0', y='0')
self.Export_CancelButton.configure(command=self.export_cancelExport)
self.Export_Frame.configure(height='200', width='200')
self.Export_Frame.place(anchor='nw', relheight='1', relwidth='1', relx='0', rely='0', x='0', y='0')
self.Export_Window.configure(height=int(600*screenHeightMult), width=int(800*screenHeightMult))
self.Export_Window.grab_set()
self.Export_Window.protocol("WM_DELETE_WINDOW", self.export_cancelExport)
def export_startExport(self):
self.Export_StartButton.configure(state='disabled')
self.mainExport(self.systemIndexList)
def export_cancelExport(self):
# Cancelling an export early causes an error in tkinter (writing to a progressbar/text field/etc. that no longer exists) but it doesn't actually affect anything
if self.exportInProgress:
if askyesno("EzRO Export", "Cancel the export?"):
# self.exportInProgress = False
# self.Export_Window.destroy()
self.cancelledExport = True
else:
self.Export_Window.destroy()
# self.cancelledExport = True
def export_toggleTestExport(self):
self.isExport = not self.isTestExport.get()
def export_auditHelp(self):
showinfo("Audit Help",
"\"Auditing\" a system directory updates the file names of misnamed roms (and the ZIP files containing them, if applicable) to match the rom's entry in the system's No-Intro DAT. This is determined by the rom's matching checksum in the DAT, so the original name doesn't matter."
+"\n\nThis also creates a log file indicating which roms exist in the romset, which roms are missing, and which roms are in the set that don't match anything from the DAT."
+"\n\nIt is highly recommended that you audit a system directory whenever you update that system's No-Intro DAT.")
def writeTextToSubProgress(self, text):
self.SubProgress_TextField.configure(state='normal')
self.SubProgress_TextField.insert(tk.END, text)
self.SubProgress_TextField.configure(state='disabled')
#################
# AUDIT (Logic) #
#################
def updateAndAuditVerifiedRomsets(self, systemIndices):
global allGameNamesInDAT, romsWithoutCRCMatch, progressBar
self.auditInProgress = True
self.cancelledAudit = False
self.Audit_MainProgress_Label.configure(text='Auditing...')
self.Audit_MainProgress_Bar['value'] = 0