python - pyqt graceful logout my app when user signs off -


when app running, if user logs off pop window displaying info , confirming logout

class myapp(qtwidgets.qapplication):      def __init__(self, *args, **kwargs):         super(myapp, self).__init__(*args, **kwargs)         self.commitdatarequest.connect(lambda manager: self.commitdata(manager))      @qtcore.pyqtslot(qtgui.qsessionmanager)     def commitdata(self, manager):         print 'shutdown'  if __name__ == '__main__':     qapplication = myapp(sys.argv)     qtwidgets.qapplication.setquitonlastwindowclosed(false) #interaction through tray icon     application.exec_() 

the issue it's not going slot method.

my app not have main window, interfaces through tray icon.

you need on ride qtwidget:

    def closeevent(self, event):      quit_msg = "are sure want exit program?"     reply = qtgui.qmessagebox.question(self, 'message',                    quit_msg, qtgui.qmessagebox.yes, qtgui.qmessagebox.no)  if reply == qtgui.qmessagebox.yes:     event.accept() else:     event.ignore() 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -