summaryrefslogtreecommitdiffstats
path: root/cholerab/cholerab-live/cholerab.py
diff options
context:
space:
mode:
authortv <tv@also>2011-08-06 00:57:39 +0200
committertv <tv@also>2011-08-06 00:57:39 +0200
commitb1ff309ce79966799a274270b583621378e95efe (patch)
treea8c1ba02a20e6e4c0bb1d49e593f2dacf3fba329 /cholerab/cholerab-live/cholerab.py
parent0d23f24ac5a5a59d15ed8127447a738230652f7d (diff)
parentc823c6fcfc9b655bd18c202cfcaed3c7f77950ab (diff)
Merge remote-tracking branch '52e446de-9909-430a-becf-0c1b94e08fc6/4b74cb04-c218-4cbd-8cd7-e73623ef87f6'
Diffstat (limited to 'cholerab/cholerab-live/cholerab.py')
-rwxr-xr-xcholerab/cholerab-live/cholerab.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/cholerab/cholerab-live/cholerab.py b/cholerab/cholerab-live/cholerab.py
new file mode 100755
index 00000000..eb9e66df
--- /dev/null
+++ b/cholerab/cholerab-live/cholerab.py
@@ -0,0 +1,36 @@
+#!/usr/bin/python2
+# -*- coding: utf-8 -*-
+import curses,time
+from view import CursesView
+from chol_net import CholerabMulicastNet
+import logging
+logging.basicConfig(filename='here.log',level=logging.DEBUG)
+log = logging.getLogger('main')
+class Cholerab:
+ def __init__(self):
+ self.view = CursesView(cholerab=self)
+ self.transport = CholerabMulicastNet(cholerab=self)
+ def send_char(self,x,y,char):
+ log.info("Sending %s at (%d,%d) to connected peers" %(char,x,y))
+ self.transport.send_char(x,y,char)
+
+ def write_char(self,x,y,char):
+ log.info("Writing %s at (%d,%d) to view" %(char,x,y))
+ self.view.write_char(x,y,char,user=2)
+ def stop(self):
+ self.view.stop()
+ self.transport.stop()
+ def main(self):
+ self.view.start()
+ self.transport.start()
+ self.view.join()
+ #after view dies, kill the transport as well
+ self.transport.stop()
+ self.transport.join()
+def main():
+ log.debug('started main')
+ chol = Cholerab()
+ chol.main()
+
+if __name__ == "__main__":
+ main()