Beispiel #1
2
def main():
    app = QtSingleApplication(appGuid, [])

    argString = " ".join(sys.argv[1:])
    argString = QtCore.QString(argString.replace('\\', '\\\\'))

    if app.isRunning():
        logging.debug('Run second instance with args: ' + argString)
        app.sendMessage(argString)
        sys.exit(app.exit(0))

    logging.debug('Run with args: ' + argString)
    logging.debug('PID: %d' % QtGui.QApplication.applicationPid())

    trayicon = SystemTrayIcon(os.path.join(module_path(), "ngq.ico"), )
    trayicon.show()

    worker = NGQLauncherWorker(host, port, argString, trayicon)
    app.messageReceived.connect(worker.executeArgs)
    worker.ngqListChanged.connect(trayicon.showNGQs)
    worker.messageEmited.connect(trayicon.showMessage)
    worker.start()

    trayicon.showNGQ.connect(worker.showNGQ)
    trayicon.rereadConfig.connect(worker.reconfigure)

    sys.exit(app.exec_())
Beispiel #2
1
def main():
    app = QtSingleApplication(appGuid, [])

    argString = " ".join(sys.argv[1:])
    argString = QtCore.QString(argString.replace("\\", "\\\\"))

    if app.isRunning():
        logging.debug("Run second instance with args: " + argString)
        app.sendMessage(argString)
        sys.exit(app.exit(0))

    logging.debug("Run with args: " + argString)
    logging.debug("PID: %d" % QtGui.QApplication.applicationPid())

    trayicon = SystemTrayIcon(os.path.join(module_path(), "ngq.ico"))
    trayicon.show()

    worker = NGQLauncherWorker(host, port, argString, trayicon)
    app.messageReceived.connect(worker.executeArgs)
    worker.ngqListChanged.connect(trayicon.showNGQs)
    worker.messageEmited.connect(trayicon.showMessage)
    worker.start()

    trayicon.showNGQ.connect(worker.showNGQ)
    trayicon.rereadConfig.connect(worker.reconfigure)

    sys.exit(app.exec_())
Beispiel #3
1
# -*- coding: utf-8 -*-

import sys
from PyQt4.QtGui import *
from ngq_manager_app import QtSingleApplication
from ngq_client_table import Table

print sys.argv

appGuid = 'F3FF80BA-BA05-4277-8063-82A6DB9245A3'
app = QtSingleApplication(appGuid, sys.argv)
if app.isRunning():
	if len(sys.argv) > 1:
		app.sendMessage(sys.argv[1])	
	sys.exit(0)

w = Table()
app.messageReceived.connect(w.processURI)

if len(sys.argv) > 1:
	w.processURI(sys.argv[1])

w.show()

sys.exit(app.exec_())