Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Darío Giménez <jgimenez@localhost.localdomain>2010-05-24 12:06:10 (GMT)
committer José Darío Giménez <jgimenez@localhost.localdomain>2010-05-24 12:06:10 (GMT)
commit2130a90777f47bfdf4f56d449d32eaaa38d8b6ba (patch)
tree80a654809e99fa80c445c7356beb74f415a661a2
parent40e1f3cd58ef8c2d9278dcc8c2b4bdc52d826a4c (diff)
Change Activity/Project Structure to be more likely to Design Structure
-rw-r--r--Controller.py24
-rw-r--r--PuzzleView.py10
-rw-r--r--Toolbar.py46
-rw-r--r--View.py33
-rwxr-xr-xactivity.py80
5 files changed, 117 insertions, 76 deletions
diff --git a/Controller.py b/Controller.py
new file mode 100644
index 0000000..06bab5a
--- /dev/null
+++ b/Controller.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+import View
+class Controller():
+ def __init__(self,activity):
+ self.activity=activity
+ view=View(self)
+
+ def evaluateAnswer(answer):
+ pass
+
+ def nextPuzzle():
+ pass
+
+ def newGame(difficulty,topic):
+ pass
+
+ def end():
+ pass
+
+ def pause():
+ pass
+
+ def getClue():
+ pass \ No newline at end of file
diff --git a/PuzzleView.py b/PuzzleView.py
new file mode 100644
index 0000000..ff19cc3
--- /dev/null
+++ b/PuzzleView.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+import gtk
+import Controller
+class PuzzleView():
+ def __init__(self,controller):
+ #contenedor = gtk.EventBox()
+ #imagen = gtk.Image()
+ #imagen.setFromFile("script01.svg")
+ #imagen.show()
+ return image
diff --git a/Toolbar.py b/Toolbar.py
new file mode 100644
index 0000000..4f38195
--- /dev/null
+++ b/Toolbar.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+import gtk
+import Controller
+class Toolbar():
+ def __init__(self,contoller):
+ toolbox=activity.ActivityToolbox(controller.activity)
+ toolbox.show()
+ controller.activity.set_toolbox(toolbox)
+ #El Layout inicial
+
+ #encabezado = gtk.Label(' El encabezado, categoria y dificultad')
+ #encabezado.show()
+
+ #Preparando el menu
+ menu = gtk.HBox()
+ alineacion = gtk.Alignment(0.5, 1, 0.5, 1)
+ categoriaL = gtk.Label("Categoria:")
+ categoriaL.show()
+ categorias = gtk.combo_box_new_text()
+ categorias.insert_text(0,"Todas")
+ categorias.insert_text(1,"Matematica")
+ categorias.insert_text(2,"Historia")
+ categorias.insert_text(3,"Castellano")
+ categorias.set_active(0)
+ categorias.show()
+ dificultadL = gtk.Label("Dificultad:")
+ dificultadL.show()
+ dificultades = gtk.combo_box_new_text()
+ dificultades.insert_text(0,"nivel 1")
+ dificultades.insert_text(1,"nivel 2")
+ dificultades.insert_text(2, "nivel 3")
+ dificultades.set_active(0)
+ dificultades.show()
+ iniciarB = gtk.Button("Inicio")
+ iniciarB.show()
+ finalizarB = gtk.Button("Terminar")
+ finalizarB.show()
+ menu.pack_start(alineacion)
+ menu.pack_start(categoriaL)
+ menu.pack_start(categorias)
+ menu.pack_start(dificultadL)
+ menu.pack_start(dificultades)
+ menu.pack_start(iniciarB)
+ menu.pack_start(finalizarB)
+ menu.show()
+ return menu
diff --git a/View.py b/View.py
new file mode 100644
index 0000000..18f3a72
--- /dev/null
+++ b/View.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+import gtk
+import Controller
+class View()
+ def __init__(self, controller):
+ menu=Toolbar(controller)
+ image=PuzzleView(controller)
+
+ #respuesta
+ respuesta = gtk.HBox()
+ respL = gtk.Label("Respuesta:")
+ respL.show()
+ respT = gtk.Entry()
+ respT.show()
+ respB = gtk.Button("Respuesta")
+ respB.show()
+ sgteB = gtk.Button("Siguiente")
+ sgteB.show()
+ respuesta.pack_start(respL, False, False, 0)
+ respuesta.pack_start(respT)
+ respuesta.pack_start(respB)
+ respuesta.pack_start(sgteB)
+ respuesta.show()
+
+ l1 = gtk.VBox()
+ #agrupo todo
+ #l1.pack_start(encabezado)
+ l1.pack_start(menu, False, False, 4)
+ l1.pack_start(respuesta, False, False, 360)
+ #l1.pack_start(imagen)
+
+ l1.show()
+ controller.activity.set_canvas(l1) \ No newline at end of file
diff --git a/activity.py b/activity.py
index 76c75c1..a87514d 100755
--- a/activity.py
+++ b/activity.py
@@ -1,81 +1,9 @@
+# -*- coding: utf-8 -*-
from sugar.activity import activity
import logging
-
-import gtk
+import Controller
class SugarBrainActivity(activity.Activity):
def __init__(self, handle):
- activity.Activity.__init__(self, handle)
- toolbox=activity.ActivityToolbox(self)
- toolbox.show()
- self.set_toolbox(toolbox)
- #El Layout inicial
- l1 = gtk.VBox()
-
- #encabezado = gtk.Label(' El encabezado, categoria y dificultad')
- #encabezado.show()
-
- #Preparando el menu
- menu = gtk.HBox()
- alineacion = gtk.Alignment(0.5, 1, 0.5, 1)
- categoriaL = gtk.Label("Categoria:")
- categoriaL.show()
- categorias = gtk.combo_box_new_text()
- categorias.insert_text(0,"Todas")
- categorias.insert_text(1,"Matematica")
- categorias.insert_text(2,"Historia")
- categorias.insert_text(3,"Castellano")
- categorias.set_active(0)
- categorias.show()
- dificultadL = gtk.Label("Dificultad:")
- dificultadL.show()
- dificultades = gtk.combo_box_new_text()
- dificultades.insert_text(0,"nivel 1")
- dificultades.insert_text(1,"nivel 2")
- dificultades.insert_text(2, "nivel 3")
- dificultades.set_active(0)
- dificultades.show()
- iniciarB = gtk.Button("Inicio")
- iniciarB.show()
- finalizarB = gtk.Button("Terminar")
- finalizarB.show()
- menu.pack_start(alineacion)
- menu.pack_start(categoriaL)
- menu.pack_start(categorias)
- menu.pack_start(dificultadL)
- menu.pack_start(dificultades)
- menu.pack_start(iniciarB)
- menu.pack_start(finalizarB)
- menu.show()
-
-
- #contenedor = gtk.EventBox()
- #imagen = gtk.Image()
- #imagen.setFromFile("script01.svg")
- #imagen.show()
-
- #respuesta
- respuesta = gtk.HBox()
- respL = gtk.Label("Respuesta:")
- respL.show()
- respT = gtk.Entry()
- respT.show()
- respB = gtk.Button("Respuesta")
- respB.show()
- sgteB = gtk.Button("Siguiente")
- sgteB.show()
- respuesta.pack_start(respL, False, False, 0)
- respuesta.pack_start(respT)
- respuesta.pack_start(respB)
- respuesta.pack_start(sgteB)
- respuesta.show()
-
- #agrupo todo
- #l1.pack_start(encabezado)
- l1.pack_start(menu, False, False, 4)
- l1.pack_start(respuesta, False, False, 360)
- #l1.pack_start(imagen)
-
- l1.show()
- self.set_canvas(l1)
-
+ activity.Activity.__init__(activity, handle)
+ controller=Controller(self) \ No newline at end of file