Beispiel #1
0
    def __init__(self):
        super(Controller, self).__init__()
        self.selectTimeout = 1
        self.sequence = 0x1
        self.tcpSock = None
        self.tcpConnected = False
        self.tcpData = ''
        self.tcpReadState = self.STATE_TCP_READ_LEN
        self.tcpResponseLen = 0
        self.tcpCommandsWaitingForResponse = dict()
        self.udpSock = None
        self.udpConnected = False
        self.selectLoopRunning = True

        self.username = ''
        self.channel = 'lobby'
        self.rom = ''
        self.fba = None
        self.checkInstallation()
        self.unsupportedRom = ''
        self.checkUnsupportedRom()
        self.playingagainst = ''

        self.challengers = set()
        self.challenged = None
        self.channels = {}
        self.pinglist = {}
        self.players = {}
        self.available = {}
        self.playing = {}
        self.awayfromkb = {}
        self.ignored = Settings.pythonValue(Settings.IGNORED) or set()
        self.sigStatusMessage.connect(logdebug().info)
Beispiel #2
0
 def restorePreference(self):
     theme = Settings.value(Settings.COLORTHEME)
     if theme:
         if theme == 'darkorange':
             self.uiDarkThemeAct.setChecked(True)
         elif theme == 'custom':
             fname = Settings.value(Settings.CUSTOM_THEME_FILENAME)
             self.setCustomQssfile(fname)
         else:
             cleanname = self.buildInStyleToActionName(theme)
             if hasattr(self, cleanname):
                 getattr(self, cleanname).setChecked(True)
     smooth = Settings.value(Settings.SMOOTHING)
     if smooth:
         cleanname = self.buildInSmoothingToActionName(smooth)
         if hasattr(self, cleanname):
             getattr(self, cleanname).setChecked(True)
     if Settings.value(Settings.MUTE_CHALLENGE_SOUND):
         self.uiMuteChallengeSoundAct.setChecked(True)
     if Settings.value(Settings.NOTIFY_PLAYER_STATE_CHANGE):
         self.uiNotifyPlayerStateChangeAct.setChecked(True)
     if Settings.value(Settings.SHOW_COUNTRY_FLAG_IN_CHAT):
         self.uiShowCountryFlagInChatAct.setChecked(True)
     if Settings.value(Settings.SHOW_TIMESTAMP_IN_CHAT):
         self.uiShowTimestampInChatAct.setChecked(True)
     fontsetting = Settings.pythonValue(Settings.CHAT_HISTORY_FONT)
     if fontsetting:
         self.uiChatHistoryTxtB.setFont(QtGui.QFont(*fontsetting))
     self.restoreStateAndGeometry()
Beispiel #3
0
    def __init__(self):
        super(Controller, self).__init__()
        self.selectTimeout = 1
        self.sequence = 0x1
        self.tcpSock = None
        self.tcpConnected = False
        self.tcpData = ''
        self.tcpReadState = self.STATE_TCP_READ_LEN
        self.tcpResponseLen = 0
        self.tcpCommandsWaitingForResponse = dict()
        self.udpSock = None
        self.udpConnected = False
        self.selectLoopRunning = True

        self.username = ''
        self.channel = 'lobby'
        self.rom = ''
        self.fba = None
        self.checkInstallation()
        self.unsupportedRom = ''
        self.checkUnsupportedRom()
        self.playingagainst = ''

        self.challengers = set()
        self.challenged = None
        self.channels = {}
        self.pinglist = {}
        self.players = {}
        self.available = {}
        self.playing = {}
        self.awayfromkb = {}
        self.ignored = Settings.pythonValue(Settings.IGNORED) or set()
        self.sigStatusMessage.connect(logdebug().info)
Beispiel #4
0
    def loadSetting(self, extID, key):
        """ Retrieves an object stored by saveSetting

        Args:
            extID: ID of calling extension
            key: string key previously passed to saveSetting

        Returns:
            The object previously stored, or None if not found
        """
        return Settings.pythonValue("EXT%s%s" % (extID, key))
Beispiel #5
0
 def restorePreference(self):
     theme = Settings.value(Settings.COLORTHEME)
     if theme:
         if theme == 'darkorange':
             self.uiDarkThemeAct.setChecked(True)
         elif theme == 'fightcade':
             self.uiGNGThemeAct.setChecked(True)
         elif theme == 'custom':
             fname = Settings.value(Settings.CUSTOM_THEME_FILENAME)
             self.setCustomQssfile(fname)
         else:
             cleanname = self.buildInStyleToActionName(theme)
             if hasattr(self, cleanname):
                 getattr(self, cleanname).setChecked(True)
     smooth = Settings.value(Settings.SMOOTHING)
     if smooth:
         cleanname = self.buildInSmoothingToActionName(smooth)
         if hasattr(self, cleanname):
             getattr(self, cleanname).setChecked(True)
     if Settings.value(Settings.MUTE_CHALLENGE_SOUND):
         self.uiMuteChallengeSoundAct.setChecked(True)
     if Settings.value(Settings.MUTE_NOTIFY_SOUND):
         self.uiMuteNotifySoundAct.setChecked(True)
     if Settings.value(Settings.NOTIFY_PLAYER_STATE_CHANGE):
         self.uiNotifyPlayerStateChangeAct.setChecked(True)
     if Settings.value(Settings.SHOW_COUNTRY_FLAG_IN_CHAT):
         self.uiShowCountryFlagInChatAct.setChecked(True)
     if Settings.value(Settings.SHOW_TIMESTAMP_IN_CHAT):
         self.uiShowTimestampInChatAct.setChecked(True)
     if Settings.value(Settings.HIDE_INGAME_CHAT):
         self.uiHideInGameChatAct.setChecked(True)
     if Settings.value(Settings.HIDE_GAMES_WITHOUT_ROM):
         self.hidemissing = True
         self.uiHideGamesWithoutRomAct.setChecked(True)
     if Settings.value(Settings.FILTER_FAVORITES):
         self.showfavorites = True
         self.uiFilterFavoriteLobbies.setChecked(True)
     if Settings.value(Settings.DISABLE_AUTOCOLOR_NICKS):
         self.uiDisableAutoColorNicks.setChecked(True)
     if Settings.value(Settings.AWAY):
         self.uiAwayAct.setChecked(True)
         self.uiAfkChk.setChecked(True)
         self.controller.sendToggleAFK(1)
     fontsetting = Settings.pythonValue(Settings.CHAT_HISTORY_FONT)
     if fontsetting:
         self.uiChatHistoryTxtB.setFont(QtGui.QFont(*fontsetting))
     self.restoreStateAndGeometry()
Beispiel #6
0
 def restorePreference(self):
     theme = Settings.value(Settings.COLORTHEME)
     if theme:
         if theme == 'darkorange':
             self.uiDarkThemeAct.setChecked(True)
         elif theme == 'fightcade':
             self.uiGNGThemeAct.setChecked(True)
         elif theme == 'custom':
             fname = Settings.value(Settings.CUSTOM_THEME_FILENAME)
             self.setCustomQssfile(fname)
         else:
             cleanname = self.buildInStyleToActionName(theme)
             if hasattr(self, cleanname):
                 getattr(self, cleanname).setChecked(True)
     smooth = Settings.value(Settings.SMOOTHING)
     if smooth:
         cleanname = self.buildInSmoothingToActionName(smooth)
         if hasattr(self, cleanname):
             getattr(self, cleanname).setChecked(True)
     if Settings.value(Settings.MUTE_CHALLENGE_SOUND):
         self.uiMuteChallengeSoundAct.setChecked(True)
     if Settings.value(Settings.MUTE_NOTIFY_SOUND):
         self.uiMuteNotifySoundAct.setChecked(True)
     if Settings.value(Settings.NOTIFY_PLAYER_STATE_CHANGE):
         self.uiNotifyPlayerStateChangeAct.setChecked(True)
     if Settings.value(Settings.SHOW_COUNTRY_FLAG_IN_CHAT):
         self.uiShowCountryFlagInChatAct.setChecked(True)
     if Settings.value(Settings.SHOW_TIMESTAMP_IN_CHAT):
         self.uiShowTimestampInChatAct.setChecked(True)
     if Settings.value(Settings.HIDE_INGAME_CHAT):
         self.uiHideInGameChatAct.setChecked(True)
     if Settings.value(Settings.HIDE_GAMES_WITHOUT_ROM):
         self.hidemissing=True
         self.uiHideGamesWithoutRomAct.setChecked(True)
     if Settings.value(Settings.FILTER_FAVORITES):
         self.showfavorites=True
         self.uiFilterFavoriteLobbies.setChecked(True)
     if Settings.value(Settings.DISABLE_AUTOCOLOR_NICKS):
         self.uiDisableAutoColorNicks.setChecked(True)
     if Settings.value(Settings.AWAY):
         self.uiAwayAct.setChecked(True)
         self.uiAfkChk.setChecked(True)
         self.controller.sendToggleAFK(1)
     fontsetting = Settings.pythonValue(Settings.CHAT_HISTORY_FONT)
     if fontsetting:
         self.uiChatHistoryTxtB.setFont(QtGui.QFont(*fontsetting))
     self.restoreStateAndGeometry()
Beispiel #7
0
    def __init__(self):
        super(Controller, self).__init__()
        self.selectTimeout = 1
        self.sequence = 0x1
        self.tcpSock = None
        self.tcpConnected = False
        self.tcpData = ''
        self.tcpReadState = self.STATE_TCP_READ_LEN
        self.tcpResponseLen = 0
        self.tcpCommandsWaitingForResponse = dict()
        self.udpSock = None
        self.udpConnected = False
        self.selectLoopRunning = True
        self.switchingServer = False

        self.username = ''
        self.password = ''
        self.channel = 'lobby'
        self.channelport = 7000
        self.rom = ''
        self.fba = None
        self.checkInstallation()
        self.unsupportedRom = ''
        self.checkUnsupportedRom()
        self.playingagainst = ''
        self.side = 0  # if currently playing, 1 or 2 if we are player 1 or player 2

        self.challengers = set()
        self.challenged = None
        self.channels = {}
        self.pinglist = {}
        self.players = {}
        self.available = {}
        self.playing = {}
        self.awayfromkb = {}
        self.ignored = Settings.pythonValue(Settings.IGNORED) or set()
        self.sigStatusMessage.connect(logdebug().info)

        tmp = calendar.timegm(time.localtime()) - calendar.timegm(time.gmtime())
        self.utcoffset = tmp if tmp > 0 else 24*60*60 - tmp  # packInt can't do negative numbers.
        self.os = 1 if IS_WINDOWS else (2 if IS_LINUX else (3 if IS_OSX else 0))

        self.sendLock = threading.Lock()  # Protect self.sequence/self.tcpCommandsWaitingForResponse in sync if extensions