Skip to content

Commit

Permalink
Merge pull request #1 from EricGoldsteinNz/TadpoleGUI
Browse files Browse the repository at this point in the history
Add Tadpole GUI
  • Loading branch information
EricGoldsteinNz authored Jun 24, 2023
2 parents 8689265 + 99b2b27 commit f6286e9
Showing 3 changed files with 81 additions and 14 deletions.
14 changes: 6 additions & 8 deletions build.bat
Original file line number Diff line number Diff line change
@@ -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 ../
8 changes: 2 additions & 6 deletions frogtool.py
Original file line number Diff line number Diff line change
@@ -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
73 changes: 73 additions & 0 deletions tadpole.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit f6286e9

Please sign in to comment.