Пример #1
0
    def __init__(self, *args, **kwargs):
        UGAMEClientFactory.__init__(self, *args, **kwargs)
        self.settings = kwargs["settings"]
        self.config = kwargs.get("config", None)
        #
        # Make sure the attributes exists, should an exception occur before
        # it is initialized. This is done
        # so that the caller does not have to check the existence of the
        # attribute when catching an exception.
        #
        self.crashing = False

        settings = self.settings
        self.ping_delay = settings.headerGetInt("/settings/@ping")
        self.no_display_packets = settings.headerGet("/settings/@no_display_packets")
        self.name = settings.headerGet("/settings/name")
        self.password = settings.headerGet("/settings/passwd")
        if self.config:
            chips_values = self.config.headerGet("/sequence/chips")
            if not chips_values:
                raise UserWarning, "PokerClientFactory: no /sequence/chips found in %s" % self.config.path
            self.chips_values = map(int, chips_values.split())
        else:
            self.chips_values = [1]
        self.host = "unknown"
        self.port = 0
        self.remember = settings.headerGet("/settings/remember") == "yes"
        self.chat_config = settings.headerGetProperties("/settings/chat")
        if self.chat_config:
            self.chat_config = self.chat_config[0]
            for (key, value) in self.chat_config.iteritems():
                self.chat_config[key] = int(value)
        else:
            self.chat_config = {}
        self.dirs = split(self.settings.headerGet("/settings/path"))
        self.verbose = self.settings.headerGetInt("/settings/@verbose")
        self.delays = self.settings.headerGetProperties("/settings/delays")
        if self.delays:
            self.delays = self.delays[0]
            for (key, value) in self.delays.iteritems():
                self.delays[key] = float(value)
            if self.delays.has_key("round"):
                self.delays["end_round"] = self.delays["round"]
                self.delays["begin_round"] = self.delays["round"]
                del self.delays["round"]
            if not self.delays.has_key("blind_ante_position"):
                self.delays["blind_ante_position"] = self.delays["position"]
        else:
            self.delays = {}
        if self.verbose > 2:
            self.message("PokerClient: delays %s" % self.delays)
        self.delays_enable = self.settings.headerGet("/settings/@delays") == "true"
        self.skin = PokerSkin(settings = self.settings)
        self.protocol = PokerClientProtocol
        self.games = PokerGames(dirs = self.dirs, verbose = self.verbose)
        self.file2name = {}
        self.first_time = self.settings.headerGet("/settings/name") == "username"
        self.played_time = self.settings.headerGet("/settings/played_time")
Пример #2
0
    def __init__(self, *args, **kwargs):
        UGAMEClientFactory.__init__(self, *args, **kwargs)
        self.settings = kwargs["settings"]
        self.config = kwargs.get("config", None)
        #
        # Make sure the attributes exists, should an exception occur before
        # it is initialized. This is done
        # so that the caller does not have to check the existence of the
        # attribute when catching an exception.
        self.crashing = False

        settings = self.settings
        self.ping_delay = settings.headerGetInt("/settings/@ping")
        self.no_display_packets = settings.headerGet(
            "/settings/@no_display_packets")
        self.name = settings.headerGet("/settings/name")
        self.password = settings.headerGet("/settings/passwd")
        if self.config:
            chips_values = self.config.headerGet("/sequence/chips")
            if not chips_values:
                raise UserWarning, "PokerClientFactory: no /sequence/chips found in %s" % self.config.path
            self.chips_values = map(int, chips_values.split())
        else:
            self.chips_values = [1]
        self.host = "unknown"
        self.port = 0
        self.remember = settings.headerGet("/settings/remember") == "yes"
        self.chat_config = settings.headerGetProperties("/settings/chat")
        if self.chat_config:
            self.chat_config = self.chat_config[0]
            for (key, value) in self.chat_config.iteritems():
                self.chat_config[key] = int(value)
        else:
            self.chat_config = {}
        self.dirs = self.settings.headerGet("/settings/path").split()
        self.delays = self.settings.headerGetProperties("/settings/delays")
        if self.delays:
            self.delays = self.delays[0]
            for (key, value) in self.delays.iteritems():
                self.delays[key] = float(value)
            if "round" in self.delays:
                self.delays["end_round"] = self.delays["round"]
                self.delays["begin_round"] = self.delays["round"]
                del self.delays["round"]
            if "blind_ante_position" not in self.delays:
                self.delays["blind_ante_position"] = self.delays["position"]
        else:
            self.delays = {}
        self.log.debug("delays %s", self.delays)
        self.delays_enable = self.settings.headerGet(
            "/settings/@delays") == "true"
        self.skin = PokerSkin(settings=self.settings)
        self.protocol = PokerClientProtocol
        self.games = PokerGames(dirs=self.dirs)
        self.file2name = {}
        self.first_time = self.settings.headerGet(
            "/settings/name") == "username"
        self.played_time = self.settings.headerGet("/settings/played_time")
Пример #3
0
    def __init__(self, *args, **kwargs):
        UGAMEClientFactory.__init__(self, *args, **kwargs)
        self.settings = kwargs["settings"]
        self.config = kwargs.get("config", None)
        #
        # Make sure the attributes exists, should an exception occur before
        # it is initialized with an instance of PokerChildren and such. This is done
        # so that the caller does not have to check the existence of the
        # attribute when catching an exception.
        #
        self.crashing = False
        self.interface = None
        self.display = None
        self.children = None

        settings = self.settings
        self.ping_delay = settings.headerGetInt("/settings/@ping")
        self.no_display_packets = settings.headerGet(
            "/settings/@no_display_packets")
        self.name = settings.headerGet("/settings/name")
        self.password = settings.headerGet("/settings/passwd")
        if self.config:
            chips_values = self.config.headerGet("/sequence/chips")
            if not chips_values:
                raise UserWarning, "PokerClientFactory: no /sequence/chips found in %s" % self.config.path
            self.chips_values = map(int, chips_values.split())
        else:
            self.chips_values = [1]
        self.host = "unknown"
        self.port = 0
        self.remember = settings.headerGet("/settings/remember") == "yes"
        self.chat_config = settings.headerGetProperties("/settings/chat")
        if self.chat_config:
            self.chat_config = self.chat_config[0]
            for (key, value) in self.chat_config.iteritems():
                self.chat_config[key] = int(value)
        else:
            self.chat_config = {}
        self.dirs = split(self.settings.headerGet("/settings/path"))
        self.verbose = self.settings.headerGetInt("/settings/@verbose")
        self.delays = self.settings.headerGetProperties("/settings/delays")
        if self.delays:
            self.delays = self.delays[0]
            for (key, value) in self.delays.iteritems():
                self.delays[key] = float(value)
            if self.delays.has_key("round"):
                self.delays["end_round"] = self.delays["round"]
                self.delays["begin_round"] = self.delays["round"]
                del self.delays["round"]
            if not self.delays.has_key("blind_ante_position"):
                self.delays["blind_ante_position"] = self.delays["position"]
        else:
            self.delays = {}
        if self.verbose > 2:
            self.message("PokerClient: delays %s" % self.delays)
        self.delays_enable = self.settings.headerGet(
            "/settings/@delays") == "true"
        self.skin = PokerSkin(settings=self.settings)
        self.protocol = PokerClientProtocol
        self.games = PokerGames(dirs=self.dirs, verbose=self.verbose)
        self.file2name = {}
        self.first_time = self.settings.headerGet(
            "/settings/name") == "username"
        self.played_time = self.settings.headerGet("/settings/played_time")

        self.children = PokerChildren(self.config, self.settings)
        self.upgrader = upgrade.Upgrader(self.config, self.settings)
        self.upgrader.registerHandler(upgrade.TICK, self.upgradeTick)
        self.upgrader.registerHandler(upgrade.CLIENT_VERSION_OK,
                                      self.clientVersionOk)
        self.upgrader.registerHandler(upgrade.NEED_UPGRADE, self.needUpgrade)
        self.upgrader.registerHandler(upgrade.UPGRADE_READY, self.upgradeReady)
        self.upgrader.registerHandler(upgrade.FAILED, self.failedUpgrade)
        self.upgrader.registerHandler(upgrade.HOST_DOES_NOT_RESPOND,
                                      self.failedUpgradeHostDoesNotRespond)
        self.upgrader.registerHandler(upgrade.NO_NETWORK,
                                      self.failedUpgradeNoNetwork)
        self.interface = None
