rparedis преди 1 година
родител
ревизия
cc31d606a7
променени са 4 файла, в които са добавени 13 реда и са изтрити 2 реда
  1. BIN
      pypdevs.tgz
  2. 9 1
      src/pypdevs/basesimulator.py
  3. 3 0
      src/pypdevs/realtime/threadingPython.py
  4. 1 1
      src/pypdevs/realtime/threadingTkInter.py

BIN
pypdevs.tgz


+ 9 - 1
src/pypdevs/basesimulator.py

@@ -1095,7 +1095,15 @@ class BaseSimulator(Solver):
                 self.threading_backend.wait(wait_time, self.runsim)
                 return True
             try:
-                portname, event_value = interrupt.split(" ")
+                info = interrupt.split(" ")
+                portname = info[0]
+                event_value = " ".join(info[1:])
+                if event_value[0] in "([{":  # also allow tuples, lists or dictionaries
+                    try:
+                        event_value = eval(event_value)
+                    except: pass
+                # event_value = eval(" ".join(info[1:]))
+                # portname, event_value = interrupt.split(" ")
                 event_port = self.portmap[portname]
             except ValueError:
                 # Couldn't split, means we should stop

+ 3 - 0
src/pypdevs/realtime/threadingPython.py

@@ -15,6 +15,7 @@
 
 from threading import Event, Thread, Lock
 import pypdevs.accurate_time as time
+from pypdevs.infinity import INFINITY
 
 class ThreadingPython(object):
     """
@@ -34,6 +35,8 @@ class ThreadingPython(object):
         :param delay: time to wait
         :param func: the function to call
         """
+        if delay == INFINITY:
+            return
         #NOTE this call has a granularity of 5ms in Python <= 2.7.x in the worst case, so beware!
         #     the granularity seems to be much better in Python >= 3.x
         p = Thread(target=ThreadingPython.callFunc, args=[self, delay, func])

+ 1 - 1
src/pypdevs/realtime/threadingTkInter.py

@@ -82,4 +82,4 @@ class ThreadingTkInter(object):
         """
         if not self.last_infinity:
             self.queue.append(None)
-        self.unlock()
+            self.unlock()