示例#1
0
def main(argv=None):
    app = None
    started = False

    # create the application if necessary
    if not QtGui.QApplication.instance():
        app = QtGui.QApplication(argv)
        app.setQuitOnLastWindowClosed(True)
        app.setOrganizationName("FightCade")
        QtCore.QCoreApplication.setApplicationName("FightCade")
    ColorTheme.saveDefaultStyle()
    if not Settings.value(Settings.COLORTHEME) or Settings.value(
            Settings.COLORTHEME) == 'fightcade' or Settings.value(
                Settings.COLORTHEME) == 'ggpong':
        ColorTheme.setGNGTheme(True)
    controller = Controller()
    thread = QtCore.QThread()
    controller.moveToThread(thread)
    thread.started.connect(controller.selectLoop)
    thread.start()

    def loggedIn():
        if started == False:
            window = GGPOWindow()
            window.setWindowIcon(QtGui.QIcon(':/assets/icon-128.png'))
            window.setController(controller)
            window.restorePreference()
            controller.sendListChannels()
            window.show()
            window.raise_()
            window.activateWindow()

    UDP = False
    port = 6009
    while True:
        UDP = controller.connectUdp(port)
        port = port - 1
        if (UDP == True or port < 6006):
            break

    logindialog = LoginDialog()
    logindialog.setController(controller)
    logindialog.accepted.connect(loggedIn)
    logindialog.rejected.connect(sys.exit)
    logindialog.exec_()
    logindialog.raise_()
    logindialog.activateWindow()
    started = True

    return app.exec_()
示例#2
0
文件: main.py 项目: Spartl/pyqtggpo
def main(argv=None):
    app = None

    # create the application if necessary
    if not QtGui.QApplication.instance():
        app = QtGui.QApplication(argv)
        app.setQuitOnLastWindowClosed(True)
        app.setOrganizationName("FightCade")
        QtCore.QCoreApplication.setApplicationName("FightCade")
    ColorTheme.saveDefaultStyle()
    if (
        not Settings.value(Settings.COLORTHEME)
        or Settings.value(Settings.COLORTHEME) == "fightcade"
        or Settings.value(Settings.COLORTHEME) == "ggpong"
    ):
        ColorTheme.setGNGTheme(True)
    controller = Controller()
    thread = QtCore.QThread()
    controller.moveToThread(thread)
    thread.started.connect(controller.selectLoop)
    thread.start()

    def loggedIn():
        UDP = False
        port = 6009
        while True:
            UDP = controller.connectUdp(port)
            port = port - 1
            if UDP == True or port < 6006:
                break
        window = GGPOWindow()
        window.setWindowIcon(QtGui.QIcon(":/assets/icon-128.png"))
        window.setController(controller)
        window.restorePreference()
        controller.sendListChannels()
        window.show()
        window.raise_()
        window.activateWindow()

    logindialog = LoginDialog()
    logindialog.setController(controller)
    logindialog.accepted.connect(loggedIn)
    logindialog.rejected.connect(sys.exit)
    logindialog.exec_()
    logindialog.raise_()
    logindialog.activateWindow()

    return app.exec_()
示例#3
0
def main(argv=None):
    app = None

    # create the application if necessary
    if not QtGui.QApplication.instance():
        app = QtGui.QApplication(argv)
        app.setQuitOnLastWindowClosed(True)
        app.setOrganizationName("GGPO")
        QtCore.QCoreApplication.setApplicationName("GGPO")
    ColorTheme.saveDefaultStyle()
    controller = Controller()
    thread = QtCore.QThread()
    controller.moveToThread(thread)
    thread.started.connect(controller.selectLoop)
    thread.start()

    def loggedIn():
        controller.connectUdp()
        window = GGPOWindow()
        window.setWindowIcon(QtGui.QIcon(':/assets/icon-128.png'))
        window.setController(controller)
        window.restorePreference()
        controller.sendListChannels()
        window.show()
        window.raise_()
        window.activateWindow()

    logindialog = LoginDialog()
    logindialog.setController(controller)
    logindialog.accepted.connect(loggedIn)
    logindialog.rejected.connect(sys.exit)
    logindialog.exec_()
    logindialog.raise_()
    logindialog.activateWindow()

    return app.exec_()