diff options
author | flavio <fdanesse@gmail.com> | 2013-06-27 17:36:10 (GMT) |
---|---|---|
committer | flavio <fdanesse@gmail.com> | 2013-06-27 17:36:10 (GMT) |
commit | 4fe22a341ebb76a4da0e6ff6a2e7455809cd34a7 (patch) | |
tree | f2d3da003f5e82e02019a0cbbe1593abae00512e /Widgets.py | |
parent | f458c6823c5c78135b0e2dc06b63059bddbe56db (diff) |
Corrección de Funciones Sobre vista de Estructura.
Diffstat (limited to 'Widgets.py')
-rw-r--r-- | Widgets.py | 57 |
1 files changed, 32 insertions, 25 deletions
@@ -1706,7 +1706,7 @@ class ErroresTreeview(Gtk.TreeView): self.view._marcar_error(int(linea)) return True - + class Estructura_Menu(Gtk.Menu): """ Menu con opciones para treeview de Estructura. @@ -1717,13 +1717,14 @@ class Estructura_Menu(Gtk.Menu): GObject.TYPE_NONE, (GObject.TYPE_PYOBJECT, GObject.TYPE_STRING, GObject.TYPE_PYOBJECT))} - def __init__(self, widget, boton, pos, tiempo, path, modelo, - isproyecto=False, accionando=False): + def __init__(self, widget, boton, pos, tiempo, path, modelo, accion_previa): Gtk.Menu.__init__(self) + iterfirst = modelo.get_iter_first() iter = modelo.get_iter(path) filepath = modelo.get_value(iter, 2) + lectura, escritura, ejecucion = self.__verificar_permisos(filepath) if os.path.exists(filepath): @@ -1741,29 +1742,34 @@ class Estructura_Menu(Gtk.Menu): if escritura: self.__get_item(widget, path, "cortar") - if escritura and not os.path.ismount(os.path.join(filepath)): + if escritura: self.__get_item(widget, path, "suprimir") if "text" in datos or "x-python" in datos and lectura: self.__get_item(widget, path, "buscar") elif os.path.isdir(filepath): - if lectura: - self.__get_item(widget, path, "copiar") - if escritura and lectura: - self.__get_item(widget, path, "cortar") + if filepath == modelo.get_value(iterfirst, 2): + self.__get_item(widget, path, "eliminar proyecto") + + if escritura and "copiar" in accion_previa or "cortar" in accion_previa: + self.__get_item(widget, path, "pegar") + + else: + if lectura: + self.__get_item(widget, path, "copiar") + + if escritura and lectura: + self.__get_item(widget, path, "cortar") - if escritura and (os.path.isdir(os.path.join(filepath)) or os.path.ismount(os.path.join(filepath))) and accionando: - self.__get_item(widget, path, "pegar") + if escritura and "copiar" in accion_previa or "cortar" in accion_previa: + self.__get_item(widget, path, "pegar") - if escritura and not os.path.ismount(os.path.join(filepath)): - if not isproyecto: + if escritura: self.__get_item(widget, path, "suprimir") - else: - self.__get_item(widget, path, "eliminar proyecto") - - if lectura: - self.__get_item(widget, path, "buscar") + + if lectura: + self.__get_item(widget, path, "buscar") self.show_all() @@ -1782,11 +1788,14 @@ class Estructura_Menu(Gtk.Menu): # os.X_OK # Permisos de ejecucion if not os.path.exists(path): return False, False, False + try: if os.access(path, os.F_OK): return os.access(path, os.R_OK), os.access(path, os.W_OK), os.access(path, os.X_OK) + else: return False, False, False + except: return False, False, False @@ -1828,24 +1837,22 @@ class DialogoEliminar(Gtk.Dialog): del archivo/directorio seleccionado """ - def __init__(self, tipo = "archivo", parent_window = None): + def __init__(self, tipo = "Archivo", parent_window = None): Gtk.Dialog.__init__(self, - title = "¿Seguro?", parent = parent_window, flags = Gtk.DialogFlags.MODAL, buttons = [ "Si, eliminar!", Gtk.ResponseType.ACCEPT, "Cancelar", Gtk.ResponseType.CANCEL]) - label = Gtk.Label(""" - Estás seguro de que deseas eliminar - el %s seleccionado? - """ % tipo) - label.set_justify(2) + self.set_size_request(300, 100) + self.set_border_width(15) + + label = Gtk.Label("Estás Seguro de que Deseas Eliminar\nel %s Seleccionado?" % tipo) label.show() - self.vbox.add(label) + self.vbox.pack_start(label, True, True, 0) class BusquedaGrep(Gtk.Dialog): """ |