Просмотр исходного кода

add network function to console

mikymod 12 лет назад
Родитель
Сommit
f0cebda1f5
1 измененных файлов с 8 добавлено и 15 удалено
  1. 8 15
      tools/gui/console/console.py

+ 8 - 15
tools/gui/console/console.py

@@ -3,18 +3,11 @@ import os
 import socket
 
 from gi.repository import Gtk
-from gi.repository import Gdk
-
-from pycrown import Repository
-    
-
-
 
 #------------------------------------------------------------------------------
 class Console:
 
-    def __init__(self):
-        
+    def __init__(self):   
         builder = Gtk.Builder()
         builder.add_from_file("ui/console.glade")
         
@@ -28,27 +21,27 @@ class Console:
 
         builder.connect_signals(self)
 
-        #m_sock = socket.create_connection(('localhost', 10000))
+        #self.m_sock = socket.create_connection(('localhost', 10000))
 
         Gtk.main()
     
     def on_destroy(self, *args):
-
-        #m_sock.close()
+        #self.m_sock.close()
         Gtk.main_quit(*args)
 
     def on_key_pressed(self, entry, event):
-        if event.keyval == 0xff0d:
+        # If return is pressed, run command
+        if event.keyval == 0xff0d:  
             self.run_command(entry.get_text())
 
     def run_command(self, cmd):
+        # Send command to Crown
+            #self.m_sock.send(cmd)
+        # Print command to console
         end_iter = self.m_buffer.get_end_iter()
         a_string = "> " + cmd + "\n"
         self.m_buffer.insert(end_iter, a_string, len(a_string))
-
         self.m_entry.set_text("")
-
-
     
 
 #------------------------------------------------------------------------------