Kaynağa Gözat

ProxyMenu just sends "d" on exit. Forget the original prompt.

Steve Thielemann 5 yıl önce
ebeveyn
işleme
62a7c0f0dc
1 değiştirilmiş dosya ile 10 ekleme ve 4 silme
  1. 10 4
      flexible.py

+ 10 - 4
flexible.py

@@ -880,16 +880,20 @@ class ProxyMenu(object):
 
         elif key == "X":
             self.queue_game.put(self.c + key + self.r + self.nl)
+            self.queue_game.put("Proxy done." + self.nl)
             self.observer.load(self.save)
             self.save = None
             # It isn't running (NOW), so don't try to stop it.
             # self.keepalive.stop()
             self.keepalive = None
-            self.queue_game.put(self.prompt)
+            # Ok, this is a HORRIBLE idea, because the prompt might be
+            # outdated.
+            # self.queue_game.put(self.prompt)
             self.prompt = None
 
             # Possibly:  Send '\r' to re-display the prompt
             # instead of displaying the original one.
+            self.game.queue_player.put("d")
 
             # Were we asked to do something when we were done here?
             if self.defer:
@@ -906,7 +910,7 @@ class ProxyMenu(object):
         self.observer.connect("player", self.scripts_player)
         self.scripts_menu()
 
-    def deactivate_scripts_menu(self):
+    def deactivate_scripts_menu(self, *_):
         self.observer.disconnect("player", self.scripts_player)
         self.observer.connect("player", self.player)        
         self.welcome_back()
@@ -936,8 +940,10 @@ class ProxyMenu(object):
             # Activate this magical event here
             ports = ScriptPort(self.game)
             d = ports.whenDone()
-            d.addCallback(self.scripts_menu)
-            d.addErrback(self.scripts_menu)
+            # d.addCallback(self.scripts_menu)
+            # d.addErrback(self.scripts_menu)
+            d.addCallback(self.deactivate_scripts_menu)
+            d.addErrback(self.deactivate_scripts_menu)
             return
         elif key == 'X':
             self.queue_game.put(self.c + key + self.r + self.nl)