def __init__(self): Gtk.Toolbar.__init__(self) self.lista = None self.accion = None self.iter = None self.insert(get_separador(draw=False, ancho=0, expand=True), -1) archivo = os.path.join(JAMediaWidgetsBASE, "Iconos", "alejar.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(0.8)) boton.set_tooltip_text("Cancelar") boton.connect("clicked", self.cancelar) self.insert(boton, -1) item = Gtk.ToolItem() item.set_expand(True) self.label = Gtk.Label("") self.label.show() item.add(self.label) self.insert(item, -1) archivo = os.path.join(JAMediaWidgetsBASE, "Iconos", "acercar.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(0.8)) boton.set_tooltip_text("Aceptar") boton.connect("clicked", self.__realizar_accion) self.insert(boton, -1) self.insert(get_separador(draw=False, ancho=0, expand=True), -1) self.show_all()
def __init__(self): Gtk.Toolbar.__init__(self) self.insert(get_separador(draw=False, ancho=0, expand=True), -1) archivo = os.path.join(JAMediaWidgetsBASE, "Iconos", "button-cancel.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(0.8)) boton.set_tooltip_text("Cancelar") boton.connect("clicked", self.cancelar) self.insert(boton, -1) self.insert(get_separador(draw=False, ancho=3, expand=False), -1) item = Gtk.ToolItem() self.label = Gtk.Label("") self.label.show() item.add(self.label) self.insert(item, -1) self.insert(get_separador(draw=False, ancho=3, expand=False), -1) archivo = os.path.join(JAMediaWidgetsBASE, "Iconos", "dialog-ok.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(0.8)) boton.set_tooltip_text("Aceptar") boton.connect("clicked", self.__emit_salir) self.insert(boton, -1) self.insert(get_separador(draw=False, ancho=0, expand=True), -1) self.show_all()
def agregar_terminal(self, path=os.environ["HOME"], interprete="/bin/bash", ejecutar=None): """ Agrega una nueva Terminal al Notebook. """ ### Label. hbox = Gtk.HBox() archivo = os.path.join(BASEPATH, "Iconos", "button-cancel.svg") boton = get_boton(archivo, pixels=get_pixels(Width_Button), tooltip_text="Cerrar") text = "bash" if "bash" in interprete: text = "bash" elif "python" in interprete: text = "python" if "ipython" in interprete: text = "ipython" label = Gtk.Label(text) hbox.pack_start(label, False, False, 0) hbox.pack_start(boton, False, False, 0) ### Area de Trabajo. scroll = Gtk.ScrolledWindow() scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) terminal = Terminal(path=path, interprete=interprete, archivo=ejecutar, fuente=self.fuente) scroll.add(terminal) self.append_page(scroll, hbox) label.show() self.show_all() boton.connect("clicked", self.__cerrar) terminal.connect("reset", self.__re_emit_reset) self.set_current_page(-1) return terminal
def __init__(self): gtk.Toolbar.__init__(self) self.modify_bg(0, get_color("NEGRO")) self.modify_fg(0, get_color("BLANCO")) self.insert(get_separador(draw=False, ancho=0, expand=True), -1) archivo = os.path.join(JAMediaWidgetsBASE, "Iconos", "alejar.png") boton = get_boton(archivo, flip=False, pixels=get_pixels(0.8)) boton.set_tooltip_text("Cancelar") boton.connect("clicked", self.cancelar) self.insert(boton, -1) self.insert(get_separador(draw=False, ancho=3, expand=False), -1) item = gtk.ToolItem() self.label = gtk.Label("") self.label.modify_fg(0, get_color("BLANCO")) self.label.show() item.add(self.label) self.insert(item, -1) self.insert(get_separador(draw=False, ancho=3, expand=False), -1) archivo = os.path.join(JAMediaWidgetsBASE, "Iconos", "acercar.png") boton = get_boton(archivo, flip=False, pixels=get_pixels(0.8)) boton.set_tooltip_text("Aceptar") boton.connect("clicked", self.__emit_salir) self.insert(boton, -1) self.insert(get_separador(draw=False, ancho=0, expand=True), -1) self.show_all()
def __init__(self): Gtk.Toolbar.__init__(self, orientation=Gtk.Orientation.HORIZONTAL) ### Interpretes disponibles. bash_path = None python_path = None paths = os.environ["PATH"].split(':') for path in paths: if 'bash' in os.listdir(path): bash_path = os.path.join(path, 'bash') if 'python' in os.listdir(path): python_path = os.path.join(path, 'python') if bash_path and python_path: break for path in paths: if 'ipython' in os.listdir(path): python_path = os.path.join(path, 'ipython') ### Construcción. archivo = os.path.join(BASEPATH, "Iconos", "edit-copy.svg") boton = get_boton(archivo, pixels=get_pixels(Width_Button), tooltip_text="Copiar") boton.connect("clicked", self.__emit_accion, "copiar") self.insert(boton, -1) archivo = os.path.join(BASEPATH, "Iconos", "editpaste.svg") boton = get_boton(archivo, pixels=get_pixels(Width_Button), tooltip_text="Pegar") boton.connect("clicked", self.__emit_accion, "pegar") self.insert(boton, -1) self.insert(get_separador(draw=False, ancho=0, expand=True), -1) ### Botón Formato. archivo = os.path.join(BASEPATH, "Iconos", "font.svg") boton = get_boton(archivo, pixels=get_pixels(Width_Button), tooltip_text="Fuente") boton.connect("clicked", self.__emit_formato) self.insert(boton, -1) ### Botón Agregar. archivo = os.path.join(BASEPATH, "Iconos", "tab-new.svg") boton = get_boton(archivo, pixels=get_pixels(Width_Button), tooltip_text="Nueva Terminal") boton.connect("clicked", self.__emit_accion, "agregar") self.insert(boton, -1) self.insert(get_separador(draw=False, ancho=10, expand=False), -1) ### Botón bash. archivo = os.path.join(BASEPATH, "Iconos", "bash.svg") boton = get_boton(archivo, pixels=get_pixels(Width_Button), tooltip_text="Terminal bash") boton.connect("clicked", self.__emit_reset, bash_path) self.insert(boton, -1) ### Botón python. archivo = os.path.join(BASEPATH, "Iconos", "python.svg") boton = get_boton(archivo, pixels=get_pixels(Width_Button), tooltip_text="Terminal python") boton.connect("clicked", self.__emit_reset, python_path) self.insert(boton, -1) self.show_all()