Esempio n. 1
0
 def newNote(self):
     # TODO: domyślna data ważności, możliwość zmiany daty ważności
     # do domyslnej daty waznosci mozna wykorzystac MessageFactory, pozniej mozemy podpiac do fabryki wstrzykiwanie domyslnych ustawien
     messageFactory = MessageFactory()
     messageFactory.set_sender(self.userName())
     messageFactory.set_recipients([])
     messageFactory.set_expiredate_policy(MessageFactory.POLICY_EXPIREDATE_DAYS)
     messageFactory.set_days_to_expire(31)
     messageFactory.set_state(MsgState.GUI)
     messageFactory.set_content('')
     
     
     m = messageFactory.build()
     
     nnote = SolidNote(m, self)
     
     self.allNotes[m.msg_uuid] = nnote
     
     # HACK TODO
     self.handleUpdateMessageBox()
Esempio n. 2
0
# -*- coding: utf-8 -*-
# TODO: DEPRECATED?
from agents.client_agent import ClientAgent
from core.message_factory import MessageFactory
import sys
if __name__ == "__main__":
    a = ClientAgent("piotrek@"+sys.argv[1], "secret")
    a.start()
    factory = MessageFactory()
    factory.set_sender('piotrek')
    factory.set_content(sys.argv[2])
    #factory.set_recipients(['kuba', 'marek'])
    factory.set_recipients(['kuba'])
    a.sendMsg(factory.build())
    alive = True
    import time
    while alive:
        try:
            time.sleep(1)
        except KeyboardInterrupt:
            alive=False
    a.stop()
    sys.exit(0)