def __init__(self): Gtk.EventBox.__init__(self) toolbar = Gtk.Toolbar() toolbar.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse('#f0e6aa')) toolbar.modify_fg(Gtk.StateType.NORMAL, Gdk.color_parse('#000000')) self.anterior = get_boton(os.path.join(icons, "go-next-rtl.svg"), pixels=get_pixels(0.5), tooltip_text="Anterior") self.anterior.connect("clicked", self.__emit_accion) toolbar.insert(self.anterior, - 1) item = Gtk.ToolItem() item.set_expand(True) self.entry = Gtk.Entry() self.entry.show() item.add(self.entry) toolbar.insert(item, - 1) self.siguiente = get_boton(os.path.join(icons, "go-next.svg"), pixels=get_pixels(0.5), tooltip_text="Siguiente") self.siguiente.connect("clicked", self.__emit_accion) toolbar.insert(self.siguiente, - 1) self.entry.connect("changed", self.__emit_buscar) self.add(toolbar) self.show_all() self.anterior.set_sensitive(False) self.siguiente.set_sensitive(False)
def __init__(self): Gtk.Toolbar.__init__(self) self.anterior = get_boton( os.path.join(icons, "go-next-rtl.svg"), pixels=get_pixels(0.5), tooltip_text="Anterior") self.anterior.connect("clicked", self.__emit_accion) self.insert(self.anterior, - 1) item = Gtk.ToolItem() item.set_expand(True) self.entry = Gtk.Entry() self.entry.show() item.add(self.entry) self.insert(item, - 1) self.siguiente = get_boton( os.path.join(icons, "go-next.svg"), pixels=get_pixels(0.5), tooltip_text="Siguiente") self.siguiente.connect("clicked", self.__emit_accion) self.insert(self.siguiente, - 1) self.entry.connect("changed", self.__emit_buscar) self.show_all() self.anterior.set_sensitive(False) self.siguiente.set_sensitive(False)
def __init__(self): Gtk.Toolbar.__init__(self) # > toolbar interna toolbar = Gtk.Toolbar() archivo = os.path.join(BASE_PATH, "Iconos", "alejar.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(0.8)) boton.set_tooltip_text("Disminuir") boton.connect("clicked", self.__restar) toolbar.insert(boton, -1) item = Gtk.ToolItem() self.time_label = Gtk.Label("1.0") self.time_label.show() item.add(self.time_label) toolbar.insert(item, -1) archivo = os.path.join(BASE_PATH, "Iconos", "acercar.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(0.8)) boton.set_tooltip_text("Aumentar") boton.connect("clicked", self.__sumar) toolbar.insert(boton, -1) item = Gtk.ToolItem() label = Gtk.Label("Seg.") label.show() item.add(label) toolbar.insert(item, -1) archivo = os.path.join(BASE_PATH, "Iconos", "play.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(0.8)) boton.set_tooltip_text("Comenzar") boton.connect("clicked", self.__run) toolbar.insert(boton, -1) toolbar.show_all() # < toolbar interna item = Gtk.ToolItem() item.set_expand(True) frame = Gtk.Frame() frame.set_label("Ráfaga:") frame.set_label_align(0.5, 0.5) frame.show() frame.add(toolbar) item.add(frame) self.insert(item, -1) self.show_all()
def __agregar(self, widget): """ Función para agregar información de un autor. """ box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) entry1 = Gtk.Entry() entry2 = Gtk.Entry() remover = get_boton(os.path.join(icons, "list-remove.svg"), pixels=get_pixels(1.0), tooltip_text="Eliminar") agregar = get_boton(os.path.join(icons, "gtk-add.svg"), pixels=get_pixels(1.0), tooltip_text="Agregar") frame1 = Gtk.Frame() frame1.set_label("Nombre") frame2 = Gtk.Frame() frame2.set_label("Mail") frame1.add(entry1) frame2.add(entry2) box.pack_start(frame1, False, False, 5) box.pack_start(frame2, False, False, 0) box.pack_start(remover, False, False, 0) box.pack_start(agregar, False, False, 0) self.pack_start(box, False, False, 0) agregar.connect("clicked", self.__agregar) remover.connect("clicked", self.__quitar) self.show_all()
def __init__(self): Gtk.Toolbar.__init__(self) self.insert(get_separador(draw=False, ancho=3, expand=False), -1) imagen = Gtk.Image() icono = os.path.join( BASE_PATH, "Iconos", "JAMediaTerminal.svg") pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(icono, -1, get_pixels(0.6)) imagen.set_from_pixbuf(pixbuf) imagen.show() item = Gtk.ToolItem() item.add(imagen) self.insert(item, -1) self.insert(get_separador(draw=False, ancho=0, expand=True), -1) # Ayuda. archivo = os.path.join( BASE_PATH, "Iconos", "activity-help.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(0.8)) boton.set_tooltip_text("Ayuda") boton.connect("clicked", self.__emit_help) self.insert(boton, -1) # Salir. archivo = os.path.join( BASE_PATH, "Iconos", "button-cancel.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(0.8)) boton.set_tooltip_text("Salir") boton.connect("clicked", self.__emit_salir) self.insert(boton, -1) self.insert(get_separador(draw=False, ancho=3, expand=False), -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( BASE_PATH, "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 = VTETerminal( 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 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(BASE_PATH, "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 = VTETerminal(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 __desactivar(self, item): option, icon = item if option.get_sensitive(): icon_path = os.path.join(icons, icon) pixels = get_pixels(0.5) pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size( icon_path, pixels, pixels) imagen = option.get_icon_widget() imagen.set_from_pixbuf(pixbuf) option.set_sensitive(False)
def __activar(self, key): option, icon = self.dict_proyecto[key] if not option.get_sensitive(): icon_path = make_icon_active(os.path.join(icons, icon)) pixels = get_pixels(0.5) pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size( icon_path, pixels, pixels) imagen = option.get_icon_widget() imagen.set_from_pixbuf(pixbuf) option.set_sensitive(True)
def __init__(self): Gtk.Toolbar.__init__(self) self.color = get_color("BLANCO") self.actualizador = False self.insert(get_separador(draw=False, ancho=0, expand=True), -1) item = Gtk.ToolItem() item.set_expand(False) self.label = Gtk.Label("") self.label.show() item.add(self.label) self.insert(item, -1) archivo = os.path.join(BASE_PATH, "Iconos", "microfono.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(1)) boton.set_tooltip_text("Grabar") boton.connect("clicked", self.__emit_senial, "grabar") self.insert(boton, -1) self.insert(get_separador(draw=False, ancho=3, expand=False), -1) archivo = os.path.join(BASE_PATH, "Iconos", "configurar.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(1)) boton.set_tooltip_text("Configurar") boton.connect("clicked", self.__emit_senial, "configurar") self.insert(boton, -1) self.insert(get_separador(draw=False, ancho=3, expand=False), -1) archivo = os.path.join(BASE_PATH, "Iconos", "rotar.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(0.8)) boton.set_tooltip_text("Izquierda") boton.connect("clicked", self.__emit_rotar, 'Izquierda') self.insert(boton, -1) archivo = os.path.join(BASE_PATH, "Iconos", "rotar.svg") boton = get_boton(archivo, flip=True, pixels=get_pixels(0.8)) boton.set_tooltip_text("Derecha") boton.connect("clicked", self.__emit_rotar, 'Derecha') self.insert(boton, -1) archivo = os.path.join(BASE_PATH, "Iconos", "stop.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(0.8)) boton.set_tooltip_text("Detener") boton.connect("clicked", self.__emit_senial, "Reset") self.insert(boton, -1) self.insert(get_separador(draw=False, ancho=0, expand=True), -1) archivo = os.path.join(BASE_PATH, "Iconos", "salir.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(1)) boton.set_tooltip_text("Salir") boton.connect("clicked", self.__salir) self.insert(boton, -1) self.show_all()
def __init__(self): Gtk.Toolbar.__init__(self) self.insert(get_separador(draw=False, ancho=3, expand=False), -1) imagen = Gtk.Image() icono = os.path.join(BASE_PATH, "Iconos", "JAMediaTerminal.svg") pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size( icono, -1, get_pixels(0.6)) imagen.set_from_pixbuf(pixbuf) imagen.show() item = Gtk.ToolItem() item.add(imagen) self.insert(item, -1) self.insert(get_separador(draw=False, ancho=0, expand=True), -1) # Ayuda. archivo = os.path.join(BASE_PATH, "Iconos", "activity-help.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(0.8)) boton.set_tooltip_text("Ayuda") boton.connect("clicked", self.__emit_help) self.insert(boton, -1) # Salir. archivo = os.path.join(BASE_PATH, "Iconos", "button-cancel.svg") boton = get_boton(archivo, flip=False, pixels=get_pixels(0.8)) boton.set_tooltip_text("Salir") boton.connect("clicked", self.__emit_salir) self.insert(boton, -1) self.insert(get_separador(draw=False, ancho=3, expand=False), -1) self.show_all()
def __ejecutar_agregar_elemento(self, elementos): """ Agrega los items a la lista, uno a uno, actualizando. """ if not elementos: self.permitir_select = True self.seleccionar_primero() self.get_toplevel().set_sensitive(True) return False texto, path = elementos[0] descripcion = describe_uri(path) icono = None if descripcion: if descripcion[2]: # Es un Archivo tipo = describe_archivo(path) if 'video' in tipo or 'application/ogg' in tipo or \ 'application/octet-stream' in tipo: icono = os.path.join(BASEPATH, "Iconos", "video.svg") elif 'audio' in tipo: icono = os.path.join(BASEPATH, "Iconos", "sonido.svg") else: icono = os.path.join(BASEPATH, "Iconos", "sonido.svg") else: icono = os.path.join(BASEPATH, "Iconos", "sonido.svg") try: pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(icono, get_pixels(0.8), -1) self.modelo.append([pixbuf, texto, path]) except: pass elementos.remove(elementos[0]) GLib.idle_add(self.__ejecutar_agregar_elemento, elementos) return False
def __init__(self): Gtk.EventBox.__init__(self) toolbar = Gtk.Toolbar() toolbar.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse('#f0e6aa')) toolbar.modify_fg(Gtk.StateType.NORMAL, Gdk.color_parse('#000000')) self.anterior = get_boton(os.path.join(icons, "go-next-rtl.svg"), pixels=get_pixels(0.5), tooltip_text="Anterior") self.anterior.connect("clicked", self.__emit_accion) toolbar.insert(self.anterior, -1) item = Gtk.ToolItem() item.set_expand(True) self.entry = Gtk.Entry() self.entry.show() item.add(self.entry) toolbar.insert(item, -1) self.siguiente = get_boton(os.path.join(icons, "go-next.svg"), pixels=get_pixels(0.5), tooltip_text="Siguiente") self.siguiente.connect("clicked", self.__emit_accion) toolbar.insert(self.siguiente, -1) self.entry.connect("changed", self.__emit_buscar) self.add(toolbar) self.show_all() self.anterior.set_sensitive(False) self.siguiente.set_sensitive(False)
def __init__(self): Gtk.EventBox.__init__(self) from collections import OrderedDict self.dict_proyecto = OrderedDict() toolbar = Gtk.Toolbar() toolbar.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse('#f0e6aa')) toolbar.modify_fg(Gtk.StateType.NORMAL, Gdk.color_parse('#000000')) icon_path = make_icon_active(os.path.join(icons, "document-new.svg")) nuevo_proyecto = get_boton(icon_path, pixels=get_pixels(0.5), tooltip_text="Nuevo Proyecto") self.dict_proyecto["Nuevo Proyecto"] = [ nuevo_proyecto, "document-new.svg" ] icon_path = make_icon_active(os.path.join(icons, "document-open.svg")) abrir_proyecto = get_boton(icon_path, pixels=get_pixels(0.5), tooltip_text="Abrir Proyecto") self.dict_proyecto["Abrir Proyecto"] = [ abrir_proyecto, "document-open.svg" ] cerrar_proyecto = get_boton(os.path.join(icons, "button-cancel.svg"), pixels=get_pixels(0.5), tooltip_text="Cerrar Proyecto") self.dict_proyecto["Cerrar Proyecto"] = [ cerrar_proyecto, "button-cancel.svg" ] editar_proyecto = get_boton(os.path.join(icons, "gtk-edit.svg"), pixels=get_pixels(0.5), tooltip_text="Editar Proyecto") self.dict_proyecto["Editar Proyecto"] = [ editar_proyecto, "gtk-edit.svg" ] guardar_proyecto = get_boton(os.path.join(icons, "document-save.svg"), pixels=get_pixels(0.5), tooltip_text="Guardar Proyecto") self.dict_proyecto["Guardar Proyecto"] = [ guardar_proyecto, "document-save.svg" ] ejecutar_proyecto = get_boton(os.path.join(icons, "media-playback-start.svg"), pixels=get_pixels(0.5), tooltip_text="Ejecutar Proyecto") self.dict_proyecto["Ejecutar Proyecto"] = [ ejecutar_proyecto, "media-playback-start.svg" ] detener_ejecucion = get_boton(os.path.join(icons, "media-playback-stop.svg"), pixels=get_pixels(0.5), tooltip_text="Detener Ejecución") self.dict_proyecto["Detener Ejecución"] = [ detener_ejecucion, "media-playback-stop.svg" ] toolbar.insert(nuevo_proyecto, -1) toolbar.insert(abrir_proyecto, -1) toolbar.insert(editar_proyecto, -1) toolbar.insert(guardar_proyecto, -1) toolbar.insert(cerrar_proyecto, -1) toolbar.insert(get_separador(draw=True, ancho=0, expand=False), -1) toolbar.insert(ejecutar_proyecto, -1) toolbar.insert(detener_ejecucion, -1) toolbar.insert(get_separador(draw=False, ancho=0, expand=True), -1) self.add(toolbar) self.show_all() for key in self.dict_proyecto.keys(): self.dict_proyecto[key][0].connect("clicked", self.__emit_accion) self.activar_proyecto(False) self.activar_ejecucion(None) self.set_size_request(240, -1)
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(BASE_PATH, "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(BASE_PATH, "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(BASE_PATH, "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(BASE_PATH, "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(BASE_PATH, "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(BASE_PATH, "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()
def abrir_archivo(self, archivo): """ Abre un archivo y agrega una página para él, con su código. """ #try: paginas = self.get_children() for pagina in paginas: view = pagina.get_child() if view.archivo and archivo: arch1 = os.path.join(view.archivo) arch2 = os.path.join(archivo) if arch1 == archivo: return False sourceview = SourceView(self.config) hbox = Gtk.HBox() label = Gtk.Label("Sin Título") boton = get_boton(os.path.join(icons, "button-cancel.svg"), pixels=get_pixels(0.5), tooltip_text="Cerrar") hbox.pack_start(label, False, False, 0) hbox.pack_start(boton, False, False, 0) scroll = Gtk.ScrolledWindow() scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scroll.add(sourceview) self.append_page(scroll, hbox) sourceview.set_archivo(archivo) label.show() boton.show() self.show_all() boton.connect("clicked", self.__cerrar) self.set_current_page(-1) self.set_tab_reorderable(scroll, True) """ # FIXME: Cuando se abre un archivo, se cierra el vacío por default. if len(paginas) > 1: for pagina in paginas: view = pagina.get_child() if not view.archivo: buffer = view.get_buffer() inicio, fin = buffer.get_bounds() buf = buffer.get_text(inicio, fin, 0) if not buf: self.remove(pagina) break """ sourceview.connect("update", self.__re_emit_update) sourceview.connect("force-select", self.__re_emit_force_select) #except: # print "FIXME: No se ha podido abrir:", archivo return False
def abrir_archivo(self, archivo): """ Abre un archivo y agrega una página para él, con su código. """ try: paginas = self.get_children() for pagina in paginas: view = pagina.get_child() # FIXME: No permitir abrir dos veces el mismo archivo? if view.archivo: arch1 = os.path.join(view.archivo) arch2 = os.path.join(archivo) if arch1 == arch2: return sourceview = SourceView(self.config) hbox = Gtk.HBox() label = Gtk.Label("Sin Título") boton = get_boton( os.path.join(icons, "button-cancel.svg"), pixels=get_pixels(0.5), tooltip_text="Cerrar") hbox.pack_start(label, False, False, 0) hbox.pack_start(boton, False, False, 0) # Se hace posteriormente # if archivo: # if os.path.exists(archivo): # nombre = str(os.path.basename(archivo)) # if len(nombre) > 13: # nombre = nombre[0:13] + " . . . " # label.set_text(nombre) sourceview.set_archivo(archivo) scroll = Gtk.ScrolledWindow() scroll.set_policy( Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scroll.add(sourceview) self.append_page(scroll, hbox) label.show() boton.show() self.show_all() boton.connect("clicked", self.__cerrar) self.set_current_page(-1) self.set_tab_reorderable(scroll, True) ''' # Cuando se abre un archivo, se cierra el vacío por default. if len(paginas) > 1: for pagina in paginas: view = pagina.get_child() if not view.archivo: buffer = view.get_buffer() inicio, fin = buffer.get_bounds() buf = buffer.get_text(inicio, fin, 0) if not buf: self.remove(pagina) break ''' sourceview.connect("update", self.__re_emit_update) except: pass return False
def __init__(self): Gtk.EventBox.__init__(self) from collections import OrderedDict self.dict_proyecto = OrderedDict() toolbar = Gtk.Toolbar() toolbar.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse('#f0e6aa')) toolbar.modify_fg(Gtk.StateType.NORMAL, Gdk.color_parse('#000000')) icon_path = make_icon_active(os.path.join(icons, "document-new.svg")) nuevo_proyecto = get_boton(icon_path, pixels=get_pixels(0.5), tooltip_text="Nuevo Proyecto") self.dict_proyecto["Nuevo Proyecto"] = [nuevo_proyecto, "document-new.svg"] icon_path = make_icon_active(os.path.join(icons, "document-open.svg")) abrir_proyecto = get_boton(icon_path, pixels=get_pixels(0.5), tooltip_text="Abrir Proyecto") self.dict_proyecto["Abrir Proyecto"] = [abrir_proyecto, "document-open.svg"] cerrar_proyecto = get_boton(os.path.join(icons, "button-cancel.svg"), pixels=get_pixels(0.5), tooltip_text="Cerrar Proyecto") self.dict_proyecto["Cerrar Proyecto"] = [cerrar_proyecto, "button-cancel.svg"] editar_proyecto = get_boton(os.path.join(icons, "gtk-edit.svg"), pixels=get_pixels(0.5), tooltip_text="Editar Proyecto") self.dict_proyecto["Editar Proyecto"] = [editar_proyecto, "gtk-edit.svg"] guardar_proyecto = get_boton(os.path.join(icons, "document-save.svg"), pixels=get_pixels(0.5), tooltip_text="Guardar Proyecto") self.dict_proyecto["Guardar Proyecto"] = [guardar_proyecto, "document-save.svg"] ejecutar_proyecto = get_boton( os.path.join(icons, "media-playback-start.svg"), pixels=get_pixels(0.5), tooltip_text="Ejecutar Proyecto") self.dict_proyecto["Ejecutar Proyecto"] = [ejecutar_proyecto, "media-playback-start.svg"] detener_ejecucion = get_boton( os.path.join(icons, "media-playback-stop.svg"), pixels=get_pixels(0.5), tooltip_text="Detener Ejecución") self.dict_proyecto["Detener Ejecución"] = [detener_ejecucion, "media-playback-stop.svg"] toolbar.insert(nuevo_proyecto, - 1) toolbar.insert(abrir_proyecto, - 1) toolbar.insert(editar_proyecto, - 1) toolbar.insert(guardar_proyecto, - 1) toolbar.insert(cerrar_proyecto, - 1) toolbar.insert(get_separador(draw=True, ancho=0, expand=False), - 1) toolbar.insert(ejecutar_proyecto, - 1) toolbar.insert(detener_ejecucion, - 1) toolbar.insert(get_separador(draw=False, ancho=0, expand=True), - 1) self.add(toolbar) self.show_all() for key in self.dict_proyecto.keys(): self.dict_proyecto[key][0].connect("clicked", self.__emit_accion) self.activar_proyecto(False) self.activar_ejecucion(None) self.set_size_request(240, -1)
def __init__(self): Gtk.EventBox.__init__(self) from collections import OrderedDict self.dict_archivo = OrderedDict() toolbar = Gtk.Toolbar() toolbar.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse('#f0e6aa')) toolbar.modify_fg(Gtk.StateType.NORMAL, Gdk.color_parse('#000000')) icon_path = make_icon_active(os.path.join(icons, "document-new.svg")) nuevo_archivo = get_boton(os.path.join(icons, icon_path), pixels=get_pixels(0.5), tooltip_text="Nuevo Archivo") self.dict_archivo["Nuevo Archivo"] = [nuevo_archivo, "document-new.svg"] icon_path = make_icon_active(os.path.join(icons, "document-open.svg")) abrir_archivo = get_boton(os.path.join(icons, icon_path), pixels=get_pixels(0.5), tooltip_text="Abrir Archivo") self.dict_archivo["Abrir Archivo"] = [abrir_archivo, "document-open.svg"] guardar_archivo = get_boton(os.path.join(icons, "document-save.svg"), pixels=get_pixels(0.5), tooltip_text="Guardar Archivo") self.dict_archivo["Guardar Archivo"] = [guardar_archivo, "document-save.svg"] icon_path = make_icon_active( os.path.join(icons, "document-save-as.svg")) guardar_como = get_boton(os.path.join(icons, icon_path), pixels=get_pixels(0.5), tooltip_text="Guardar Como") self.dict_archivo["Guardar Como"] = [guardar_como, "document-save-as.svg"] icon_path = make_icon_active( os.path.join(icons, "media-playback-start.svg")) ejecutar = get_boton(os.path.join(icons, icon_path), pixels=get_pixels(0.5), tooltip_text="Ejecutar Archivo") self.dict_archivo["Ejecutar Archivo"] = [ejecutar, "media-playback-start.svg"] detener = get_boton( os.path.join(icons, "media-playback-stop.svg"), pixels=get_pixels(0.5), tooltip_text="Detener Ejecución") self.dict_archivo["Detener Ejecución"] = [detener, "media-playback-stop.svg"] deshacer = get_boton(os.path.join(icons, "edit-undo.svg"), pixels=get_pixels(0.5), tooltip_text="Deshacer") self.dict_archivo["Deshacer"] = [deshacer, "edit-undo.svg"] rehacer = get_boton(os.path.join(icons, "edit-redo.svg"), pixels=get_pixels(0.5), tooltip_text="Rehacer") self.dict_archivo["Rehacer"] = [rehacer, "edit-redo.svg"] copiar = get_boton(os.path.join(icons, "edit-copy.svg"), pixels=get_pixels(0.5), tooltip_text="Copiar") self.dict_archivo["Copiar"] = [copiar, "edit-copy.svg"] cortar = get_boton(os.path.join(icons, "editcut.svg"), pixels=get_pixels(0.5), tooltip_text="Cortar") self.dict_archivo["Cortar"] = [cortar, "editcut.svg"] pegar = get_boton(os.path.join(icons, "editpaste.svg"), pixels=get_pixels(0.5), tooltip_text="Pegar") self.dict_archivo["Pegar"] = [pegar, "editpaste.svg"] seleccionar_todo = get_boton( os.path.join(icons, "edit-select-all.svg"), pixels=get_pixels(0.5), tooltip_text="Seleccionar Todo") self.dict_archivo["Seleccionar Todo"] = [seleccionar_todo, "edit-select-all.svg"] toolbar.insert(get_separador(draw=False, ancho=10, expand=False), - 1) toolbar.insert(nuevo_archivo, - 1) toolbar.insert(abrir_archivo, - 1) toolbar.insert(guardar_archivo, - 1) toolbar.insert(guardar_como, - 1) toolbar.insert(get_separador(draw=True, ancho=0, expand=False), - 1) toolbar.insert(ejecutar, - 1) toolbar.insert(detener, - 1) toolbar.insert(get_separador(draw=True, ancho=0, expand=False), - 1) toolbar.insert(deshacer, - 1) toolbar.insert(rehacer, - 1) toolbar.insert(get_separador(draw=True, ancho=0, expand=False), - 1) toolbar.insert(copiar, - 1) toolbar.insert(cortar, - 1) toolbar.insert(pegar, - 1) toolbar.insert(get_separador(draw=True, ancho=0, expand=False), - 1) toolbar.insert(seleccionar_todo, - 1) toolbar.insert(get_separador(draw=False, ancho=0, expand=True), - 1) self.add(toolbar) self.show_all() for key in self.dict_archivo.keys(): boton = self.dict_archivo[key][0] boton.connect("clicked", self.__emit_accion)
def __init__(self): Gtk.EventBox.__init__(self) from collections import OrderedDict self.dict_archivo = OrderedDict() toolbar = Gtk.Toolbar() toolbar.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse('#f0e6aa')) toolbar.modify_fg(Gtk.StateType.NORMAL, Gdk.color_parse('#000000')) icon_path = make_icon_active(os.path.join(icons, "document-new.svg")) nuevo_archivo = get_boton(os.path.join(icons, icon_path), pixels=get_pixels(0.5), tooltip_text="Nuevo Archivo") self.dict_archivo["Nuevo Archivo"] = [ nuevo_archivo, "document-new.svg" ] icon_path = make_icon_active(os.path.join(icons, "document-open.svg")) abrir_archivo = get_boton(os.path.join(icons, icon_path), pixels=get_pixels(0.5), tooltip_text="Abrir Archivo") self.dict_archivo["Abrir Archivo"] = [ abrir_archivo, "document-open.svg" ] guardar_archivo = get_boton(os.path.join(icons, "document-save.svg"), pixels=get_pixels(0.5), tooltip_text="Guardar Archivo") self.dict_archivo["Guardar Archivo"] = [ guardar_archivo, "document-save.svg" ] icon_path = make_icon_active( os.path.join(icons, "document-save-as.svg")) guardar_como = get_boton(os.path.join(icons, icon_path), pixels=get_pixels(0.5), tooltip_text="Guardar Como") self.dict_archivo["Guardar Como"] = [ guardar_como, "document-save-as.svg" ] icon_path = make_icon_active( os.path.join(icons, "media-playback-start.svg")) ejecutar = get_boton(os.path.join(icons, icon_path), pixels=get_pixels(0.5), tooltip_text="Ejecutar Archivo") self.dict_archivo["Ejecutar Archivo"] = [ ejecutar, "media-playback-start.svg" ] detener = get_boton(os.path.join(icons, "media-playback-stop.svg"), pixels=get_pixels(0.5), tooltip_text="Detener Ejecución") self.dict_archivo["Detener Ejecución"] = [ detener, "media-playback-stop.svg" ] deshacer = get_boton(os.path.join(icons, "edit-undo.svg"), pixels=get_pixels(0.5), tooltip_text="Deshacer") self.dict_archivo["Deshacer"] = [deshacer, "edit-undo.svg"] rehacer = get_boton(os.path.join(icons, "edit-redo.svg"), pixels=get_pixels(0.5), tooltip_text="Rehacer") self.dict_archivo["Rehacer"] = [rehacer, "edit-redo.svg"] copiar = get_boton(os.path.join(icons, "edit-copy.svg"), pixels=get_pixels(0.5), tooltip_text="Copiar") self.dict_archivo["Copiar"] = [copiar, "edit-copy.svg"] cortar = get_boton(os.path.join(icons, "editcut.svg"), pixels=get_pixels(0.5), tooltip_text="Cortar") self.dict_archivo["Cortar"] = [cortar, "editcut.svg"] pegar = get_boton(os.path.join(icons, "editpaste.svg"), pixels=get_pixels(0.5), tooltip_text="Pegar") self.dict_archivo["Pegar"] = [pegar, "editpaste.svg"] seleccionar_todo = get_boton(os.path.join(icons, "edit-select-all.svg"), pixels=get_pixels(0.5), tooltip_text="Seleccionar Todo") self.dict_archivo["Seleccionar Todo"] = [ seleccionar_todo, "edit-select-all.svg" ] toolbar.insert(get_separador(draw=False, ancho=10, expand=False), -1) toolbar.insert(nuevo_archivo, -1) toolbar.insert(abrir_archivo, -1) toolbar.insert(guardar_archivo, -1) toolbar.insert(guardar_como, -1) toolbar.insert(get_separador(draw=True, ancho=0, expand=False), -1) toolbar.insert(ejecutar, -1) toolbar.insert(detener, -1) toolbar.insert(get_separador(draw=True, ancho=0, expand=False), -1) toolbar.insert(deshacer, -1) toolbar.insert(rehacer, -1) toolbar.insert(get_separador(draw=True, ancho=0, expand=False), -1) toolbar.insert(copiar, -1) toolbar.insert(cortar, -1) toolbar.insert(pegar, -1) toolbar.insert(get_separador(draw=True, ancho=0, expand=False), -1) toolbar.insert(seleccionar_todo, -1) toolbar.insert(get_separador(draw=False, ancho=0, expand=True), -1) self.add(toolbar) self.show_all() for key in self.dict_archivo.keys(): boton = self.dict_archivo[key][0] boton.connect("clicked", self.__emit_accion)