Explorar el Código

small fixed, worked on PinAPIBee

digital hace 8 años
padre
commit
813c40e904
Se han modificado 3 ficheros con 18 adiciones y 9 borrados
  1. 6 4
      lib/beewatch/gui/__init__.py
  2. 11 4
      lib/beewatch/server/__init__.py
  3. 1 1
      server.py

+ 6 - 4
lib/beewatch/gui/__init__.py

@@ -101,10 +101,11 @@ class ChildSettings(digilib.gui.ChildSettings):
         pass
 
 class BeeWindow(digilib.gui.WindowBase):
-    def __init__(self,host,port):
+    def __init__(self,host,port,af_family):
         super(BeeWindow,self).__init__(title="BeeWatch")
         self.host = host
         self.port = port
+        self.af_family = af_family
         self.client = None
         self.set_border_width(10)
         self.tb = digilib.misc.Container()
@@ -196,9 +197,10 @@ class BeeWindow(digilib.gui.WindowBase):
         return grid
     def make_client(self):
         client = digilib.network.Client(
-            self.host,
-            self.port,
-            self.child_console.add_msg_threadsafe,
+            host=self.host,
+            port=self.port,
+            af_family=self.af_family,
+            handle_data_func=self.child_console.add_msg_threadsafe,
         )
         return client
     def get_client(self):

+ 11 - 4
lib/beewatch/server/__init__.py

@@ -1,4 +1,4 @@
-#! /usr/bin/python3.5
+#! /usr/bin/env python3.5
 # Copyright 2017 Digital
 #
 # This file is part of BeeWatch.
@@ -60,6 +60,11 @@ class BeeAPI(object):
         super(BeeAPI, self).__init__()
         lapi.info("BeeAPI")
         self.pin_api = beewatch.pinapi.PinAPIBee()
+        self.text_to_func = {
+            "turn_left":self.pin_api.turn_left,
+            "turn_left":self.pin_api.turn_right,
+            "turn":self.pin_api.turn,
+        }
     def turn_left(self,respond_method):
         self.pin_api.turn_left()
         respond_method("heyooo")
@@ -75,9 +80,11 @@ class BeeAPI(object):
         respond_method("doing three things at once")
     def log(self,*args):
         lapi.debug(args)
-    text_to_func = {
-    "turn_left":turn_left,
-    }
+    # text_to_func = {
+    #     "turn_left":turn_left,
+    #     "turn_left":turn_right,
+    #     "turn":turn,
+    # }
 
 class ConnHandlerBeeWatch(digilib.network.ConnHandlerBase):
     def __init__(self, socket, addr, server, bee_api=None):

+ 1 - 1
server.py

@@ -87,7 +87,7 @@ group_af_family.add_argument(
 args = parser.parse_args()
 print(args)
 if args.debug:
-    with open("bee_logging.yaml") as f:
+    with open("config/logging.yaml") as f:
         data = f.read()
     config = yaml.safe_load(data)
     logging.config.dictConfig(config)