Skip to content

Commit

Permalink
Load character list based on terminal command. v1.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
NikhilNarayana committed Dec 26, 2018
1 parent ddb1a80 commit 9be713c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
34 changes: 20 additions & 14 deletions meleeuploader/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand All @@ -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)

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -547,5 +547,11 @@ def main():
sys.exit(1)


def ult():
global melee
melee = False
main()


if __name__ == "__main__":
main()
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"],
Expand Down

0 comments on commit 9be713c

Please sign in to comment.