diff options
author | Cristian Garcia <cristian99garcia@gmail.com> | 2013-05-25 20:59:52 (GMT) |
---|---|---|
committer | Cristian Garcia <cristian99garcia@gmail.com> | 2013-05-25 22:12:23 (GMT) |
commit | c019e3b0201de3a2da9472cbaeb8116172a8f48c (patch) | |
tree | a3820e3f1c89b01ce377280da30fac40507d2981 | |
parent | 09f83b7d6ffcefc4d748b9a622301eecbe954d36 (diff) |
Agregando para setear la terminal desde los botoncitos para bash e ipython
-rw-r--r-- | WorkPanel.py | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/WorkPanel.py b/WorkPanel.py index 7238fcd..f3bed44 100644 --- a/WorkPanel.py +++ b/WorkPanel.py @@ -426,36 +426,39 @@ class Terminal(Vte.Terminal): Vte.Terminal.__init__(self) - self.fork_command_full(Vte.PtyFlags(0), - os.environ["HOME"], - ('/bin/bash',), - [], - GLib.SpawnFlags(0), - self.abriendo, - 'algo') - - self.connect('child-exited', self.reabrir) + self.emulacion = '/bin/bash' + + self.setear(self.emulacion) + self.connect('child-exited', self.__reabrir) - def abriendo(self, widget): + def __abriendo(self, widget): """ Cuando recién abre la terminal. """ print '\n' - def reabrir(self, widget): + def setear(self, emulacion): """ - Reinicia la Terminal para que se pueda seguir usando. + Setea todo y reinicia. """ + self.emulacion = emulacion self.fork_command_full(Vte.PtyFlags(0), os.environ["HOME"], - ('/bin/bash',), + (self.emulacion,), [], GLib.SpawnFlags(0), - self.abriendo, + self.__abriendo, 'algo') + def __reabrir(self, widget): + """ + Reinicia la Terminal para que se pueda seguir usando. + """ + + self.setear(self.emulacion) + class DebugNotebook(Gtk.Notebook): def __init__(self): @@ -474,11 +477,25 @@ class DebugNotebook(Gtk.Notebook): boton_copiar = Gtk.Button(None, Gtk.STOCK_COPY) boton_pegar = Gtk.Button(None, Gtk.STOCK_PASTE) + boton_bash = Gtk.Button('_Bash') + boton_ipython = Gtk.Button('_Ipython') + + boton_bash.set_tooltip_text('Usar bash como línea de ordenes') + boton_ipython.set_tooltip_text('Usar ipython como línea de ordenes') + + boton_bash.set_use_underline(True) + boton_ipython.set_use_underline(True) + hbox.pack_start(boton_copiar, False, False, 5) hbox.pack_start(boton_pegar, False, False, 5) + hbox.pack_end(boton_bash, False, False, 0) + hbox.pack_end(boton_ipython, False, False, 0) + boton_copiar.connect('clicked', self.__actuar_sobre_terminal, 'copiar') boton_pegar.connect('clicked', self.__actuar_sobre_terminal, 'pegar') + boton_bash.connect('clicked', self.__setear_terminal, '/bin/bash') + boton_ipython.connect('clicked', self.__setear_terminal, '/usr/bin/ipython') self.append_page(vbox, Gtk.Label('Terminal')) @@ -493,3 +510,9 @@ class DebugNotebook(Gtk.Notebook): elif accion == 'pegar': self.terminal.paste_clipboard() + def __setear_terminal(self, widget, emulacion): + """ + Setea la terminal. + """ + + self.terminal.setear(emulacion) |