From 6bc5e159266b20b2f8715ceccebbafd3d9c197bd Mon Sep 17 00:00:00 2001 From: Cristian Garcia Date: Thu, 06 Jun 2013 15:53:17 +0000 Subject: Quitando terminal --- diff --git a/CristianEdit/Run.py b/CristianEdit/Run.py deleted file mode 100644 index f214401..0000000 --- a/CristianEdit/Run.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# objetos.py por: -# Cristian García -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -import os - -from threading import Thread -from Terminal import Terminal - - -def ejecutar(direccion): - - if direccion != 'Sin dirección': - - bash = os.path.expanduser('~/.cristianedit/bash.sh') - texto = 'chmod +x %s \nexec %s' % (direccion, direccion) - - comando = open(bash, 'w') - comando.write(texto) - comando.close() - - os.system('chmod +x %s' % bash) - - string = '' - - for x in direccion.split('/')[:-1]: - string = string + x + '/' - - terminal = Terminal(string) diff --git a/CristianEdit/Run.pyc b/CristianEdit/Run.pyc deleted file mode 100644 index aac70df..0000000 --- a/CristianEdit/Run.pyc +++ /dev/null Binary files differ diff --git a/CristianEdit/Terminal.py b/CristianEdit/Terminal.py deleted file mode 100644 index af4163c..0000000 --- a/CristianEdit/Terminal.py +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# Terminal.py por: -# Cristian García -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -import os -import objetos - -from gi.repository import Gtk -from gi.repository import Vte - - -class Terminal(Gtk.Window): - - def __init__(self, direccion): - - Gtk.Window.__init__(self) - - self.connect('destroy', self.salir) - - self.set_size_request(700, 500) - self.set_title('Terminal') - - self.terminales = [] - self.etiquetas = [] - self.direccion = direccion - self.primera_vez = True - - self.toolbar = objetos.Terminal_Toolbar(self) - self.notebook = objetos.Terminal_Notebook() - self.vbox = Gtk.VBox() - - self.notebook.set_show_tabs(False) - - self.vbox.pack_start(self.toolbar, False, False, 5) - self.vbox.pack_start(self.notebook, True, True, 0) - - self.crear_pagina() - - self.connect('destroy', self.salir) - self.notebook.connect('boton-cerrar-clicked', self.cerrar_desde_boton) - - self.add(self.vbox) - self.show_all() - - def salir(self, *args): - - #self.destroy() - Gtk.main_quit() - - def crear_pagina(self, *args): - """Crea una página en el cuaderno de fichas, - y selecciona un emulador a utilizar(bash, - o un archivo que ejecuta otro archivo)""" - - if self.primera_vez: - emulacion = (os.path.expanduser('~/.cristianedit/bash.sh'),) - self.primera_vez = False - - else: - emulacion = ('/bin/bash',) - - terminal = objetos.Terminal(self.direccion, emulacion) - label = Gtk.Label('Terminal') - - self.notebook.nueva_pagina(terminal, label) - self.terminales.append(terminal) - self.etiquetas.append(label) - - terminal.connect('window-title-changed', self.title_changed) - terminal.connect('child-exited', self.cerrar_terminal) - - self.notebook.set_show_tabs(self.notebook.get_n_pages() > 1) - - self.show_all() - - def title_changed(self, widget): - """Establece el texto a la etiqueta - de la etiqueta de la ficha actual""" - - numero = self.notebook.get_n_pages() - 1 - label = self.etiquetas[numero] - - label.set_text(widget.get_window_title()) - - def cerrar_terminal(self, widget): - """Cierra una página desde el - comando 'exit' de una terminal""" - - vbox = widget.get_parent() - numero = self.notebook.get_n_pages() - 2 - - if numero > -1: - self.cerrar_desde_boton(None, vbox) - - else: - self.salir() - - def cerrar_desde_boton(self, widget, objeto): - """Cierra una página desde el botón - de cerrado en la ficha del cuaderno""" - - numero = self.notebook.page_num(objeto) - terminal = self.terminales[numero] - label = self.etiquetas[numero] - - self.terminales.remove(terminal) - self.etiquetas.remove(label) - - terminal.destroy() - label.destroy() - - self.notebook.borrar_pagina(numero) - self.notebook.set_show_tabs(self.notebook.get_n_pages() > 1) diff --git a/CristianEdit/Terminal.pyc b/CristianEdit/Terminal.pyc deleted file mode 100644 index e432fbe..0000000 --- a/CristianEdit/Terminal.pyc +++ /dev/null Binary files differ diff --git a/CristianEdit/objetos.py b/CristianEdit/objetos.py index 7f77fec..d2f4b22 100644 --- a/CristianEdit/objetos.py +++ b/CristianEdit/objetos.py @@ -1292,153 +1292,3 @@ class Teclado(Gtk.Dialog): string2 = string2 + x2 buffer.set_text(string1 + string2) - - -class TerminalToolbar(Gtk.Toolbar): - - def __init__(self, padre): - - Gtk.Toolbar.__init__(self) - - self.padre = padre - - self.toolbutton(Gtk.STOCK_NEW, 'Nueva terminal', self.crear_pagina) - - def crear_pagina(self, widget): - """Llama a la función de - CristianEdit con el mismo nombre""" - - self.padre.crear_pagina() - - def toolbutton(self, stock, tooltip=None, callback=None): - """Crea un boton para el Widget clase""" - - toolbutton = Gtk.ToolButton(stock) - self.add(toolbutton) - - if callback: - toolbutton.connect('clicked', callback) - - if tooltip != None: - toolbutton.set_tooltip_text(tooltip) - - -class Terminal(Vte.Terminal): - - def configurar(self): - """Configura al Widget clase""" - - #shape: 0: Normal - Block - # 1: Barra simple - Ibeam - # 2: Guión bajo - Underline - - shape = Vte.TerminalCursorShape(2) - fg_color = '#00FF00' - bg_color = '#000000' - lineas = 1000 - fuente = 'Monospace' - transparente = True - nivel = 0.50 - - self.set_cursor_shape(shape) - self.set_colors(Gdk.color_parse(fg_color), - Gdk.color_parse(bg_color), []) - - self.set_scrollback_lines(lineas) - self.set_font(Pango.FontDescription(fuente)) - self.set_background_transparent(transparente) - self.set_background_saturation(nivel) - - def __init__(self, direccion, emulacion): - - Vte.Terminal.__init__(self) - - vteflags = Vte.PtyFlags(1) - lista = ['algo'] - glibflags = GLib.SpawnFlags(1) - algo = 'algo' - - self.configurar() - - #banderas de vte, dirección, emulación, lista, banderas de glib, función - - self.fork_command_full(vteflags, - direccion, - emulacion, - lista, - glibflags, - self.benvienida, - algo) - - def benvienida(self, widget): - """Imprime un texto cuando - recién se crea el Widget clase""" - - print G.BIENVENIDA - - def tecla(self, widget, event): - """Obtiene el evento de teclado y - llama a la función evento""" - - tecla = Gdk.keyval_name(event.keyval) - self.evento(event) - - def evento(self, event): - """Reacciona a los eventos de teclado""" - - pass - - -class TerminalNotebook(Gtk.Notebook): - - __gsignals__ = { - 'boton-cerrar-clicked': (GObject.SIGNAL_RUN_FIRST, - None, (object,)) - } - - def __init__(self): - - Gtk.Notebook.__init__(self) - - self.set_scrollable(True) - - def nueva_pagina(self, objeto, label): - """Crea una página al Widget clase""" - - vbox = Gtk.VBox() - scrolled = Gtk.ScrolledWindow() - hbox = Gtk.HBox() - boton = Gtk.ToolButton(Gtk.STOCK_CLOSE) - - hbox.pack_start(label, False, False, 0) - hbox.pack_start(boton, False, False, 0) - - vbox.add(scrolled) - scrolled.add(objeto) - - self.append_page(vbox, hbox) - - hbox.show_all() - - boton.connect('clicked', self.cerrar, vbox) - - def borrar_pagina(self, numero=None): - """Borra una página según un número, o la actual""" - - if not numero: - numero = self.get_current_page() - - self.remove_page(numero) - - def desplazar_al_final(self): - """Activa la última pestaña""" - - numero = self.get_n_pages() - for x in range(0, numero): - self.next_page() - - def cerrar(self, widget, objeto): - """Emite la señal 'boton-cerrar-clicked'""" - - self.emit('boton-cerrar-clicked', objeto) - -- cgit v0.9.1