Re: [Sugar-devel] [PATCH sugar-datastore] Ensure we return valid internal / calculated properties
Hi Sascha, thanks for the patch. On 02/11/11 23:21, Sascha Silbe wrote: The copy in the metadata storage can get corrupted, e.g. due to low level crashes or running out of battery (see OLPC#11372 [1] for a real-life example). This is especially problematic for the uid property, since without it the caller (i.e. the Journal) can't even figure out which entry to delete. [1] https://dev.laptop.org/ticket/11372 It would be good to add here information what the patch does, that it adds the uid and filesize to the metadata but does not write it to disk etc. Reported-by: Gary Martingarycmar...@googlemail.com Signed-off-by: Sascha Silbesi...@activitycentral.com --- Passes the test suite - at least after fixing the latter to accept decimal strings instead of just integers for the 'filesize' property. No difference in performance noticeable with three runs of the test suite (default settings, on my desktop machine). src/carquinyol/datastore.py | 20 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/src/carquinyol/datastore.py b/src/carquinyol/datastore.py index 4f3faba..eafc8e1 100644 --- a/src/carquinyol/datastore.py +++ b/src/carquinyol/datastore.py @@ -333,6 +333,7 @@ class DataStore(dbus.service.Object): return self._find_all(query, properties) metadata = self._metadata_store.retrieve(uid, properties) +self._fill_internal_props(metadata, uid, properties) entries.append(metadata) logger.debug('find(): %r', time.time() - t) @@ -350,10 +351,28 @@ class DataStore(dbus.service.Object): entries = [] for uid in uids: metadata = self._metadata_store.retrieve(uid, properties) +self._fill_internal_props(metadata, uid, properties) entries.append(metadata) return entries, count +def _fill_internal_props(self, metadata, uid, names=None): +Fill in internal / computed properties in metadata + +Properties are only set if they appear in names or if names is +empty. + +if not names or 'uid' in names: +metadata['uid'] = uid + +if not names or 'filesize' in names: +file_path = self._file_store.get_file_path(uid) +if os.path.exists(file_path): +stat = os.stat(file_path) +metadata['filesize'] = str(stat.st_size) +else: +metadata['filesize'] = '0' Why do you make the filesize a string here? In all the other cases in the code it is an int e.g.: if os.path.exists(file_path): stat = os.stat(file_path) props['filesize'] = stat.st_size else: props['filesize'] = 0 I think we should be consistent here. Regards, Simon ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar] Journal detail view: don't choke on invalid 'keep' property
Hi Sascha, thanks for the patch. On 02/11/11 23:28, Sascha Silbe wrote: Properties of data store entries can get corrupted, e.g. due to low level crashes or running out of battery (see OLPC#11372 [1] for a real-life example). In addition any activity can - accidentally or on purpose - write data store entries with arbitrary metadata. By comparing the 'keep' property as a string we can avoid the ValueError that might happen when trying to convert the property value to an integer. [1] https://dev.laptop.org/ticket/11372 Reported-by: Gary Martingarycmar...@googlemail.com Signed-off-by: Sascha Silbesi...@activitycentral.com --- Tested using the data store attached to the ticket referenced above. src/jarabe/journal/expandedentry.py |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py index 495c7e9..caf6003 100644 --- a/src/jarabe/journal/expandedentry.py +++ b/src/jarabe/journal/expandedentry.py @@ -147,7 +147,7 @@ class ExpandedEntry(hippo.CanvasBox): self._metadata = metadata self._object_id = object_id -self._keep_icon.keep = (int(metadata.get('keep', 0)) == 1) +self._keep_icon.keep = (str(metadata.get('keep', 0)) == '1') self._icon = self._create_icon() self._icon_box.clear() -- 1.7.6.3 There is another place in the code where we retrieve the 'keep' property, I would suggest something like: diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py index 4e99dc2..3617cbb 100644 --- a/src/jarabe/journal/expandedentry.py +++ b/src/jarabe/journal/expandedentry.py @@ -144,7 +144,7 @@ class ExpandedEntry(hippo.CanvasBox): return self._metadata = metadata -self._keep_icon.keep = (int(metadata.get('keep', 0)) == 1) +self._keep_icon.keep = self.get_keep() self._icon = self._create_icon() self._icon_box.clear() @@ -419,7 +419,8 @@ class ExpandedEntry(hippo.CanvasBox): self._update_title_sid = None def get_keep(self): -return int(self._metadata.get('keep', 0)) == 1 +# We can not rely on the keep metadata to be int, SL 1591 +return str(self._metadata.get('keep', 0)) == '1' def _keep_icon_activated_cb(self, keep_icon): if self.get_keep(): Afaik, this patch is not needed to fix [1]. I think it would be better to note [2][3] as tickets it fixes. As well, we should check if there are other cases that fail and fix those, too like a sensible approach noted in [3]. [1] https://dev.laptop.org/ticket/11372 [2] http://bugs.sugarlabs.org/ticket/1591 [3] http://bugs.sugarlabs.org/ticket/1561 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] Sugar Digest 2012-01-10
== Sugar Digest == 1. 2012 has started off with a big splash. In the OLPC demonstration of their prototype tablet--the XO-3.0--at the Consumer Electronics Show (CES), Sugar figured prominently. The XO surrounded by a spiral of Activity icons was everywhere (e.g., [1]). Featured in Ed McNierney's (OLPC CTO) nonstop demo was Measure, Turtle Blocks, Wikipedia, and Fraction Bounce, among others. The OLPC devel team did some tweaks to Sugar to enhance it on the tablet: the Frame can be invoked by dragging your finger to the lower right-hand corner of the screen. Clicking anywhere on the canvas hides the Frame. Works pretty well. Of course, there is a ways to go to realize a full touch integration. It was amusing to watch people use the gestures they've grown accustom to on their iPads to no effect in Sugar. The work on porting to GTK-3 (Sugar 0.96) will make a big difference there. I made a few tweaks to Turtle Blocks for the demo: (1) I try to distinguish between a click on a block and a short drag of the block--it is hard to click on a touch screen without some x-y displacement; (2) I added a mechanism for changing the values in number blocks without a keyboard; and (3) I tightened up the toolbars so that they would fit on the smaller XO-3.0 display. While all of these changes are more general in their applicability, #3 is something we need to think about for all small displays as it is often the case that not all of the toolbar buttons fit. 2. In addition to the GTK-3 migration, we have a few more features queued up for Sugar 0.96 (See [2]). The one I am working on at the moment is Write to Journal anytime [3]. The goal is to encourage more writing and reflection throughout the process of using an Activity, not just when you close it at the end of the first session. The mechanism I am experimenting with is to add a new toolbar palette to the Activity Toolbar that incorporated a text-entry field. By typing into this field, you can add notes to the Activity Description found in the Journal. It is my hypothesis that by making it easier to take notes while one is working, we may see more note taking and the vision of the Journal as a lab notebook may finally be realized. 3. Aleksey Lim continues to make progress on the Sugar Network [4], a platform he is developing in Peru in order to facilitate sharing of content, with an emphasis on the needs of off-line deployments. 4. Bernie Innocenti and Stefan Unterhauser (Dogi) are getting ready to migrate our servers to a new colocation site. We have been hosted by the Free Software Foundation, but since they are going to be moving to a new colocation site, we are planning to consolidate our servers in a server room at MIT. Details about the migration will be announced well in advance and we don't expect any major disruption of services. Stay tuned. 5. Tony Forster, Guzmán Trinidad, Andrés Aguirre, Facundo Benavides, Federico Andrade, Alan Aguiar, Gonzalo Tejera, and I have written a paper about using Turtle Blocks with sensors. A draft is in the wiki. [5] === Sugar Labs === Gary Martin has generated SOMs from the past few weeks of discussion on the IAEP mailing list: 2011 Dec 31st-Jan 6th (30 emails) [6] 2011 Dec 24th-30th (18 emails) [7] 2011 Dec 17th-23rd (16 emails) [8] Visit our planet [9] for more updates about Sugar and Sugar deployments. [1] http://www.blogcdn.com/www.engadget.com/media/2012/01/img1983.jpg [2] http://wiki.sugarlabs.org/go/0.96/Feature_List#Accepted_Features_for_0.96 [3] http://wiki.sugarlabs.org/go/Features/Write_to_journal_anytime [4] http://wiki.sugarlabs.org/go/Sugar_Network [5] http://wiki.sugarlabs.org/go/File:Turtle_sensors.pdf| [6] http://wiki.sugarlabs.org/go/File:2011-Dec-31-Jan-6-som.jpg [7] http://wiki.sugarlabs.org/go/File:2011-Dec-24-30-som.jpg [8] http://wiki.sugarlabs.org/go/File:2011-Dec-17-23-som.jpg [9] http://planet.sugarlabs.org -walter -- Walter Bender Sugar Labs http://www.sugarlabs.org ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [REMINDER] Development team meeting --- 10. Jan 2012 (15:00 UTC)
On Mon, Jan 9, 2012 at 6:42 PM, Walter Bender walter.ben...@gmail.com wrote: On Mon, Jan 9, 2012 at 1:06 PM, Simon Schampijer si...@schampijer.de wrote: [snip] [done] #action Walter send a mail to get the 'write to journal anytime' discussion going Please see [1-3]. [1] http://wiki.sugarlabs.org/go/Features/Write_to_journal_anytime#Detailed_Description [2] http://wiki.sugarlabs.org/go/Talk:Features/Write_to_journal_anytime#Log_from_Design_Team_Meeting_08_January_2012 [3] http://wiki.sugarlabs.org/images/a/a4/Write_to_Journal_Palette.png [snip] As per today's discussion, here is a version of Write to Journal anytime that uses a textview widget, showing the contents of the Description field. [1] In my mind: Pros: all notes are visible. Cons: takes up lots of vertical space. Will work on some of the other ideas next. -walter [1] http://wiki.sugarlabs.org/go/File:Write_to_Journal_Text_View.png -- Walter Bender Sugar Labs http://www.sugarlabs.org ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [MINUTES] Development team meeting --- 10. Jan 2012 (15:00 UTC)
Hi, for those that could not attend, here the logs: Minutes: http://meeting.sugarlabs.org/sugar-meeting/meetings/2012-01-10T15:01:06.html meeting: Log: http://meeting.sugarlabs.org/sugar-meeting/meetings/2012-01-10T15:01:06 Regards, Simon ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [REMINDER] Development team meeting --- 10. Jan 2012 (15:00 UTC)
Excerpts from Walter Bender's message of 2012-01-10 18:19:33 +0100: As per today's discussion, here is a version of Write to Journal anytime that uses a textview widget, showing the contents of the Description field. [1] In my mind: Pros: all notes are visible. Cons: takes up lots of vertical space. FWIW, I think this one is good enough for the first iteration. We can still improve it in the next cycle, based on feedback from users (possibly indirectly via deployments). 1-2 clicks to get from canvas to notes is good enough; if we can come up with a good keyboard shortcut, even better. [1] http://wiki.sugarlabs.org/go/File:Write_to_Journal_Text_View.png Thanks for keeping up the good work! Sascha -- http://sascha.silbe.org/ http://www.infra-silbe.de/ signature.asc Description: PGP signature ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] downloading disk images via bittorrent (was: 883 on XO1)
Excerpts from Richard A. Smith's message of 2012-01-08 20:01:55 +0100: Having builds available via bittorrent or some other p2p tool would be very useful when the dev team in in China. MirrorBrain (the tool used to host download.sugarlabs.org) can automatically create torrent files [1,2]. (*) In general this wouldn't actually help you as there's probably no one seeding the files via bittorrent, but ... Bandwidth at the factory is limited on per IP basis. If the builds were available via p2p with swarming then the team could peer each other and we all would download chunks in parallel. in your particular case even the above could be enough. Most bittorrent clients have DHT support, so you don't need a tracker. The torrent file includes web seeds using URLs of mirrors, so if your client supports downloading chunks via HTTP, it should just work. And even without using MirrorBrain for download.laptop.org (possibly by backing it with SL infrastructure), just creating a single torrent file including a web seed should work well enough for downloading the image at the factory. Sascha (*) I'm working on enabling this for download.sugarlabs.org, but hit a bug [3], so not going to happen today. [1] http://mirrorbrain.org/docs/configuration/#configuring-torrent-generation [2] http://mirrorbrain.org/docs/installation/initial_config/#creating-hashes [3] http://mirrorbrain.org/issues/issue94 -- http://sascha.silbe.org/ http://www.infra-silbe.de/ signature.asc Description: PGP signature ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [REMINDER] Development team meeting --- 10. Jan 2012 (15:00 UTC)
Here there are two images with another proposal we talked in the meeting: The first is without pressing the button take notes, the second is pressed. http://wiki.sugarlabs.org/go/File:Write_to_Journal_Anytime_Proposal2_a.png http://wiki.sugarlabs.org/go/File:Write_to_Journal_Anytime_Proposal2_b.png Gonzalo ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [REMINDER] Development team meeting --- 10. Jan 2012 (15:00 UTC)
On Tue, Jan 10, 2012 at 3:02 PM, Gonzalo Odiard gonz...@laptop.org wrote: Here there are two images with another proposal we talked in the meeting: The first is without pressing the button take notes, the second is pressed. http://wiki.sugarlabs.org/go/File:Write_to_Journal_Anytime_Proposal2_a.png http://wiki.sugarlabs.org/go/File:Write_to_Journal_Anytime_Proposal2_b.png Gonzalo I like it, but I don't know how to implement it. A new Palette Class? -walter -- Walter Bender Sugar Labs http://www.sugarlabs.org ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [REMINDER] Development team meeting --- 10. Jan 2012 (15:00 UTC)
On Tue, Jan 10, 2012 at 2:00 PM, Sascha Silbe si...@activitycentral.com wrote: Excerpts from Walter Bender's message of 2012-01-10 18:19:33 +0100: As per today's discussion, here is a version of Write to Journal anytime that uses a textview widget, showing the contents of the Description field. [1] In my mind: Pros: all notes are visible. Cons: takes up lots of vertical space. FWIW, I think this one is good enough for the first iteration. We can still improve it in the next cycle, based on feedback from users (possibly indirectly via deployments). 1-2 clicks to get from canvas to notes is good enough; if we can come up with a good keyboard shortcut, even better. [1] http://wiki.sugarlabs.org/go/File:Write_to_Journal_Text_View.png Thanks for keeping up the good work! Sascha -- http://sascha.silbe.org/ http://www.infra-silbe.de/ FWIW, I've tried using a palette for the save/load buttons in Turtle Art (freeing up precious space on the Activity toolbar). Might not be so bad. We could then think about a favorites button and a tags palette since we'd have space for them. -walter -- Walter Bender Sugar Labs http://www.sugarlabs.org ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [REMINDER] Development team meeting --- 10. Jan 2012 (15:00 UTC)
On Tue, Jan 10, 2012 at 3:26 PM, Walter Bender walter.ben...@gmail.com wrote: On Tue, Jan 10, 2012 at 2:00 PM, Sascha Silbe si...@activitycentral.com wrote: Excerpts from Walter Bender's message of 2012-01-10 18:19:33 +0100: As per today's discussion, here is a version of Write to Journal anytime that uses a textview widget, showing the contents of the Description field. [1] In my mind: Pros: all notes are visible. Cons: takes up lots of vertical space. FWIW, I think this one is good enough for the first iteration. We can still improve it in the next cycle, based on feedback from users (possibly indirectly via deployments). 1-2 clicks to get from canvas to notes is good enough; if we can come up with a good keyboard shortcut, even better. [1] http://wiki.sugarlabs.org/go/File:Write_to_Journal_Text_View.png Thanks for keeping up the good work! Sascha -- http://sascha.silbe.org/ http://www.infra-silbe.de/ FWIW, I've tried using a palette for the save/load buttons in Turtle Art (freeing up precious space on the Activity toolbar). Might not be so bad. We could then think about a favorites button and a tags palette since we'd have space for them. Forgot to include the link: http://wiki.sugarlabs.org/images/8/86/TAsave-load-palette.png -walter -- Walter Bender Sugar Labs http://www.sugarlabs.org -- Walter Bender Sugar Labs http://www.sugarlabs.org ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel