Exemplo n.º 1
0
    def __init__(self, reactor, params):
        Entity.__init__(self)

        self.reactor = reactor
        self.params = params

        # Initial property values
        self.address = Address(params.host, params.port)
        if params.node_id:
            self.id_= safe_str(params.node_id)
        else:
            self.id_ = self.CreateId(params)
        if params.pos_x or params.pos_y:
            self.position = Position((params.pos_x, params.pos_y, 0))
        else:
            self.position = self.RandomPosition()
        if params.pseudo:
            self.pseudo = safe_unicode(params.pseudo)
        else:
            self.pseudo = self.RandomPseudo()
        print "Creating node '%s'" % self.id_

        # Call parent class constructor

        # Dummy test data
        self.languages = ['fr', 'en']
Exemplo n.º 2
0
 def GetNode(self):
     """
     Get the object representing the node (i.e. ourselves).
     """
     node = Entity()
     node.pseudo = self.pseudo
     # Dummy value to avoid None-marshaling
     node.address = Address()
     # Test data
     for s in self.services:
         node.AddService(s)
     return node
Exemplo n.º 3
0
 def GetNode(self):
     """
     Get the object representing the node (i.e. ourselves).
     """
     node = Entity()
     node.pseudo = self.pseudo
     lang_code = wx.Locale.GetLanguageInfo(wx.Locale.GetSystemLanguage()).CanonicalName
     if lang_code:
         node.languages = [ str(lang_code.split('_')[0]) ]
     # Dummy value to avoid None-marshaling
     node.address = Address()
     # Test data
     for s in self.services:
         node.AddService(s)
     return node
Exemplo n.º 4
0
    def __init__(self, reactor, params):
        self.reactor = reactor
        self.params = params

        id_ = self.CreateId()
        position = Position((params.pos_x, params.pos_y, 0))
        address = Address(params.host, params.port)

        # Call parent class constructor
        Entity.__init__(self, id_=id_, position=position, pseudo=params.pseudo, address=address)

        # Random pseudos for unnamed nodes
        if not self.pseudo:
            self.SetRandomPseudo()

        # Dummy test data
        self.languages = ['fr', 'en']