[Sugar-devel] usermode yum (was Re: Adding git to Sugar platform?)

2011-10-21 Thread Andrés Ambrois
On Friday, October 21, 2011 03:11:22 PM Peter Robinson wrote:
  There are over .5 million children in Uruguay who don't have access.
 
 That is ultimately a deployment decision and has nothing to do with the
 technical ability to do it. I was obviously talking about the later.
 
 Peter
 

This is not entirely true. The lack of understanding of the Linux security 
model by the deployments play a major role in not even considering 
implementing that feature.
-- 
  -Andrés


signature.asc
Description: This is a digitally signed message part.
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Feature Freeze exception request: Journal Sort

2010-08-23 Thread Andrés Ambrois
On Monday, August 23, 2010 04:25:48 am Tomeu Vizoso wrote:
 On Sat, Aug 21, 2010 at 01:24, Aleksey Lim alsr...@member.fsf.org wrote:
  Hi all,
 
  Implement sorting in the Journal UI. Also adds support for the two new
  properties (filesize and ctime).
 
  Feature page:
  http://wiki.sugarlabs.org/go/Features/Journal_Sort
 
  Implementations:
  http://git.sugarlabs.org/projects/sugar-datastore/repos/journal_sort
  http://git.sugarlabs.org/projects/sugar/repos/journal_sort
 
 Some questions:
 
 - what with hard links? Aren't users going to expect that if they
 delete an entry of 50MB that their available space will be increased
 by 50MB?

One way or the other, we are going to leak the abstraction that different 
journal entries consume disk space independently; be it by the behavior you 
describe, or providing some sort of visual hints. I don't think there's much 
we can do except making it clear that file size is just a hint these days 
(think filesystem compression).

 - creation time will be always displayed as '%Y-%m-%dT%H:%M:%S' ? What
 about those countries where they expect the fields being ordered in a
 different way? (may be good to format the string in listview.py
 instead of in listmodel.py, so we keep UI decisions out from the
 model).

I agree with that separation of concerns. In fact it was initially that way,
but the format is required by activities such as Etoys, that break unless we 
use it. Other activities may also be depending on it, as it is documented in 
[0].

 - if we are not interested in sorting by title, we should remove that
 field from the index, because makes the index bigger and also slows
 queries down a bit.

As I've learned from this work, adding/removing DS properties should be done 
with care, as everything can break in a gazillion ways. In any case, that 
belongs to a different patchset.

 - seems like this feature is still in dicussion in
 http://bugs.sugarlabs.org/ticket/1915 so I don't think it makes sense
 to accept it for inclusion in 0.90 at this stage. Also would be good
 to have the feature first accepted in the release set before
 eventually merging it.

It would be a shame for it to miss the boat, but I think that this should get 
plenty of testing as it may cause data loss for users.

 Regards,
 
 Tomeu
 
  --
  Aleksey

[0] http://wiki.sugarlabs.org/go/Development_Team/Low-
level_Activity_API#Meta_Data
-- 
  -Andrés


signature.asc
Description: This is a digitally signed message part.
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Feature Freeze exception request: Journal Sort

2010-08-23 Thread Andrés Ambrois
On Monday, August 23, 2010 02:12:38 pm Tomeu Vizoso wrote:
 On Mon, Aug 23, 2010 at 19:09, Aleksey Lim alsr...@member.fsf.org wrote:
  On Mon, Aug 23, 2010 at 04:48:33PM +, Aleksey Lim wrote:
  On Mon, Aug 23, 2010 at 01:08:30PM -0300, Andrés Ambrois wrote:
   On Monday, August 23, 2010 04:25:48 am Tomeu Vizoso wrote:
   
- creation time will be always displayed as '%Y-%m-%dT%H:%M:%S' ? 
What
about those countries where they expect the fields being ordered in a
different way? (may be good to format the string in listview.py
instead of in listmodel.py, so we keep UI decisions out from the
model).
  
   I agree with that separation of concerns. In fact it was initially that 
way,
   but the format is required by activities such as Etoys, that break 
unless we
   use it. Other activities may also be depending on it, as it is 
documented in
   [0].
 
  If are talking about UI representaion, then it is ok (ago format).
  About internal representaion, Andrés, for what readon we store ctime in 
ISO,
  what about int value (to keep it in the same format as timestamp)?
 
  Sorry, didn't see [0] (was thinking that we dind't expose any ctime
  fields before), what about renaming ctime ds field and using int value.
 
 Ttat sounds interesting.

If we rename it, all the activities that use it will need to be fixed. If we 
just create a new one with a different name, then we will have redundant 
metadata. 

The DS needs to expose ctime in the %Y-%m-%d format for activities such as 
Etoys anyway, so we might as well use that format on disk and spare us the 
conversion on each query.

As for localization, the journal part need to be correctly localized, but the 
format we expose in the DS service is part of the API, not a user-visible 
string. I would even say that it is easier to understand what you mean by 
'2010-08-23T14:51:14' than by 1282585874.0, almost everywhere in the world. A 
good argument for the float format is that it is easier to convert with the 
python library. 

 Regards,
 
 Tomeu
 
  --
  Aleksey
 
 

-- 
  -Andrés


signature.asc
Description: This is a digitally signed message part.
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] journal sort options

2010-08-18 Thread Andrés Ambrois
On Wednesday, August 18, 2010 09:38:28 pm James Cameron wrote:
 On Thu, Aug 19, 2010 at 09:53:11AM +1000, fors...@ozonline.com.au wrote:
  with os373pyg if i sort the journal by creation date, all entries
  (except tamyblock.py) show a creation date 41 years 8 months ago. Is
  this right? If so its not very useful.
 
 Forty one years?  Two years would be fine.  Check the time on your
 computer to see if it is set to the current year?

That's a zero in a ctime property (it counts since the Unix epoch). Do new 
entries display correct ctimes? It may be that a reindex didn't trigger on 
upgrade.

 -- 
 James Cameron
 http://quozl.linux.org.au/

-- 
  -Andrés


signature.asc
Description: This is a digitally signed message part.
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] journal sort options

2010-08-18 Thread Andrés Ambrois
On Wednesday, August 18, 2010 10:27:47 pm fors...@ozonline.com.au wrote:
 
  That's a zero in a ctime property (it counts since the Unix epoch). Do new 
  entries display correct ctimes? It may be that a reindex didn't trigger on 
  upgrade.
 
 depends on what you call a new entry, saved activities are all 41 years, but 
saved photos, clipboard items and tamyblock.py(saved by turtleblocks at 
install time) display correctly
 

By new entries I mean journal entries that were created after you upgraded to 
a build with the journal sorting feature.

-- 
  -Andrés


signature.asc
Description: This is a digitally signed message part.
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] Wrong exception when copying an entry with no file to a removable device.

2010-06-13 Thread Andrés Ambrois
In that case write() was called with file_path=None by copy() and a
TypeError was raised by os.path.exists().

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/model.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index ae77e72..fd3d3db 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -492,7 +492,7 @@ def write(metadata, file_path='', update_mtime=True, 
transfer_ownership=True):
  file_path,
  transfer_ownership)
 else:
-if not os.path.exists(file_path):
+if not file_path or not os.path.exists(file_path):
 raise ValueError('Entries without a file cannot be copied to '
  'removable devices')
 
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] Journal: Fix for sl#1842

2010-06-13 Thread Andrés Ambrois
On Sunday 13 June 2010 06:21:22 pm anishmangal2...@gmail.com wrote:
 diff --git a/src/jarabe/journal/journalactivity.py 
b/src/jarabe/journal/journalactivity.py
 index 0559560..9536ca3 100644
 --- a/src/jarabe/journal/journalactivity.py
 +++ b/src/jarabe/journal/journalactivity.py
 @@ -27,6 +27,7 @@ import statvfs
  import os
  
  from sugar.graphics.window import Window
 +from sugar.graphics.alert import NotifyRedAlert
  from sugar.bundle.bundle import ZipExtractException, RegistrationException
  from sugar import env
  from sugar.activity import activityfactory
 @@ -138,6 +139,17 @@ class JournalActivity(Window):
  self._critical_space_alert = None
  self._check_available_space()
  
 +def _alert_notify_cb(self, _volumes_toolbar, strerror):

This may be useful to show errors coming from other places than VolumesToolbar 
(e.g. ObjectPalette may delete entries and raise errors too), so the second 
parameter may not always be _volumes_toolbar.

 +alert = NotifyRedAlert(10)
 +alert.props.title=_('Alert')
 +alert.props.msg = _(strerror)

Gettexting a variable string will not work unless you're thinking of 
translating all the possible variations, which in any case should already be 
done by the user's system locale. I guess this could also break pootle.

 diff --git a/src/jarabe/journal/volumestoolbar.py 
b/src/jarabe/journal/volumestoolbar.py
 index 74b974c..33e7b88 100644
 --- a/src/jarabe/journal/volumestoolbar.py
 +++ b/src/jarabe/journal/volumestoolbar.py
 @@ -35,6 +35,9 @@ class VolumesToolbar(gtk.Toolbar):
  __gsignals__ = {
  'volume-changed': (gobject.SIGNAL_RUN_FIRST,
 gobject.TYPE_NONE,
 +   ([str])),
 +'data-ioerror': (gobject.SIGNAL_RUN_FIRST,
 +   gobject.TYPE_NONE,
 ([str]))
  }

This is just a nitpick, but 'data-ioerror' may not be the best name. For 
instance, when we copy an empty without a file to a removable device, 
model.write() throws a ValueError.

 @@ -137,7 +150,11 @@ class BaseButton(RadioToolButton):
 info, timestamp):
  object_id = selection_data.data
  metadata = model.get(object_id)
 -model.copy(metadata, self.mount_point)
 +try:
 +model.copy(metadata, self.mount_point)
 +except IOError as (errno, strerror):
 +logging.error('BaseButton._drag_data_received_cb: %s; %s' % 
(errno, strerror))
 +self.emit('data-ioerror', strerror)

If you also catch ValueError here, and with the patch I just sent (Wrong 
exception when copying an entry with no file to a removable device) you could 
show that error to the user as well.

Nice work!

Reviewed-by: Andrés Ambrois andresambr...@gmail.com
-- 
  -Andrés


signature.asc
Description: This is a digitally signed message part.
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] Wrong exception when copying an entry with no file to a removable device.

2010-06-13 Thread Andrés Ambrois
On Sunday 13 June 2010 09:52:22 pm Gonzalo Odiard wrote:
 Andres! Gol de Uruguay?

For a change! ;)

Actually, I don't know if there's a ticket for this. I just ran into it while 
looking at the code.

P.S.: Good thing that Germany - Australia was a little more exciting than the 
rest of the world cup so far... lets hope we can ramp up the pace as well :)

 Gonzalo
 
 On Sun, Jun 13, 2010 at 9:49 PM, Michael Stone mich...@laptop.org wrote:
 
  On Sun, Jun 13, 2010 at 08:43:19PM -0300, Andrés Ambrois wrote:
  In that case write() was called with file_path=None by copy() and a
  TypeError was raised by os.path.exists().
  
  Signed-off-by: Andrés Ambrois andresambr...@gmail.com
  ---
   src/jarabe/journal/model.py |2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)
  
  diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
  index ae77e72..fd3d3db 100644
  --- a/src/jarabe/journal/model.py
  +++ b/src/jarabe/journal/model.py
  @@ -492,7 +492,7 @@ def write(metadata, file_path='', update_mtime=True,
  transfer_ownership=True):
file_path,
transfer_ownership)
   else:
  -if not os.path.exists(file_path):
  +if not file_path or not os.path.exists(file_path):
   raise ValueError('Entries without a file cannot be copied to
  '
'removable devices')
  
  --
  1.6.3.3
 
  Reviewed-by: Michael Stone mich...@laptop.org
 
  Looks good to me; merged into my personal tree.
 
  Michael
  ___
  Sugar-devel mailing list
  Sugar-devel@lists.sugarlabs.org
  http://lists.sugarlabs.org/listinfo/sugar-devel
 
 
 
 
 -- 
 Gonzalo Odiard
 Responsable de Desarrollo
 Sistemas Australes
 

-- 
  -Andrés


signature.asc
Description: This is a digitally signed message part.
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH 0/3] mobile-broadband-provider-info support. Take 2.

2010-06-13 Thread Andrés Ambrois
I'm resurrecting an old patch here, hoping it makes it for 0.90.

From SL#1630:

The NetworkManager project provides an XML database containing carrier
network details for a large number of countries. Support for parsing this
database would greatly benefit the user experience when configuring a mobile
broadband modem.
The database package is usually called mobile-broadband-provider-info. 

Andrés Ambrois (3):
  Add models for detecting and parsing the providers DB.
  Show Country/Provider/Plan comboboxes if DB exists.
  Add config.py.in and update AC_CONFIG_FILES.

 configure.ac   |1 +
 .../cpsection/modemconfiguration/Makefile.am   |2 +
 .../cpsection/modemconfiguration/config.py.in  |   20 +++
 extensions/cpsection/modemconfiguration/model.py   |  109 
 extensions/cpsection/modemconfiguration/view.py|  136 +---
 5 files changed, 252 insertions(+), 16 deletions(-)
 create mode 100644 extensions/cpsection/modemconfiguration/config.py.in
 mode change 100755 = 100644 extensions/cpsection/modemconfiguration/model.py

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH 1/3] Add models for detecting and parsing the providers DB.

2010-06-13 Thread Andrés Ambrois
has_providers_db() checks for the files needed and is used by the view
to decide whether to show the combo boxes.
The models are gtk.ListStore subclasses that parse the XML element they
receive as a parameter in their constructors.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com

 mode change 100755 = 100644 extensions/cpsection/modemconfiguration/model.py

diff --git a/extensions/cpsection/modemconfiguration/model.py 
b/extensions/cpsection/modemconfiguration/model.py
old mode 100755
new mode 100644
index 2545ce1..42f7563
--- a/extensions/cpsection/modemconfiguration/model.py
+++ b/extensions/cpsection/modemconfiguration/model.py
@@ -15,11 +15,20 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  US
 
 import gconf
+import gtk
+import os
+import locale
+from xml.etree.cElementTree import ElementTree
+from gettext import gettext as _
 
 from jarabe.model.network import GSM_USERNAME_PATH, GSM_PASSWORD_PATH, \
  GSM_NUMBER_PATH, GSM_APN_PATH, GSM_PIN_PATH, \
  GSM_PUK_PATH
 
+from cpsection.modemconfiguration.config import PROVIDERS_PATH, \
+PROVIDERS_FORMAT_SUPPORTED, \
+COUNTRY_CODES_PATH
+
 def get_username():
 client = gconf.client_get_default()
 return client.get_string(GSM_USERNAME_PATH) or ''
@@ -68,3 +77,103 @@ def set_puk(puk):
 client = gconf.client_get_default()
 client.set_string(GSM_PUK_PATH, puk)
 
+def has_providers_db():
+if not os.path.isfile(COUNTRY_CODES_PATH):
+return False
+try:
+tree = ElementTree(file=PROVIDERS_PATH)
+elem = tree.getroot()
+if elem is None or elem.get('format') != PROVIDERS_FORMAT_SUPPORTED:
+return False
+return True
+except IOError:
+return False
+
+class CountryListStore(gtk.ListStore):
+COUNTRY_CODE = locale.getdefaultlocale()[0][3:5].lower()
+
+def __init__(self):
+gtk.ListStore.__init__(self, str, object)
+codes = {}
+with open(COUNTRY_CODES_PATH) as codes_file:
+for line in codes_file:
+if line.startswith('#'):
+continue
+code, name = line.split('\t')[:2]
+codes[code.lower()] = name.strip()
+etree = ElementTree(file=PROVIDERS_PATH).getroot()
+self._country_idx = None
+i = 0
+for elem in etree.findall('.//country'):
+code = elem.attrib['code']
+if code == self.COUNTRY_CODE:
+self._country_idx = i
+else:
+i += 1
+if code in codes:
+self.append((codes[code], elem))
+else:
+self.append((code, elem))
+
+def get_row_providers(self, row):
+return self[row][1]
+
+def guess_country_row(self):
+if self._country_idx is not None:
+return self._country_idx
+else:
+return -1
+
+class ProviderListStore(gtk.ListStore):
+def __init__(self, elem):
+gtk.ListStore.__init__(self, str, object)
+for provider_elem in elem.findall('.//provider'):
+apns = provider_elem.findall('.//apn')
+if not apns:
+# Skip carriers with CDMA entries only
+continue
+self.append((provider_elem.find('.//name').text, apns))
+
+def get_row_plans(self, row):
+return self[row][1]
+
+class PlanListStore(gtk.ListStore):
+LANG_NS_ATTR = '{http://www.w3.org/XML/1998/namespace}lang'
+LANG = locale.getdefaultlocale()[0][:2]
+DEFAULT_NUMBER = '*99#'
+
+def __init__(self, elems):
+gtk.ListStore.__init__(self, str, object)
+for apn_elem in elems:
+plan = {}
+names = apn_elem.findall('.//name')
+if names:
+for name in names:
+if name.get(self.LANG_NS_ATTR) is None:
+# serviceproviders.xml default value
+plan['name'] = name.text
+elif name.get(self.LANG_NS_ATTR) == self.LANG:
+# Great! We found a name value for our locale!
+plan['name'] = name.text
+break
+else:
+plan['name'] = _('Default')
+plan['apn'] = apn_elem.get('value')
+user = apn_elem.find('.//username')
+if user is not None:
+plan['username'] = user.text
+else:
+plan['username'] = ''
+passwd = apn_elem.find('.//password')
+if passwd is not None:
+plan['password'] = passwd.text
+else:
+plan['password'] = ''
+
+plan['number'] = self.DEFAULT_NUMBER
+
+self.append((plan['name'], plan))
+
+def get_row_plan(self, row):
+return

[Sugar-devel] [PATCH 2/3] Show Country/Provider/Plan comboboxes if DB exists.

2010-06-13 Thread Andrés Ambrois
Display comboboxes for selecting a data plan for each country and
provider if the mobile-broadband-providers-info package is installed.
Populate the connection parameters with the info from the selected data
plan.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com

diff --git a/extensions/cpsection/modemconfiguration/view.py 
b/extensions/cpsection/modemconfiguration/view.py
index b236f3f..e2fdd53 100644
--- a/extensions/cpsection/modemconfiguration/view.py
+++ b/extensions/cpsection/modemconfiguration/view.py
@@ -160,61 +160,142 @@ class ModemConfiguration(SectionView):
 self._model = model
 self.restart_alerts = alerts
 
-self.set_border_width(style.DEFAULT_SPACING)
 self.set_spacing(style.DEFAULT_SPACING)
-self._group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
+
+label_group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
+
+scrolled_win = gtk.ScrolledWindow()
+scrolled_win.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+scrolled_win.show()
+self.add(scrolled_win)
+
+main_box = gtk.VBox(spacing=style.DEFAULT_SPACING)
+main_box.set_border_width(style.DEFAULT_SPACING)
+main_box.show()
+scrolled_win.add_with_viewport(main_box)
 
 explanation = _(You will need to provide the following  \
 information to set up a mobile  \
 broadband connection to a cellular \
 (3G) network.)
 self._text = gtk.Label(explanation)
-self._text.set_width_chars(100)
 self._text.set_line_wrap(True)
 self._text.set_alignment(0, 0)
-self.pack_start(self._text, False)
+main_box.pack_start(self._text, False)
 self._text.show()
 
+if model.has_providers_db():
+self._upper_box = gtk.VBox(spacing=style.DEFAULT_SPACING)
+self._upper_box.set_border_width(style.DEFAULT_SPACING)
+main_box.pack_start(self._upper_box, expand=False)
+self._upper_box.show()
+
+combo_group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
+
+box = gtk.HBox(spacing=style.DEFAULT_SPACING)
+label = gtk.Label(_('Country:'))
+label_group.add_widget(label)
+box.pack_start(label, False)
+label.show()
+country_store = model.CountryListStore()
+country_combo = gtk.ComboBox(country_store)
+combo_group.add_widget(country_combo)
+cell = gtk.CellRendererText()
+cell.props.xalign = 0.5
+country_combo.pack_start(cell)
+country_combo.add_attribute(cell, 'text', 0)
+country_combo.connect('changed', self.__country_selected_cb)
+box.pack_start(country_combo, False)
+country_combo.show()
+self._upper_box.pack_start(box, False)
+box.show()
+
+box = gtk.HBox(spacing=style.DEFAULT_SPACING)
+label = gtk.Label(_('Provider:'))
+label_group.add_widget(label)
+box.pack_start(label, False)
+label.show()
+self._providers_combo = gtk.ComboBox()
+combo_group.add_widget(self._providers_combo)
+cell = gtk.CellRendererText()
+cell.props.xalign = 0.5
+self._providers_combo.pack_start(cell)
+self._providers_combo.add_attribute(cell, 'text', 0)
+self._providers_combo.connect('changed',
+  self.__provider_selected_cb)
+box.pack_start(self._providers_combo, False)
+self._providers_combo.show()
+self._upper_box.pack_start(box, False)
+box.show()
+
+box = gtk.HBox(spacing=style.DEFAULT_SPACING)
+label = gtk.Label(_('Plan:'))
+label_group.add_widget(label)
+box.pack_start(label, False)
+label.show()
+self._plan_combo = gtk.ComboBox()
+combo_group.add_widget(self._plan_combo)
+cell = gtk.CellRendererText()
+cell.props.xalign = 0.5
+self._plan_combo.pack_start(cell)
+self._plan_combo.add_attribute(cell, 'text', 0)
+self._plan_combo.connect('changed', self.__plan_selected_cb)
+box.pack_start(self._plan_combo, False)
+self._plan_combo.show()
+self._upper_box.pack_start(box, False)
+box.show()
+
+country_combo.set_active(country_store.guess_country_row())
+
+separator = gtk.HSeparator()
+main_box.pack_start(separator, False)
+separator.show()
+
+self._lower_box = gtk.VBox(spacing=style.DEFAULT_SPACING)
+self._lower_box.set_border_width(style.DEFAULT_SPACING)
+main_box.pack_start(self._lower_box, expand=False)
+self._lower_box.show()
+
 self._username_entry = UsernameEntry(model

[Sugar-devel] [PATCH 3/3] Add config.py.in and update AC_CONFIG_FILES.

2010-06-13 Thread Andrés Ambrois
config.py is generated from config.py.in at configure time by autoconf,
so it needs to be added to AC_CONFIG_FILES in configure.ac.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com

 create mode 100644 extensions/cpsection/modemconfiguration/config.py.in

diff --git a/configure.ac b/configure.ac
index 13a2f09..68a8bf3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,6 +56,7 @@ extensions/cpsection/frame/Makefile
 extensions/cpsection/keyboard/Makefile
 extensions/cpsection/language/Makefile
 extensions/cpsection/modemconfiguration/Makefile
+extensions/cpsection/modemconfiguration/config.py
 extensions/cpsection/Makefile
 extensions/cpsection/network/Makefile
 extensions/cpsection/power/Makefile
diff --git a/extensions/cpsection/modemconfiguration/Makefile.am 
b/extensions/cpsection/modemconfiguration/Makefile.am
index 3e2613e..525e02e 100644
--- a/extensions/cpsection/modemconfiguration/Makefile.am
+++ b/extensions/cpsection/modemconfiguration/Makefile.am
@@ -4,3 +4,5 @@ sugar_PYTHON =  \
__init__.py \
model.py\
view.py 
+
+nodist_sugar_PYTHON = config.py
diff --git a/extensions/cpsection/modemconfiguration/config.py.in 
b/extensions/cpsection/modemconfiguration/config.py.in
new file mode 100644
index 000..6fa688e
--- /dev/null
+++ b/extensions/cpsection/modemconfiguration/config.py.in
@@ -0,0 +1,20 @@
+# -*- encoding: utf-8 -*-
+# Copyright (C) 2010 Andrés Ambrois
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  US
+
+PROVIDERS_PATH = 
@prefix@/share/mobile-broadband-provider-info/serviceproviders.xml
+PROVIDERS_FORMAT_SUPPORTED = 2.0
+COUNTRY_CODES_PATH = @prefix@/share/zoneinfo/iso3166.tab
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] More Sugar 0.88 bugs to work on

2010-05-28 Thread Andrés Ambrois
On Thursday 27 May 2010 10:17:11 am Bernie Innocenti wrote:
 On the plane to Miami, I've reorganized some of the reports sent by
 various testers:
 
 === Bugs reported against os240 ===
 [ ] Alt-1 does not capture a screenshot
 
 Probably the same of ALT-Tab not working. I bet we're eating all the ALT
 events for the start-new function in the Favorites view. Who would like
 to work on this?
 
 
 [ ] Selecting pictures from the journal in Memorize kills the
 application (journal error?)
 
 Andres, this might be a regression introduced by your patch series.

I could not reproduce this on os240py or sugar-jhbuild with Memorize 34. Do 
you have a more detailed report?

Also, this image doesn't include the last version of the patchset. Sorting on 
removable devices doesn't work, for example. I would recommend any testing to 
be done with the latest version.

 [ ] Control panel - keyboard causes a restart, thats all it does,
 dont know what its meant to do but shouldnt restart without warning
 
 Martin, maybe you could do this?
 
 
 [ ] Trouble handling non-sugarized activities (XaoS)
 
 I wonder how much work would it take, in your opinion, to implement the
 Freedesktop startup-notification protocol in Sugar? So we could stop
 wrapping every non-native activities with things such as the sugarize
 script, which serves no useful purpose but to implement the non-standard
 startup protocol expected by Sugar.
 
 After the switch to Metacity, this would be another step towards proper
 integration of regular Linux applications with Sugar.
 
 -- 
// Bernie Innocenti - http://codewiz.org/
  \X/  Sugar Labs   - http://sugarlabs.org/
 
 

-- 
  -Andrés


signature.asc
Description: This is a digitally signed message part.
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] #1686 UNSP: Accessibility - virtual keyboard

2010-05-27 Thread Andrés Ambrois
On Wednesday 26 May 2010 06:26:52 pm James Cameron wrote:
 On Wed, May 26, 2010 at 10:57:55AM -0400, Michael Stone wrote:
  For this sole strategic reason, I think we need to consider accepting
  well-written patches that come to us in Spanish or in English.
 
 I agree.  I don't think language, culture of origin, or degree of
 whitespace should prevent acceptance.  They might delay or hinder review
 though, and so use of English should be a recommendation and not a
 requirement.

Lets also think about translation. I would like to be disproved but I think 
English is the most popular secondary language in the world, so gettexted 
strings should always be in English. I don't believe this completely 
invalidates the arguments for accepting code in other languages, but at least 
the gap between writing some things in English and writing everything in 
English is smaller. 

It is also not currently possible to write a useful patch without reading a 
lot of existing code (in English), so I don't think whoever does it would be 
unable to write it in (at least bad) English.

I don't think having a rigid policy either way, either accepting only patches 
in English or accepting any patch, is a good idea. We don't want to discourage 
contributors that don't speak English, but neither do we want to have lazy 
contributors forgetting about the maintainability of their code.
 -- 
 James Cameron
 http://quozl.linux.org.au/
 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel
 

-- 
  -Andrés


signature.asc
Description: This is a digitally signed message part.
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] Add icons for the sorting options in the Journal

2010-05-26 Thread Andrés Ambrois
Thanks to Gary C. Martin for the icons.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 icons/scalable/actions/Makefile.am   |3 +++
 icons/scalable/actions/view-created.svg  |   21 +
 icons/scalable/actions/view-lastedit.svg |   23 +++
 icons/scalable/actions/view-size.svg |   12 
 4 files changed, 59 insertions(+), 0 deletions(-)
 create mode 100644 icons/scalable/actions/view-created.svg
 create mode 100644 icons/scalable/actions/view-lastedit.svg
 create mode 100644 icons/scalable/actions/view-size.svg

