Skip to content

Instantly share code, notes, and snippets.

@gutierri
Created June 4, 2025 19:18
Show Gist options
  • Select an option

  • Save gutierri/1831c268d58a070ea7ae3cdf285928e0 to your computer and use it in GitHub Desktop.

Select an option

Save gutierri/1831c268d58a070ea7ae3cdf285928e0 to your computer and use it in GitHub Desktop.
GUI for iso2god-rs cmd program
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ISO2GOD-rs-gui - GUI for iso2god-rs cmd program
# Copyright (C) 2025 Gutierri Barboza <git@gutierri.me>
#
# ISO2GOD-rs-gui is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ISO2GOD-rs-gui is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see https://www.gnu.org/licenses/.
import threading
import subprocess
import tkinter as tk
from pathlib import Path
from tkinter import filedialog, messagebox, ttk
class IsoToGodApp:
def __init__(self, root):
self.root = root
self.root.title("ISO to GOD Utility")
self.style = ttk.Style()
self.create_widgets()
def create_widgets(self):
ttk.Label(self.root, text="ISO Location:").grid(
row=0, column=0, padx=10, pady=10, sticky="e"
)
self.iso_entry = ttk.Entry(self.root, width=50)
self.iso_entry.grid(row=0, column=1, padx=10, pady=10)
ttk.Button(self.root, text="Browse", command=self.browse_iso).grid(
row=0, column=2, padx=5, pady=10
)
ttk.Label(self.root, text="GOD Dest Dir:").grid(
row=1, column=0, padx=10, pady=10, sticky="e"
)
self.god_entry = ttk.Entry(self.root, width=50)
self.god_entry.grid(row=1, column=1, padx=10, pady=10)
ttk.Button(
self.root, text="Browse", command=self.browse_dest_dir
).grid(row=1, column=2, padx=5, pady=10)
self.progress = ttk.Progressbar(self.root, mode="indeterminate")
self.progress.grid(row=2, column=1, padx=10, pady=10)
self.progress.grid_remove() # Oculta inicialmente
self.submit_button = ttk.Button(
self.root, text="Submit", command=self.submit
)
self.submit_button.grid(row=3, column=1, pady=20)
def browse_iso(self):
filepath = filedialog.askopenfilename(
initialdir=Path.home(),
filetypes=[("ISO files", "*.iso")]
)
if filepath:
self.iso_entry.delete(0, tk.END)
self.iso_entry.insert(0, filepath)
def browse_dest_dir(self):
folderpath = filedialog.askdirectory(initialdir=Path.home())
if folderpath:
self.god_entry.delete(0, tk.END)
self.god_entry.insert(0, folderpath)
def set_ui_state(self, active):
state = 'normal' if active else 'disabled'
self.iso_entry.configure(state=state)
self.god_entry.configure(state=state)
self.submit_button.configure(state=state)
if active:
self.progress.stop()
self.progress.grid_remove()
else:
self.progress.grid()
self.progress.start()
def submit(self):
iso_path = self.iso_entry.get()
dest_dir = self.god_entry.get()
if not iso_path or not dest_dir:
messagebox.showwarning(
"Required fields",
"Fill in all fields"
)
return
self.set_ui_state(False)
thread = threading.Thread(
target=self.run_command,
args=(iso_path, dest_dir)
)
thread.start()
def run_command(self, iso_path, dest_dir):
try:
subprocess.run(
f'iso2god-rs "{iso_path}" "{dest_dir}"',
shell=True,
check=True
)
self.root.after(
0,
lambda: messagebox.showinfo(
"Success",
"Conversion completed successfully "
)
)
except subprocess.CalledProcessError:
self.root.after(
0,
lambda: messagebox.showerror(
"Error",
"An unexpected error has occurred:\n"
)
)
finally:
self.root.after(0, lambda: self.set_ui_state(True))
if __name__ == "__main__":
IsoToGodApp(tk.Tk()).root.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment