Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAriel Calzada <ariel@activitycentral.com>2012-05-04 17:06:58 (GMT)
committer Ariel Calzada <ariel@activitycentral.com>2012-05-04 17:06:58 (GMT)
commit6596cb6889d84e3bf9432e828524c492583c4531 (patch)
treef35d3238649703d89937d3c1854dc6145e9e6494
parent77a2bd62f00c16af61d629f8c0f67b1eec1a5783 (diff)
Converted from git to sugar
-rw-r--r--CeibalNotifica3
-rw-r--r--CeibalNotifica.desktop11
-rw-r--r--CeibalNotifica.py77
-rw-r--r--CeibalNotificaUninstall3
-rw-r--r--CeibalNotificaUninstall.py12
-rw-r--r--MANIFEST10
-rw-r--r--base.py87
-rw-r--r--setup.cfg4
-rw-r--r--[-rwxr-xr-x]setup.py24
9 files changed, 34 insertions, 197 deletions
diff --git a/CeibalNotifica b/CeibalNotifica
deleted file mode 100644
index 5cbccbe..0000000
--- a/CeibalNotifica
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-exec "/usr/bin/python" "/usr/local/share/CeibalNotifica/CeibalNotifica.py" "$@"
diff --git a/CeibalNotifica.desktop b/CeibalNotifica.desktop
deleted file mode 100644
index 645b7cd..0000000
--- a/CeibalNotifica.desktop
+++ /dev/null
@@ -1,11 +0,0 @@
-
-[Desktop Entry]
-Encoding=UTF-8
-Name=CeibalNotifica
-GenericName=CeibalNotifica
-Exec=/usr/local/bin/CeibalNotifica
-Terminal=false
-Type=Application
-Icon=/usr/local/share/CeibalNotifica/Iconos/CeibalNotifica.png
-Categories=GNOME;GTK;Utility
-StartupNotify=true
diff --git a/CeibalNotifica.py b/CeibalNotifica.py
index 6005128..59ff93e 100644
--- a/CeibalNotifica.py
+++ b/CeibalNotifica.py
@@ -23,26 +23,21 @@ import os
import gtk
import sys
import gobject
-
try:
from ceibal.notifier.store import *
except:
from store import *
-
+from sugar.activity import activity
+from sugar.activity.widgets import StopButton
BASE = os.path.dirname(__file__)
-pixbuf1 = gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(BASE, "Iconos", "ceibal-gris.png"), 32, 32)
-pixbuf2 = gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(BASE, "Iconos", "ceibal.png"), 32, 32)
-
+pixbuf1 = gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(BASE, "Iconos", "ceibal-gris.png"), 32,32)
+pixbuf2 = gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(BASE, "Iconos", "ceibal.png"), 32,32)
-class CeibalNotifica(gtk.Window):
- def __init__(self):
- super(CeibalNotifica, self).__init__()
+class CeibalNotifica(activity.Activity):
+ def __init__(self, handle):
+ activity.Activity.__init__(self, handle, False)
self.set_title("Ceibal Notifica")
- self.set_icon_from_file(os.path.join(BASE, "Iconos", "ceibal.png"))
- self.set_resizable(True)
- self.set_size_request(640, 480)
self.set_border_width(2)
- self.set_position(gtk.WIN_POS_CENTER)
self.text_buffer = None
self.text_view = None
self.store = None
@@ -61,6 +56,7 @@ class CeibalNotifica(gtk.Window):
self.control_toolbar.connect("get_filter", self.get_filter)
self.control_toolbar.connect("make_filter", self.make_filter)
self.control_toolbar.connect("show_filter", self.show_filter)
+ self.control_toolbar.connect("exit", self.salir)
self.load_notify()
self.notify_store.columns_autosize()
@@ -71,8 +67,8 @@ class CeibalNotifica(gtk.Window):
self.text_buffer = gtk.TextBuffer()
self.text_view = gtk.TextView(buffer=self.text_buffer)
self.text_view.set_editable(False)
- self.text_view.set_wrap_mode(gtk.WRAP_WORD)
self.text_view.set_justification(gtk.JUSTIFY_LEFT)
+ self.text_view.set_wrap_mode(gtk.WRAP_WORD)
hpanel = gtk.HPaned()
try:
self.store = Store(db_filename="prueba.db")
@@ -93,7 +89,7 @@ class CeibalNotifica(gtk.Window):
vbox.pack_start(hpanel, True, True, 0)
vbox.pack_start(self.info_toolbar, False, False, 0)
hpanel.show_all()
- self.add(vbox)
+ self.set_canvas(vbox)
def get_filter(self, widget, value):
filtro_nivel2 = self.store.db.get_categories(value=value)
@@ -178,7 +174,6 @@ class CeibalNotifica(gtk.Window):
def salir(self, widget=None):
sys.exit(0)
-
class ListoreModel(gtk.ListStore):
def __init__(self):
gtk.ListStore.__init__(self, gtk.gdk.Pixbuf,
@@ -187,7 +182,6 @@ class ListoreModel(gtk.ListStore):
gobject.TYPE_STRING, gobject.TYPE_STRING,
gobject.TYPE_STRING, gobject.TYPE_BOOLEAN)
-
class Notify_Store(gtk.TreeView):
__gsignals__ = {"show_notify": (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, (gobject.TYPE_STRING, gobject.TYPE_STRING)),
@@ -195,7 +189,6 @@ class Notify_Store(gtk.TreeView):
gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, )),
"marcar_notify": (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, ))}
-
def __init__(self, model):
gtk.TreeView.__init__(self, model)
self.set_property("rules-hint", True)
@@ -208,7 +201,6 @@ class Notify_Store(gtk.TreeView):
self.treeselection.set_mode(gtk.SELECTION_SINGLE)
self.treeselection.set_select_function(self.func_selections,
self.get_model(), True)
-
def set_columns(self):
self.append_column(self.make_column_mark('', 0, True))
self.append_column(self.make_column('id', 1, False))
@@ -219,20 +211,17 @@ class Notify_Store(gtk.TreeView):
self.append_column(self.make_column('Expira', 6, True))
self.append_column(self.make_column('Tipo', 7, True))
self.append_column(self.make_column('Favorito', 8, False))
-
def make_column_mark(self, text, index, visible):
render = gtk.CellRendererPixbuf()
column = gtk.TreeViewColumn(text, render, pixbuf = index)
column.set_property("visible", visible)
return column
-
def make_column(self, text, index, visible):
render = gtk.CellRendererText()
column = gtk.TreeViewColumn(text, render, text=index)
column.set_sort_column_id(index)
column.set_property('visible', visible)
return column
-
def func_selections(self, selection, model, path, is_selected, user_data):
iter = self.get_model().get_iter(path)
texto = self.get_model().get_value(iter, 4)
@@ -246,7 +235,6 @@ class Notify_Store(gtk.TreeView):
info = "id: %s Lanzamiento: %s Favorito: %s" % (nid, lanzamiento, fav)
self.emit("show_notify", texto, info)
return True
-
def handle_click(self, widget, event):
boton = event.button
pos = (int(event.x), int(event.y))
@@ -262,7 +250,6 @@ class Notify_Store(gtk.TreeView):
return
except:
pass
-
def get_menu(self, boton, pos, tiempo, path):
menu = gtk.Menu()
eliminar = gtk.MenuItem("Eliminar Notificación.")
@@ -276,7 +263,6 @@ class Notify_Store(gtk.TreeView):
marcar.connect_object("activate", self.emit_marcar_notify, path)
menu.show_all()
gtk.Menu.popup(menu, None, None, None, boton, tiempo)
-
def get_path_selected(self):
(model, iter) = self.get_selection().get_selected()
path = None
@@ -284,16 +270,12 @@ class Notify_Store(gtk.TreeView):
treemodelrow = model[iter]
path = treemodelrow.path
return path
-
def emit_delete_notify(self, path):
self.emit("delete_notify", path)
-
def emit_marcar_notify(self, path):
self.emit("marcar_notify", path)
-
class ToolbarInfo(gtk.Toolbar):
-
def __init__(self):
gtk.Toolbar.__init__(self)
self.modify_bg(gtk.STATE_NORMAL,
@@ -319,15 +301,15 @@ class ToolbarInfo(gtk.Toolbar):
def set_text(self, text=""):
self.info_label.set_text(text)
-
class ToolbarControl(gtk.Toolbar):
__gsignals__ = {"get_filter": (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, (gobject.TYPE_STRING, )),
"make_filter": (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, )),
"show_filter": (gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE, []),
+ "exit": (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, [])}
-
def __init__(self):
gtk.Toolbar.__init__(self)
self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0, 0, 0, 1))
@@ -335,7 +317,6 @@ class ToolbarControl(gtk.Toolbar):
self.filter_combo2 = None
self.set_layout()
self.show_all()
-
self.filter_combo1.connect("change_selection", self.emit_get_filter)
self.filter_combo2.connect("change_selection", self.emit_make_filter)
@@ -345,21 +326,18 @@ class ToolbarControl(gtk.Toolbar):
separator.set_size_request(10, -1)
separator.set_expand(False)
self.insert(separator, -1)
-
item = gtk.ToolItem()
label = gtk.Label("Filtrar por:")
label.modify_fg(gtk.STATE_NORMAL,
- gtk.gdk.Color(65535, 65535, 65535,1))
+ gtk.gdk.Color(65535, 65535, 65535,1))
label.show()
item.add(label)
self.insert(item, -1)
-
separator = gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_size_request(10, -1)
separator.set_expand(False)
self.insert(separator, -1)
-
item = gtk.ToolItem()
self.filter_combo1 = Combo()
self.filter_combo1.set_items(["Tipo", "Prioridad",
@@ -367,27 +345,23 @@ class ToolbarControl(gtk.Toolbar):
self.filter_combo1.show()
item.add(self.filter_combo1)
self.insert(item, -1)
-
separator = gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_size_request(10, -1)
separator.set_expand(False)
self.insert(separator, -1)
-
item = gtk.ToolItem()
label = gtk.Label("Seleccionar:")
label.modify_fg(gtk.STATE_NORMAL,
- gtk.gdk.Color(65535, 65535, 65535,1))
+ gtk.gdk.Color(65535, 65535, 65535,1))
label.show()
item.add(label)
self.insert(item, -1)
-
separator = gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_size_request(10, -1)
separator.set_expand(False)
self.insert(separator, -1)
-
item = gtk.ToolItem()
self.filter_combo2 = Combo()
self.filter_combo2.set_items([])
@@ -395,13 +369,27 @@ class ToolbarControl(gtk.Toolbar):
self.filter_combo2.show()
item.add(self.filter_combo2)
self.insert(item, -1)
-
separator = gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_size_request(0, -1)
separator.set_expand(True)
self.insert(separator, -1)
+ stopbutton = gtk.ToolButton()
+ image = gtk.Image()
+ image.set_from_stock(gtk.STOCK_STOP, 32)
+ stopbutton.set_icon_widget(image)
+ image.show()
+ stopbutton.connect('clicked', self.emit_exit)
+ self.insert(stopbutton, -1)
+ stopbutton.show()
+
+ separator = gtk.SeparatorToolItem()
+ separator.props.draw = False
+ separator.set_size_request(10, -1)
+ separator.set_expand(False)
+ self.insert(separator, -1)
+
def emit_get_filter(self, widget, value):
self.emit("get_filter", value)
@@ -417,11 +405,12 @@ class ToolbarControl(gtk.Toolbar):
self.filter_combo2.get_model().clear()
self.emit('show_filter')
+ def emit_exit(self, widget):
+ self.emit('exit')
class Combo(gtk.ComboBox):
__gsignals__ = {"change_selection": (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, (gobject.TYPE_STRING, ))}
-
def __init__(self):
gtk.ComboBox.__init__(self, gtk.ListStore(str))
cell = gtk.CellRendererText()
@@ -451,7 +440,3 @@ class Combo(gtk.ComboBox):
value = self.get_model().get_value(iter, 0)
return value
-
-if __name__ == "__main__":
- CeibalNotifica()
- gtk.main()
diff --git a/CeibalNotificaUninstall b/CeibalNotificaUninstall
deleted file mode 100644
index d76e66d..0000000
--- a/CeibalNotificaUninstall
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-exec "/usr/bin/python" "/usr/local/share/CeibalNotifica/CeibalNotificaUninstall.py" "$@"
diff --git a/CeibalNotificaUninstall.py b/CeibalNotificaUninstall.py
deleted file mode 100644
index f193567..0000000
--- a/CeibalNotificaUninstall.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import os, commands, platform
-
-print "Desinstalando de:", platform.platform()
-print commands.getoutput('rm -r /usr/local/share/CeibalNotifica')
-print commands.getoutput('rm /usr/share/applications/CeibalNotifica.desktop')
-print commands.getoutput('rm /usr/local/bin/CeibalNotifica')
-print commands.getoutput('rm /usr/local/bin/CeibalNotificaUninstall')
-print "CeibalNotifica se ha Desinstalado Correctamente del Sistema"
-
diff --git a/MANIFEST b/MANIFEST
deleted file mode 100644
index 53f15fd..0000000
--- a/MANIFEST
+++ /dev/null
@@ -1,10 +0,0 @@
-CeibalNotifica.py
-setup.cfg
-CeibalNotifica
-MANIFEST
-CeibalNotifica.desktop
-CeibalNotificaUninstall
-setup.py
-CeibalNotificaUninstall.py
-Iconos/ceibal.png
-Iconos/ceibal-gris.png
diff --git a/base.py b/base.py
deleted file mode 100644
index a46be89..0000000
--- a/base.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-# Flavio Danesse - fdanesse@activitycentral.com
-
-'''
-La idea es hacer una aplicación que sea capaz de mostrar todos los mensajes, no importa su prioridad.
-La aplicación se llevará a cabo tanto en el azúcar y en Gnome y debe ser capaz de:
-- Muestra todos los mensajes activos
-- Filtrar y ordenar los mensajes por prioridad, fecha o tipo de mensajes'''
-
-import shelve
-import sqlite3
-import time
-import datetime
-import os
-from store import *
-
-# Archivo notificaciones # http://docs.python.org/library/shelve.html
-filename = os.path.join('/tmp', 'notify_0')
-d = shelve.open(filename)
-d['id'] = 0
-d['title'] = "Uruguay"
-d['text'] = '''
-Uruguay, oficialmente República Oriental del Uruguay, es un país de América del Sur, situado en la parte oriental del Cono Sur americano.
-Limita al noreste con Brasil —estado de Río Grande del Sur—, al oeste con Argentina —provincias de Entre Ríos y Corrientes— y tiene costas en el océano Atlántico al sureste y sobre el Río de la Plata hacia el sur.
-Abarca 176 mil km² siendo el segundo país más pequeño de Sudamérica en cuanto a territorio, detrás de Surinam. Posee un clima templado.
-La población estimada para 2011 es de 3,25 millones de habitantes,1 4 representando la décima mayor población entre los países de América del Sur.
-Es una república presidencialista subdividida en 19 departamentos y 89 alcaldías.
-La capital y ciudad más grande del país es Montevideo, con 1,4 millones de habitantes,5 y cuya área metropolitana alcanza casi los dos millones,6 lo que corresponde al 58,8% del total nacional.
-Es miembro de las Naciones Unidas, del Mercosur, de la OEA, de la UNASUR y del G77, entre otros.
-El actual territorio uruguayo fue conocido en un principio como Banda Oriental —que también incluía parte del actual estado brasileño de Río Grande del Sur—.
-Tal denominación proviene de su ubicación geográfica, pues se ubica al este —u oriente— del río Uruguay y al norte del Río de la Plata, siendo la tierra más oriental del Virreinato del Río de la Plata.
-El 28 de agosto de 1828 se firmó la Convención Preliminar de Paz en la que se estableció la creación de un estado independiente, aunque sin denominación oficial. La primera denominación de la actual República Oriental del Uruguay fue «Estado Oriental del Uruguay.»
-Dicha denominación fue dada al país por la primera Constitución promulgada el 28 de junio de 1830 y jurada por el pueblo el 18 de julio del mismo año.'''
-d['priority'] = 1
-d['launched'] = datetime.date(1972, 6, 21)
-d['expires'] = datetime.date(2012, 6, 21)
-d['type'] = "Geografía"
-d['fav'] = 0
-d.close()
-
-filename = os.path.join('/tmp', 'notify_1')
-d = shelve.open(filename)
-d['id'] = 1
-d['title'] = "América del Sur"
-d['text'] = '''
-América del Sur, también llamada Sudamérica o Suramérica, es el subcontinente austral de América.
-Está atravesada por la línea ecuatorial en su extremo norte, quedando así con la mayor parte de su territorio comprendida dentro del Hemisferio Sur.
-Está situada entre el océano Atlántico y el océano Pacífico quienes delimitan los extremos Este y Oeste respectivamente, mientras que el Mar Caribe delimita por el norte y el Océano Antártico su extremo sur.
-Ocupa una superficie de 17,8 millones de km², lo que representa un 42% del continente americano y un 12% de las tierras emergidas,9 y está habitada por el 6% de la población mundial.'''
-d['priority'] = 2
-d['launched'] = datetime.date(1973, 6, 21)
-d['expires'] = datetime.date(2013, 6, 21)
-d['type'] = "Geografía"
-d['fav'] = 1
-d.close()
-
-filename = os.path.join('/tmp', 'notify_2')
-d = shelve.open(filename)
-d['id'] = 2
-d['title'] = "Nueva Imagen Para tu xo"
-d['text'] = '''Está disponible la nueva imagen para tu XO!
-Para tenerla entrar al sitio www.ceibal.edu.uy'''
-d['priority'] = 0
-d['launched'] = datetime.date(1974, 6, 21)
-d['expires'] = datetime.date(2013, 6, 21)
-d['type'] = "Actualización"
-d['fav'] = 1
-d.close()
-
-filename = os.path.join('/tmp', 'notify_3')
-d = shelve.open(filename)
-d['id'] = 3
-d['title'] = "Actividades"
-d['text'] = '''En setiembre se viene la Liga de Primavera de Cazaproblemas.
-En breve podrás inscribirte y participar por grandes premios'''
-d['priority'] = 3
-d['launched'] = datetime.date(1975, 6, 21)
-d['expires'] = datetime.date(2013, 6, 21)
-d['type'] = "Actividades"
-d['fav'] = 0
-d.close()
-
-store = Store(xmlpath='/tmp', db_filename="prueba.db")
-mensaje = store.db.get_messages([])
-print mensaje
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index d5a27ff..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-[install]
-install_lib=/usr/local/share/CeibalNotifica
-install_data=/usr/local/share/CeibalNotifica
-install_scripts=/usr/local/bin
diff --git a/setup.py b/setup.py
index f728a66..6ea61a6 100755..100644
--- a/setup.py
+++ b/setup.py
@@ -1,21 +1,3 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-# setup.py por: Flavio Danesse fdanesse@activitycentral.com
-# https://sites.google.com/site/flaviodanesse/
-# https://sites.google.com/site/sugaractivities/
-# http://codigosdeejemplo.blogspot.com/
-
-import commands
-from distutils.core import setup
-
-setup(name="CeibalNotifica",
- version = "1",
- author = "Flavio Danesse",
- author_email = "fdanesse@activitycentral.com",
- license = "GPL3",
- scripts = ["CeibalNotifica", "CeibalNotificaUninstall"],
- py_modules = ['CeibalNotifica', 'CeibalNotificaUninstall'],
- data_files = [('/usr/share/applications/', ['CeibalNotifica.desktop']),
- ('', ['CeibalNotificaUninstall.py']),
- ('Iconos', ['Iconos/ceibal.png', 'Iconos/ceibal-gris.png'])])
+#!/usr/bin/python
+from sugar.activity import bundlebuilder
+bundlebuilder.start()