Exemplo n.º 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_()
Exemplo n.º 2
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("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_()
Exemplo n.º 3
0
 def getPlayerColor(self, name):
     if name == self.username or name == 'ponder':
         return '#ff0000'
     elif name in self.players:
         if hasattr(self.players[name], 'id'):
             return ColorTheme.getPlayerColor(self.players[name].id)
     return '#808080'
Exemplo n.º 4
0
 def getPlayerColor(self, name):
     if name == self.username or name == 'ponder':
         return '#ff0000'
     elif name in self.players:
         if hasattr(self.players[name], 'id'):
             return ColorTheme.getPlayerColor(self.players[name].id)
     return '#808080'
Exemplo n.º 5
0
 def getPlayerColor(self, name):
     if name == self.username:
         return '#ff0000'
     elif name in self.players:
         if Settings.value(Settings.DISABLE_AUTOCOLOR_NICKS):
             return '#034456'
         if hasattr(self.players[name], 'id'):
             return ColorTheme.getPlayerColor(self.players[name].id)
     return '#808080'
Exemplo n.º 6
0
 def getPlayerColor(self, name):
     if name == self.username:
         return '#ff0000'
     elif name in self.players:
         if Settings.value(Settings.DISABLE_AUTOCOLOR_NICKS):
             return '#034456'
         if hasattr(self.players[name], 'id'):
             return ColorTheme.getPlayerColor(self.players[name].id)
     return '#808080'
Exemplo n.º 7
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_()