add status bar
Marco Andronaco andronacomarco@gmail.com
Wed, 06 Jul 2022 13:39:29 +0200
4 files changed,
40 insertions(+),
40 deletions(-)
M
Constants.py
→
Constants.py
@@ -5,7 +5,7 @@
PATCH_VERSION = '1.1.1' FINAL_ROM_NAME = f'Mother 1+2 [T+Ita{PATCH_VERSION}].gba' -STATUS_START = "Benvenuto al patcher per Mother 1+2." +STATUS_START = "Patcher pronto all'uso." STATUS_PRESET = "Preset applicato." STATUS_MD5 = "MD5 verificato." STATUS_COPIED = "File copiati."
M
Functions.py
→
Functions.py
@@ -37,7 +37,7 @@ showinfo(title=Constants.SUCCESS_TITLE, message=message)
def set_progress(app, percent, message): app.progress.set(percent) - app.progress_text.set(message) + app.status_text.set(message) def start_patching(app): set_progress(app, 20, Constants.STATUS_MD5)@@ -94,4 +94,3 @@ os.remove(item)
set_progress(app, 100, Constants.STATUS_CLEANED) show_success(Constants.SUCCESS_CONTENT) -
M
patcher.py
→
patcher.py
@@ -9,7 +9,7 @@ PROJECT_PATH = Path(__file__).parent
PROJECT_UI = PROJECT_PATH / "patcher.ui" class PatcherApp: - def __init__(self, master=None, baserom=None): + def __init__(self, master=None): self.builder = builder = Builder() builder.add_resource_path(PROJECT_PATH) builder.add_from_file(PROJECT_UI)@@ -24,7 +24,7 @@ self.sprites = None
self.palette = None self.skip_m1 = None self.progress = None - self.progress_text = None + self.status_text = None builder.import_variables( self, [@@ -36,14 +36,19 @@ "sprites",
"palette", "skip_m1", "progress", - "progress_text", + "status_text", ], ) apply_preset(self, next(iter(Constants.PRESETS.items()))[1]) - self.progress_text.set(Constants.STATUS_START) + self.status_text.set(Constants.STATUS_START) self.apply_button = builder.get_object("apply_button") + baserom = None + for file in os.listdir('.'): + if file.lower().endswith('.gba'): + filename = os.path.join('.', file) + baserom = filename if check_rom(filename) else baserom if baserom is not None: self.browse_path.set(baserom)@@ -78,17 +83,11 @@ def main():
if not os.path.isdir(Constants.PATH_TOOLS): show_warning(Constants.WARNING_EXTRACT) return - - baserom = None - for file in os.listdir('.'): - if file.lower().endswith('.gba'): - filename = os.path.join('.', file) - baserom = filename if check_rom(filename) else baserom root = tkinter.Tk() root.title(Constants.VAR_WINDOW_TITLE) - app = PatcherApp(root, baserom) + app = PatcherApp(root) app.run() if __name__ == "__main__": - main()+ main()
M
patcher.ui
→
patcher.ui
@@ -279,47 +279,49 @@ </child>
</object> </child> <child> - <object class="ttk.Button" id="apply_button"> - <property name="command" type="command" cbtype="simple">on_apply_button</property> - <property name="text" translatable="yes">Applica!</property> - <layout manager="grid"> - <property name="column">1</property> - <property name="ipadx">2</property> - <property name="ipady">2</property> - <property name="padx">5</property> - <property name="pady">5</property> - <property name="row">4</property> - <property name="sticky">ew</property> - </layout> - </object> - </child> - <child> - <object class="ttk.Frame" id="frame1"> + <object class="ttk.Frame" id="apply_frame"> <property name="height">200</property> <property name="width">200</property> <layout manager="grid"> <property name="column">0</property> - <property name="row">4</property> + <property name="columnspan">2</property> + <property name="padx">5</property> + <property name="pady">4</property> + <property name="row">5</property> + <property name="sticky">ew</property> </layout> <child> - <object class="ttk.Progressbar" id="progress_bar"> - <property name="length">215</property> - <property name="orient">horizontal</property> - <property name="variable">int:progress</property> + <object class="ttk.Button" id="apply_button"> + <property name="command" type="command" cbtype="simple">on_apply_button</property> + <property name="text" translatable="yes">Applica!</property> <layout manager="pack"> - <property name="side">top</property> + <property name="fill">x</property> + <property name="pady">2</property> </layout> </object> </child> <child> - <object class="ttk.Label" id="progress_label"> - <property name="text" translatable="yes">BenvenutÉ™ al patcher per Mother 1+2.</property> - <property name="textvariable">string:progress_text</property> + <object class="ttk.Progressbar" id="progress_bar"> + <property name="length">215</property> + <property name="orient">horizontal</property> + <property name="variable">int:progress</property> <layout manager="pack"> + <property name="fill">x</property> <property name="side">top</property> </layout> </object> </child> + </object> + </child> + <child> + <object class="ttk.Label" id="status_label"> + <property name="relief">sunken</property> + <property name="text" translatable="yes">Benvenuto al patcher per Mother 1+2.</property> + <property name="textvariable">string:status_text</property> + <layout manager="grid"> + <property name="columnspan">2</property> + <property name="sticky">ew</property> + </layout> </object> </child> </object>