adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[adonthell-wastesedge-commits] Release_0-3-1 06c1205 149/237: FIXED Pyth


From: Kai Sterker
Subject: [adonthell-wastesedge-commits] Release_0-3-1 06c1205 149/237: FIXED Python console
Date: Mon, 25 Jul 2016 18:15:08 +0000 (UTC)

tag: Release_0-3-1
commit 06c1205e3217970e9e947969c729475ceefd9fe1
Author: adondev <adondev>
Commit: adondev <adondev>

    FIXED Python console
---
 scripts/modules/console.py                          |   18 ++++--------------
 scripts/schedules/mapcharacters/keyboard_control.py |   17 +++++++++++------
 2 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/scripts/modules/console.py b/scripts/modules/console.py
index fe944ad..06596ca 100755
--- a/scripts/modules/console.py
+++ b/scripts/modules/console.py
@@ -25,13 +25,10 @@ class console (adonthell.win_container):
         self.namespace = ns
         self.history = []
         self.hist_idx = 0
-        self.thisown = 0
-        self.quit = 1
 
         # read the old history
         self.read_history ()
 
-        self.py_signal_connect (self.on_destroy, adonthell.win_event_DESTROY)
         self.py_signal_connect (self.on_update, adonthell.win_event_UPDATE)
         
         # -- get font and theme
@@ -69,10 +66,6 @@ class console (adonthell.win_container):
         self.entry.set_focus (1)
         self.entry.set_activate (1)
 
-    # -- cleanup --
-    def __del__(self):
-        self.write_history ()
-
     # -- callback for command execution
     def on_execute (self):
         text = self.entry.text_char ()
@@ -94,16 +87,13 @@ class console (adonthell.win_container):
                 error = "Error:\n  " + str (type) + ":\n  \"" + str (value) + 
"\""
                 self.entry.set_text (error)
 
-    # -- callback to close the window
-    def on_destroy (self):
-        return self.quit
-
-    # -- catch relevant keypresses 
+    # -- catch relevant keypresses
     def on_update (self):
         # -- quit
         if adonthell.input_has_been_pushed (adonthell.SDLK_TAB):
-            self.quit = 0
-        
+            self.write_history ()
+            adonthell.gamedata_engine ().main_quit ()
+
         # -- clear screen
         elif adonthell.input_has_been_pushed (adonthell.SDLK_DELETE):
             self.entry.set_text ("")
diff --git a/scripts/schedules/mapcharacters/keyboard_control.py 
b/scripts/schedules/mapcharacters/keyboard_control.py
index 6b90a2d..6a719a4 100755
--- a/scripts/schedules/mapcharacters/keyboard_control.py
+++ b/scripts/schedules/mapcharacters/keyboard_control.py
@@ -152,12 +152,17 @@ class keyboard_control:
         # -- python console
         elif input_has_been_pushed (SDLK_TAB):
             import console
+
             c = console.console (globals ())
-            c.thisown = C
-            # c.py_signal_connect (self.on_data_screen_close, win_event_CLOSE)
-            # Stop updating the map
-            # gamedata_map_engine ().set_should_update_map (0)
             c.set_activate (1)
-            win_manager_add (c)
-            win_manager_set_focus (c)
+
+            # -- Stop updating the map
+            gamedata_engine ().set_update_map (0)
+
+            # -- open the console
+            gamedata_engine ().main (c, "console")
+
+            # -- continue
+            gamedata_engine ().set_update_map (1)
+
             c = None



reply via email to

[Prev in Thread] Current Thread [Next in Thread]