Пример #4
0
    def __init__(self, *args, **kwargs):
        UGAMEClientFactory.__init__(self, *args, **kwargs)
        self.settings = kwargs["settings"]
        self.config = kwargs.get("config", None)
        #
        # Make sure the attributes exists, should an exception occur before
        # it is initialized with an instance of PokerChildren and such. This is done
        # so that the caller does not have to check the existence of the
        # attribute when catching an exception.
        #
        self.crashing = False
        self.interface = None
        self.display = None
        self.children = None

        settings = self.settings
        self.ping_delay = settings.headerGetInt("/settings/@ping")
        self.no_display_packets = settings.headerGet("/settings/@no_display_packets")
        self.name = settings.headerGet("/settings/name")
        self.password = settings.headerGet("/settings/passwd")
        if self.config:
            chips_values = self.config.headerGet("/sequence/chips")
            if not chips_values:
                raise UserWarning, "PokerClientFactory: no /sequence/chips found in %s" % self.config.path
            self.chips_values = map(int, chips_values.split())
        else:
            self.chips_values = [1]
        self.host = "unknown"
        self.port = 0
        self.remember = settings.headerGet("/settings/remember") == "yes"
        self.chat_config = settings.headerGetProperties("/settings/chat")
        if self.chat_config:
            self.chat_config = self.chat_config[0]
            for (key, value) in self.chat_config.iteritems():
                self.chat_config[key] = int(value)
        else:
            self.chat_config = {}
        self.dirs = split(self.settings.headerGet("/settings/path"))
        self.verbose = self.settings.headerGetInt("/settings/@verbose")
        self.delays = self.settings.headerGetProperties("/settings/delays")
        if self.delays:
            self.delays = self.delays[0]
            for (key, value) in self.delays.iteritems():
                self.delays[key] = float(value)
            if self.delays.has_key("round"):
                self.delays["end_round"] = self.delays["round"]
                self.delays["begin_round"] = self.delays["round"]
                del self.delays["round"]
            if not self.delays.has_key("blind_ante_position"):
                self.delays["blind_ante_position"] = self.delays["position"]
        else:
            self.delays = {}
        if self.verbose > 2:
            self.message("PokerClient: delays %s" % self.delays)
        self.delays_enable = self.settings.headerGet("/settings/@delays") == "true"
        self.skin = PokerSkin(settings = self.settings)
        self.protocol = PokerClientProtocol
        self.games = PokerGames(dirs = self.dirs, verbose = self.verbose)
        self.file2name = {}
        self.first_time = self.settings.headerGet("/settings/name") == "username"
        self.played_time = self.settings.headerGet("/settings/played_time")

        self.children = PokerChildren(self.config, self.settings)
        self.upgrader = upgrade.Upgrader(self.config, self.settings)
        self.upgrader.registerHandler(upgrade.TICK, self.upgradeTick)
        self.upgrader.registerHandler(upgrade.CLIENT_VERSION_OK, self.clientVersionOk)
        self.upgrader.registerHandler(upgrade.NEED_UPGRADE, self.needUpgrade)
        self.upgrader.registerHandler(upgrade.UPGRADE_READY, self.upgradeReady)
        self.upgrader.registerHandler(upgrade.FAILED, self.failedUpgrade)
        self.upgrader.registerHandler(upgrade.HOST_DOES_NOT_RESPOND, self.failedUpgradeHostDoesNotRespond)
        self.upgrader.registerHandler(upgrade.NO_NETWORK, self.failedUpgradeNoNetwork)
        self.interface = None
Пример #5
0
 def __init__(self, screenObj, msgpokerurl):
     UGAMEClientFactory.__init__(self)
     self.screenObj = screenObj
     self.protocol = PokerClientProtocol
     self.established_deferred.addCallback(self.letsGo)
     self.msgpokerurl = msgpokerurl
Пример #6
0
 def __init__(self, screenObj, msgpokerurl):
     UGAMEClientFactory.__init__(self)
     self.screenObj = screenObj
     self.protocol = PokerClientProtocol
     self.established_deferred.addCallback(self.letsGo)
     self.msgpokerurl = msgpokerurl