瀏覽代碼

Removed object instance count checking. (!)

We are doing it correctly now.  Instead of checking
to see if an object is active or not.  (Which is
the wrong way to do it.)
Steve Thielemann 5 年之前
父節點
當前提交
ca79199cef
共有 1 個文件被更改,包括 6 次插入18 次删除
  1. 6 18
      tcp-proxy.py

+ 6 - 18
tcp-proxy.py

@@ -168,10 +168,7 @@ class PlayerInput(object):
         return line
 
 class ProxyMenu(object):
-    count = 0
-
     def __init__(self, game):
-        ProxyMenu.count += 1
         self.nl = "\n\r"
         self.c = merge(Style.BRIGHT + Fore.YELLOW + Back.BLUE)
         self.r = Style.RESET_ALL
@@ -192,13 +189,8 @@ class ProxyMenu(object):
         self.keepalive.start(30)
         self.menu()
 
-    @classmethod
-    def total(cls):
-        return cls.count
-
     def __del__(self):
         log.msg("ProxyMenu {0} RIP".format(self))
-        ProxyMenu.count -= 1
 
     def whenDone(self):
         self.defer = defer.Deferred()
@@ -878,9 +870,7 @@ class Player(protocol.Protocol):
             self.queue_player.put(chunk)
         
         else:
-            # If there's an observer -- should I continue here?
-            log.msg("I'm being watched...")
-            # TIAS.
+            # There's an observer.  Don't continue.
             return
 
         if chunk == b"~":
@@ -898,14 +888,12 @@ class Player(protocol.Protocol):
 
         if chunk == b"|":
             # how can I tell if this is active or not?
-            log.msg(pformat(self.observer.dispatch))
+            # I no longer see a 'player' observer.  GOOD!
+            # log.msg(pformat(self.observer.dispatch))
 
-            if ProxyMenu.total() == 0:
-                # prompt = self.game.getPrompt()
-                # if re.match(r"Command \[TL=.* \(\?=Help\)\? :", prompt):
-                menu = ProxyMenu(self.game)
-            else:
-                log.msg("The menu is already active!")
+            # prompt = self.game.getPrompt()
+            # if re.match(r"Command \[TL=.* \(\?=Help\)\? :", prompt):
+            menu = ProxyMenu(self.game)