From d6c4b6b0d08232d931ce2d3fc2e9d5f8ea2a0bca Mon Sep 17 00:00:00 2001 From: Simon Ebner Date: Tue, 10 Mar 2020 11:21:01 +0100 Subject: [PATCH] cleanup --- src/convert/convert.py | 7 +------ src/launcher.py | 7 ++++++- src/launcher_model.py | 4 ++-- src/protect.py | 5 +++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/convert/convert.py b/src/convert/convert.py index c34edb2..307dd97 100755 --- a/src/convert/convert.py +++ b/src/convert/convert.py @@ -10,11 +10,6 @@ import codecs import argparse import pyparsing import traceback -try: - raw_input -except NameError: - raw_input = input - class LauncherBaseModel(object): """Base class to parse launcher config and level files. @@ -382,7 +377,7 @@ class LauncherMenuModel(LauncherBaseModel): user_input = '' while True: - user_input = raw_input('Overwrite? [y/N]:') + user_input = input('Overwrite? [y/N]:') if user_input == 'y' or user_input == 'Y': break elif (user_input == 'n' or diff --git a/src/launcher.py b/src/launcher.py index ea9fc48..a784fb0 100755 --- a/src/launcher.py +++ b/src/launcher.py @@ -24,17 +24,20 @@ from .launcher_model import * import signal signal.signal(signal.SIGINT, signal.SIG_DFL) + def stringContains(string, substring, caseSensitive): if caseSensitive: return substring in string else: return substring.lower() in string.lower() + def convertPwdToHash(password): m = hashlib.md5() m.update(password.encode()) return m.hexdigest() + def verifyPassword(object, password): passwordInput = showPasswordDialog(object) if passwordInput is not None: @@ -44,6 +47,8 @@ def verifyPassword(object, password): else: showWrongPasswordDialog(object) return False + + def showPasswordDialog(object): password, ok = QInputDialog.getText(object.window(), @@ -53,6 +58,7 @@ def showPasswordDialog(object): return password return None + def showWrongPasswordDialog(parent): messageBox = QMessageBox(parent.window()) messageBox.setText("Wrong password") @@ -281,7 +287,6 @@ class LauncherMenu(QMenu): candidate = self while type(candidate) != LauncherWindow: candidate = candidate.parent() - print(candidate) return candidate diff --git a/src/launcher_model.py b/src/launcher_model.py index bf6a164..fc7c340 100644 --- a/src/launcher_model.py +++ b/src/launcher_model.py @@ -167,7 +167,7 @@ class launcher_menu_model(object): ": Unknown type \"" + item_type + "\". Skipped" logging.warning(warn_msg) - if menu_item != None: + if menu_item is not None: self.menu_items.append(menu_item) def check_item_format_json(self, item, item_name, mandatory_param): @@ -306,4 +306,4 @@ class launcher_title_item(launcher_menu_model_item): """Text menu separator.""" def __init__(self, parent, item): - launcher_menu_model_item.__init__(self, parent, item) \ No newline at end of file + launcher_menu_model_item.__init__(self, parent, item) diff --git a/src/protect.py b/src/protect.py index ba15f9a..6cf08f8 100755 --- a/src/protect.py +++ b/src/protect.py @@ -82,7 +82,7 @@ def main(): args = argsParse.parse_args() # Add password to json structure - if args.password == None: + if args.password is None: # Ask for password password = input("Enter password: ") else: @@ -95,6 +95,7 @@ def main(): # Add password to file and, if recursive, to all the files within processFile(jsonFilePath, password, args.recursive) + # Start program here if __name__ == '__main__': - main() \ No newline at end of file + main()