From 9be713c04caba90ce21caf6072f8c4cf0af50f25 Mon Sep 17 00:00:00 2001 From: Nikhil Narayana Date: Wed, 26 Dec 2018 15:36:28 -0800 Subject: [PATCH] Load character list based on terminal command. v1.5.2 --- meleeuploader/main.py | 34 ++++++++++++++++++++-------------- setup.py | 4 ++-- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/meleeuploader/main.py b/meleeuploader/main.py index a53a61b..cbfe444 100755 --- a/meleeuploader/main.py +++ b/meleeuploader/main.py @@ -26,6 +26,8 @@ from pyforms_lite.controls import ControlCombo, ControlProgress from pyforms_lite.controls import ControlButton, ControlCheckBox, ControlCheckBoxList +melee = True + class EmittingStream(QtCore.QObject): @@ -41,7 +43,11 @@ def flush(self): class MeleeUploader(BaseWidget): def __init__(self): - super(MeleeUploader, self).__init__("Melee YouTube Uploader") + global melee + if melee: + super(MeleeUploader, self).__init__("Melee YouTube Uploader") + else: + super(MeleeUploader, self).__init__("Smash YouTube Uploader") # Redirct print output sys.stdout = EmittingStream(textWritten=self.writePrint) @@ -104,7 +110,7 @@ def __init__(self): 'Clear': [{'Clear Match Values': self.__reset_match}, {'Clear Event Values': self.__reset_event}, {'Clear All': self.__reset_forms}], 'Queue': [{'Toggle Uploads': self.__toggle_worker}, {'Save Queue': self.__save_queue}, {'Load Queue': self.__load_queue}], 'History': [{'Show History': self.__show_h_view}], - 'Characters': [{'Melee': self.__melee_chars}, {'Ultimate/Smash4': self.__ultimate_chars}]}] + 'Characters': [{'Melee': self.__melee_chars}, {'Ultimate': self.__ultimate_chars}]}] # Add ControlCombo values self._mtype += "Pools" @@ -191,6 +197,12 @@ def __init__(self): self._description ] + # Set character list + if melee: + self.__melee_chars() + else: + self.__ultimate_chars() + # Get latest values from form_values.txt self.__load_form() @@ -475,12 +487,6 @@ def __load_form(self, history=[]): if history: for val, var in zip(history, self._form_fields): if isinstance(val, (list, dict)): - if updateChars and any(char not in self._melee_chars for char in val): - self.__ultimate_chars() - updateChars = False - elif updateChars: - self.__melee_chars() - updateChars = False var.load_form(dict(selected=val)) elif val: var.value = val @@ -490,12 +496,6 @@ def __load_form(self, history=[]): values = json.loads(f.read()) for val, var in zip(values, self._form_fields): if isinstance(val, (list, dict)): - if updateChars and any(char not in self._melee_chars for char in val): - self.__ultimate_chars() - updateChars = False - elif updateChars: - self.__melee_chars() - updateChars = False var.load_form(dict(selected=val)) elif val: var.value = val @@ -547,5 +547,11 @@ def main(): sys.exit(1) +def ult(): + global melee + melee = False + main() + + if __name__ == "__main__": main() diff --git a/setup.py b/setup.py index 14b2666..e470efe 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from os import path here = path.abspath(path.dirname(__file__)) -version = '1.5.1' +version = '1.5.2' long_des = "" with open(path.join(here, 'README.md')) as f: @@ -27,7 +27,7 @@ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Natural Language :: English", ], - entry_points=dict(console_scripts=['meleeuploader = meleeuploader.main:main', 'smashuploader = meleeuploader.main:main']), + entry_points=dict(console_scripts=['meleeuploader = meleeuploader.main:main', 'smashuploader = meleeuploader.main:ult']), python_requires='~=3.5', version=version, packages=["meleeuploader"],