[Sugar-devel] [PATCH Terminal] Don't save a data file in journal

S. Daniel Francis francis at sugarlabs.org
Mon Jun 4 15:41:19 EDT 2012


This patch is temporary until we solve the problem with the method
Vte.Terminal.get_text

Signed-off-by: Daniel Francis <francis at sugarlabs.org>
---
 terminal.py |   65 ++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 33 insertions(+), 32 deletions(-)

diff --git a/terminal.py b/terminal.py
index 6918e3f..16d39f5 100644
--- a/terminal.py
+++ b/terminal.py
@@ -467,38 +467,39 @@ class TerminalActivity(activity.Activity):
             self._next_tab_button.props.sensitive = True

     def write_file(self, file_path):
-        if not self.metadata['mime_type']:
-            self.metadata['mime_type'] = 'text/plain'
-
-        data = {}
-        data['current-tab'] = self._notebook.get_current_page()
-        data['tabs'] = []
-
-        for i in range(self._notebook.get_n_pages()):
-            page = self._notebook.get_nth_page(i)
-
-            def selected_cb(terminal, c, row, cb_data):
-                return 1
-            scrollback_text = page.vt.get_text(selected_cb, False)
-
-            scrollback_lines = scrollback_text.split('\n')
-
-            # Note- this currently gets the child's initial environment
-            # rather than the current environment, making it not very useful.
-            environment = open('/proc/%d/environ' %
-                               page.pid, 'r').read().split('\0')
-
-            cwd = os.readlink('/proc/%d/cwd' % page.pid)
-
-            tab_state = {'env': environment, 'cwd': cwd,
-                         'scrollback': scrollback_lines}
-
-            data['tabs'].append(tab_state)
-
-        fd = open(file_path, 'w')
-        text = simplejson.dumps(data)
-        fd.write(text)
-        fd.close()
+        return
+#        if not self.metadata['mime_type']:
+#            self.metadata['mime_type'] = 'text/plain'
+#
+#        data = {}
+#        data['current-tab'] = self._notebook.get_current_page()
+#        data['tabs'] = []
+#
+#        for i in range(self._notebook.get_n_pages()):
+#            page = self._notebook.get_nth_page(i)
+#
+#            def selected_cb(terminal, c, row, cb_data):
+#                return 1
+#            scrollback_text = page.vt.get_text(selected_cb, False)
+#
+#            scrollback_lines = scrollback_text.split('\n')
+#
+#            # Note- this currently gets the child's initial environment
+#            # rather than the current environment, making it not very useful.
+#            environment = open('/proc/%d/environ' %
+#                               page.pid, 'r').read().split('\0')
+#
+#            cwd = os.readlink('/proc/%d/cwd' % page.pid)
+#
+#            tab_state = {'env': environment, 'cwd': cwd,
+#                         'scrollback': scrollback_lines}
+#
+#            data['tabs'].append(tab_state)
+#
+#        fd = open(file_path, 'w')
+#        text = simplejson.dumps(data)
+#        fd.write(text)
+#        fd.close()

     def _get_conf(self, conf, var, default):
         if conf.has_option('terminal', var):
-- 
1.7.10.2


More information about the Sugar-devel mailing list