diff --git a/icons/scalable/actions/Makefile.am 
b/icons/scalable/actions/Makefile.am
index 42a06a3..a00a2df 100644
--- a/icons/scalable/actions/Makefile.am
+++ b/icons/scalable/actions/Makefile.am
@@ -94,6 +94,9 @@ icon_DATA =   \
view-freeform.svg   \
view-fullscreen.svg \
view-list.svg   \
+   view-size.svg   \
+   view-lastedit.svg   \
+   view-created.svg\
view-radial.svg \
view-refresh.svg\
view-return.svg \
diff --git a/icons/scalable/actions/view-created.svg 
b/icons/scalable/actions/view-created.svg
new file mode 100644
index 000..7d3ba09
--- /dev/null
+++ b/icons/scalable/actions/view-created.svg
@@ -0,0 +1,21 @@
+?xml version=1.0 encoding=UTF-8?
+!DOCTYPE svg PUBLIC -//W3C//DTD SVG 1.1//EN 
http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd; [
+  !ENTITY fill_color #00
+  !ENTITY stroke_color #FF
+]
+svg xmlns=http://www.w3.org/2000/svg; width=55 height=55
+   defs
+   mask id=Mask maskUnits=userSpaceOnUse x=0 y=0 
width=55 height=55
+rect x=0 y=0 width=55 height=55 fill=#FF 
stroke=none/
+   circle cx=27.5 cy=15 r=1.75 
style=fill:#00;;stroke:none/
+   circle cx=27.5 cy=40 r=1.75 
style=fill:#00;;stroke:none/
+   circle cx=15 cy=27.5 r=1.75 
style=fill:#00;;stroke:none/
+   circle cx=40 cy=27.5 r=1.75 
style=fill:#00;;stroke:none/
+line x1=27.5 y1=27.5 x2=34.5 y2=17 stroke=#00 
stroke-width=2.5 stroke-linecap=round/
+line x1=27.5 y1=27.5 x2=35 y2=32.5 stroke=#00 
stroke-width=2.5 stroke-linecap=round/
+   /mask
+   /defs
+circle cx=27.5 cy=27.5 r=17 
style=fill:stroke_color;;stroke:stroke_color;;stroke-width:3.5 
mask=url(#Mask)/
+!--
+--
+/svg
diff --git a/icons/scalable/actions/view-lastedit.svg 
b/icons/scalable/actions/view-lastedit.svg
new file mode 100644
index 000..fe3e077
--- /dev/null
+++ b/icons/scalable/actions/view-lastedit.svg
@@ -0,0 +1,23 @@
+?xml version=1.0 encoding=UTF-8?
+!DOCTYPE svg PUBLIC -//W3C//DTD SVG 1.1//EN 
http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd; [
+  !ENTITY fill_color #00
+  !ENTITY stroke_color #FF
+]
+svg xmlns=http://www.w3.org/2000/svg; width=55 height=55
+   defs
+   mask id=Mask maskUnits=userSpaceOnUse x=0 y=0 
width=55 height=55
+rect x=0 y=0 width=55 height=55 fill=#FF 
stroke=none/
+line x1=19 y1=19 x2=27 y2=19 stroke=#00 
stroke-width=2.5/
+line x1=28 y1=19 x2=31 y2=19 stroke=#00 
stroke-width=2.5/
+line x1=19 y1=24 x2=21 y2=24 stroke=#00 
stroke-width=2.5/
+line x1=22 y1=24 x2=26 y2=24 stroke=#00 
stroke-width=2.5/
+line x1=19 y1=29 x2=22 y2=29 stroke=#00 
stroke-width=2.5/
+path d=M 24 35 l 2 -6 l 19 -19 l 4 3 l -19 19 z fill=#00 
stroke=#00 stroke-width=3/
+   /mask
+   /defs
+rect x=15 y=14 width=25 height=27 
style=fill:stroke_color;;stroke:stroke_color;;stroke-width:3.5 
mask=url(#Mask)/
+path d=M 24 35 l 1 -5 l 4 3 z fill=stroke_color; stroke=none/
+path d=M 24 35 m 2 -6 l 19 -19 l 4 3 l -19 19 z fill=stroke_color; 
stroke=none/
+!--
+--
+/svg
diff --git a/icons/scalable/actions/view-size.svg 
b/icons/scalable/actions/view-size.svg
new file mode 100644
index 000..e87f978
--- /dev/null
+++ b/icons/scalable/actions/view-size.svg
@@ -0,0 +1,12 @@
+?xml version=1.0 encoding=UTF-8?
+!DOCTYPE svg PUBLIC -//W3C//DTD SVG 1.1//EN 
http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd; [
+  !ENTITY fill_color #00
+  !ENTITY stroke_color #FF
+]
+svg xmlns=http://www.w3.org/2000/svg; width=55 height=55
+line x1=12 y1=17.5 x2=43 y2=17.5 stroke=stroke_color; 
stroke-width=2.5/
+line x1=16 y1=22.5 x2=39 y2=22.5 stroke=stroke_color; 
stroke-width=2.5/
+line x1=20 y1=27.5 x2=35 y2=27.5 stroke=stroke_color; 
stroke-width=2.5/
+line x1=23.5 y1=32.5 x2=31.5 y2=32.5 stroke=stroke_color; 
stroke-width=2.5/
+line x1

[Sugar-devel] [PATCH v1 0/5] Add ctime and filesize properties to the datastore

2010-05-23 Thread Andrés Ambrois
This is in preparation of the Journal work implementing sorting of entries by
these properties.

v0: Initial submission to sugar-devel
v1: Split ctime and filesize patches as requested by Sascha

Andrés Ambrois (5):
  Add filesize property to the index
  Add migration code from DS v0 for the filesize property
  Increment CURRENT_LAYOUT_VERSION to trigger an index rebuild.
  Add ctime property to the index and datastore
  Implement migration from DS v0 for ctime property.

 src/carquinyol/datastore.py |   22 --
 src/carquinyol/indexstore.py|   17 +
 src/carquinyol/layoutmanager.py |2 +-
 src/carquinyol/migration.py |   12 +++-
 4 files changed, 49 insertions(+), 4 deletions(-)

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v1 2/5] Add migration code from DS v0 for the filesize property

2010-05-23 Thread Andrés Ambrois

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/carquinyol/migration.py |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/carquinyol/migration.py b/src/carquinyol/migration.py
index 95ee391..228467c 100644
--- a/src/carquinyol/migration.py
+++ b/src/carquinyol/migration.py
@@ -45,8 +45,8 @@ def migrate_from_0():
 
 logging.debug('Migrating entry %r', uid)
 try:
-_migrate_metadata(root_path, old_root_path, uid)
 _migrate_file(root_path, old_root_path, uid)
+_migrate_metadata(root_path, old_root_path, uid)
 _migrate_preview(root_path, old_root_path, uid)
 except Exception:
 logging.exception('Error while migrating entry %r', uid)
@@ -73,6 +73,13 @@ def _migrate_metadata(root_path, old_root_path, uid):
 metadata['timestamp'] = \
 time.mktime(time.strptime(metadata['mtime'], DATE_FORMAT))
 
+file_path = layoutmanager.get_instance().get_data_path(uid)
+if 'filesize' not in metadata:
+if os.path.exists(file_path):
+metadata['filesize'] = int(os.stat(file_path).st_size)
+else:
+metadata['filesize'] = 0
+
 for key, value in metadata.items():
 try:
 f = open(os.path.join(metadata_path, key), 'w')
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v1 3/5] Increment CURRENT_LAYOUT_VERSION to trigger an index rebuild.

2010-05-23 Thread Andrés Ambrois

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/carquinyol/layoutmanager.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/carquinyol/layoutmanager.py b/src/carquinyol/layoutmanager.py
index 8402b6d..aee5efb 100644
--- a/src/carquinyol/layoutmanager.py
+++ b/src/carquinyol/layoutmanager.py
@@ -18,7 +18,7 @@ import os
 import logging
 
 MAX_QUERY_LIMIT = 40960
-CURRENT_LAYOUT_VERSION = 4
+CURRENT_LAYOUT_VERSION = 5
 
 class LayoutManager(object):
 Provide the logic about how entries are stored inside the datastore
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v1 4/5] Add ctime property to the index and datastore

2010-05-23 Thread Andrés Ambrois

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/carquinyol/datastore.py  |   10 --
 src/carquinyol/indexstore.py |7 +++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/carquinyol/datastore.py b/src/carquinyol/datastore.py
index 93ad419..9f0be96 100644
--- a/src/carquinyol/datastore.py
+++ b/src/carquinyol/datastore.py
@@ -154,8 +154,11 @@ class DataStore(dbus.service.Object):
 uid = str(uuid.uuid4())
 logging.debug('datastore.create %r', uid)
 
+ctime = int(time.time())
 if not props.get('timestamp', ''):
-props['timestamp'] = int(time.time())
+props['timestamp'] = ctime
+if not props.get('ctime', ''):
+props['ctime'] = ctime
 
 if os.path.exists(file_path):
 stat = os.stat(file_path)
@@ -196,8 +199,11 @@ class DataStore(dbus.service.Object):
async_cb, async_err_cb):
 logging.debug('datastore.update %r', uid)
 
+timestamp = int(time.time())
+if not props.get('ctime', ''):
+props['ctime'] = props.get('timestamp', timestamp)
 if not props.get('timestamp', ''):
-props['timestamp'] = int(time.time())
+props['timestamp'] = timestamp
 
 if os.path.exists(file_path):
 stat = os.stat(file_path)
diff --git a/src/carquinyol/indexstore.py b/src/carquinyol/indexstore.py
index 121ae25..49b6c09 100644
--- a/src/carquinyol/indexstore.py
+++ b/src/carquinyol/indexstore.py
@@ -61,6 +61,7 @@ _QUERY_TERM_MAP = {
 _QUERY_VALUE_MAP = {
 'timestamp': {'number': _VALUE_TIMESTAMP, 'type': float},
 'filesize': {'number': _VALUE_FILESIZE, 'type': int},
+'ctime': {'number': _VALUE_CTIME, 'type': int},
 }
 
 
@@ -72,6 +73,8 @@ class TermGenerator (xapian.TermGenerator):
 document.add_value(_VALUE_TITLE, properties.get('title', '').strip())
 document.add_value(_VALUE_FILESIZE,
 xapian.sortable_serialise(int(properties['filesize'])))
+document.add_value(_VALUE_CTIME,
+xapian.sortable_serialise(int(properties['ctime'])))
 
 self.set_document(document)
 
@@ -286,6 +289,10 @@ class IndexStore(object):
 enquire.set_sort_by_value(_VALUE_TIMESTAMP, True)
 elif order_by == '-timestamp':
 enquire.set_sort_by_value(_VALUE_TIMESTAMP, False)
+elif order_by == '+ctime':
+enquire.set_sort_by_value(_VALUE_CTIME, True)
+elif order_by == '-ctime':
+enquire.set_sort_by_value(_VALUE_CTIME, False)
 elif order_by == '+title':
 enquire.set_sort_by_value(_VALUE_TITLE, True)
 elif order_by == '-title':
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v1 5/5] Implement migration from DS v0 for ctime property.

2010-05-23 Thread Andrés Ambrois

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/carquinyol/migration.py |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/carquinyol/migration.py b/src/carquinyol/migration.py
index 228467c..80adbae 100644
--- a/src/carquinyol/migration.py
+++ b/src/carquinyol/migration.py
@@ -73,6 +73,9 @@ def _migrate_metadata(root_path, old_root_path, uid):
 metadata['timestamp'] = \
 time.mktime(time.strptime(metadata['mtime'], DATE_FORMAT))
 
+if 'ctime' not in metadata:
+metadata['ctime'] = int(os.stat(old_metadata_path).st_ctime)
+
 file_path = layoutmanager.get_instance().get_data_path(uid)
 if 'filesize' not in metadata:
 if os.path.exists(file_path):
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v1 00/10] Journal sorting by file size and creation time.

2010-05-23 Thread Andrés Ambrois
See [0] for the rationale behind this patchset.

[0] http://lists.sugarlabs.org/archive/sugar-devel/2010-May/023664.html

v0: Initial submission to sugar-devel
v1: Separated ctime and filesize patches. Implemented sorting for removable 
devices.

Andrés Ambrois (10):
  Journal: Retrieve filesize from the datastore
  Add a filesize column to the journal list model
  Journaltoolbox: Add add_separator method for convenience.
  Add a ListViewButton to the journal search toolbar.
  Rename the date column to 'sort_column'
  Display the sorting property in the last column.
  Expandedentry: Try to use the filesize property.
  Implement sorting for removable devices.
  Add sort by creation time option to the ListViewButton
  Add ctime property to the journal model.

 src/jarabe/journal/expandedentry.py  |5 +-
 src/jarabe/journal/journaltoolbox.py |   86 ++
 src/jarabe/journal/listmodel.py  |   22 ++--
 src/jarabe/journal/listview.py   |   33 +++--
 src/jarabe/journal/model.py  |   22 ++--
 5 files changed, 140 insertions(+), 28 deletions(-)

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v1 01/10] Journal: Retrieve filesize from the datastore

2010-05-23 Thread Andrés Ambrois
Add the filesize property to the list of properties we ask the datastore
for.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/model.py |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index ffc62e0..874d7bd 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -36,9 +36,9 @@ DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore'
 DS_DBUS_PATH = '/org/laptop/sugar/DataStore'
 
 # Properties the journal cares about.
-PROPERTIES = ['uid', 'title', 'mtime', 'timestamp', 'keep', 'buddies',
-  'icon-color', 'mime_type', 'progress', 'activity', 'mountpoint',
-  'activity_id', 'bundle_id']
+PROPERTIES = ['uid', 'title', 'mtime', 'timestamp', 'filesize',
+  'keep', 'buddies', 'icon-color', 'mime_type', 'progress',
+  'activity', 'mountpoint', 'activity_id', 'bundle_id']
 
 MIN_PAGES_TO_CACHE = 3
 MAX_PAGES_TO_CACHE = 5
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v1 02/10] Add a filesize column to the journal list model

2010-05-23 Thread Andrés Ambrois
This will make it easy to display the current sorting column by
associating a cell renderer with it.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/listmodel.py |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/jarabe/journal/listmodel.py b/src/jarabe/journal/listmodel.py
index 07f8544..135dc95 100644
--- a/src/jarabe/journal/listmodel.py
+++ b/src/jarabe/journal/listmodel.py
@@ -48,18 +48,20 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
 COLUMN_ICON = 2
 COLUMN_ICON_COLOR = 3
 COLUMN_TITLE = 4
-COLUMN_DATE = 5
-COLUMN_PROGRESS = 6
-COLUMN_BUDDY_1 = 7
-COLUMN_BUDDY_2 = 8
-COLUMN_BUDDY_3 = 9
+COLUMN_TIMESTAMP = 5
+COLUMN_FILESIZE = 6
+COLUMN_PROGRESS = 7
+COLUMN_BUDDY_1 = 8
+COLUMN_BUDDY_2 = 9
+COLUMN_BUDDY_3 = 10
 
 _COLUMN_TYPES = {COLUMN_UID:str,
  COLUMN_FAVORITE:   bool,
  COLUMN_ICON:   str,
  COLUMN_ICON_COLOR: object,
  COLUMN_TITLE:  str,
- COLUMN_DATE:   str,
+ COLUMN_TIMESTAMP:  str,
+ COLUMN_FILESIZE:   str,
  COLUMN_PROGRESS:   int,
  COLUMN_BUDDY_1:object,
  COLUMN_BUDDY_3:object,
@@ -141,6 +143,9 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
 timestamp = int(metadata.get('timestamp', 0))
 self._cached_row.append(util.timestamp_to_elapsed_string(timestamp))
 
+size = int(metadata.get('filesize', 0))
+self._cached_row.append(util.format_size(size))
+
 self._cached_row.append(int(metadata.get('progress', 100)))
 
 if metadata.get('buddies', ''):
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v1 04/10] Add a ListViewButton to the journal search toolbar.

2010-05-23 Thread Andrés Ambrois
Add a button to display the sorting options. Rebuild the query when the
sort option changes.

Use a RadioToolButton for a future implementation of multiple journal
views (as described in the Journal Design Proposal).

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/journaltoolbox.py |   74 ++
 1 files changed, 74 insertions(+), 0 deletions(-)

diff --git a/src/jarabe/journal/journaltoolbox.py 
b/src/jarabe/journal/journaltoolbox.py
index 7466461..995cc73 100644
--- a/src/jarabe/journal/journaltoolbox.py
+++ b/src/jarabe/journal/journaltoolbox.py
@@ -30,6 +30,7 @@ from sugar.graphics.toolbox import Toolbox
 from sugar.graphics.toolcombobox import ToolComboBox
 from sugar.graphics.toolbutton import ToolButton
 from sugar.graphics.toggletoolbutton import ToggleToolButton
+from sugar.graphics.radiotoolbutton import RadioToolButton
 from sugar.graphics.combobox import ComboBox
 from sugar.graphics.menuitem import MenuItem
 from sugar.graphics.icon import Icon
@@ -109,6 +110,17 @@ class SearchToolbar(gtk.Toolbar):
 self.insert(tool_item, -1)
 tool_item.show()
 
+self._add_separator(expand=True)
+
+self._list_view_button = ListViewButton()
+# TODO: Connect when Grid View is implemented
+#self._list_view.connect('toggled', self.__view_button_toggled_cb)
+self._list_view_button.set_active(True)
+self.insert(self._list_view_button, -1)
+self._list_view_button.connect('sort-property-changed',
+   self.__sort_changed_cb)
+self._list_view_button.show()
+
 # TODO: enable it when the DS supports saving the buddies.
 #self._with_search_combo = self._get_with_search_combo()
 #tool_item = ToolComboBox(self._with_search_combo)
@@ -202,6 +214,14 @@ class SearchToolbar(gtk.Toolbar):
 if text:
 query['query'] = text
 
+property, order = self._list_view_button.get_current_sort()
+
+if order == gtk.SORT_ASCENDING:
+sign = '+'
+else:
+sign = '-'
+query['order_by'] = [sign + property]
+
 return query
 
 def _get_date_range(self):
@@ -224,6 +244,9 @@ class SearchToolbar(gtk.Toolbar):
 def _combo_changed_cb(self, combo):
 self._update_if_needed()
 
+def __sort_changed_cb(self, button):
+self._update_if_needed()
+
 def _update_if_needed(self):
 new_query = self._build_query()
 if self._query != new_query:
@@ -467,3 +490,54 @@ class EntryToolbar(gtk.Toolbar):
 activity_info.get_bundle_id())
 palette.menu.append(menu_item)
 menu_item.show()
+
+class ListViewButton(RadioToolButton):
+__gtype_name__ = 'JournalListViewButton'
+
+__gsignals__ = {
+'sort-property-changed': (gobject.SIGNAL_RUN_FIRST,
+  gobject.TYPE_NONE,
+  ([])),
+}
+
+_SORT_OPTIONS = [
+('timestamp', 'view-lastedit', _('View by last edit')),
+('filesize', 'view-size', _('View by size')),
+]
+
+def __init__(self):
+RadioToolButton.__init__(self)
+
+self._property = 'timestamp'
+self._order = gtk.SORT_ASCENDING
+
+self.props.tooltip = _('List view')
+self.props.named_icon = 'view-list'
+# TODO: Set accelerator when Grid View is implemented
+#self.props.accelerator = _('Ctrl2')
+self.props.group = None
+
+for property, icon, label in self._SORT_OPTIONS:
+button = MenuItem(icon_name=icon, text_label=label)
+button.connect('activate',
+   self.__sort_type_changed_cb,
+   property,
+   icon)
+button.show()
+self.props.palette.menu.insert(button, -1)
+
+def __sort_type_changed_cb(self, widget, property, named_icon):
+self._property = property
+#FIXME: Implement sorting order
+self._order = gtk.SORT_ASCENDING
+self.emit('sort-property-changed')
+
+self.props.named_icon = named_icon
+
+if not self.props.active:
+self.props.active = True
+else:
+self.emit('toggled')
+
+def get_current_sort(self):
+return (self._property, self._order)
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v1 05/10] Rename the date column to 'sort_column'

2010-05-23 Thread Andrés Ambrois
As it will be used to display the currently active sorting property.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/listview.py |   22 +++---
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py
index 9e19f70..375a8ee 100644
--- a/src/jarabe/journal/listview.py
+++ b/src/jarabe/journal/listview.py
@@ -97,7 +97,7 @@ class BaseListView(gtk.Bin):
 self.cell_title = None
 self.cell_icon = None
 self._title_column = None
-self.date_column = None
+self.sort_column = None
 self._add_columns()
 
 self.tree_view.enable_model_drag_source(gtk.gdk.BUTTON1_MASK,
@@ -190,15 +190,15 @@ class BaseListView(gtk.Bin):
 date = util.timestamp_to_elapsed_string(timestamp)
 date_width = self._get_width_for_string(date)
 
-self.date_column = gtk.TreeViewColumn()
-self.date_column.props.sizing = gtk.TREE_VIEW_COLUMN_FIXED
-self.date_column.props.fixed_width = date_width
-self.date_column.set_alignment(1)
-self.date_column.props.resizable = True
-self.date_column.props.clickable = True
-self.date_column.pack_start(cell_text)
-self.date_column.add_attribute(cell_text, 'text', 
ListModel.COLUMN_DATE)
-self.tree_view.append_column(self.date_column)
+self.sort_column = gtk.TreeViewColumn()
+self.sort_column.props.sizing = gtk.TREE_VIEW_COLUMN_FIXED
+self.sort_column.props.fixed_width = date_width
+self.sort_column.set_alignment(1)
+self.sort_column.props.resizable = True
+self.sort_column.props.clickable = True
+self.sort_column.pack_start(cell_text)
+self.sort_column.add_attribute(cell_text, 'text', 
ListModel.COLUMN_TIMESTAMP)
+self.tree_view.append_column(self.sort_column)
 
 def _get_width_for_string(self, text):
 # Add some extra margin
@@ -415,7 +415,7 @@ class BaseListView(gtk.Bin):
 
 while True:
 x, y, width, height = self.tree_view.get_cell_area(path,
-   
self.date_column)
+   
self.sort_column)
 x, y = self.tree_view.convert_tree_to_widget_coords(x, y)
 self.tree_view.queue_draw_area(x, y, width, height)
 if path == end_path:
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v1 06/10] Display the sorting property in the last column.

2010-05-23 Thread Andrés Ambrois
update_with_query() is called when the query is modified in the toolbox.
Get the name of the property and set the sort_column cell renderer accordingly.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/listview.py |   11 ---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py
index 375a8ee..deffe84 100644
--- a/src/jarabe/journal/listview.py
+++ b/src/jarabe/journal/listview.py
@@ -252,11 +252,16 @@ class BaseListView(gtk.Bin):
 
 def update_with_query(self, query_dict):
 logging.debug('ListView.update_with_query')
+if 'order_by' not in query_dict:
+query_dict['order_by'] = ['+timestamp']
+if query_dict['order_by'] != self._query.get('order_by'):
+property = query_dict['order_by'][0][1:]
+cell_text = self.sort_column.get_cell_renderers()[0]
+self.sort_column.set_attributes(cell_text,
+text=getattr(ListModel, 'COLUMN_' + property.upper(),
+ ListModel.COLUMN_TIMESTAMP))
 self._query = query_dict
 
-if 'order_by' not in self._query:
-self._query['order_by'] = ['+timestamp']
-
 self.refresh()
 
 def refresh(self):
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v1 07/10] Expandedentry: Try to use the filesize property.

2010-05-23 Thread Andrés Ambrois
Instead of calling the datastore again.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/expandedentry.py |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/jarabe/journal/expandedentry.py 
b/src/jarabe/journal/expandedentry.py
index c8e40c1..725c0f9 100644
--- a/src/jarabe/journal/expandedentry.py
+++ b/src/jarabe/journal/expandedentry.py
@@ -260,8 +260,9 @@ class ExpandedEntry(hippo.CanvasBox):
 lines = [
 _('Kind: %s') % (self._metadata.get('mime_type') or _('Unknown'),),
 _('Date: %s') % (self._format_date(),),
-_('Size: %s') % (format_size(model.get_file_size(
-self._metadata['uid'])),)]
+_('Size: %s') % (format_size(int(self._metadata.get('filesize',
+model.get_file_size(self._metadata['uid']),
+]
 
 for line in lines:
 text = hippo.CanvasText(text=line,
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v1 08/10] Implement sorting for removable devices.

2010-05-23 Thread Andrés Ambrois

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/model.py |   16 +---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index 874d7bd..4fd81ac 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -21,6 +21,7 @@ import time
 import shutil
 from stat import S_IFMT, S_IFDIR, S_IFREG
 import re
+from operator import itemgetter
 
 import gobject
 import dbus
@@ -246,6 +247,8 @@ class InplaceResultSet(BaseResultSet):
 
 self._mime_types = query.get('mime_type', [])
 
+self._sort = query.get('order_by', ['+timestamp'])[0]
+
 def setup(self):
 self._file_list = []
 self._recurse_dir(self._mount_point)
@@ -254,7 +257,13 @@ class InplaceResultSet(BaseResultSet):
 self._stopped = True
 
 def setup_ready(self):
-self._file_list.sort(lambda a, b: b[2] - a[2])
+if self._sort[1:] == 'filesize':
+keygetter = itemgetter(3)
+else:
+keygetter = itemgetter(2) # timestamp
+self._file_list.sort(lambda a, b: b - a,
+ key=keygetter,
+ reverse=self._sort[0]=='-')
 self.ready.send(self)
 
 def find(self, query):
@@ -273,7 +282,7 @@ class InplaceResultSet(BaseResultSet):
 files = self._file_list[offset:offset + limit]
 
 entries = []
-for file_path, stat, mtime_ in files:
+for file_path, stat, mtime_, size_ in files:
 metadata = _get_file_metadata(file_path, stat)
 metadata['mountpoint'] = self._mount_point
 entries.append(metadata)
@@ -331,7 +340,7 @@ class InplaceResultSet(BaseResultSet):
 add_to_list = False
 
 if add_to_list:
-file_info = (full_path, stat, int(stat.st_mtime))
+file_info = (full_path, stat, int(stat.st_mtime), 
stat.st_size)
 self._file_list.append(file_info)
 
 self.progress.send(self)
@@ -344,6 +353,7 @@ def _get_file_metadata(path, stat):
 return {'uid': path,
 'title': os.path.basename(path),
 'timestamp': stat.st_mtime,
+'filesize': stat.st_size,
 'mime_type': gio.content_type_guess(filename=path),
 'activity': '',
 'activity_id': '',
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v1 09/10] Add sort by creation time option to the ListViewButton

2010-05-23 Thread Andrés Ambrois

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/journaltoolbox.py |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/jarabe/journal/journaltoolbox.py 
b/src/jarabe/journal/journaltoolbox.py
index 995cc73..03afb4e 100644
--- a/src/jarabe/journal/journaltoolbox.py
+++ b/src/jarabe/journal/journaltoolbox.py
@@ -502,6 +502,7 @@ class ListViewButton(RadioToolButton):
 
 _SORT_OPTIONS = [
 ('timestamp', 'view-lastedit', _('View by last edit')),
+('ctime', 'view-created', _('View by creation date')),
 ('filesize', 'view-size', _('View by size')),
 ]
 
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH v1 00/10] Journal sorting by file size and creation time.

2010-05-23 Thread Andrés Ambrois
On Sunday 23 May 2010 04:08:51 pm Michael Stone wrote:
 Andrés,
 
 I've read these patches and tested them locally (with minor changes due to
 merge conflicts with some of my experimental work) and the results are quite
 pleasing to me.

Thanks!

 The one issue that I would like you to fix before I merge these patches into 
my
 tree is that I would like you to include additional patches for the new 
icons
 that your ListViewButton requires to function as intended. 
 
 (I don't really care whether the new icons are different from the old icons; 
I
 merely care that I still have a normal-looking ListViewButton after I select
 one of your new sort modes rather than the thin grey bar that I currently 
see.)

I only have the filesize icon I made for testing, but I usually stay away from 
graphics work (I suck at GIMP). 

Gary, I see you uploaded [0] to the wiki, which is what this patchset is based 
on. Do you have SVG versions of the icons you put in there?

 Regards, and thanks for all your hard work here,

Thank you for reviewing!

 Michael
 
[0] 
http://wiki.sugarlabs.org/go/File:Journal_mockup_gary_list_extended_palette.png
-- 
  -Andrés


signature.asc
Description: This is a digitally signed message part.
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [RFC PATCH v0 0/8] Journal sorting by file size and creation time.

2010-05-06 Thread Andrés Ambrois
On Thursday 06 May 2010 02:14:44 am you wrote:
 On Sat, May 01, 2010 at 04:33:48PM -0300, Andrés Ambrois wrote:
 snip
 
 As current datastore and journal maintainer, some points:
 
 I'm still not sure will ml path proposal scheme work on not, it removes
 some bugs.sl.o issues but adds new e.g. it is pretty hard to collaborate
 (in my mind) via ml history, in case of bugs.sl.o, someone can just
 share http link to complicated query. Other thing is that on bugs.sl.o
 it is easy to query tickets by keywords for example.
 
 And since having patches both on bugs.sl.o and ml is pretty useless and
 there is no regular way to attach 0.90 targeted keyword to ml posts,
 please create tickets on bugs.sl.o.

Hi Aleksey. Thanks for taking the time to look at this. 

While I personally don't think it's that hard to collaborate on the ml, I 
believe this discussion belongs in the Code Review process changes thread 
[0]. Either way, the bug I referred to (#1915) contains the previous 
discussion and links to both patchsets. It is also tagged as r?, though no 
one has taken a look at it yet.

I should say that the fact that you commented on this thread before you did so 
on the ticket is evidence that reviewing patches here managed, at worst, to 
grab the right person's attention, and at best will work the same for others.

But I digress. I think your opinion is important and should be part of that 
thread.

 In case of journal, my strong thinking is that Journal shouldn't be only
 one for all purposes and it shouldn't be only in glucose as part of
 sugar core. I initiated journal library [3]. The major idea is that
 anyone can create his own journal activity and glucose can provide
 common/simple/default one.
 
 So, all my resources I spend to journal library (and related projects)
 not to journal code in glucose. If you share this thinking, please come
 aboard.

I'm not convinced, but I could be. 

While I think opening up the API might encourage activity developers to 
produce their own (potentially better) journal UI's, I feel it is a mistake to 
stop improving the canonical interface for accessing the user's data: it is 
orthogonal; we can work on improving the current UI _and_ provide the tools 
you mention. 

If you think Journal development should be halted until it is moved out of 
glucose, we should get working on that; deployments need this feature. On the 
other hand, the Journal was once an activity but was integrated into the shell 
in 0.84 (see commit f0ff3b) for performance and maintainability reasons, have 
any of those priorities changed in your mind?

I've taken a look at some of the components of your Polyol project and I'm 
impressed by the quality and quantity of your work, congrats!.

 Having covered all the above, I thing only datastore patch is requested.

You mean only the DS patch will be accepted?

 [3] http://wiki.sugarlabs.org/go/Activity_Team/Services/Journal
 
 -- 
 Aleksey
 

[0] http://lists.sugarlabs.org/archive/sugar-devel/2010-April/023410.html
-- 
  -Andrés


signature.asc
Description: This is a digitally signed message part.
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [RFC PATCH 8/8] Expandedentry: Try to use the filesize property.

2010-05-04 Thread Andrés Ambrois
On Saturday 01 May 2010 04:33:56 pm Andrés Ambrois wrote:
 +_('Size: %s') % (format_size(int(self._metadata.get('filesize')) or
 +model.get_file_size(self._metadata['uid'])),),
 +]

This is wrong. It should be:

 _('Size: %s') % (format_size(int(self._metadata.get('filesize', 
model.get_file_size(self._metadata['uid']),

-- 
  -Andrés


signature.asc
Description: This is a digitally signed message part.
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [RFC PATCH 1/2] Add ctime and timestamp properties to the index.

2010-05-01 Thread Andrés Ambrois

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/carquinyol/datastore.py  |   22 --
 src/carquinyol/indexstore.py |   17 +
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/src/carquinyol/datastore.py b/src/carquinyol/datastore.py
index a556869..9f0be96 100644
--- a/src/carquinyol/datastore.py
+++ b/src/carquinyol/datastore.py
@@ -154,8 +154,17 @@ class DataStore(dbus.service.Object):
 uid = str(uuid.uuid4())
 logging.debug('datastore.create %r', uid)
 
+ctime = int(time.time())
 if not props.get('timestamp', ''):
-props['timestamp'] = int(time.time())
+props['timestamp'] = ctime
+if not props.get('ctime', ''):
+props['ctime'] = ctime
+
+if os.path.exists(file_path):
+stat = os.stat(file_path)
+props['filesize'] = stat.st_size
+else:
+props['filesize'] = 0
 
 self._metadata_store.store(uid, props)
 self._index_store.store(uid, props)
@@ -190,8 +199,17 @@ class DataStore(dbus.service.Object):
async_cb, async_err_cb):
 logging.debug('datastore.update %r', uid)
 
+timestamp = int(time.time())
+if not props.get('ctime', ''):
+props['ctime'] = props.get('timestamp', timestamp)
 if not props.get('timestamp', ''):
-props['timestamp'] = int(time.time())
+props['timestamp'] = timestamp
+
+if os.path.exists(file_path):
+stat = os.stat(file_path)
+props['filesize'] = stat.st_size
+else:
+props['filesize'] = 0
 
 self._metadata_store.store(uid, props)
 self._index_store.store(uid, props)
diff --git a/src/carquinyol/indexstore.py b/src/carquinyol/indexstore.py
index 8a69334..49b6c09 100644
--- a/src/carquinyol/indexstore.py
+++ b/src/carquinyol/indexstore.py
@@ -28,6 +28,9 @@ from carquinyol.layoutmanager import MAX_QUERY_LIMIT
 _VALUE_UID = 0
 _VALUE_TIMESTAMP = 1
 _VALUE_TITLE = 2
+# 3 reserved for version support
+_VALUE_FILESIZE = 4
+_VALUE_CTIME = 5
 
 _PREFIX_NONE = 'N'
 _PREFIX_FULL_VALUE = 'F'
@@ -57,6 +60,8 @@ _QUERY_TERM_MAP = {
 
 _QUERY_VALUE_MAP = {
 'timestamp': {'number': _VALUE_TIMESTAMP, 'type': float},
+'filesize': {'number': _VALUE_FILESIZE, 'type': int},
+'ctime': {'number': _VALUE_CTIME, 'type': int},
 }
 
 
@@ -66,6 +71,10 @@ class TermGenerator (xapian.TermGenerator):
 document.add_value(_VALUE_TIMESTAMP,
 xapian.sortable_serialise(float(properties['timestamp'])))
 document.add_value(_VALUE_TITLE, properties.get('title', '').strip())
+document.add_value(_VALUE_FILESIZE,
+xapian.sortable_serialise(int(properties['filesize'])))
+document.add_value(_VALUE_CTIME,
+xapian.sortable_serialise(int(properties['ctime'])))
 
 self.set_document(document)
 
@@ -280,10 +289,18 @@ class IndexStore(object):
 enquire.set_sort_by_value(_VALUE_TIMESTAMP, True)
 elif order_by == '-timestamp':
 enquire.set_sort_by_value(_VALUE_TIMESTAMP, False)
+elif order_by == '+ctime':
+enquire.set_sort_by_value(_VALUE_CTIME, True)
+elif order_by == '-ctime':
+enquire.set_sort_by_value(_VALUE_CTIME, False)
 elif order_by == '+title':
 enquire.set_sort_by_value(_VALUE_TITLE, True)
 elif order_by == '-title':
 enquire.set_sort_by_value(_VALUE_TITLE, False)
+elif order_by == '+filesize':
+enquire.set_sort_by_value(_VALUE_FILESIZE, True)
+elif order_by == '-filesize':
+enquire.set_sort_by_value(_VALUE_FILESIZE, False)
 else:
 logging.warning('Unsupported property for sorting: %s', order_by)
 
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [RFC PATCH 2/2] Add migration from DS v0 code for the new properties.

2010-05-01 Thread Andrés Ambrois

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/carquinyol/migration.py |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/carquinyol/migration.py b/src/carquinyol/migration.py
index 95ee391..80adbae 100644
--- a/src/carquinyol/migration.py
+++ b/src/carquinyol/migration.py
@@ -45,8 +45,8 @@ def migrate_from_0():
 
 logging.debug('Migrating entry %r', uid)
 try:
-_migrate_metadata(root_path, old_root_path, uid)
 _migrate_file(root_path, old_root_path, uid)
+_migrate_metadata(root_path, old_root_path, uid)
 _migrate_preview(root_path, old_root_path, uid)
 except Exception:
 logging.exception('Error while migrating entry %r', uid)
@@ -73,6 +73,16 @@ def _migrate_metadata(root_path, old_root_path, uid):
 metadata['timestamp'] = \
 time.mktime(time.strptime(metadata['mtime'], DATE_FORMAT))
 
+if 'ctime' not in metadata:
+metadata['ctime'] = int(os.stat(old_metadata_path).st_ctime)
+
+file_path = layoutmanager.get_instance().get_data_path(uid)
+if 'filesize' not in metadata:
+if os.path.exists(file_path):
+metadata['filesize'] = int(os.stat(file_path).st_size)
+else:
+metadata['filesize'] = 0
+
 for key, value in metadata.items():
 try:
 f = open(os.path.join(metadata_path, key), 'w')
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [RFC PATCH 2/2] Implement migration for the two new properties (filesize and ctime). Increment CURRENT_LAYOUT_VERSION.

2010-05-01 Thread Andrés Ambrois

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/carquinyol/layoutmanager.py |2 +-
 src/carquinyol/migration.py |   21 +
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/carquinyol/layoutmanager.py b/src/carquinyol/layoutmanager.py
index 8402b6d..aee5efb 100644
--- a/src/carquinyol/layoutmanager.py
+++ b/src/carquinyol/layoutmanager.py
@@ -18,7 +18,7 @@ import os
 import logging
 
 MAX_QUERY_LIMIT = 40960
-CURRENT_LAYOUT_VERSION = 4
+CURRENT_LAYOUT_VERSION = 5
 
 class LayoutManager(object):
 Provide the logic about how entries are stored inside the datastore
diff --git a/src/carquinyol/migration.py b/src/carquinyol/migration.py
index 95ee391..36c7d57 100644
--- a/src/carquinyol/migration.py
+++ b/src/carquinyol/migration.py
@@ -45,8 +45,8 @@ def migrate_from_0():
 
 logging.debug('Migrating entry %r', uid)
 try:
-_migrate_metadata(root_path, old_root_path, uid)
 _migrate_file(root_path, old_root_path, uid)
+_migrate_metadata(root_path, old_root_path, uid)
 _migrate_preview(root_path, old_root_path, uid)
 except Exception:
 logging.exception('Error while migrating entry %r', uid)
@@ -69,9 +69,22 @@ def _migrate_metadata(root_path, old_root_path, uid):
 if 'uid' not in metadata:
 metadata['uid'] = uid
 
-if 'timestamp' not in metadata and 'mtime' in metadata:
-metadata['timestamp'] = \
-time.mktime(time.strptime(metadata['mtime'], DATE_FORMAT))
+if 'timestamp' not in metadata:
+if 'mtime' in metadata:
+metadata['timestamp'] = \
+time.mktime(time.strptime(metadata['mtime'], DATE_FORMAT))
+else:
+metadata['timestamp'] = int(os.stat(old_metadata_path).st_mtime)
+
+if 'ctime' not in metadata:
+metadata['ctime'] = int(os.stat(old_metadata_path).st_ctime)
+
+file_path = layoutmanager.get_instance().get_data_path(uid)
+if 'filesize' not in metadata:
+if os.path.exists(file_path):
+metadata['filesize'] = int(os.stat(file_path).st_size)
+else:
+metadata['filesize'] = 0
 
 for key, value in metadata.items():
 try:
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [RFC PATCH 2/2] Implement migration for the two new properties (filesize and ctime). Increment CURRENT_LAYOUT_VERSION.

2010-05-01 Thread Andrés Ambrois
On Saturday 01 May 2010 03:52:46 pm Andrés Ambrois wrote:
 
 Signed-off-by: Andrés Ambrois andresambr...@gmail.com
 ---
  src/carquinyol/layoutmanager.py |2 +-
  src/carquinyol/migration.py |   21 +
  2 files changed, 18 insertions(+), 5 deletions(-)

Sigh. Disregard this one. Seems I split this one in two but forgot to delete 
it from the patches directory

-- 
  -Andrés


signature.asc
Description: This is a digitally signed message part.
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [RFC PATCH] Increment CURRENT_LAYOUT_VERSION to trigger an index rebuild.

2010-05-01 Thread Andrés Ambrois
This one was suppoused to be in the previous series. I will resend the whole
patchset once review is complete.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/carquinyol/layoutmanager.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/carquinyol/layoutmanager.py b/src/carquinyol/layoutmanager.py
index 8402b6d..aee5efb 100644
--- a/src/carquinyol/layoutmanager.py
+++ b/src/carquinyol/layoutmanager.py
@@ -18,7 +18,7 @@ import os
 import logging
 
 MAX_QUERY_LIMIT = 40960
-CURRENT_LAYOUT_VERSION = 4
+CURRENT_LAYOUT_VERSION = 5
 
 class LayoutManager(object):
 Provide the logic about how entries are stored inside the datastore
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [RFC PATCH v0 0/8] Journal sorting by file size and creation time.

2010-05-01 Thread Andrés Ambrois
This patchset implements sorting in the Journal UI as described in [0]. 

This feature was requested in [1] and sponsored by Activity Central [2].

Sorting by filesize is vital in the field where users need to free up disk
space. Currently, the only way to find candidates for deletion is to access
the expanded view of each entry, one by one. This can be a very time consuming
process and often leads to indiscriminate deletion and thus potential loss of
valuable data. This is bad.

Sorting by creation time (ctime) is also implemented as described in the Design
Proposal.

This implementation currently lacks two aspects which I hope will be sorted out
in the review process:

1- The proposal does not include a specification for changing the order of the
sort. This patch assumes an ascending order.

2- There are no icons for the sorting criteria. Or at least I couldn't find the
ones presented in the proposal. I'm sure someone from the design team could
vectorize the ones there.

v0: Initial submission to sugar-devel

[0] 
http://wiki.sugarlabs.org/go/Design_Team/Proposals/Journal#Extended_list_view_palette
[1] http://bugs.sugarlabs.org/ticket/1915
[2] http://activitycentral.org

Andrés Ambrois (8):
  Journal: Retrieve ctime and filesize from the datastore.
  Add ctime and filesize columns to the journal list model.
  Add add_separator method for convenience.
  Add a ListViewButton to the journal search toolbar.
  Rename the date column to 'sort_column'
  Add sort_by method to the journal list view.
  Call sort_by in the list view when sorting is selected in the
toolbar.
  Expandedentry: Try to use the filesize property.

 src/jarabe/journal/expandedentry.py   |5 +-
 src/jarabe/journal/journalactivity.py |5 ++
 src/jarabe/journal/journaltoolbox.py  |   75 -
 src/jarabe/journal/listmodel.py   |   22 +++---
 src/jarabe/journal/listview.py|   34 ++-
 src/jarabe/journal/model.py   |6 +-
 6 files changed, 124 insertions(+), 23 deletions(-)

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [RFC PATCH 1/8] Journal: Retrieve ctime and filesize from the datastore.

2010-05-01 Thread Andrés Ambrois
Add the two new properties (ctime and filesize) to the list of
properties we ask the datastore for.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/model.py |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index ffc62e0..4f1eb8d 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -36,9 +36,9 @@ DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore'
 DS_DBUS_PATH = '/org/laptop/sugar/DataStore'
 
 # Properties the journal cares about.
-PROPERTIES = ['uid', 'title', 'mtime', 'timestamp', 'keep', 'buddies',
-  'icon-color', 'mime_type', 'progress', 'activity', 'mountpoint',
-  'activity_id', 'bundle_id']
+PROPERTIES = ['uid', 'title', 'mtime', 'timestamp', 'ctime', 'filesize',
+  'keep', 'buddies', 'icon-color', 'mime_type', 'progress',
+  'activity', 'mountpoint', 'activity_id', 'bundle_id']
 
 MIN_PAGES_TO_CACHE = 3
 MAX_PAGES_TO_CACHE = 5
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [RFC PATCH 2/8] Add ctime and filesize columns to the journal list model.

2010-05-01 Thread Andrés Ambrois
Add two columns to the ListModel. This will make it easy to display the
values we are sorting by by simply associating the cell renderer with
one of them.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/listmodel.py |   22 --
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/jarabe/journal/listmodel.py b/src/jarabe/journal/listmodel.py
index 07f8544..494f1e0 100644
--- a/src/jarabe/journal/listmodel.py
+++ b/src/jarabe/journal/listmodel.py
@@ -48,18 +48,22 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
 COLUMN_ICON = 2
 COLUMN_ICON_COLOR = 3
 COLUMN_TITLE = 4
-COLUMN_DATE = 5
-COLUMN_PROGRESS = 6
-COLUMN_BUDDY_1 = 7
-COLUMN_BUDDY_2 = 8
-COLUMN_BUDDY_3 = 9
+COLUMN_TIMESTAMP = 5
+COLUMN_CTIME = 6
+COLUMN_FILESIZE = 7
+COLUMN_PROGRESS = 8
+COLUMN_BUDDY_1 = 9
+COLUMN_BUDDY_2 = 10
+COLUMN_BUDDY_3 = 11
 
 _COLUMN_TYPES = {COLUMN_UID:str,
  COLUMN_FAVORITE:   bool,
  COLUMN_ICON:   str,
  COLUMN_ICON_COLOR: object,
  COLUMN_TITLE:  str,
- COLUMN_DATE:   str,
+ COLUMN_TIMESTAMP:  str,
+ COLUMN_CTIME:  str,
+ COLUMN_FILESIZE:   str,
  COLUMN_PROGRESS:   int,
  COLUMN_BUDDY_1:object,
  COLUMN_BUDDY_3:object,
@@ -141,6 +145,12 @@ class ListModel(gtk.GenericTreeModel, gtk.TreeDragSource):
 timestamp = int(metadata.get('timestamp', 0))
 self._cached_row.append(util.timestamp_to_elapsed_string(timestamp))
 
+ctime = int(metadata.get('ctime', 0))
+self._cached_row.append(util.timestamp_to_elapsed_string(ctime))
+
+size = int(metadata.get('filesize', 0))
+self._cached_row.append(util.format_size(size))
+
 self._cached_row.append(int(metadata.get('progress', 100)))
 
 if metadata.get('buddies', ''):
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [RFC PATCH 3/8] Add add_separator method for convenience.

2010-05-01 Thread Andrés Ambrois

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/journaltoolbox.py |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/jarabe/journal/journaltoolbox.py 
b/src/jarabe/journal/journaltoolbox.py
index 61671bc..7466461 100644
--- a/src/jarabe/journal/journaltoolbox.py
+++ b/src/jarabe/journal/journaltoolbox.py
@@ -154,6 +154,17 @@ class SearchToolbar(gtk.Toolbar):
 with_search.connect('changed', self._combo_changed_cb)
 return with_search
 
+def _add_separator(self, expand=False):
+separator = gtk.SeparatorToolItem()
+separator.props.draw = False
+if expand:
+separator.set_expand(True)
+else:
+separator.set_size_request(style.GRID_CELL_SIZE,
+   style.GRID_CELL_SIZE)
+self.insert(separator, -1)
+separator.show()
+
 def _add_widget(self, widget, expand=False):
 tool_item = gtk.ToolItem()
 tool_item.set_expand(expand)
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [RFC PATCH 4/8] Add a ListViewButton to the journal search toolbar.

2010-05-01 Thread Andrés Ambrois
Add a button to display the sorting options. Create a sort-property-changed
signal in the toolbar to notify the activity of changes.

Use a RadioToolButton for a future implementation of multiple journal views
(as described in the Journal Design Proposal).

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/journaltoolbox.py |   64 +-
 1 files changed, 63 insertions(+), 1 deletions(-)

diff --git a/src/jarabe/journal/journaltoolbox.py 
b/src/jarabe/journal/journaltoolbox.py
index 7466461..48aeb34 100644
--- a/src/jarabe/journal/journaltoolbox.py
+++ b/src/jarabe/journal/journaltoolbox.py
@@ -30,6 +30,7 @@ from sugar.graphics.toolbox import Toolbox
 from sugar.graphics.toolcombobox import ToolComboBox
 from sugar.graphics.toolbutton import ToolButton
 from sugar.graphics.toggletoolbutton import ToggleToolButton
+from sugar.graphics.radiotoolbutton import RadioToolButton
 from sugar.graphics.combobox import ComboBox
 from sugar.graphics.menuitem import MenuItem
 from sugar.graphics.icon import Icon
@@ -74,7 +75,10 @@ class SearchToolbar(gtk.Toolbar):
 __gsignals__ = {
 'query-changed': (gobject.SIGNAL_RUN_FIRST,
   gobject.TYPE_NONE,
-  ([object]))
+  ([object])),
+'sort-property-changed': (gobject.SIGNAL_RUN_FIRST,
+  gobject.TYPE_NONE,
+  ([str, object]))
 }
 
 def __init__(self):
@@ -109,6 +113,17 @@ class SearchToolbar(gtk.Toolbar):
 self.insert(tool_item, -1)
 tool_item.show()
 
+self._add_separator(expand=True)
+
+self._list_view_button = ListViewButton()
+# TODO: Connect when Grid View is implemented
+#self._list_view.connect('toggled', self.__view_button_toggled_cb)
+self._list_view_button.set_active(True)
+self.insert(self._list_view_button, -1)
+self._list_view_button.connect('sort-property-changed',
+   self.__sort_changed_cb)
+self._list_view_button.show()
+
 # TODO: enable it when the DS supports saving the buddies.
 #self._with_search_combo = self._get_with_search_combo()
 #tool_item = ToolComboBox(self._with_search_combo)
@@ -119,6 +134,9 @@ class SearchToolbar(gtk.Toolbar):
 
 self.refresh_filters()
 
+def __sort_changed_cb(self, button, property, order):
+self.emit('sort-property-changed', property, order)
+
 def give_entry_focus(self):
 self._search_entry.grab_focus()
 
@@ -467,3 +485,47 @@ class EntryToolbar(gtk.Toolbar):
 activity_info.get_bundle_id())
 palette.menu.append(menu_item)
 menu_item.show()
+
+class ListViewButton(RadioToolButton):
+__gtype_name__ = 'JournalListViewButton'
+
+__gsignals__ = {
+'sort-property-changed': (gobject.SIGNAL_RUN_FIRST,
+  gobject.TYPE_NONE,
+  ([str, object])),
+}
+
+_SORT_OPTIONS = [
+('timestamp', 'view-lastedit', _('View by last edit')),
+('ctime', 'view-created', _('View by creation date')),
+('filesize', 'view-size', _('View by size')),
+]
+
+def __init__(self):
+RadioToolButton.__init__(self)
+
+self.props.tooltip = _('List view')
+self.props.named_icon = 'view-list'
+# TODO: Set accelerator when Grid View is implemented
+#self.props.accelerator = _('Ctrl2')
+self.props.group = None
+
+for property, icon, label in self._SORT_OPTIONS:
+button = MenuItem(icon_name=icon, text_label=label)
+button.connect('activate',
+   self.__sort_type_changed_cb,
+   property,
+   icon)
+button.show()
+self.props.palette.menu.insert(button, -1)
+
+def __sort_type_changed_cb(self, widget, property, named_icon):
+#FIXME: Implement sorting order
+self.emit('sort-property-changed', property, gtk.SORT_ASCENDING)
+
+self.props.named_icon = named_icon
+
+if not self.props.active:
+self.props.active = True
+else:
+self.emit('toggled')
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [RFC PATCH 7/8] Call sort_by in the list view when sorting is selected in the toolbar.

2010-05-01 Thread Andrés Ambrois
Connect the sort-property-changed signal in the toolbar to the sort_by
method the view.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/journalactivity.py |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/jarabe/journal/journalactivity.py 
b/src/jarabe/journal/journalactivity.py
index 0559560..f5e101b 100644
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -165,6 +165,7 @@ class JournalActivity(Window):
 
 search_toolbar = self._main_toolbox.search_toolbar
 search_toolbar.connect('query-changed', self._query_changed_cb)
+search_toolbar.connect('sort-property-changed', self._sort_changed_cb)
 search_toolbar.set_mount_point('/')
 
 def _setup_secondary_view(self):
@@ -196,6 +197,10 @@ class JournalActivity(Window):
 self._list_view.update_with_query(query)
 self.show_main_view()
 
+def _sort_changed_cb(self, toolbar, property, order):
+self._list_view.sort_by(property, order)
+self.show_main_view()
+
 def show_main_view(self):
 if self.toolbar_box != self._main_toolbox:
 self.set_toolbar_box(self._main_toolbox)
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [RFC PATCH 6/8] Add sort_by method to the journal list view.

2010-05-01 Thread Andrés Ambrois
This method triggers the actual sorting. This is done by placing a 'order_by'
value in the query, and calling the datastore to retrieve the sorted data set.
The sort_column is also modified to display the property we are sorting by.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/listview.py |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py
index 375a8ee..ad0390a 100644
--- a/src/jarabe/journal/listview.py
+++ b/src/jarabe/journal/listview.py
@@ -250,6 +250,18 @@ class BaseListView(gtk.Bin):
 metadata['keep'] = '1'
 model.write(metadata, update_mtime=False)
 
+def sort_by(self, property, order):
+cell_text = self.sort_column.get_cell_renderers()[0]
+self.sort_column.set_attributes(cell_text,
+text=getattr(ListModel, 'COLUMN_' + property.upper(),
+ ListModel.COLUMN_TIMESTAMP))
+if order == gtk.SORT_ASCENDING:
+sign = '+'
+else:
+sign = '-'
+self._query['order_by'] = [sign + property]
+self.refresh()
+
 def update_with_query(self, query_dict):
 logging.debug('ListView.update_with_query')
 self._query = query_dict
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [RFC PATCH 8/8] Expandedentry: Try to use the filesize property.

2010-05-01 Thread Andrés Ambrois
Instead of calling the datastore again.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/journal/expandedentry.py |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/jarabe/journal/expandedentry.py 
b/src/jarabe/journal/expandedentry.py
index c8e40c1..ffb6a63 100644
--- a/src/jarabe/journal/expandedentry.py
+++ b/src/jarabe/journal/expandedentry.py
@@ -260,8 +260,9 @@ class ExpandedEntry(hippo.CanvasBox):
 lines = [
 _('Kind: %s') % (self._metadata.get('mime_type') or _('Unknown'),),
 _('Date: %s') % (self._format_date(),),
-_('Size: %s') % (format_size(model.get_file_size(
-self._metadata['uid'])),)]
+_('Size: %s') % (format_size(int(self._metadata.get('filesize')) or
+model.get_file_size(self._metadata['uid'])),),
+]
 
 for line in lines:
 text = hippo.CanvasText(text=line,
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] #1725: Resize home window on screen size change

2010-04-24 Thread Andrés Ambrois
  When switching resolutions, the main window doesn't resize
properly. Listen for gtk.gdk.Screen size-changed signal and
resize the window accordingly.

Signed-off-by: Andrés Ambrois andresambr...@gmail.com
---
 src/jarabe/desktop/homewindow.py |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/jarabe/desktop/homewindow.py b/src/jarabe/desktop/homewindow.py
index d830ed0..fec4289 100644
--- a/src/jarabe/desktop/homewindow.py
+++ b/src/jarabe/desktop/homewindow.py
@@ -45,8 +45,10 @@ class HomeWindow(gtk.Window):
 self._active = False
 self._fully_obscured = True
 
-self.set_default_size(gtk.gdk.screen_width(),
-  gtk.gdk.screen_height())
+screen = self.get_screen()
+screen.connect('size-changed', self.__screen_size_change_cb)
+self.set_default_size(screen.get_width(),
+  screen.get_height())
 
 self.realize()
 self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DESKTOP)
@@ -80,6 +82,9 @@ class HomeWindow(gtk.Window):
 elif level == ShellModel.ZOOM_MESH:
 self._mesh_box.suspend()
 
+def __screen_size_change_cb(self, screen):
+self.resize(screen.get_width(), screen.get_height())
+
 def _activate_view(self, level):
 if level == ShellModel.ZOOM_HOME:
 self._home_box.resume()
-- 
1.6.3.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] Automake-fu question

2010-02-19 Thread Andrés Ambrois
Hello list!

To provide mobile-broadband-provider-info support for the 3G feature, I need 
to parse some system files, namely /usr/share/zoneinfo/iso3166.tab and 
/usr/share/mobile-broadband-provider-info/serviceproviders.xml.  In order for 
packagers to override those locations I created a config.py.in file that looks 
like this:

PROVIDERS_PATH = @prefix@/share/mobile-broadband-provider-
info/serviceproviders.xml
PROVIDERS_FORMAT_SUPPORTED = 2.0
COUNTRY_CODES_PATH = @prefix@/share/zoneinfo/iso3166.tab

Which is then converted by a make rule in Makefile.am into config.py. I 
understand this is the recommended approach when using autotools [0]. 

One of the problems is that this breaks jhbuild, because it uses
--prefix=/path/to/jhbuild/install. The other is that by default @prefix@ 
expands 
to /usr/local/, which is not the usual location for these files. 

The full patch is [1], if you're interested.

Cheers!

[0] http://www.gnu.org/software/autoconf/manual/autoconf.html#Installation-
Directory-Variables
[1] http://bugs.sugarlabs.org/ticket/1630
-- 
  -Andrés
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Google Summer of Code

2010-02-01 Thread Andrés Ambrois
On Tuesday 02 February 2010 03:20:52 am Rafael Enrique Ortiz Guerrero wrote:
 Hello Peter.
 
 On Mon, Feb 1, 2010 at 9:31 PM, Peter Robinson pbrobin...@gmail.com wrote:
  Hi All,
  I can't remember if SL participates in the GSOC but I've noticed they're
  starting to gear up for GSOC 2010 so it might be worthwhile starting to
  think about it from the SL perspective.
  Peter

See this mail for more info:

http://bit.ly/9hFpcb

In a nutshell:

We will begin accepting application from would-be mentoring organizations 
beginning March 8th at approximately 19:00 UTC, with applications closing on 
March 12th at 23:00 UTC. Students can apply between 19:00 UTC on March 29th to 
19:00 UTC on April 9th.

 SL participated successfully in last year GSOC
 
 More info here
 
 http://wiki.sugarlabs.org/go/Summer_of_Code
 
 
 ___
 
  Sugar-devel mailing list
  Sugar-devel@lists.sugarlabs.org
  http://lists.sugarlabs.org/listinfo/sugar-devel
 
 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel
 

-- 
  -Andrés
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] Carrier database support for GSM modem feature

2009-12-21 Thread Andrés Ambrois
Hello,

I have created http://dev.sugarlabs.org/ticket/1630 and added a patch with a 
first implementation of this feature. This depends on tch's patches [0], so I 
will need to update it if they change. 

Daniel, I just found out you were planning to work on this, does this patch 
adjust to your requirements?

Cheers!
-- 
  -Andrés

[0] http://dev.sugarlabs.org/ticket/1622
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Is Project Ceibal violating the GNU General Public License?

2009-08-24 Thread Andrés Ambrois
On Monday 24 August 2009 10:11:54 am Walter Bender wrote:
 On Mon, Aug 24, 2009 at 3:48 AM, John Gilmoreg...@toad.com wrote:
  Re: [Sugar-devel] RFH - Journal corruption reports fom 8.2.1 users in Uy
 
  Remember that Ceibal XOs have root access locked-down. And I recently
  found out that since the key-delegation stuff was implemented, we can't
  request developer keys. Not from OLPC at least, and LATU is not
  providing that service that I know...
 
  Could someone please clarify this?

 According to Ceilbal (24-08-09):

 We have delivered developer keys in the past, and we will deliver them to
 the owner of the machine upon request.

 Therefore, I do not think that there is a violation of the GPL.

I wrote to Ceibal asking for information and this is what they replied:

Hola Andrés, 
Debido al sistema de seguridad incorporado en la XO, el Plan Ceibal no brinda 
la clave de desarrollador. Esto se debe, a que una persona con acceso a la 
clave podría desactivar la seguridad de la máquina.
 Cualquier otra consulta, no dudes en volver a comunicarte.

Translation:

Hello Andrés,

Because of the security system built into the XO, Plan Ceibal doesn't provide 
developer keys. This is because a person with access to the key could 
deactivate the security of the machine.
Don't hesitate in contacting us for any other questions. 

 -walter

  It sounds like Project Ceibal is explicitly violating the GNU General
  Public License on much or all of the software that it ships:
 
   *  It provides binaries without source code, and without a written
  offer of source code.
 
   *  It provides binaries in a physical form (laptop) which is
  protected against modification by the end-user, so that those
  users cannot replace the GPLv3-licensed software on the laptop
  with later versions.  More than 20 packages shipped are GPLv3
  licensed, as of 12 months ago, including the Coreutils (most
  shell commands), tar and cpio (used for software updates), and
  gettext (internationalization).  GPLv3 requires that the relevant
  passwords or keys must be supplied to the end user -- including
  both the developer key and the root password.
 
   *  Some programs are modified, but the modified versions are not
  marked to distinguish them from the original GPL-licensed
  programs.
 
  There are other less important violations as well (most are documented
  at bugs.laptop.org; search for GPL).
 
  I would be happy to learn that the children receiving these laptops
  have full access to source code, ability to upgrade their laptops
  at will, and can tell modified from unmodified software.  Please let
  me know what is really happening in the schools of Uruguay.
 
 John Gilmore
  ___
  Devel mailing list
  de...@lists.laptop.org
  http://lists.laptop.org/listinfo/devel

-- 
  -Andrés
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] RFH - Journal corruption reports fom 8.2.1 users in Uy

2009-08-20 Thread Andrés Ambrois
On Thursday 20 August 2009 06:58:48 pm Martin Langhoff wrote:
 On Thu, Aug 20, 2009 at 7:44 PM, Tomeu Vizosoto...@sugarlabs.org wrote:
  Would be nice to have more details about the failure so we can both
  fix it and propose the best tool for the job. Maybe a ceibal jam
  volunteer with some linux knowledge would like to work with us on
  this?

 Many are reading olpc-sur -- I hope someone might help.

I'll help in any way I can. Would an upload webservice similar to Sacha's for 
uploading the necessary datastore bits help? We can then distribute a simple 
cli tool that uploads the data.

Will collecting the indexes be enough or do you need the whole datastore?

 cheers,



 m

-- 
  -Andrés
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Overlay chat architecture

2009-08-15 Thread Andrés Ambrois
On Saturday 15 August 2009 06:50:06 pm Benjamin M. Schwartz wrote:
 I've been thinking about overlay chat, and I wonder

 1.  Has there been any code written to that end?

http://git.sugarlabs.org/projects/sugar-toolkit/repos/sugar-toolkit-chat

This was done a while ago, but I was slowed down when trying to make palettes 
pop-up from the buddy icons in the friends tray (right frame). In any case it 
may need a rebase, but the bureaucratic code for mapping the different types of 
channel handles (our addresses in the telepathy channels) with buddy keys 
(what sugar can easily get from buddy_ps.props.key) worked fine. 

It also keeps references to all the text channels as a class attribute to 
avoid looking for them on every activity switch. 

 2.  Has anyone thought about the necessary architecture?

 Overlay chat requires a number of things working together: per-activity
 daemons, spawned when sharing starts, with references to the telepathy
 channels for each activity, as well as bidirectional access to the Friends
 tray for GUI.  It's not clear to me, for example, what code in Sugar could
 launch such a daemon.

See sugar/src/jarabe/frame/friendstray.py. My idea was to keep it simple and 
consistent by making the BuddyModel (jarabe/model/buddy.py) hold one of these 
objects (the owner would hold a ChatPitcher, the rest a ChatCatcher*) and 
expose a signal/method for events.

This would mean both the icons used in the friendstray and in the neighborhood 
view have access to this service through the BuddyModel.

Also, I don't think we need a process for each activity. Since we can only 
show chats from one activity at a time, and telepathy holds unacknowledged 
messages. We can just subscribe a class method to 'chat-received' in all 
channels for notifications.

*: These are awful names, someone please come up with something more clever.

 --Ben

-- 
  -Andrés
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [Sugar-GSoC] Print Support (Moodle or No Moodle)

2009-07-06 Thread Andrés Ambrois
On Monday 06 July 2009 01:28:00 pm Vamsi Krishna Davuluri wrote:
 Hi,

 So I had spent almost 3 weeks entirely with Moodle,
 and I have failed to be half as productive with Moodle
 as I have with sugar.

 I would relate the reasons to be:

 My lack of an estimation on moodle's vastness,

 1) I had no experience with web oriented systems
 2) I had no prior experience with php and databases
 3) The assignment plugin which is a what I'm intending to
 base my print Module is very huge (4000-5000 Lines of code)
 It would take me a while to hack it and tune it down.
 4) I still haven't hit the comfort spot with moodle
 5) I can't figure out what does what exactly.

Vamsi,

  Don't Panic! We can help you if you try to ask questions we can answer [0]. 
I really recommend you to read that document whenever you have time, which may 
not be right now...

  If you get stuck, search in Google, if you're still stuck, we're here to 
help you, but try to give us something we can answer. Usually a Good Question 
is a variation of I'm trying to accomplish X, I've written this code: code 
and expect it to do Y, but its doing Z. I've searched Google about this but 
couldn't find more information. Any help would be appreciated


 As a bear essential, I could get the assignment module to have
 a print option, but I don't exactly have the code ready for it.(its
 back at my home place)

You already got the newmodule test module working the other night. This module 
includes examples of moodle's abstraction for forms, database, and themed html 
output. If you want to see what the hell all those functions are, I suggest 
you run an rgrep (or grep -r) in moodle's root dir for 'function 
function_name'. Moodle might be huge and crazy but its pretty well 
commented. 

Dont try to hack the assignment module into your printing script. Just take 
code from it.

Following this module's structure, view.php would contain the teacher UI, 
mod_form is for setting up the module instance the first time (and 
configuration 
thereafter) and another script would contain your xmlrpc entry point. Writing 
an XML-RPC server in PHP is trivial as you can see in [1]. 

From the assignments module you pretty much only need the file handling stuff. 
This is basically done using file_area($userid) to get a directory where the 
files are stored (see lib.php in the assignments module). 

For the upload, the xmlrpc server code would need to use file_area_name($USER-
id) to get a dirname, and then write the file to it. 

You will also want to have a table to store information for each file (original 
filename, user, time of upload, status), you can declare this table in your 
module's db/install.xml, en then you can access them with the get_record, 
delete_records, update_records, etc. Grep the code for these function's 
headers. 

For printing I've already pointed you to [2]. 

This is just my vision of the solution. I think you should sit down, go 
through all these steps and see if you can understand the picture enough to 
have an idea of a schedule before moving on. If you don't understand how to 
achieve something please ask me or the list concrete questions to get you back 
on the road. 

This is why I insisted so much on detailed schedules, so we wont have huge 
surprises :). 


 Anyway, the alternatives I can lay out are:

 1)Use a thin client-server based architecture, a small python based server
 script
 which listens to requests from sugar (XOs) and stores them in a folder, the
 admin
 can then print those files.
 ( suggestions on perfecting this are needed)

I don't see how you can build something useful in this direction without 
getting into problems already solved for you in Moodle, such as user 
interface, authentication and database handling (at least in some files). 
Please remember the objective of this project is to produce something that can 
be used in the field by kids and teachers as easy and transparently as 
possible.

 2) drop this, and focus on network printing.

If with Network Printing you're referring to discovery of printers through 
Bonjour/Avahi, I don't think this is a priority for our users. This is also a 
big question mark as Network Printing is as far as your specification goes. I 
don't want to add variables to an already late project. 

 Thanks,
 Vamsi

We can hopefully discuss more in tomorrow's meeting.


[0] http://catb.org/esr/faqs/smart-questions.html
[1]http://hell.org.ua/Docs/oreilly/webprog/pcook/ch12_08.htm
[2]http://www.nongnu.org/phpprintipp/
-- 
  -Andrés
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal --- Sugar-Developers meeting REMINDER (2 July, 2009 - 14.00 (UTC)) --- irc.freenode.net, #sugar-meeting

2009-07-04 Thread Andrés Ambrois
On Saturday 04 July 2009 12:31:48 am Eben Eliason wrote:
 On Fri, Jul 3, 2009 at 11:19 PM, Gary C Marting...@garycmartin.com wrote:
  On 4 Jul 2009, at 03:13, Eben Eliason wrote:

snip 

  PS. I think we need to come up with some better terminology to
  distinguish between collaboration sharing and journal sharing. That
  would make this much easier to talk about.
 
  You're not kidding there :-)

 should we call both sharing, but differentiate it with a modifier,
 like collaboration vs. document, or maybe activity vs. object.
 This latter might be the best I've thought of so far. activity
 sharing is real-time collaboration; object-sharing is public
 Journal entries, the output. Thoughts? Better suggestions?

How about publishing? It seems to me the most concise way to express the 
action of making content available to a wider audience.

 Eben

  Regards,
  --Gary

 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel

-- 
  -Andrés
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal --- Sugar-Developers meeting REMINDER (2 July, 2009 - 14.00 (UTC)) --- irc.freenode.net, #sugar-meeting

2009-07-03 Thread Andrés Ambrois
On Friday 03 July 2009 02:29:56 pm Eben Eliason wrote:
 On Fri, Jul 3, 2009 at 10:42 AM, Gary C Marting...@garycmartin.com wrote:
  On 2 Jul 2009, at 14:47, Eben Eliason wrote:
  On Wed, Jul 1, 2009 at 1:42 PM, Aleksey Limalsr...@member.fsf.org 
wrote:
  But in that case we should provide possibility to mark objects that can
  be shared(I guess sharing all local objects by default is not a nice
  idea).
 
  Right. This would be essential. There's definitely some thought that
  needs to be done here.
 
  Scott had an interesting proposal which basically exposed the Journal
  (or some subset of it) as an RSS feed. This was really neat, because
  it meant we could build a UI for someone else's Journal in Sugar,
  populating it with that data, but also that these feeds could be
  shared globally, for anyone with an RSS reader to benefit from. That's
  a really powerful approach in my mind, and there is some starter code
  lying around as a proof of concept already!
 
  +1 to rss feed concept, makes life a lot easier in a heterogeneous
  environment.
 
  I'm still catching up on email so apologies if this has been mentioned
  already. But the UI for marking of entries as sharable does not
  necessarily need to be another Journal user-interface addition** In the
  simplest approach you could just extend the Activity Share with: my
  Neighbourhood control to mark a Journal entry as part of the RRS feed.
  Would need some

 The problem I see with this is that we're talking about two different
 kinds of sharing. Just because I want to make a picture I drew
 available for anyone to look at, or even make a photocopy of to
 scribble on, doesn't mean that I want to let them into a shared
 painting session so they can scribble on the original with me.

 This is the difference between sharing an activity with someone
 collaboratively, and sending them (a copy of) the resulting object.

  thought on wording, do you add more levels of sharing? Or do you just
  simplify the Share with: language language to Private, Share with:
  Anyone.
 
  **though I would like entries to visually show their sharing state, the
  buddy column hints at this but should be made explicit

 I do actually think that the Journal is the best place to expose this,
 especially since the way we plan to expose the feature in the UI is
 something like view my friend's Journal. I'm not sure exactly how
 or where that happens. Perhaps if we can abandon the checkbox for the
 multi-selection we can use that space for a public/private toggle of
 some kind.

How about using special tags? A Publish tag seems reasonable for this, and 
consistent with the fact that it could live in a publish directory an HTTP 
server would serve. 

I can also imagine a tags used for starred entries and other metadata (in a 
general sense) used by sugar. This would make them searchable as well. 


 Eben
 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel

-- 
  -Andrés
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal --- Sugar-Developers meeting REMINDER (2 July, 2009 - 14.00 (UTC)) --- irc.freenode.net, #sugar-meeting

2009-07-03 Thread Andrés Ambrois
On Friday 03 July 2009 11:18:24 pm Eben Eliason wrote:
 On Fri, Jul 3, 2009 at 9:52 PM, Andrés Ambroisandresambr...@gmail.com 
wrote:
  On Friday 03 July 2009 02:29:56 pm Eben Eliason wrote:
  On Fri, Jul 3, 2009 at 10:42 AM, Gary C Marting...@garycmartin.com 
wrote:
   On 2 Jul 2009, at 14:47, Eben Eliason wrote:
   On Wed, Jul 1, 2009 at 1:42 PM, Aleksey Limalsr...@member.fsf.org
 
  wrote:
   But in that case we should provide possibility to mark objects that
   can be shared(I guess sharing all local objects by default is not a
   nice idea).
  
   Right. This would be essential. There's definitely some thought that
   needs to be done here.
  
   Scott had an interesting proposal which basically exposed the Journal
   (or some subset of it) as an RSS feed. This was really neat, because
   it meant we could build a UI for someone else's Journal in Sugar,
   populating it with that data, but also that these feeds could be
   shared globally, for anyone with an RSS reader to benefit from.
   That's a really powerful approach in my mind, and there is some
   starter code lying around as a proof of concept already!
  
   +1 to rss feed concept, makes life a lot easier in a heterogeneous
   environment.
  
   I'm still catching up on email so apologies if this has been mentioned
   already. But the UI for marking of entries as sharable does not
   necessarily need to be another Journal user-interface addition** In
   the simplest approach you could just extend the Activity Share with:
   my Neighbourhood control to mark a Journal entry as part of the RRS
   feed. Would need some
 
  The problem I see with this is that we're talking about two different
  kinds of sharing. Just because I want to make a picture I drew
  available for anyone to look at, or even make a photocopy of to
  scribble on, doesn't mean that I want to let them into a shared
  painting session so they can scribble on the original with me.
 
  This is the difference between sharing an activity with someone
  collaboratively, and sending them (a copy of) the resulting object.
 
   thought on wording, do you add more levels of sharing? Or do you just
   simplify the Share with: language language to Private, Share
   with: Anyone.
  
   **though I would like entries to visually show their sharing state,
   the buddy column hints at this but should be made explicit
 
  I do actually think that the Journal is the best place to expose this,
  especially since the way we plan to expose the feature in the UI is
  something like view my friend's Journal. I'm not sure exactly how
  or where that happens. Perhaps if we can abandon the checkbox for the
  multi-selection we can use that space for a public/private toggle of
  some kind.
 
  How about using special tags? A Publish tag seems reasonable for this,
  and consistent with the fact that it could live in a publish directory an
  HTTP server would serve.

 I think it's a good idea to store these states as metadata, but I also
 think that we need to expose the feature visually to highlight the
 capability and make it easier to manage. I wouldn't want kids to have
 to type publish into the correct field in order to share their work.

I wasn't suggesting that either. Scott's concepts [0] have a list of used tags 
for exploration, these special tags would be highlighted/prioritized somehow 
in this list. 

[0]http://wiki.laptop.org/go/Image:Journal2-working.png


  I can also imagine a tags used for starred entries and other metadata (in
  a general sense) used by sugar. This would make them searchable as well.

 Yup. I don't think this works yet, but the intent has always been to
 allow advanced search queries by specifying key:value pairs (as in
 gmail). In fact, all of the filters we support should have text
 equvalents, eg. cat kind:image with:alice favorite:yes (or similar).

 Eben

  Eben
  ___
  Sugar-devel mailing list
  Sugar-devel@lists.sugarlabs.org
  http://lists.sugarlabs.org/listinfo/sugar-devel
 
  --
   -Andrés

-- 
  -Andrés
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Karma: quadrilaterals + Surf it works!

2009-06-30 Thread Andrés Ambrois
On Tuesday 30 June 2009 03:17:00 pm Felipe López Toledo wrote:
 hi guys

 I'm a little upset because during last week I was trying to optimize the
 Quadrilaterals activity:
 http://karma.sugarlabs.org/quadrilaterals/

 Lucian recommend me (last week...or before) to try it using Surf,
 I was trying to compile it from source... mmm, no progress
 today Lucian gave me some links:
 the xo bundle: http://dev.laptop.org/~bobbyp/surf/
 also read: http://wiki.laptop.org/go/Browse/WebKit

 thanks Lucian

 well, if you have a chance please test it,
 it works really good (performance) there is some work to do (stuff related
 to css and scale), but it works a lot better than with firefox

 :)

Tried Quadrilaterals with Surf-106 on Jhbuild on Ubuntu Jaunty. 

I see the same I see on a non html5 enabled browser.  The log ends with this 
line:

console message: http://karma.sugarlabs.org/quadrilaterals/js/activity.js @49: 
Value undefined does not allow function calls.

libwebkit on Jaunty is v1.0.1

