[Sugar-devel] Journal Backup Code.

2013-02-28 Thread Matias Basso
Hi all!

I have a code that use GTK-2, and in it I made an import:

from jarabe.journal.processdialog import VolumeBackupDialog

The problem is the next:
I'm using now a Fedora-18 image in wich use GTK-3 (Sugar) and when I run
the program this is what shows up:

from  jarabe.journal.processdialog import VolumeBackupDialog
  File /usr/lib/python2.7/site-packages/jarabe/journal/processdialog.py,
line 19, in module
from gi.repository import GObject
  File /usr/lib/python2.7/site-packages/gi/__init__.py, line 27, in
module
from ._gi import _API, Repository
ImportError: could not import gobject (error was: ImportError('When using
gi.repository you must not import static modules like gobject. Please
change all occurrences of import gobject to from gi.repository import
GObject.',))

Someone knows how to solve this?
Thx! bye bye!!

-- 
Tec. MATIAS BASSO .-
Investigación y Desarrollo - Plan Ceibal .-
Centro Ceibal - Av. Italia 6201 - Montevideo, Uruguay .-
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal Backup Code.

2013-02-28 Thread Daniel Narvaez
You cannot mix gtk2 and gtk3 code (more precisely static and dynamic
gobject bindings). You will have to port the code to gtk3.

On 28 February 2013 14:40, Matias Basso mba...@plan.ceibal.edu.uy wrote:
 Hi all!

 I have a code that use GTK-2, and in it I made an import:

 from jarabe.journal.processdialog import VolumeBackupDialog

 The problem is the next:
 I'm using now a Fedora-18 image in wich use GTK-3 (Sugar) and when I run the
 program this is what shows up:

 from  jarabe.journal.processdialog import VolumeBackupDialog
   File /usr/lib/python2.7/site-packages/jarabe/journal/processdialog.py,
 line 19, in module
 from gi.repository import GObject
   File /usr/lib/python2.7/site-packages/gi/__init__.py, line 27, in
 module
 from ._gi import _API, Repository
 ImportError: could not import gobject (error was: ImportError('When using
 gi.repository you must not import static modules like gobject. Please
 change all occurrences of import gobject to from gi.repository import
 GObject.',))

 Someone knows how to solve this?
 Thx! bye bye!!

 --
 Tec. MATIAS BASSO .-
 Investigación y Desarrollo - Plan Ceibal .-
 Centro Ceibal - Av. Italia 6201 - Montevideo, Uruguay .-

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




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


Re: [Sugar-devel] Journal Backup Code.

2013-02-28 Thread Matias Basso
Thx Daniel !

That was one of the solution I had in mind. So, i will start to port to GTK3

Thanks a lot!


2013/2/28 Daniel Narvaez dwnarv...@gmail.com

 You cannot mix gtk2 and gtk3 code (more precisely static and dynamic
 gobject bindings). You will have to port the code to gtk3.

 On 28 February 2013 14:40, Matias Basso mba...@plan.ceibal.edu.uy wrote:
  Hi all!
 
  I have a code that use GTK-2, and in it I made an import:
 
  from jarabe.journal.processdialog import VolumeBackupDialog
 
  The problem is the next:
  I'm using now a Fedora-18 image in wich use GTK-3 (Sugar) and when I run
 the
  program this is what shows up:
 
  from  jarabe.journal.processdialog import VolumeBackupDialog
File
 /usr/lib/python2.7/site-packages/jarabe/journal/processdialog.py,
  line 19, in module
  from gi.repository import GObject
File /usr/lib/python2.7/site-packages/gi/__init__.py, line 27, in
  module
  from ._gi import _API, Repository
  ImportError: could not import gobject (error was: ImportError('When using
  gi.repository you must not import static modules like gobject. Please
  change all occurrences of import gobject to from gi.repository import
  GObject.',))
 
  Someone knows how to solve this?
  Thx! bye bye!!
 
  --
  Tec. MATIAS BASSO .-
  Investigación y Desarrollo - Plan Ceibal .-
  Centro Ceibal - Av. Italia 6201 - Montevideo, Uruguay .-
 
  ___
  Sugar-devel mailing list
  Sugar-devel@lists.sugarlabs.org
  http://lists.sugarlabs.org/listinfo/sugar-devel
 



 --
 Daniel Narvaez




-- 
Tec. MATIAS BASSO .-
Investigación y Desarrollo - Plan Ceibal .-
Centro Ceibal - Av. Italia 6201 - Montevideo, Uruguay .-
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [read PATCH] sdxo#4448: Revert back to the earlier behaviour, of re-computing filehash every time when needed.

2013-02-28 Thread Ajay Garg
This reverts commit 21af7cc988320c8a53c946253d52fe1bb6ff9a7e.

Thankfully, we do not lose anything, as the commit 
21af7cc988320c8a53c946253d52fe1bb6ff9a7e was just an optimisation-commit;
we don't lose anything on the frontend/backend/anywhere :)

 readactivity.py| 10 ++
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/readactivity.py b/readactivity.py
index beed2b4..e0f0cf8 100644
--- a/readactivity.py
+++ b/readactivity.py
@@ -710,7 +710,6 @@ class ReadActivity(activity.Activity):
 self.metadata['Read_search'] = \
 self._edit_toolbar._search_entry.props.text
 self.metadata['activity'] = self.get_bundle_id()
-self.metadata['filehash'] = self.filehash
 
 os.link(self._tempfile, file_path)
 
@@ -856,13 +855,8 @@ class ReadActivity(activity.Activity):
 self._view_toolbar.set_view(self._view)
 self._edit_toolbar.set_view(self._view)
 
-
-self.filehash = self.metadata.get('filehash', None)
-if self.filehash is None:
-self.filehash = get_md5(filepath)
-logging.error('Calculate hash %s', self.filehash)
-
-self._bookmarkmanager = BookmarkManager(self.filehash)
+filehash = get_md5(filepath)
+self._bookmarkmanager = BookmarkManager(filehash)
 self._bookmarkmanager.connect('added_bookmark',
 self._added_bookmark_cb)
 self._bookmarkmanager.connect('removed_bookmark',
-- 
1.7.11.7

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


Re: [Sugar-devel] How to make a GTK3 EventBox accept the focus?

2013-02-28 Thread James Simmons
Gonzalo,

The problem with that it I want the arrow keys to page through the images
only when the image has the focus.  There are other places in the Activity
where I don't want to interfere with the arrow keys.  For instance, you can
make annotations for a specific image.

I notice that GtkImage is a subclass of GtkWidget, so maybe that means that
I don't need the event box anymore.  Maybe the image itself can accept the
focus and receive the events.  The problem I have with that is that the old
GTK made Image extend Widget also, and as I remember it you couldn't get
events from an Image.  It was years ago.  Maybe I've been doing it wrong
the whole time.

James Simmons


On Wed, Feb 27, 2013 at 6:24 PM, Gonzalo Odiard gonz...@laptop.org wrote:

 Can you catch the key-press-event in the activity class?
 I think other activities like Read or Terminal do this.

 Gonzalo

 On Wed, Feb 27, 2013 at 1:53 PM, James Simmons nices...@gmail.com wrote:

 Aneesh,

 I'm trying to incorporate your GTK3 update to View Slides and release the
 result on ASLO.  The problem I'm still having is that I cannot page through
 the images using the keyboard as I used to.  What I did in the past was to
 nest the image control in an event box and make the event box able to
 accept the focus.  Then the user clicks on the image with the mouse to set
 the focus and at that point the event box receives key press events.

 When you upgraded View Slides to use GTK3 you removed the code to make
 the event box focusable.  I have tried to replace the missing line of code
 with what seems to be the GTK3 equivalent but it isn't working.  I've done
 a lot of google searches trying to figure out the problem and I'm not
 getting anywhere.  I cannot release View Slides as it is.  It really needs
 to be able to navigate through the images with the keyboard to be usable.

 I'm hoping you might have some thoughts or maybe an idea of how to do the
 keyboard paging a different way.

 James Simmons


 On Mon, Feb 25, 2013 at 6:20 AM, Manuel Quiñones ma...@laptop.orgwrote:

 Hi James,

 2013/2/24 James Simmons nices...@gmail.com:
  I was looking at the upgrade to GTK3 done for View Slides and it seems
 that
  it no longer responds to the keyboard.  What I had done previously to
 get it
  to do that was to put the image I was displaying in an event box.  I
 then
  made the event box accept the focus like this:
 
  self.eventbox.set_events(gtk.gdk.KEY_PRESS_MASK |
 gtk.gdk.BUTTON_PRESS_MASK)
  self.eventbox.set_flags(gtk.CAN_FOCUS)
 
  The Gtk3 port changed the code to this:
 
  self.eventbox.set_events(Gdk.EventMask.KEY_PRESS_MASK |
  Gdk.EventMask.BUTTON_PRESS_MASK)
 
  There was no code to make it accept the focus.  I tried adding this:
 
  self.eventbox.set_can_focus(True)
 
  This does not prevent the Activity from running, but it doesn't make
 the
  Event Box focusable either.

 Have you tried self.eventbox.grab_focus() ?


 http://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-grab-focus

 --
 .. manuq ..



 ___
 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


Re: [Sugar-devel] [read PATCH] sdxo#4448: Revert back to the earlier behaviour, of re-computing filehash every time when needed.

2013-02-28 Thread Gonzalo Odiard
How is this related with collaboration?

Gonzalo

On Thu, Feb 28, 2013 at 12:23 PM, Ajay Garg a...@activitycentral.comwrote:

 This reverts commit 21af7cc988320c8a53c946253d52fe1bb6ff9a7e.

 Thankfully, we do not lose anything, as the commit
 21af7cc988320c8a53c946253d52fe1bb6ff9a7e was just an optimisation-commit;
 we don't lose anything on the frontend/backend/anywhere :)

  readactivity.py| 10 ++
  1 files changed, 2 insertions(+), 8 deletions(-)

 diff --git a/readactivity.py b/readactivity.py
 index beed2b4..e0f0cf8 100644
 --- a/readactivity.py
 +++ b/readactivity.py
 @@ -710,7 +710,6 @@ class ReadActivity(activity.Activity):
  self.metadata['Read_search'] = \
  self._edit_toolbar._search_entry.props.text
  self.metadata['activity'] = self.get_bundle_id()
 -self.metadata['filehash'] = self.filehash

  os.link(self._tempfile, file_path)

 @@ -856,13 +855,8 @@ class ReadActivity(activity.Activity):
  self._view_toolbar.set_view(self._view)
  self._edit_toolbar.set_view(self._view)

 -
 -self.filehash = self.metadata.get('filehash', None)
 -if self.filehash is None:
 -self.filehash = get_md5(filepath)
 -logging.error('Calculate hash %s', self.filehash)
 -
 -self._bookmarkmanager = BookmarkManager(self.filehash)
 +filehash = get_md5(filepath)
 +self._bookmarkmanager = BookmarkManager(filehash)
  self._bookmarkmanager.connect('added_bookmark',
  self._added_bookmark_cb)
  self._bookmarkmanager.connect('removed_bookmark',
 --
 1.7.11.7

 ___
 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


Re: [Sugar-devel] [read PATCH] sdxo#4448: Revert back to the earlier behaviour, of re-computing filehash every time when needed.

2013-02-28 Thread Gonzalo Odiard
Hmm, may be I misreaded.
What is trying to solve this patch?

Gonzalo

On Thu, Feb 28, 2013 at 1:01 PM, Gonzalo Odiard gonz...@laptop.org wrote:

 How is this related with collaboration?

 Gonzalo


 On Thu, Feb 28, 2013 at 12:23 PM, Ajay Garg a...@activitycentral.comwrote:

 This reverts commit 21af7cc988320c8a53c946253d52fe1bb6ff9a7e.

 Thankfully, we do not lose anything, as the commit
 21af7cc988320c8a53c946253d52fe1bb6ff9a7e was just an optimisation-commit;
 we don't lose anything on the frontend/backend/anywhere :)

  readactivity.py| 10 ++
  1 files changed, 2 insertions(+), 8 deletions(-)

 diff --git a/readactivity.py b/readactivity.py
 index beed2b4..e0f0cf8 100644
 --- a/readactivity.py
 +++ b/readactivity.py
 @@ -710,7 +710,6 @@ class ReadActivity(activity.Activity):
  self.metadata['Read_search'] = \
  self._edit_toolbar._search_entry.props.text
  self.metadata['activity'] = self.get_bundle_id()
 -self.metadata['filehash'] = self.filehash

  os.link(self._tempfile, file_path)

 @@ -856,13 +855,8 @@ class ReadActivity(activity.Activity):
  self._view_toolbar.set_view(self._view)
  self._edit_toolbar.set_view(self._view)

 -
 -self.filehash = self.metadata.get('filehash', None)
 -if self.filehash is None:
 -self.filehash = get_md5(filepath)
 -logging.error('Calculate hash %s', self.filehash)
 -
 -self._bookmarkmanager = BookmarkManager(self.filehash)
 +filehash = get_md5(filepath)
 +self._bookmarkmanager = BookmarkManager(filehash)
  self._bookmarkmanager.connect('added_bookmark',
  self._added_bookmark_cb)
  self._bookmarkmanager.connect('removed_bookmark',
 --
 1.7.11.7

 ___
 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


Re: [Sugar-devel] [read PATCH] sdxo#4448: Revert back to the earlier behaviour, of re-computing filehash every time when needed.

2013-02-28 Thread Ajay Garg
Hi Gonzalo.

1)
XO-A shares a document.

2)
XO-B joins the activity.

3)
Now, at XO-B, there is a call to write_file for the just-loaded
document; however, the self.filehash being None, fails to save.
There are also other issues with self.filehash as part of
sharing-wokflows.


On Thu, Feb 28, 2013 at 9:32 PM, Gonzalo Odiard gonz...@laptop.org wrote:

 Hmm, may be I misreaded.
 What is trying to solve this patch?

 Gonzalo


 On Thu, Feb 28, 2013 at 1:01 PM, Gonzalo Odiard gonz...@laptop.orgwrote:

 How is this related with collaboration?

 Gonzalo


 On Thu, Feb 28, 2013 at 12:23 PM, Ajay Garg a...@activitycentral.comwrote:

 This reverts commit 21af7cc988320c8a53c946253d52fe1bb6ff9a7e.

 Thankfully, we do not lose anything, as the commit
 21af7cc988320c8a53c946253d52fe1bb6ff9a7e was just an optimisation-commit;
 we don't lose anything on the frontend/backend/anywhere :)

  readactivity.py| 10 ++
  1 files changed, 2 insertions(+), 8 deletions(-)

 diff --git a/readactivity.py b/readactivity.py
 index beed2b4..e0f0cf8 100644
 --- a/readactivity.py
 +++ b/readactivity.py
 @@ -710,7 +710,6 @@ class ReadActivity(activity.Activity):
  self.metadata['Read_search'] = \
  self._edit_toolbar._search_entry.props.text
  self.metadata['activity'] = self.get_bundle_id()
 -self.metadata['filehash'] = self.filehash

  os.link(self._tempfile, file_path)

 @@ -856,13 +855,8 @@ class ReadActivity(activity.Activity):
  self._view_toolbar.set_view(self._view)
  self._edit_toolbar.set_view(self._view)

 -
 -self.filehash = self.metadata.get('filehash', None)
 -if self.filehash is None:
 -self.filehash = get_md5(filepath)
 -logging.error('Calculate hash %s', self.filehash)
 -
 -self._bookmarkmanager = BookmarkManager(self.filehash)
 +filehash = get_md5(filepath)
 +self._bookmarkmanager = BookmarkManager(filehash)
  self._bookmarkmanager.connect('added_bookmark',
  self._added_bookmark_cb)
  self._bookmarkmanager.connect('removed_bookmark',
 --
 1.7.11.7

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






-- 
Regards,

Ajay Garg
Dextrose Developer
Activity Central: http://activitycentral.com
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] How to make a GTK3 EventBox accept the focus?

2013-02-28 Thread Daniel Narvaez
Two things you could try:

- set_visible_window(True) the event box and also set_can_focus

- Remove the box and set_can_focus the image.

On Thursday, 28 February 2013, James Simmons wrote:

 Gonzalo,

 The problem with that it I want the arrow keys to page through the images
 only when the image has the focus.  There are other places in the Activity
 where I don't want to interfere with the arrow keys.  For instance, you can
 make annotations for a specific image.

 I notice that GtkImage is a subclass of GtkWidget, so maybe that means
 that I don't need the event box anymore.  Maybe the image itself can accept
 the focus and receive the events.  The problem I have with that is that the
 old GTK made Image extend Widget also, and as I remember it you couldn't
 get events from an Image.  It was years ago.  Maybe I've been doing it
 wrong the whole time.

 James Simmons


 On Wed, Feb 27, 2013 at 6:24 PM, Gonzalo Odiard 
 gonz...@laptop.orgjavascript:_e({}, 'cvml', 'gonz...@laptop.org');
  wrote:

 Can you catch the key-press-event in the activity class?
 I think other activities like Read or Terminal do this.

 Gonzalo

 On Wed, Feb 27, 2013 at 1:53 PM, James Simmons 
 nices...@gmail.comjavascript:_e({}, 'cvml', 'nices...@gmail.com');
  wrote:

 Aneesh,

 I'm trying to incorporate your GTK3 update to View Slides and release
 the result on ASLO.  The problem I'm still having is that I cannot page
 through the images using the keyboard as I used to.  What I did in the past
 was to nest the image control in an event box and make the event box able
 to accept the focus.  Then the user clicks on the image with the mouse to
 set the focus and at that point the event box receives key press events.

 When you upgraded View Slides to use GTK3 you removed the code to make
 the event box focusable.  I have tried to replace the missing line of code
 with what seems to be the GTK3 equivalent but it isn't working.  I've done
 a lot of google searches trying to figure out the problem and I'm not
 getting anywhere.  I cannot release View Slides as it is.  It really needs
 to be able to navigate through the images with the keyboard to be usable.

 I'm hoping you might have some thoughts or maybe an idea of how to do
 the keyboard paging a different way.

 James Simmons


 On Mon, Feb 25, 2013 at 6:20 AM, Manuel Quiñones 
 ma...@laptop.orgjavascript:_e({}, 'cvml', 'ma...@laptop.org');
  wrote:

 Hi James,

 2013/2/24 James Simmons nices...@gmail.com javascript:_e({}, 'cvml',
 'nices...@gmail.com');:
  I was looking at the upgrade to GTK3 done for View Slides and it
 seems that
  it no longer responds to the keyboard.  What I had done previously to
 get it
  to do that was to put the image I was displaying in an event box.  I
 then
  made the event box accept the focus like this:
 
  self.eventbox.set_events(gtk.gdk.KEY_PRESS_MASK |
 gtk.gdk.BUTTON_PRESS_MASK)
  self.eventbox.set_flags(gtk.CAN_FOCUS)
 
  The Gtk3 port changed the code to this:
 
  self.eventbox.set_events(Gdk.EventMask.KEY_PRESS_MASK |
  Gdk.EventMask.BUTTON_PRESS_MASK)
 
  There was no code to make it accept the focus.  I tried adding this:
 
  self.eventbox.set_can_focus(True)
 
  This does not prevent the Activity from running, but it doesn't make
 the
  Event Box focusable either.

 Have you tried self.eventbox.grab_focus() ?


 http://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-grab-focus

 --
 .. manuq ..



 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org javascript:_e({}, 'cvml',
 'Sugar-devel@lists.sugarlabs.org');
 http://lists.sugarlabs.org/listinfo/sugar-devel





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


Re: [Sugar-devel] How to make a GTK3 EventBox accept the focus?

2013-02-28 Thread Daniel Narvaez
GtkImage only works for me:

from gi.repository import Gtk

def image1_focus_in_cb(a, b):
print(focus in 1)

def image1_focus_out_cb(a, b):
print(focus out 1)

def image2_focus_in_cb(a, b):
print(focus in 2)

def image2_focus_out_cb(a, b):
print(focus out 2)


window = Gtk.Window()
box = Gtk.HBox()

image1 = Gtk.Image.new_from_file()
image1.set_can_focus(True)

image1.connect(focus-in-event, image1_focus_in_cb)
image1.connect(focus-out-event, image1_focus_out_cb)

image2 = Gtk.Image.new_from_file()
image2.set_can_focus(True)

image2.connect(focus-in-event, image2_focus_in_cb)
image2.connect(focus-out-event, image2_focus_out_cb)

box.pack_start(image1, False, False, 0)
box.pack_start(image2, False, False, 0)

window.add(box)
window.show_all()

Gtk.main()


On 28 February 2013 17:06, Daniel Narvaez dwnarv...@gmail.com wrote:
 Two things you could try:

 - set_visible_window(True) the event box and also set_can_focus

 - Remove the box and set_can_focus the image.


 On Thursday, 28 February 2013, James Simmons wrote:

 Gonzalo,

 The problem with that it I want the arrow keys to page through the images
 only when the image has the focus.  There are other places in the Activity
 where I don't want to interfere with the arrow keys.  For instance, you can
 make annotations for a specific image.

 I notice that GtkImage is a subclass of GtkWidget, so maybe that means
 that I don't need the event box anymore.  Maybe the image itself can accept
 the focus and receive the events.  The problem I have with that is that the
 old GTK made Image extend Widget also, and as I remember it you couldn't get
 events from an Image.  It was years ago.  Maybe I've been doing it wrong the
 whole time.

 James Simmons


 On Wed, Feb 27, 2013 at 6:24 PM, Gonzalo Odiard gonz...@laptop.org
 wrote:

 Can you catch the key-press-event in the activity class?
 I think other activities like Read or Terminal do this.

 Gonzalo

 On Wed, Feb 27, 2013 at 1:53 PM, James Simmons nices...@gmail.com
 wrote:

 Aneesh,

 I'm trying to incorporate your GTK3 update to View Slides and release
 the result on ASLO.  The problem I'm still having is that I cannot page
 through the images using the keyboard as I used to.  What I did in the past
 was to nest the image control in an event box and make the event box able 
 to
 accept the focus.  Then the user clicks on the image with the mouse to set
 the focus and at that point the event box receives key press events.

 When you upgraded View Slides to use GTK3 you removed the code to make
 the event box focusable.  I have tried to replace the missing line of code
 with what seems to be the GTK3 equivalent but it isn't working.  I've done 
 a
 lot of google searches trying to figure out the problem and I'm not getting
 anywhere.  I cannot release View Slides as it is.  It really needs to be
 able to navigate through the images with the keyboard to be usable.

 I'm hoping you might have some thoughts or maybe an idea of how to do
 the keyboard paging a different way.

 James Simmons


 On Mon, Feb 25, 2013 at 6:20 AM, Manuel Quiñones ma...@laptop.org
 wrote:

 Hi James,

 2013/2/24 James Simmons nices...@gmail.com:
  I was looking at the upgrade to GTK3 done for View Slides and it
  seems that
  it no longer responds to the keyboard.  What I had done previously to
  get it
  to do that was to put the image I was displaying in an event box.  I
  then
  made the event box accept the focus like this:
 
  self.eventbox.set_events(gtk.gdk.KEY_PRESS_MASK |
  gtk.gdk.BUTTON_PRESS_MASK)
  self.eventbox.set_flags(gtk.CAN_FOCUS)
 
  The Gtk3 port changed the code to this:
 
  self.eventbox.set_events(Gdk.EventMask.KEY_PRESS_MASK |
  Gdk.EventMask.BUTTON_PRESS_MASK)
 
  There was no code to make it accept the focus.  I tried adding this:
 
  self.eventbox.set_can_focus(True)
 
  This does not prevent the Activity from running, but it doesn't make
  the
  Event Box focusable either.

 Have you tried self.eventbox.grab_focus() ?


 http://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-grab-focus

 --
 .. manuq ..



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





 --
 Daniel Narvaez




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


Re: [Sugar-devel] How to make a GTK3 EventBox accept the focus?

2013-02-28 Thread James Simmons
Daniel,

Thanks, that's a big help!

James Simmons


On Thu, Feb 28, 2013 at 10:20 AM, Daniel Narvaez dwnarv...@gmail.comwrote:

 GtkImage only works for me:

 from gi.repository import Gtk

 def image1_focus_in_cb(a, b):
 print(focus in 1)

 def image1_focus_out_cb(a, b):
 print(focus out 1)

 def image2_focus_in_cb(a, b):
 print(focus in 2)

 def image2_focus_out_cb(a, b):
 print(focus out 2)


 window = Gtk.Window()
 box = Gtk.HBox()

 image1 = Gtk.Image.new_from_file()
 image1.set_can_focus(True)

 image1.connect(focus-in-event, image1_focus_in_cb)
 image1.connect(focus-out-event, image1_focus_out_cb)

 image2 = Gtk.Image.new_from_file()
 image2.set_can_focus(True)

 image2.connect(focus-in-event, image2_focus_in_cb)
 image2.connect(focus-out-event, image2_focus_out_cb)

 box.pack_start(image1, False, False, 0)
 box.pack_start(image2, False, False, 0)

 window.add(box)
 window.show_all()

 Gtk.main()


 On 28 February 2013 17:06, Daniel Narvaez dwnarv...@gmail.com wrote:
  Two things you could try:
 
  - set_visible_window(True) the event box and also set_can_focus
 
  - Remove the box and set_can_focus the image.
 
 
  On Thursday, 28 February 2013, James Simmons wrote:
 
  Gonzalo,
 
  The problem with that it I want the arrow keys to page through the
 images
  only when the image has the focus.  There are other places in the
 Activity
  where I don't want to interfere with the arrow keys.  For instance, you
 can
  make annotations for a specific image.
 
  I notice that GtkImage is a subclass of GtkWidget, so maybe that means
  that I don't need the event box anymore.  Maybe the image itself can
 accept
  the focus and receive the events.  The problem I have with that is that
 the
  old GTK made Image extend Widget also, and as I remember it you
 couldn't get
  events from an Image.  It was years ago.  Maybe I've been doing it
 wrong the
  whole time.
 
  James Simmons
 
 
  On Wed, Feb 27, 2013 at 6:24 PM, Gonzalo Odiard gonz...@laptop.org
  wrote:
 
  Can you catch the key-press-event in the activity class?
  I think other activities like Read or Terminal do this.
 
  Gonzalo
 
  On Wed, Feb 27, 2013 at 1:53 PM, James Simmons nices...@gmail.com
  wrote:
 
  Aneesh,
 
  I'm trying to incorporate your GTK3 update to View Slides and release
  the result on ASLO.  The problem I'm still having is that I cannot
 page
  through the images using the keyboard as I used to.  What I did in
 the past
  was to nest the image control in an event box and make the event box
 able to
  accept the focus.  Then the user clicks on the image with the mouse
 to set
  the focus and at that point the event box receives key press events.
 
  When you upgraded View Slides to use GTK3 you removed the code to make
  the event box focusable.  I have tried to replace the missing line of
 code
  with what seems to be the GTK3 equivalent but it isn't working.  I've
 done a
  lot of google searches trying to figure out the problem and I'm not
 getting
  anywhere.  I cannot release View Slides as it is.  It really needs to
 be
  able to navigate through the images with the keyboard to be usable.
 
  I'm hoping you might have some thoughts or maybe an idea of how to do
  the keyboard paging a different way.
 
  James Simmons
 
 
  On Mon, Feb 25, 2013 at 6:20 AM, Manuel Quiñones ma...@laptop.org
  wrote:
 
  Hi James,
 
  2013/2/24 James Simmons nices...@gmail.com:
   I was looking at the upgrade to GTK3 done for View Slides and it
   seems that
   it no longer responds to the keyboard.  What I had done previously
 to
   get it
   to do that was to put the image I was displaying in an event box.
  I
   then
   made the event box accept the focus like this:
  
   self.eventbox.set_events(gtk.gdk.KEY_PRESS_MASK |
   gtk.gdk.BUTTON_PRESS_MASK)
   self.eventbox.set_flags(gtk.CAN_FOCUS)
  
   The Gtk3 port changed the code to this:
  
   self.eventbox.set_events(Gdk.EventMask.KEY_PRESS_MASK |
   Gdk.EventMask.BUTTON_PRESS_MASK)
  
   There was no code to make it accept the focus.  I tried adding
 this:
  
   self.eventbox.set_can_focus(True)
  
   This does not prevent the Activity from running, but it doesn't
 make
   the
   Event Box focusable either.
 
  Have you tried self.eventbox.grab_focus() ?
 
 
 
 http://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-grab-focus
 
  --
  .. manuq ..
 
 
 
  ___
  Sugar-devel mailing list
  Sugar-devel@lists.sugarlabs.org
  http://lists.sugarlabs.org/listinfo/sugar-devel
 
 
 
 
 
  --
  Daniel Narvaez
 



 --
 Daniel Narvaez

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


Re: [Sugar-devel] [read PATCH] sdxo#4448: Revert back to the earlier behaviour, of re-computing filehash every time when needed.

2013-02-28 Thread Gonzalo Odiard
In the ticket I have attached a alternative solution.
If you can confirm is working for you should be nice.

Gonzalo

On Thu, Feb 28, 2013 at 1:05 PM, Ajay Garg a...@activitycentral.com wrote:

 Hi Gonzalo.

 1)
 XO-A shares a document.

 2)
 XO-B joins the activity.

 3)
 Now, at XO-B, there is a call to write_file for the just-loaded
 document; however, the self.filehash being None, fails to save.
 There are also other issues with self.filehash as part of
 sharing-wokflows.



 On Thu, Feb 28, 2013 at 9:32 PM, Gonzalo Odiard gonz...@laptop.orgwrote:

 Hmm, may be I misreaded.
 What is trying to solve this patch?

 Gonzalo


 On Thu, Feb 28, 2013 at 1:01 PM, Gonzalo Odiard gonz...@laptop.orgwrote:

 How is this related with collaboration?

 Gonzalo


 On Thu, Feb 28, 2013 at 12:23 PM, Ajay Garg a...@activitycentral.comwrote:

 This reverts commit 21af7cc988320c8a53c946253d52fe1bb6ff9a7e.

 Thankfully, we do not lose anything, as the commit
 21af7cc988320c8a53c946253d52fe1bb6ff9a7e was just an optimisation-commit;
 we don't lose anything on the frontend/backend/anywhere :)

  readactivity.py| 10 ++
  1 files changed, 2 insertions(+), 8 deletions(-)

 diff --git a/readactivity.py b/readactivity.py
 index beed2b4..e0f0cf8 100644
 --- a/readactivity.py
 +++ b/readactivity.py
 @@ -710,7 +710,6 @@ class ReadActivity(activity.Activity):
  self.metadata['Read_search'] = \
  self._edit_toolbar._search_entry.props.text
  self.metadata['activity'] = self.get_bundle_id()
 -self.metadata['filehash'] = self.filehash

  os.link(self._tempfile, file_path)

 @@ -856,13 +855,8 @@ class ReadActivity(activity.Activity):
  self._view_toolbar.set_view(self._view)
  self._edit_toolbar.set_view(self._view)

 -
 -self.filehash = self.metadata.get('filehash', None)
 -if self.filehash is None:
 -self.filehash = get_md5(filepath)
 -logging.error('Calculate hash %s', self.filehash)
 -
 -self._bookmarkmanager = BookmarkManager(self.filehash)
 +filehash = get_md5(filepath)
 +self._bookmarkmanager = BookmarkManager(filehash)
  self._bookmarkmanager.connect('added_bookmark',
  self._added_bookmark_cb)
  self._bookmarkmanager.connect('removed_bookmark',
 --
 1.7.11.7

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






 --
 Regards,

 Ajay Garg
 Dextrose Developer
 Activity Central: http://activitycentral.com
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel