Skip to content

Commit

Permalink
Added Ability To Change/Update Pusher Credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
ScreamingOranges committed Sep 11, 2021
1 parent ef1110b commit 55a5220
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
12 changes: 10 additions & 2 deletions inputGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,36 @@
import PyQt5.QtWidgets

class inputGUI(PyQt5.QtWidgets.QDialog):
def __init__(self, parent = None):
super(inputGUI, self).__init__(parent)
def __init__(self, pusherCreds = None):
super(inputGUI, self).__init__(None)
layout = PyQt5.QtWidgets.QFormLayout()

self.btnAppID = PyQt5.QtWidgets.QPushButton("Enter app_id")
self.btnAppID.clicked.connect(self.getAppID)
self.leAppID = PyQt5.QtWidgets.QLabel()
if pusherCreds != None:
self.leAppID.setText(str(pusherCreds[0]))
layout.addRow(self.btnAppID,self.leAppID)

self.btnKey = PyQt5.QtWidgets.QPushButton("Enter key")
self.btnKey.clicked.connect(self.getKey)
self.leKey = PyQt5.QtWidgets.QLabel()
if pusherCreds != None:
self.leKey.setText(str(pusherCreds[1]))
layout.addRow(self.btnKey,self.leKey)

self.btnSecret = PyQt5.QtWidgets.QPushButton("Enter secret")
self.btnSecret.clicked.connect(self.getSecret)
self.leSecret = PyQt5.QtWidgets.QLabel()
if pusherCreds != None:
self.leSecret.setText(str(pusherCreds[2]))
layout.addRow(self.btnSecret,self.leSecret)

self.btnCluster = PyQt5.QtWidgets.QPushButton("Choose cluster")
self.btnCluster.clicked.connect(self.chooseCluster)
self.leCluster = PyQt5.QtWidgets.QLabel()
if pusherCreds != None:
self.leCluster.setText(str(pusherCreds[3]))
layout.addRow(self.btnCluster,self.leCluster)

self.btnAccept = PyQt5.QtWidgets.QPushButton("Submit")
Expand Down
20 changes: 19 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,21 @@ def checkJsonFile():
data = {"pusherAppID":pusherCreds[0],"pusherKey":pusherCreds[1],"pusherSecret":pusherCreds[2],"pusherCluster":pusherCreds[3]}
with open('data.json', 'w') as outfile:
json.dump(data, outfile)


def pusherCredentials():
global pusherCreds
if os.path.exists("./data.json"):
with open('data.json', 'r') as openfile:
json_object = json.load(openfile)
pusherCreds = json_object["pusherAppID"], json_object["pusherKey"], json_object["pusherSecret"], json_object["pusherCluster"]
ex = inputGUI.inputGUI(pusherCreds)
ex.show()
if ex.exec_() == inputGUI.inputGUI.Accepted:
pusherCreds = ex.pCred
data = {"pusherAppID":pusherCreds[0],"pusherKey":pusherCreds[1],"pusherSecret":pusherCreds[2],"pusherCluster":pusherCreds[3]}
with open('data.json', 'w') as outfile:
json.dump(data, outfile)

def colorResetCall():
conn = icueConnect.icueConnect()
conn.releaseControl()
Expand Down Expand Up @@ -74,6 +88,10 @@ def main():
iCueSDK_Test = PyQt5.QtWidgets.QAction("Test")
iCueSDK_Test.triggered.connect(iCueSDK_TestCall)
menu.addAction(iCueSDK_Test)
# To change Pusher Creds
pusher_credentials = PyQt5.QtWidgets.QAction("Pusher Credentials")
pusher_credentials.triggered.connect(pusherCredentials)
menu.addAction(pusher_credentials)
# To quit the app
quit = PyQt5.QtWidgets.QAction("Quit")
quit.triggered.connect(app.quit)
Expand Down

0 comments on commit 55a5220

Please sign in to comment.