Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristian García <cristian99garcia@gmail.com>2013-04-16 16:34:31 (GMT)
committer Cristian García <cristian99garcia@gmail.com>2013-04-16 16:34:31 (GMT)
commit86832793666cd99c6a344db258894ea580804f99 (patch)
treed5e4e33906f121789fa403a34d40a631af7f216b
parent8864887abc27e50b5b4955949ba3068461fccc01 (diff)
Emprolijando
-rw-r--r--CExplorer.py1
-rw-r--r--Widgets.py10
-rw-r--r--Widgets.pycbin12469 -> 12549 bytes
-rw-r--r--window.py46
4 files changed, 37 insertions, 20 deletions
diff --git a/CExplorer.py b/CExplorer.py
index b61abc1..7f8f735 100644
--- a/CExplorer.py
+++ b/CExplorer.py
@@ -158,7 +158,6 @@ class CExplorer(activity.Activity):
def tecla_presionada(self, widget, event):
tecla = event.keyval
- print tecla
direccion = self.direccion
if direccion[-1] != '/':
diff --git a/Widgets.py b/Widgets.py
index 928faef..776f3ca 100644
--- a/Widgets.py
+++ b/Widgets.py
@@ -146,6 +146,8 @@ class Area(Gtk.IconView):
__gsignals__ = {
'cambio-de-direccion': (GObject.SIGNAL_RUN_FIRST,
+ GObject.TYPE_NONE, (GObject.TYPE_STRING,)),
+ 'cambio-de-texto': (GObject.SIGNAL_RUN_FIRST,
GObject.TYPE_NONE, (GObject.TYPE_STRING,))}
def __init__(self, padre):
@@ -167,7 +169,7 @@ class Area(Gtk.IconView):
self.connect('button-press-event', self.click)
self.connect('selection-changed', self.changed)
- def changed(self, *args):
+ def changed(self, widget):
if self.get_selected_items():
@@ -185,7 +187,11 @@ class Area(Gtk.IconView):
archivos = Archivos.get_tamanio(direccion)
string = ' - ' + archivos
- self.padre.b_estado.set_text('Se ha seleccionado: ', direccion, string)
+ self.padre.b_estado.set_text('Se ha seleccionado: ',
+ direccion, string)
+
+ else:
+ self.padre.b_estado.set_text('')
def agregar(self, nombre, direccion):
"""Agrega el icono de una carpeta o un archivo"""
diff --git a/Widgets.pyc b/Widgets.pyc
index 29d379c..6454bdf 100644
--- a/Widgets.pyc
+++ b/Widgets.pyc
Binary files differ
diff --git a/window.py b/window.py
index d227cd5..1e72ef9 100644
--- a/window.py
+++ b/window.py
@@ -5,6 +5,8 @@
# Cristian García <cristian99garcia@gmail.com>
import os
+import thread
+import time
import Archivos
from gi.repository import Gtk
@@ -33,19 +35,23 @@ context.add_provider_for_screen(
Gtk.STYLE_PROVIDER_PRIORITY_USER)
+Gdk.threads_init()
+
+
class CExplorer(Gtk.Window):
__gsignals__ = {
'change-directory': (GObject.SIGNAL_RUN_FIRST,
GObject.TYPE_NONE, []),
- 'statete-changed': (GObject.SIGNAL_RUN_FIRST,
- GObject.TYPE_NONE, [])}
+ 'estado-cambiado': (GObject.SIGNAL_RUN_FIRST,
+ GObject.TYPE_NONE, (GObject.TYPE_STRING,))}
def __init__(self):
Gtk.Window.__init__(self)
self.set_size_request(600, 400)
+ self.set_title('CExplorer')
self.ocultos = False
self.direccion = os.path.expanduser('~')
@@ -125,26 +131,24 @@ class CExplorer(Gtk.Window):
self.connect('destroy', Gtk.main_quit)
self.connect('key-press-event', self.tecla_presionada)
self.connect('change-directory', self.borrar_todo)
+ self.connect('estado-cambiado', self.estado_cambiado)
self.add(self.vbox)
self.show_all()
def abrir(self, directorio):
- """Intenta abrir el directorio especificado"""
+ """Abre el directorio especificado"""
- lectura, escritura, ejecucion = Archivos.get_permisos(directorio)
- texto = None
-
- if lectura and \
- (os.path.isdir(directorio) or os.path.ismount(directorio)):
+ texto = False
+ if os.path.isdir(directorio) or os.path.ismount(directorio):
# Sí es que no exíste, devolverá False
self.direccion = directorio
self.entrada.set_text(directorio)
self.emit('change-directory')
- self.estado_cambiado()
+ self.emit('estado-cambiado', 'cargando')
for objeto in os.listdir(directorio):
direccion = os.path.join(directorio, objeto)
@@ -156,8 +160,9 @@ class CExplorer(Gtk.Window):
self.carpetas.append(objeto)
if os.path.isfile(direccion):
- if not self.ocultos and \
- not (list(objeto)[0] == '.' or list(objeto)[-1] == '~'):
+ if not self.ocultos and not \
+ (list(objeto)[0] == '.' or list(objeto)[-1] == '~'):
+
self.archivos.append(objeto)
elif self.ocultos:
@@ -197,11 +202,11 @@ class CExplorer(Gtk.Window):
self.estado_cambiado()
- self.estado_cambiado()
+ self.emit('estado-cambiado', 'parado')
- def estado_cambiado(self, *args):
+ def estado_cambiado(self, widget, estado):
- if self.spinner.get_state() == Gtk.StateType(0):
+ if estado == 'cargando':
self.spinner.start()
else:
@@ -210,6 +215,7 @@ class CExplorer(Gtk.Window):
def tecla_presionada(self, widget, event):
tecla = event.keyval
+ print tecla
direccion = self.direccion
if direccion[-1] != '/':
@@ -232,6 +238,12 @@ class CExplorer(Gtk.Window):
if lectura and escritura:
self.borrar_archivo()
+ elif tecla == 65293:
+ self.abrir(direccion)
+
+ elif tecla == 65288:
+ self.abrir_arriba()
+
if tecla == 43:
if lectura and escritura:
self.crear_directorio()
@@ -343,9 +355,9 @@ class CExplorer(Gtk.Window):
except:
return self.direccion
-
-CExplorer()
-Gtk.main()
+if __name__ == '__main__':
+ CExplorer()
+ Gtk.main()
"""
ico = "/home/cristian/Documentos/JAMediaSuite/JAMediaObjects/Iconos/JAMedia.png"