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

Rafael Ortiz rafael at activitycentral.com
Mon Jun 4 16:11:51 EDT 2012


On Mon, Jun 4, 2012 at 2:46 PM, S. Daniel Francis <francis at sugarlabs.org>wrote:

> Commited as:
>
> http://git.sugarlabs.org/terminal/mainline/commit/5bff52765091225a1ef4095812064337c0b48dd3
>
> Cheers.
>
> 2012/6/4 S. Daniel Francis <francis at sugarlabs.org>:
>
> > 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
>
> Thanks Daniel, I just added a comment on the sources about why we are
making this patch.


Cheers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120604/a4e51ef1/attachment-0001.html>


More information about the Sugar-devel mailing list