From 96b9529dee25cae0976c348ca644584d97360560 Mon Sep 17 00:00:00 2001 From: Dpeta <69427753+Dpeta@users.noreply.github.com> Date: Sun, 4 Oct 2020 17:41:14 +0000 Subject: [PATCH] Incorrectly added functionality to choose server There really has to be a better way, but I don't know how qt works. .w. --- profile.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/profile.py b/profile.py index bd75328..337c625 100644 --- a/profile.py +++ b/profile.py @@ -285,7 +285,35 @@ class userConfig(object): def server(self): if hasattr(self.parent, 'serverOverride'): return self.parent.serverOverride - return self.config.get('server', 'irc.mindfang.org') + # Okay, so I tried to use qt to promt the user to choose a server via a message box. + # It seems to ...work... but I know that this isn't the proper way to implement something like this at all. + # But, uh, I have no clue how to properly use qt. + # If anyone knows how to actually implement something like this please feel free to fix this. + # HOPEFULLY this is a temporary solution + + msgBox = QtGui.QMessageBox() + #msgBox.setIcon(QtGui.QMessageBox.Information) + #msgBox.setText("") + msgBox.setWindowTitle("Which server do you want to connect to?") + msgBox.addButton(QtGui.QPushButton("ghostDunk's server (Official)"), QtGui.QMessageBox.YesRole) + msgBox.addButton(QtGui.QPushButton("turntechCatnip's server"), QtGui.QMessageBox.NoRole) + msgBox.addButton(QtGui.QPushButton('kaliope.ddns.net'), QtGui.QMessageBox.RejectRole) + ret = msgBox.exec_() + #pressed_button = msgBox.clickedButton() + reply = msgBox.buttonRole(msgBox.clickedButton()) + + if (reply==QtGui.QMessageBox.YesRole): + print("Server is: irc.mindfang.org") + return self.config.get('server', 'irc.mindfang.org') + if (reply==QtGui.QMessageBox.NoRole): + print("Server is: 178.84.124.125") + return self.config.get('server', '178.84.124.125') + if (reply==QtGui.QMessageBox.RejectRole): + print("Server is: kaliope.ddns.net") + return self.config.get('server', 'kaliope.ddns.net') + + #print(reply) + #return self.config.get('server', 'irc.mindfang.org') def port(self): if hasattr(self.parent, 'portOverride'): return self.parent.portOverride