示例#1
0
import sys
from gui import Gui
from qtsingleapplication import QtSingleApplication


appGuid = '58B37CBA-BE8F-4483-965C-5E2ED0C90D54'
app = QtSingleApplication(appGuid, sys.argv)
if app.isRunning():
    print("Running already")
    sys.exit(0)

gui = Gui()
app.setActivationWindow(gui)
sys.exit(app.exec_())
示例#2
0
class Goal(object):
    def __init__(self, seconds, currentTime, imagePath="", mp3Path="", title="", initialSeconds=0, gwp=None):
        self.seconds = seconds
        self.registeredTime = currentTime
        self.imagePath = imagePath
        self.mp3Path = mp3Path
        self.title = title
        self.initialSeconds = initialSeconds
        self.gwp = gwp
                  
if __name__ == '__main__':
    print "\nPROG_ID:",generateID(),'\n'
    ID = generateID()
    
    #Replace with QtGui.QApplication() for no singleton
    app = QtSingleApplication(ID, sys.argv)
    if app.isRunning(): 

        saveSocket = QtNetwork.QLocalSocket()
        saveSocket.connectToServer(ID + '-2')
        saving = saveSocket.waitForConnected()
        
        if saving:
            QtGui.QMessageBox.critical(None, PROGRAM_NAME+" - Still Saving", "Application is still saving. Wait until it has completed.")
            print "Already running, exiting"
            sys.exit(0)
        else:
            QtGui.QMessageBox.critical(None, PROGRAM_NAME, "Application is still running. Closing.")
            print "Already running, exiting"
            sys.exit(0)