forked from ctrl_packages/epics_launcher
cleanup
This commit is contained in:
@@ -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
|
||||
|
||||
+6
-1
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
launcher_menu_model_item.__init__(self, parent, item)
|
||||
|
||||
+3
-2
@@ -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()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user