WIP exit & traymenu fix

This commit is contained in:
Dpeta 2021-03-25 21:39:37 +01:00
parent 3747b854be
commit 8be8cf9f07
4 changed files with 21 additions and 5 deletions

3
irc.py
View file

@ -314,6 +314,9 @@ class PesterIRC(QtCore.QThread):
except socket.error:
self.setConnectionBroken()
def quit_dc(self):
helpers.quit(self.cli, _pcVersion + " <3")
moodUpdated = QtCore.pyqtSignal('QString', Mood)
colorUpdated = QtCore.pyqtSignal('QString', QtGui.QColor)
messageReceived = QtCore.pyqtSignal('QString', 'QString')

View file

@ -78,6 +78,7 @@ def identify(cli, passwd, authuser="NickServ"):
msg(cli, authuser, "IDENTIFY %s" % passwd)
def quit(cli, msg='gone'):
#print(msg)
cli.send("QUIT :%s" % msg)
cli._end = 1

View file

@ -1137,7 +1137,7 @@ class PesterWindow(MovingWindow):
opts.triggered.connect(self.openOpts)
exitaction = QtWidgets.QAction(self.theme["main/menus/client/exit"], self)
self.exitaction = exitaction
exitaction.triggered.connect(self.app.quit)
exitaction.triggered.connect(self.quit)
userlistaction = QtWidgets.QAction(self.theme["main/menus/client/userlist"], self)
self.userlistaction = userlistaction
userlistaction.triggered.connect(self.showAllUsers)
@ -2928,6 +2928,17 @@ class PesterWindow(MovingWindow):
msg.setInformativeText("The server has hit max capacity. Please try again later.")
msg.show()
@QtCore.pyqtSlot()
def quit(self):
# girl help how do i scope
# This seriously needs to be fixed but I don't feel like it </3
pesterchum.irc.quit_dc() # Actually send QUIT to server
pesterchum.trayicon.hide() # Hopefully,
pesterchum.app.quit() # stop the trayicon from sticking around :/
# Just in case.
sys.exit()
pcUpdate = QtCore.pyqtSignal('QString', 'QString')
closeToTraySignal = QtCore.pyqtSignal()
newConvoStarted = QtCore.pyqtSignal('QString', bool, name="newConvoStarted")
@ -3077,7 +3088,7 @@ class MainProgram(QtCore.QObject):
miniAction = QtWidgets.QAction("MINIMIZE", self)
miniAction.triggered.connect(self.widget.showMinimized)
exitAction = QtWidgets.QAction("EXIT", self)
exitAction.triggered.connect(self.app.quit)
exitAction.triggered.connect(PesterWindow.quit)
self.traymenu.addAction(miniAction)
self.traymenu.addAction(exitAction)
@ -3115,6 +3126,7 @@ class MainProgram(QtCore.QObject):
# return
# QtCore.QTimer.singleShot(1000*seconds, self, QtCore.SLOT('runUpdateSlot()'))
@QtCore.pyqtSlot(QtWidgets.QWidget)
def alertWindow(self, widget):
self.app.alert(widget)

View file

@ -1,2 +1,2 @@
_pcVersion = "Alt. 2.0"
buildVersion = "2.0"
_pcVersion = "Alt. v2.0"
buildVersion = "v2.0"