On FFX 3.5preb4 it works great! One little comment: it doesnt recognize 
concave quadrilaterals properly. 
-- 
  -Andrés
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] meshing XOs with netbooks (WAS: Re: [Bugs] #79 NORM: SOAS should mesh network when possible)

2009-06-09 Thread Andrés Ambrois
On Tuesday 09 June 2009 10:07:19 pm Martin Dengler wrote:
 On Wed, Jun 10, 2009 at 01:46:07AM +0100, Gary C Martin wrote:
  There's another 'non-mesh' option possible for the '3 kids under a tree'
  case. They will likely have no AP/infrastructure to connect to, so
  blanking the jabber server is not an option. For them the existing
  local-link config would be very viable solution, but there's no Sugar UI
  for it yet.

 Would this be as simple as a ad-hoc device in the frame that put the
 wireless into ad-hoc mode?

http://blog.tomeuvizoso.net/2009/05/ad-hoc-wireless-networks-in-sugar.html

As usual, Tomeu beat us all there :P

 Martin

-- 
  -Andrés
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Quoting in shell scripts (was: Re: [sugar-devel] Recent fiddlings with Print Support)

2009-05-14 Thread Andrés Ambrois
On Wednesday 13 May 2009 08:03:22 am Vamsi Krishna Davuluri wrote:
 Thanks. I have taken into account your suggestions and made another 
script.

Thank you all for helping out! Here are a few other comments: 

 #!/bin/bash -e
 # CUPS filter to process ODT files using abiword


 # $6 happens to be the path to file passed as argument
 fn=$6

 #in case its not defined
 TMPDIR=/tmp
See Jona's comments

 # we are creating a dummy folder, which can take different file types 
using
 mkdir, change to =/tmp/cups-odftops
 sandbox=${TMPDIR-/tmp}/cups-odftops.
 (umask 077  mkdir $sandbox) || exit 1

 #our two dummy files
 fn1=$sandbox/temp123.odt
 cp $fn $fn1
Do you need to cp? Can't you symlink? Copying potentially large files is a 
problem. 


 # Call abiword quietly, securely
 abiword --to=ps $fn1
 fn2=`echo $fn1 | sed -e 's/odt/ps/' `
fn2=`echo $fn1 | sed 's/\.odt$/\.ps/'`

 #check if our version doesn't require an intermediate conversion, if it
 does, do it, else break;

 if [ -n `grep -q %!PS-Adobe-3.0  $fn2 ` ];then

grep -q is always silent, and [ -n ] tests for string length nonzero, so this 
will always fail. 

I guess you're trying to see if the conversion failed (does not contain 
%!PS-Adobe-3.0 ), so you should need: 

if [ -z `grep %!PS-Adobe-3.0  $fn2` ]; then

 abiword --to=doc $fn1
 abiword --to=ps `echo $fn1 | sed -e 's/odt/doc/' `
 fi
Again,  watch out for that sed.

-- 
  Andrés
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] FoodForce II Beta Release

2009-05-08 Thread Andrés Ambrois
On Friday 08 May 2009 03:24:30 pm Mohit Taneja wrote:
 Hi,

 The Beta version of the FoodForce2 game has been developed for the XO. The
 features that have been incorporated are :
snip

Congratulations! Looks great! I had a chance to see a presentation on this 
game last October in El Salvador and I was impressed with the work. 

May I ask what license is it under?

 FoodForce2 Team

-- 
  Andrés
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [IAEP] The User experience/interface for Printing

2009-05-03 Thread Andrés Ambrois
On Sunday 03 May 2009 06:29:26 pm Albert Cahalan wrote:
 Vamsi Krishna Davuluri writes:
  So, talking to Tomeu, we agreed that for Write and Read using
  the gtkprint would be best as both support it as a printing API.

 The focus on Write and Read is short sighted and may lead
 to inflexible solutions.

Read was selected to contain the send to print code because Tomeu expressed 
some concerns about the maintainability of that code in the Journal. Also, we 
agreed that going through read is good for reviewing the pdf output and saving 
paper on badly formatted docs. 

  Now, the current plan is:
  1) We do journal printing only, albeit, the respective
  activity opens the file.

 Eh, OK. Provide a script called /usr/bin/lpr which runs ps2pdf
 or directly runs gs. This lets normal software, which is already
 designed to output standard Postscript to lpr, work just fine.
 After conversion, put the PDF into the journal.

 Better yet, just toss the file into the journal without conversion.

 BTW, this can also be implemented as a filter script that the
 normal lpr program invokes for the default printer.

The priority is on sending the docs to cups-pdf for conversion and then 
talking to Moodle for teacher review. It is a good idea to have the code that 
sends docs for printing (to Moodle, a local printer, or one discovered by 
avahi) in a reusable module that a /usr/bin/lpr script can use. 

  Now here a cross road is presented:
 
  1) Do we use a print dialog inside each activity that can save it as pdf,
  print or export a pdf to moodle

If we are going to keep everything inside Read for now. It'll be best to have 
the print button only in Read. The use case we had discussed was like this: 
open the file in Read, if its not ps/pdf Read converts it using cups-pdf, 
displays it, and then you can use the print button in its toolbar. 

The converted file gets added as a journal entry right after conversion. The 
datastore already contains code to hard link identical files, so disk space 
usage in multiple conversions is kept to a minimum. Read could add a pointer 
to the pdf in the original entry's metadata as well. 

Adding a print dialog to every activity (e.g. Adding some gtkprint support in 
sugar-toolkit) should be optional for GSoC. First we should concentrate on 
getting entries printed, and getting teacher review right. Then we can move 
code around for legacy support and nice print me buttons. 

  2) Do we use separate buttons for each of these operations?
 
  What of the user experience?

 Separate buttons provides a distinction that will be important
 in some environments. Some places will want immediate printing.

 For now, the print button can be almost the same as the other,
 but with the output PDF marked for near-term deletion.

 Make PDF and Print now seem like fine names.


I agree. Just a print button for now. The PDF will be generated on startup 
anyway. We can have the cups-pdf local printer in the printer selection dialog 
when we provide other printing methods. 

  The initial plan was to make Read the global printing station,
  how do you find this idea?

 Starting up Read just to print something is not nice. Read may
 even cause an out-of-memory condition. For sure, there is no need
 to very slowly render a big document that doesn't even need to be
 seen on the screen.

This is to encourage review and to keep the code away from the Journal. The 
code can then be moved to Glucose. Also, distributing a modified Read for 
testing will be considerably easier than patching the Journal. 

  the teacher checks his print page in moodle, views the file (either
  through fancy javascript or a download) and approves/disapproves
  for printing. Kennedy then logs into his moodle print page and
  checks if the job was success or not, and if he has a comment from
  his teacher.

 I can barely imagine that happening in a real classroom. Try this:

 The student brings his XO to the teacher's desk, with his work shown
 on the screen. The teacher looks at the work, then lets the student
 plug his XO into a printer which sits on the teacher's desk.

  Printing resources can be very expensive for most schools, so
  the system should include a way for students to submit jobs to a
  queue and for an administrator to preview and approve or denie them.

 Tux Paint can rate limit a student's printing. For example, a setting
 of 60 will be once per minute.

 Do not forget that this issue is more social than technical. In addition
 to any discipline, the teacher can simply turn off the printer. This is
 advisable in any case; many printers use excessive power in standby.

I dont see a teacher having a printer on her desk. Most schools here in 
Uruguay (and I dare say in Perú) don't even have printers. If there is one, it 
will be where the server/administration is. And possibly locked in a cage 
(like we have the servers now). So that scenario is going to be priority one. 

Next will be of course provide local 

Re: [Sugar-devel] Print Support (journal vs activity)

2009-04-21 Thread Andrés Ambrois
On Tuesday 21 April 2009 14:16:36 Tomeu Vizoso wrote:
 On Tue, Apr 21, 2009 at 19:02, Carol Farlow Lerche c...@msbit.com wrote:
  It's entirely unclear what this project has morphed to.  Tomeu, what use
  is uploading arbitrary journal entries to Moodle?

 Because the chances that the needed filter to convert that file to a
 printable format is in the server are bigger than being in every
 machine, for some deployments.

  I thought creating pdf
  output in sugar and enabling uploading of the pdf to Moodle was the point
  of this project.  That is useful in two ways.  First, it is a path to
  assignment turn-in or printing either through Moodle or by other
  transports to a system configured to print pdfs.  It also allows a
  student to review the printer-ready output to decide if it is worth
  getting hard copy.

 Sure, I though I had made clear than printing to PDF in Sugar has
 important use cases.

 Regards,

 Tomeu

My idea for dealing with the headache of filters is assuming only pdf/ps is 
printable, and having the Journal display a Print button if and only if the 
mimetype is pdf or ps. 

This way we can then make the decision of sending it to moodle via xml-rpc, a 
local cups queue, or a remote cups server using lpr. 

Activities that can't output to pdf/ps will be provided with gtkprint 
facilities and a pdf journal entry will be generated after they draw their 
output. 

Vamsi has already hacked pdf output into Write, so that's one big activity we 
will have covered. 

For the security issues, activities will only generate a journal pdf entry, 
which would be displayed using show_object_in_journal or somesuch (just like 
Chat currently handles opnening URLs). The user will then have the ability to 
immediately review the printable output and/or send it to the preferred queue. 

This architecture follows some basic principles: 

1) Paper/Ink is expensive, we need a way to easily and reliably review what's 
going to be printed. Requiring people to load up Browse, navigate inside 
Moodle, and download a PDF file for review, is not exactly user-friendly. 

2) We don't need to specify a set of required filters...yet, we can easily 
expand this to well, HTML, JPG and PNG are probably going to be supported by 
every CUPS out there, so admit those as well, but I think 1) is priority 
here. 

3) Following up on 2), the journal mechanism is orthogonal to what we end up 
sending to Moodle. Ben and Tomeu have sort of agreed on sending the raw 
journal entries to Moodle, so we can use all the CUPS filters on the server, 
this conflicts with 1) in my view, but it has its advantages. 

  On Tue, Apr 21, 2009 at 9:36 AM, Tomeu Vizoso to...@sugarlabs.org wrote:
  On Tue, Apr 21, 2009 at 18:29, Benjamin M. Schwartz
 
  bmsch...@fas.harvard.edu wrote:
   -BEGIN PGP SIGNED MESSAGE-
   Hash: SHA1
  
   Tomeu Vizoso wrote:
   Printing is not limited to uploading files to moodle, we provide both
   local and server printing and users will use whatever works in their
   environment.
  
   I think this is too much for one Summer of Code project.  That's why I
   have been recommending that we forget about local printing for now.
 
  I would actually be happy if we just implemented sending journal
  entries to the print queue and the moodle module. Print to pdf has
  several important use cases and I would like to see it implemented for
  0.86 for at least Write and Browse, but I don't think it needs to be
  part of this GSoC.
 
   Anyway, on a purely technical level I think we have reached agreement.
(I
   do wonder whether the Moodle print queue should also support acting as
   a standard print server, so that standard desktops can print into the
   Moodle
   approval queue, but that's a detail.)
 
  Yeah, I would prefer if we use simple file upload at first because it
  works already.
 
  There's lots of fun stuff to do in this area, but what gives most
  value to the user is quite straightforward. We should aim to leave the
  complicated stuff for the end, as extras, and focus on delivering what
  matters most first
 
  Regards,
 
  Tomeu
 
   - --Ben
   -BEGIN PGP SIGNATURE-
   Version: GnuPG v2.0.10 (GNU/Linux)
  
   iEYEARECAAYFAknt9FQACgkQUJT6e6HFtqTjmwCfdM831aiEMbpRiJNQLX8Bf2FY
   OH8AniCGOPuqgY/GlR+V2io6+/NyiTnl
   =KI8s
   -END PGP SIGNATURE-
 
  ___
  Sugar-devel mailing list
  Sugar-devel@lists.sugarlabs.org
  http://lists.sugarlabs.org/listinfo/sugar-devel
 
  --
  It is difficult to get a man to understand something, when his salary
  depends upon his not understanding it. -- Upton Sinclair

 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel

-- 
  Andrés


signature.asc
Description: This is a digitally signed message part.
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org

Re: [Sugar-devel] accessibility

2009-04-08 Thread Andrés Ambrois
On Wednesday 08 April 2009 05:24:18 Tomeu Vizoso wrote:
 Hi,

 might be interesting to lurk during this session to learn more about
 how we'll improve accessibility in Sugar.


  Some weeks ago I met Andrea Mangiatordi, from the Farfalla Project, who is 
working with LATU on accessibility issues. I invited him to write down his 
thoughts on this problem, and I think it would be great to discuss some here:


Andrés Ambrois wrote:
 Hey Andrea!
 There has been a lot of talk on accessibility lately in the Sugar
 community, mainly because of several related Summer of Code
 applications. I remember you've been working on this front with LATU,
 and I think it would be great if you could share some of your work with us.

Hi Andrés, hi Chris,
I am also Ccing Pablo Flores (CeibalJAM) who recently asked me to put 
down some lines about my proyect before he heads to Boston.
I am currently working in the Ceibal technical Area at LATU even if I am 
not strictly a technician. I am a PhD student interested on the 
inclusive potential of technology for disabled children who attend 
lessons in ordinary classes. Currently, I am splitting my weeks in two 
parts: I participate in the school work of some children (three days a 
week, teaching them how to use some very basical instruments, such as 
Mousekeys...) and during the remaining days I work (mainly alone, but in 
a LATU office) on my own proyect, which is a web application which aims 
to providing some special aids through the web [0]. I am trying to 
optimize the app to be used on the XO laptop.

You know there are some small haks which can be practiced on an XO to install 
and configure some new interesting features. I started out from this one [1] 
and I find it absolutely useful with children with movement impairments 
as the ones in the school I am doing research.
The last week, as an example, two students came to propose a project 
they are working on for their thesis: it was not considered interesting 
and someone proposed me to talk to them and ask if they could be 
interested in developing something related to accessibility... They 
showed some interested, but they were visibly incredulous...
Ah, in the LATU tech area there are also two people working on an 
interface to use a wheelchair through the XO.

 I'm CCing Chris Ball who is one of the main developers behind Dasher,
 which we talked about a couple of weeks ago, apart from an engineer
 working at OLPC and an all around good guy. It would be great if LATU
 could help in some way integrate Dasher in Sugar.

Nice! I am a Dasher fan, as I already told Andrés. I would like to do a 
Dasher Activity myself, if I only knew how!

 We would be very happy to hear about your work on the Sugar mailing list
 [0]. Please feel free to stop by our IRC channel #sugar at
 irc.freenode.net, I'm usually idling there as aa.
 See you around :).

Ok, now I'll join both.

Summarizing, my ideas about Sugar accessibility solutions are:

- integrating accessX in the Sugar core, putting an icon in the control 
panel to configure the mouse/keyboard preferences - this seems quite 
simple to me, even if I don't have (almost) any knowledge of python

- adding some way to do CAPS LOCK! I read in this [2] olpc wiki 
discussions that the caps lock key was proposed for removal for encumber 
reasons. This seems odd to me, because most of the children I am working 
with simply don't know small capitals letters!

- adding screen reader features, but I know this is already in the GSoC 
proposals... As you know, I already installed Xubuntu on my XO and it 
runs like a charm, with ORCA enabled too. I have some problems with 
dasher there... It doesn't seem to get the mouse cursor position. I'll 
investigate it soon...

- adding an onscreen keyboard: it could be a standalone application with 
its own text area (just like Dasher) or a system wide keyboard. I think 
the second option would be trikier... GOK could be the preferred choice, 
but I also noticed this [3] proyect and I found it interesting.
In the case of a standalone keyboard I would probably prefer (for 
personal experience reasons only) to use this [4] javascript based 
virtual keyboard inside a navigator. It comes with very good 
multilanguage support and together with some web wisiwig editor could be 
very useful. I am already integrating it in my own proyect.

- adding some magnifying aid: I don't really like the one which comes 
with ORCA, I would prefer something which gave the opportunity to have
both a fixed magnifying area (as in ORCA's) AND a movable magnifying 
virtual glass (as the one here [5])

Ok, these are some ideas, not very original to be honest, but I think 
they have to be considered mayor priorities. And it's quite late and I'm 
quite lazy ;)

I hope that the discussion will be hot on the Sugar ML...

Thanks to everybody for your interest in this theme.

See you

Andrea


[0] http://www.farfalla-project.org
[1] http://wiki.laptop.org/go/AccessX
[2] http