diff --git a/build.bat b/build.bat index 2d79452..a17ab13 100644 --- a/build.bat +++ b/build.bat @@ -1,6 +1,6 @@ @echo off -set ver=0.2.1 -rem build script for the distributable versions of frogtool +set ver=0.1.1 +rem build script for the distributable versions of tadpole if not exist "venv\" ( py -m venv venv ) @@ -10,13 +10,11 @@ if not exist "venv\Lib\site-packages\PyInstaller" ( if not exist "venv\Lib\site-packages\PIL" ( venv\Scripts\python -m pip install Pillow ) -venv\Scripts\python -m PyInstaller frogtool.py -F --version-file versioninfo --icon frog.ico +venv\Scripts\python -m PyInstaller --onefile tadpole.py --icon frog.ico copy README.md "dist\readme.md" -rem extremely dirty markdown to txt conversion by stripping out a few non-obvious characters -py -c "open('dist/readme.txt','w').write(open('dist/readme.md','r').read().replace('`','').replace('### ',''))" copy LICENSE "dist\license.txt" -copy frogtool.py "dist\frogtool.py" +copy tadpole.py "dist\tadpole.py" cd dist -tar -a -cf frogtool-%ver%-win.zip frogtool.exe readme.txt license.txt -tar -a -cf frogtool-%ver%-py.zip frogtool.py readme.txt license.txt +tar -a -cf tadpole-%ver%-win.zip tadpole.exe readme.txt license.txt +tar -a -cf tadpole-%ver%-py.zip tadpole.py readme.txt license.txt cd ../ diff --git a/frogtool.py b/frogtool.py index c52545d..7802022 100644 --- a/frogtool.py +++ b/frogtool.py @@ -120,7 +120,7 @@ def process_sys(drive, system, test_mode): conf = input() if conf.upper() != "Y": print("Cancelling, game list not modified") - return + return "Cancelling, game list not modified" else: print(f"Found {no_files} ROMs") @@ -140,6 +140,7 @@ def process_sys(drive, system, test_mode): write_index_file(name_map_pinyin, sort_normal, index_path_pinyin, test_mode) print("Done\n") + return f"Finished updating {system} with {no_files} ROMs" def find_matching_file_diff_ext(target, files): @@ -384,8 +385,3 @@ def run(): print("Press enter to exit") input() - -try: - run() -except KeyboardInterrupt: - pass diff --git a/tadpole.py b/tadpole.py new file mode 100644 index 0000000..d6d941a --- /dev/null +++ b/tadpole.py @@ -0,0 +1,73 @@ +from PyQt5.QtWidgets import (QApplication, QMainWindow, QWidget, QMessageBox, QGridLayout, QLabel, QComboBox, QPushButton) +from PyQt5.QtGui import (QIcon) +import frogtool +import os +import sys +import string + +def RunFrogTool(): + drive = window.combobox_drive.currentText() + console = window.combobox_console.currentText() + + print(f"Running Frogtool with drive ({drive}) and console ({console})") + result = frogtool.process_sys(drive,console, False) + QMessageBox.about(window,"Result",result) + +#SubClass QMainWindow to create a Tadpole general interface +class MainWindow (QMainWindow): + def __init__(self): + super().__init__() + self.setWindowTitle("Tadpole - SF2000 Tool") + widget = QWidget() + self.setCentralWidget(widget) + layout = QGridLayout(widget) + rowCounter = 0 + + #Drive Select Widgets + self.lbl_drive = QLabel(text="Drive:") + self.combobox_drive = QComboBox() + layout.addWidget(self.lbl_drive, rowCounter, 0) + layout.addWidget(self.combobox_drive, rowCounter, 1) + rowCounter += 1 + + #Console Select Widgets + self.lbl_console = QLabel(text="Console:") + self.combobox_console = QComboBox() + layout.addWidget(self.lbl_console, rowCounter, 0) + layout.addWidget(self.combobox_console, rowCounter, 1) + rowCounter += 1 + + #Update Widget + self.button = QPushButton("Update!") + layout.addWidget(self.button, rowCounter, 0) + + + +#Initialise the Application +app = QApplication(sys.argv) + +# Build the Window +window = MainWindow() + +#Update list of drives +available_drives_placeholder = "???" +window.combobox_drive.addItem(QIcon(),available_drives_placeholder,available_drives_placeholder) +available_drives = ['%s:' % d for d in string.ascii_uppercase if os.path.exists('%s:' % d)] +window.combobox_drive.clear() +for drive in available_drives: + window.combobox_drive.addItem(QIcon(),drive,drive) + + +#Update list of consoles +available_consoles_placeholder = "???" +window.combobox_console.addItem(QIcon(),available_consoles_placeholder,available_consoles_placeholder) +window.combobox_console.clear() +for console in frogtool.systems.keys(): + window.combobox_console.addItem(QIcon(),console,console) + + +window.button.clicked.connect(RunFrogTool) + + +window.show() +app.exec() \ No newline at end of file