Re: [Sugar-devel] [PATCH] Feature Request added : Kill the Mute function by clicking on the speaker icon.

2010-12-06 Thread Shanjit Singh Jajmann
Team,

I tried sending a patch to this thread by following the standard procedure
of copying and pasting the message id to the "in-reply-to : ". However, for
some reason the patch goes on to the different thread.

Please find the link to the patch, http://patchwork.sugarlabs.org/patch/519/


Shan

On Mon, Dec 6, 2010 at 4:36 PM, Shanjit Singh Jajmann wrote:

> Team,
>
> I thank you all for having a look at the patch and for recommending
> necessary changes.
>
> I am sending a revised patch for the same.
>
> Feedback and Response appreciated.
>
>
> Shan
>
>
> On Sat, Nov 13, 2010 at 6:45 PM, Gonzalo Odiard wrote:
>
>> Reviewed-By: gonz...@laptop.org
>>
>>
>> On Sat, Nov 13, 2010 at 7:08 AM,  wrote:
>>
>>> From: Shanjit Singh Jajmann 
>>>
>>> Muting by clicking on the icon is killed.
>>> ---
>>>  extensions/deviceicon/speaker.py |   10 --
>>>  1 files changed, 0 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/extensions/deviceicon/speaker.py
>>> b/extensions/deviceicon/speaker.py
>>> index 3a54464..4242105 100644
>>> --- a/extensions/deviceicon/speaker.py
>>> +++ b/extensions/deviceicon/speaker.py
>>> @@ -50,9 +50,6 @@ class DeviceView(TrayIcon):
>>>
>>> self.connect('expose-event', self.__expose_event_cb)
>>>
>>> -self._icon_widget.connect('button-release-event',
>>> -  self.__button_release_event_cb)
>>> -
>>> self._update_info()
>>>
>>> def create_palette(self):
>>> @@ -73,13 +70,6 @@ class DeviceView(TrayIcon):
>>> self.icon.props.icon_name = get_icon_state(name, current_level,
>>> step=-1)
>>> self.icon.props.xo_color = xo_color
>>>
>>> -def __button_release_event_cb(self, widget, event):
>>> -if event.button == 1:
>>> -self._model.props.muted = not self._model.props.muted
>>> -return True
>>> -else:
>>> -return False
>>> -
>>> def __expose_event_cb(self, *args):
>>> self._update_info()
>>>
>>> --
>>> 1.7.2.2
>>>
>>> ___
>>> 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


[Sugar-devel] [PATCH] Feature Request added : Remove Mute Toggle SL#1234

2010-12-06 Thread shanjit
From: Shanjit Singh Jajmann 

Mute toggle by clicking on the speaker icon has been removed. SL#1234
---
 extensions/deviceicon/speaker.py |   10 --
 1 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/extensions/deviceicon/speaker.py b/extensions/deviceicon/speaker.py
index 3a54464..4242105 100644
--- a/extensions/deviceicon/speaker.py
+++ b/extensions/deviceicon/speaker.py
@@ -50,9 +50,6 @@ class DeviceView(TrayIcon):
 
 self.connect('expose-event', self.__expose_event_cb)
 
-self._icon_widget.connect('button-release-event',
-  self.__button_release_event_cb)
-
 self._update_info()
 
 def create_palette(self):
@@ -73,13 +70,6 @@ class DeviceView(TrayIcon):
 self.icon.props.icon_name = get_icon_state(name, current_level, 
step=-1)
 self.icon.props.xo_color = xo_color
 
-def __button_release_event_cb(self, widget, event):
-if event.button == 1:
-self._model.props.muted = not self._model.props.muted
-return True
-else:
-return False
-
 def __expose_event_cb(self, *args):
 self._update_info()
 
-- 
1.7.2.2

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


[Sugar-devel] [PATCH] Feature Request added : Remove Mute Toggle SL#1234

2010-12-06 Thread shanjit
From: Shanjit Singh Jajmann 

Mute toggle by clicking on the speaker icon has been removed. SL#1234
---
 extensions/deviceicon/speaker.py |   10 --
 1 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/extensions/deviceicon/speaker.py b/extensions/deviceicon/speaker.py
index 3a54464..4242105 100644
--- a/extensions/deviceicon/speaker.py
+++ b/extensions/deviceicon/speaker.py
@@ -50,9 +50,6 @@ class DeviceView(TrayIcon):
 
 self.connect('expose-event', self.__expose_event_cb)
 
-self._icon_widget.connect('button-release-event',
-  self.__button_release_event_cb)
-
 self._update_info()
 
 def create_palette(self):
@@ -73,13 +70,6 @@ class DeviceView(TrayIcon):
 self.icon.props.icon_name = get_icon_state(name, current_level, 
step=-1)
 self.icon.props.xo_color = xo_color
 
-def __button_release_event_cb(self, widget, event):
-if event.button == 1:
-self._model.props.muted = not self._model.props.muted
-return True
-else:
-return False
-
 def __expose_event_cb(self, *args):
 self._update_info()
 
-- 
1.7.2.2

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


Re: [Sugar-devel] [PATCH] Feature Request added : Kill the Mute function by clicking on the speaker icon.

2010-12-06 Thread Shanjit Singh Jajmann
Team,

I thank you all for having a look at the patch and for recommending
necessary changes.

I am sending a revised patch for the same.

Feedback and Response appreciated.


Shan

On Sat, Nov 13, 2010 at 6:45 PM, Gonzalo Odiard  wrote:

> Reviewed-By: gonz...@laptop.org
>
>
> On Sat, Nov 13, 2010 at 7:08 AM,  wrote:
>
>> From: Shanjit Singh Jajmann 
>>
>> Muting by clicking on the icon is killed.
>> ---
>>  extensions/deviceicon/speaker.py |   10 --
>>  1 files changed, 0 insertions(+), 10 deletions(-)
>>
>> diff --git a/extensions/deviceicon/speaker.py
>> b/extensions/deviceicon/speaker.py
>> index 3a54464..4242105 100644
>> --- a/extensions/deviceicon/speaker.py
>> +++ b/extensions/deviceicon/speaker.py
>> @@ -50,9 +50,6 @@ class DeviceView(TrayIcon):
>>
>> self.connect('expose-event', self.__expose_event_cb)
>>
>> -self._icon_widget.connect('button-release-event',
>> -  self.__button_release_event_cb)
>> -
>> self._update_info()
>>
>> def create_palette(self):
>> @@ -73,13 +70,6 @@ class DeviceView(TrayIcon):
>> self.icon.props.icon_name = get_icon_state(name, current_level,
>> step=-1)
>> self.icon.props.xo_color = xo_color
>>
>> -def __button_release_event_cb(self, widget, event):
>> -if event.button == 1:
>> -self._model.props.muted = not self._model.props.muted
>> -return True
>> -else:
>> -return False
>> -
>> def __expose_event_cb(self, *args):
>> self._update_info()
>>
>> --
>> 1.7.2.2
>>
>> ___
>> 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


[Sugar-devel] [PATCH] Feature Request added : Kill the Mute function by clicking on the speaker icon.

2010-11-13 Thread shanjit
From: Shanjit Singh Jajmann 

Muting by clicking on the icon is killed.
---
 extensions/deviceicon/speaker.py |   10 --
 1 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/extensions/deviceicon/speaker.py b/extensions/deviceicon/speaker.py
index 3a54464..4242105 100644
--- a/extensions/deviceicon/speaker.py
+++ b/extensions/deviceicon/speaker.py
@@ -50,9 +50,6 @@ class DeviceView(TrayIcon):
 
 self.connect('expose-event', self.__expose_event_cb)
 
-self._icon_widget.connect('button-release-event',
-  self.__button_release_event_cb)
-
 self._update_info()
 
 def create_palette(self):
@@ -73,13 +70,6 @@ class DeviceView(TrayIcon):
 self.icon.props.icon_name = get_icon_state(name, current_level, 
step=-1)
 self.icon.props.xo_color = xo_color
 
-def __button_release_event_cb(self, widget, event):
-if event.button == 1:
-self._model.props.muted = not self._model.props.muted
-return True
-else:
-return False
-
 def __expose_event_cb(self, *args):
 self._update_info()
 
-- 
1.7.2.2

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


[Sugar-devel] Feature Request "Kill the "Mute" function on the volume icon in the frame"

2010-11-13 Thread Shanjit Singh Jajmann
Team,

I am working on the Dextrose TODO list[1], I am doing the "Kill the "Mute"
function on the volume icon in the frame" one, under the UI changes heading.

I have created a Wiki page regarding my progress on the feature request[2],
i would request you to have a look at it.

Feedback would be appreciated.


Shan

[1] : http://wiki.sugarlabs.org/go/Dextrose/TODO
[2] :
http://wiki.sugarlabs.org/go/Kill_the_mute_function_in_the_volume_icon_of_the_frame
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH V3] Copying files multiple times results in bogus names. (SL#2060)

2010-11-13 Thread shanjit
From: Shanjit Singh Jajmann 

For every existing file copied to the location, the names are explicitly
changed to filename_copynumber.extension e.g. games_1.png, games_2.png,
games_3.jpg and so on.

---
v1 -> v2. Parenthesis idea removed, i initialised from 1.
Recommendations by Gonzalo Odiard, James Cameron and Martin Dengler added.
v2 -> v3. Line wrapping and .extension added.  
---
 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 81ca7d4..81d1663 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -529,8 +529,8 @@ def _get_file_name(title, mime_type):
 def _get_unique_file_name(mount_point, file_name):
 if os.path.exists(os.path.join(mount_point, file_name)):
 i = 1
+name, extension = os.path.splitext(file_name)
 while len(file_name) <= 255:
-name, extension = os.path.splitext(file_name)
 file_name = name + '_' + str(i) + extension
 if not os.path.exists(os.path.join(mount_point, file_name)):
 break
-- 
1.7.2.2

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


Re: [Sugar-devel] [PATCH V3] Copying files multiple times results in bogus names. (SL#2060)

2010-11-13 Thread Shanjit Singh Jajmann
Daniel

I thank you for your suggestion and feedback.

I would be adding the names of the people, whose recommendations have been
taken into consideration while submitting the patch.

Shan

On Sat, Nov 13, 2010 at 6:32 AM, Daniel Drake  wrote:

> On 12 November 2010 19:01,   wrote:
> > From: Shanjit Singh Jajmann 
>
> This is not your own work. You shouldn't put your name on it like this.
>

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


[Sugar-devel] [PATCH V3] Copying files multiple times results in bogus names. (SL#2060)

2010-11-12 Thread shanjit
From: Shanjit Singh Jajmann 

For every existing file copied to the location, the names are explicitly 
changed to filename_copynumber.extension e.g. games_1.png, games_2.png, 
games_3.jpg and so on.

---
v1 -> v2. Parenthesis idea removed, i initialised from 1.
v2 -> v3. Line wrapping and .extension added.  
---
 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 81ca7d4..81d1663 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -529,8 +529,8 @@ def _get_file_name(title, mime_type):
 def _get_unique_file_name(mount_point, file_name):
 if os.path.exists(os.path.join(mount_point, file_name)):
 i = 1
+name, extension = os.path.splitext(file_name)
 while len(file_name) <= 255:
-name, extension = os.path.splitext(file_name)
 file_name = name + '_' + str(i) + extension
 if not os.path.exists(os.path.join(mount_point, file_name)):
 break
-- 
1.7.2.2

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


[Sugar-devel] [PATCH V2] Copying files multiple times results in bogus names. (SL#2060)

2010-11-12 Thread shanjit
From: Shanjit Singh Jajmann 

For every existing file copied to the location, the names are explicitly 
changed to filename_copynumber. e.g. games_1.png, games_2.png. games_3.jpg and 
so on.
---
 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 81ca7d4..81d1663 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -529,8 +529,8 @@ def _get_file_name(title, mime_type):
 def _get_unique_file_name(mount_point, file_name):
 if os.path.exists(os.path.join(mount_point, file_name)):
 i = 1
+name, extension = os.path.splitext(file_name)
 while len(file_name) <= 255:
-name, extension = os.path.splitext(file_name)
 file_name = name + '_' + str(i) + extension
 if not os.path.exists(os.path.join(mount_point, file_name)):
 break
-- 
1.7.2.2

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


Re: [Sugar-devel] [Dextrose] [PATCH] Copying files multiple times results in bogus names. (SL#2060)

2010-11-12 Thread Shanjit Singh Jajmann
Hi all,

Firstly, I thank you all for having a look at the patch.

What i was trying to do was change the file names to
file_name(copy_number_of_the_file, starting with 2).
i had done so because of an earlier conversation with Aleksay and Sascha.

My most recent conversation with Aleksay has made me aware of the impact of
my changes and thus i would be incorporating the changes suggested above.


Thanks again.

Regards
Shan



On Thu, Nov 11, 2010 at 3:46 PM, Martin Dengler wrote:

> On Wed, Nov 10, 2010 at 05:57:18PM -0300, Gonzalo Odiard wrote:
> > Mhh, is sufficient with doing the split out of the while
>
> looks good
>
> > Gonzalo
>
> Martin
>
>
> ___
> 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


[Sugar-devel] [PATCH] Copying files multiple times results in bogus names. (SL#2060)

2010-11-10 Thread shanjit
From: Shanjit Singh Jajmann 

For every existing file copied to the location, the names are explicitly 
changed to filename(copynumber). e.g. games.png, games(2).png. games(3).jpg and 
so on.
---
 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 81ca7d4..f944a63 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -528,10 +528,10 @@ def _get_file_name(title, mime_type):
 
 def _get_unique_file_name(mount_point, file_name):
 if os.path.exists(os.path.join(mount_point, file_name)):
-i = 1
+i = 2
+name, extension = os.path.splitext(file_name)
 while len(file_name) <= 255:
-name, extension = os.path.splitext(file_name)
-file_name = name + '_' + str(i) + extension
+file_name = name + '(' + str(i) + ')' + extension
 if not os.path.exists(os.path.join(mount_point, file_name)):
 break
 i += 1
-- 
1.7.2.2

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


[Sugar-devel] SL. #2060 : Copying files multiple times results in bogus names.

2010-11-10 Thread Shanjit Singh Jajmann
Hello Team,

I am working on the Issue SL# 2060. It proposes to change the naming feature
of files having the same name.

I invite everyone to look at the approach used, and provide feedback on both
the approach and the implementation.

A separate patch will also be put up shortly.

Regards
Shanjit Singh Jajmann

1.
http://wiki.sugarlabs.org/go/Copying_files_multiple_times_results_in_bogus_names
2. http://bugs.sugarlabs.org/ticket/2060
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] SL. #2060 : Copying files multiple times results in bogus names.

2010-11-10 Thread Shanjit Singh Jajmann
On Wed, Nov 10, 2010 at 5:20 PM, Shanjit Singh Jajmann wrote:

> Hello Team,
>
> I am working on the Issue SL# 2060. It proposes to change the naming
> feature of files having the same name.
>

It changes the naming feature of the files (existing with the same name)
when copied to the volume.
Sorry for the error.
-Shan

>
> I invite everyone to look at the approach used, and provide feedback on
> both the approach and the implementation.
>
> A separate patch will also be put up shortly.
>
> Regards
> Shanjit Singh Jajmann
>
> 1.
> http://wiki.sugarlabs.org/go/Copying_files_multiple_times_results_in_bogus_names
> 2. http://bugs.sugarlabs.org/ticket/2060
>
>
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v8] Downgrading activities not allowed. (SL #2164)

2010-10-25 Thread shanjit
From: Shanjit Singh Jajmann , Anubhav Aggarwal 


Activity can be downgraded on the availability of an older .xo version of an
activity. An alert pops up when trying to install an older .xo file of an
activity, which asks the user to make a selection on whether to move to an
older activity version or not.

Co-authored-by: Shanjit Singh Jajmann 
Co-authored-by: Anubhav Aggarwal 
---

v1 -> v2. Inline function used, signal emission condition revised and global
variables removed. Recommendations by James Cameron and Aleksey Lim added.

v2 -> v3. Used misc.resume.

v3 -> v4. Changes in the copyright of the new file.

v4 -> v5. Alert shown in the same window as the journal.

v5 -> v6. Static variable removed, name of the functions changed.
Recommendations by James Cameron and Aleksey Lim added.

v6 -> v7. Logic for the alert pop up made simpler.
Recommendations by Aleksay Lim added.

v7 -> v8. Missing file added.
---
 src/jarabe/journal/journalactivity.py |5 ++-
 src/jarabe/journal/journalwindow.py   |   34 +++
 src/jarabe/journal/misc.py|   47 ++--
 src/jarabe/model/bundleregistry.py|7 +++-
 4 files changed, 80 insertions(+), 13 deletions(-)
 create mode 100644 src/jarabe/journal/journalwindow.py

diff --git a/src/jarabe/journal/journalactivity.py 
b/src/jarabe/journal/journalactivity.py
index 44cc018..beb0962 100644
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -44,6 +44,7 @@ from jarabe.journal.journalentrybundle import 
JournalEntryBundle
 from jarabe.journal.objectchooser import ObjectChooser
 from jarabe.journal.modalalert import ModalAlert
 from jarabe.journal import model
+from jarabe.journal.journalwindow import JournalWindow
 
 J_DBUS_SERVICE = 'org.laptop.Journal'
 J_DBUS_INTERFACE = 'org.laptop.Journal'
@@ -102,10 +103,10 @@ class JournalActivityDBusService(dbus.service.Object):
 def ObjectChooserCancelled(self, chooser_id):
 pass
 
-class JournalActivity(Window):
+class JournalActivity(JournalWindow):
 def __init__(self):
 logging.debug("STARTUP: Loading the journal")
-Window.__init__(self)
+JournalWindow.__init__(self)
 
 self.set_title(_('Journal'))
 
diff --git a/src/jarabe/journal/journalwindow.py 
b/src/jarabe/journal/journalwindow.py
new file mode 100644
index 000..3c718c2
--- /dev/null
+++ b/src/jarabe/journal/journalwindow.py
@@ -0,0 +1,34 @@
+#Copyright (C) 2010 Software for Education, Entertainment and Training
+#Activities
+#
+# 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  USA
+
+import gtk
+from sugar.graphics.window import Window
+
+_journal_window = None
+
+
+class JournalWindow(Window):
+
+def __init__(self):
+
+global _journal_window
+Window.__init__(self)
+_journal_window = self
+
+
+def get_journal_window():
+return _journal_window
diff --git a/src/jarabe/journal/misc.py b/src/jarabe/journal/misc.py
index 32a2847..122feca 100644
--- a/src/jarabe/journal/misc.py
+++ b/src/jarabe/journal/misc.py
@@ -27,8 +27,10 @@ from sugar.activity import activityfactory
 from sugar.activity.activityhandle import ActivityHandle
 from sugar.graphics.icon import get_icon_file_name
 from sugar.graphics.xocolor import XoColor
+from sugar.graphics.alert import ConfirmationAlert
 from sugar import mime
 from sugar.bundle.activitybundle import ActivityBundle
+from sugar.bundle.bundle import AlreadyInstalledException
 from sugar.bundle.contentbundle import ContentBundle
 from sugar import util
 
@@ -36,6 +38,7 @@ from jarabe.view import launcher
 from jarabe.model import bundleregistry, shell
 from jarabe.journal.journalentrybundle import JournalEntryBundle
 from jarabe.journal import model
+from jarabe.journal import journalwindow
 
 def _get_icon_for_mime(mime_type):
 generic_types = mime.get_all_generic_types()
@@ -159,19 +162,16 @@ def resume(metadata, bundle_id=None):
 bundle = ActivityBundle(file_path)
 if not registry.is_installed(bundle):
 logging.debug('Installing activity bundle')
-registry.install(bundle)
+try:
+registry.install(bundle)
+except AlreadyInstalledException:
+  

[Sugar-devel] [PATCH v7] Downgrading activities not allowed. (SL #2164)

2010-10-24 Thread shanjit
From: Shanjit Singh Jajmann 

Activity can be downgraded on the availability of an older .xo version of an
activity. An alert pops up when trying to install an older .xo file of an
activity, which asks the user to make a selection on whether to move to an
older activity version or not.

Co-authored-by: Shanjit Singh Jajmann 
Anubhav Aggarwal 
---

v1 -> v2. Inline function used, signal emission condition revised and global
variables removed. Recommendations by James Cameron and Aleksey Lim added.

v2 -> v3. Used misc.resume.

v3 -> v4. Changes in the copyright of the new file.

v4 -> v5. Alert shown in the same window as the journal.

v5 -> v6. Static variable removed, name of the functions changed.
Recommendations by James Cameron and Aleksey Lim added.

v6 -> v7. Logic for the alert pop up made simpler.
Recommendations by Aleksay Lim added.
---
 src/jarabe/journal/journalactivity.py |5 ++-
 src/jarabe/journal/misc.py|   47 ++--
 src/jarabe/model/bundleregistry.py|7 +++-
 3 files changed, 46 insertions(+), 13 deletions(-)

diff --git a/src/jarabe/journal/journalactivity.py 
b/src/jarabe/journal/journalactivity.py
index 44cc018..beb0962 100644
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -44,6 +44,7 @@ from jarabe.journal.journalentrybundle import 
JournalEntryBundle
 from jarabe.journal.objectchooser import ObjectChooser
 from jarabe.journal.modalalert import ModalAlert
 from jarabe.journal import model
+from jarabe.journal.journalwindow import JournalWindow
 
 J_DBUS_SERVICE = 'org.laptop.Journal'
 J_DBUS_INTERFACE = 'org.laptop.Journal'
@@ -102,10 +103,10 @@ class JournalActivityDBusService(dbus.service.Object):
 def ObjectChooserCancelled(self, chooser_id):
 pass
 
-class JournalActivity(Window):
+class JournalActivity(JournalWindow):
 def __init__(self):
 logging.debug("STARTUP: Loading the journal")
-Window.__init__(self)
+JournalWindow.__init__(self)
 
 self.set_title(_('Journal'))
 
diff --git a/src/jarabe/journal/misc.py b/src/jarabe/journal/misc.py
index 32a2847..1d73fa8 100644
--- a/src/jarabe/journal/misc.py
+++ b/src/jarabe/journal/misc.py
@@ -27,8 +27,10 @@ from sugar.activity import activityfactory
 from sugar.activity.activityhandle import ActivityHandle
 from sugar.graphics.icon import get_icon_file_name
 from sugar.graphics.xocolor import XoColor
+from sugar.graphics.alert import ConfirmationAlert
 from sugar import mime
 from sugar.bundle.activitybundle import ActivityBundle
+from sugar.bundle.bundle import AlreadyInstalledException
 from sugar.bundle.contentbundle import ContentBundle
 from sugar import util
 
@@ -36,6 +38,7 @@ from jarabe.view import launcher
 from jarabe.model import bundleregistry, shell
 from jarabe.journal.journalentrybundle import JournalEntryBundle
 from jarabe.journal import model
+from jarabe.journal import journalwindow
 
 def _get_icon_for_mime(mime_type):
 generic_types = mime.get_all_generic_types()
@@ -159,19 +162,16 @@ def resume(metadata, bundle_id=None):
 bundle = ActivityBundle(file_path)
 if not registry.is_installed(bundle):
 logging.debug('Installing activity bundle')
-registry.install(bundle)
+try:
+registry.install(bundle)
+except AlreadyInstalledException:
+_downgrade_option_alert(bundle)
+return
 else:
 logging.debug('Upgrading activity bundle')
 registry.upgrade(bundle)
 
-logging.debug('activityfactory.creating bundle with id %r',
-bundle.get_bundle_id())
-installed_bundle = registry.get_bundle(bundle.get_bundle_id())
-if installed_bundle:
-launch(installed_bundle)
-else:
-logging.error('Bundle %r is not installed.',
-  bundle.get_bundle_id())
+_install_bundle(bundle)
 
 elif is_content_bundle(metadata) and bundle_id is None:
 
@@ -215,6 +215,17 @@ def resume(metadata, bundle_id=None):
 launch(bundle, activity_id=activity_id, object_id=object_id,
 color=get_icon_color(metadata))
 
+def _install_bundle(bundle):
+registry = bundleregistry.get_registry()
+logging.debug('activityfactory.creating bundle with id %r',
+   bundle.get_bundle_id())
+installed_bundle = registry.get_bundle(bundle.get_bundle_id())
+if installed_bundle:
+   launch(installed_bundle)
+else:
+logging.error('Bundle %r is not installed.',
+bundle.get_bundle_id())
+
 def launch(bundle, activity_id=None, object_id=None, uri=None, color=None,
invited=False):
 if activity_id is None or not activity_id:
@@ -239,6 +250,24 @@ def laun

Re: [Sugar-devel] [PATCH v3] Reduction in the time taken for loading of the menu (SL#1169)

2010-10-21 Thread Shanjit Singh Jajmann
Sascha,


By mistake, i may have added a new thread.

Request you to kindly ignore that. Do consider the patch in this thread
only.


Thanks

Warm Regards
Shanjit Singh Jajmann
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v3] Reduction in the time taken for loading of the menu (SL#1169)

2010-10-21 Thread shanjit
From: Shanjit Singh Jajmann 

Reduction in the lead time for loading the drop down menus. Changes made in 
the time delay for rendering of the secondary palette to improve human 
computer interaction and experience.

Co-authored-by: Frederick Grose 
Reviewed-by: Bernie Innocenti 
---

v1 -> v2 : Since the time 0.0, was too short for comfortable viewing,
arguments have been modified suitably to bring in a smooth pop-up and pop-down
feature. Suggestions taken from SL#2367.

v2 -> v3 : Position of changelog changed and text wrapping done.

 src/sugar/graphics/palette.py   |2 +-
 src/sugar/graphics/palettewindow.py |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sugar/graphics/palette.py b/src/sugar/graphics/palette.py
index d4f844c..5be8304 100644
--- a/src/sugar/graphics/palette.py
+++ b/src/sugar/graphics/palette.py
@@ -103,7 +103,7 @@ class Palette(PaletteWindow):
 
 self._menu_content_separator = gtk.HSeparator()
 
-self._secondary_anim = animator.Animator(2.0, 10)
+self._secondary_anim = animator.Animator(1.0, 10)
 self._secondary_anim.add(_SecondaryAnimation(self))
 
 # we init after initializing all of our containers
diff --git a/src/sugar/graphics/palettewindow.py 
b/src/sugar/graphics/palettewindow.py
index f51c938..4f19e0d 100644
--- a/src/sugar/graphics/palettewindow.py
+++ b/src/sugar/graphics/palettewindow.py
@@ -148,7 +148,7 @@ class PaletteWindow(gtk.Window):
 self._up = False
 self._old_alloc = None
 
-self._popup_anim = animator.Animator(.5, 10)
+self._popup_anim = animator.Animator(0.0, 10)
 self._popup_anim.add(_PopupAnimation(self))
 
 self._popdown_anim = animator.Animator(0.6, 10)
-- 
1.7.2.2

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


Re: [Sugar-devel] [PATCH v2] Reduction in the time taken for loading of the menu (SL#1169)

2010-10-21 Thread Shanjit Singh Jajmann
Sascha,


Thanks for your time and the review of the patch.

I will keep the the pointers in mind next time onwards.

The revised patch has been put up.


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


[Sugar-devel] [PATCH v3] Reduction in the time taken for loading of the menu (SL#1169)

2010-10-21 Thread shanjit
From: Shanjit Singh Jajmann 

Reduction in the lead time for loading the drop down menus. Changes made in 
the time delay for rendering of the secondary palette to improve human 
computer interaction and experience.

Co-authored-by: Frederick Grose 
Reviewed-by: Bernie Innocenti 
---

v1 -> v2 : Since the time 0.0, was too short for comfortable viewing,
arguments have been modified suitably to bring in a smooth pop-up and pop-down
feature. Suggestions taken from SL#2367.

v2 -> v3 : Position of changelog changed and text wrapping done.

 src/sugar/graphics/palette.py   |2 +-
 src/sugar/graphics/palettewindow.py |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sugar/graphics/palette.py b/src/sugar/graphics/palette.py
index d4f844c..5be8304 100644
--- a/src/sugar/graphics/palette.py
+++ b/src/sugar/graphics/palette.py
@@ -103,7 +103,7 @@ class Palette(PaletteWindow):
 
 self._menu_content_separator = gtk.HSeparator()
 
-self._secondary_anim = animator.Animator(2.0, 10)
+self._secondary_anim = animator.Animator(1.0, 10)
 self._secondary_anim.add(_SecondaryAnimation(self))
 
 # we init after initializing all of our containers
diff --git a/src/sugar/graphics/palettewindow.py 
b/src/sugar/graphics/palettewindow.py
index f51c938..4f19e0d 100644
--- a/src/sugar/graphics/palettewindow.py
+++ b/src/sugar/graphics/palettewindow.py
@@ -148,7 +148,7 @@ class PaletteWindow(gtk.Window):
 self._up = False
 self._old_alloc = None
 
-self._popup_anim = animator.Animator(.5, 10)
+self._popup_anim = animator.Animator(0.0, 10)
 self._popup_anim.add(_PopupAnimation(self))
 
 self._popdown_anim = animator.Animator(0.6, 10)
-- 
1.7.2.2

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


Re: [Sugar-devel] [Dextrose] [PATCH] Reduction in the time taken for loading of the menu (SL#1169)

2010-10-21 Thread Shanjit Singh Jajmann
Bernie,

Thanks for your time to review the patch.

Glad you could provide pointers.

Thanks.

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


[Sugar-devel] [PATCH v2] Reduction in the time taken for loading of the menu (SL#1169)

2010-10-21 Thread shanjit
From: Shanjit Singh Jajmann 

Reduction in the lead time for loading the drop down menus. Changes made in the 
time delay for rendering of the secondary palette to improve human computer 
interaction and experience.

v1 -> v2 : Since the time 0.0, was too short for comfortable viewing, arguments 
have been modified suitably to bring in a smooth pop-up and pop-down feature. 
Suggestions taken from SL#2367.

Co-authored-by: Frederick Grose 
Reviewed-by: Bernie Innocenti 
---
 src/sugar/graphics/palette.py   |2 +-
 src/sugar/graphics/palettewindow.py |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sugar/graphics/palette.py b/src/sugar/graphics/palette.py
index d4f844c..5be8304 100644
--- a/src/sugar/graphics/palette.py
+++ b/src/sugar/graphics/palette.py
@@ -103,7 +103,7 @@ class Palette(PaletteWindow):
 
 self._menu_content_separator = gtk.HSeparator()
 
-self._secondary_anim = animator.Animator(2.0, 10)
+self._secondary_anim = animator.Animator(1.0, 10)
 self._secondary_anim.add(_SecondaryAnimation(self))
 
 # we init after initializing all of our containers
diff --git a/src/sugar/graphics/palettewindow.py 
b/src/sugar/graphics/palettewindow.py
index f51c938..4f19e0d 100644
--- a/src/sugar/graphics/palettewindow.py
+++ b/src/sugar/graphics/palettewindow.py
@@ -148,7 +148,7 @@ class PaletteWindow(gtk.Window):
 self._up = False
 self._old_alloc = None
 
-self._popup_anim = animator.Animator(.5, 10)
+self._popup_anim = animator.Animator(0.0, 10)
 self._popup_anim.add(_PopupAnimation(self))
 
 self._popdown_anim = animator.Animator(0.6, 10)
-- 
1.7.2.2

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


[Sugar-devel] [PATCH] Reduction in the time taken for loading of the menu (SL#1169)

2010-10-20 Thread shanjit
From: Shanjit Singh Jajmann 

The earlier menu which was slow in loading up, has now been made quicker to 
respond to hovering above it. Changes have been made to palette.py and 
palettewindow.py .

v1 -> v2 : Since the time 0.0, was too short for comfortable viewing, changes 
have been made, to allow sufficient pop up down. Suggestions taken from SL#2367.

Co-Authored by : Frederick 
---
 src/sugar/graphics/palette.py   |2 +-
 src/sugar/graphics/palettewindow.py |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sugar/graphics/palette.py b/src/sugar/graphics/palette.py
index d4f844c..5be8304 100644
--- a/src/sugar/graphics/palette.py
+++ b/src/sugar/graphics/palette.py
@@ -103,7 +103,7 @@ class Palette(PaletteWindow):
 
 self._menu_content_separator = gtk.HSeparator()
 
-self._secondary_anim = animator.Animator(2.0, 10)
+self._secondary_anim = animator.Animator(1.0, 10)
 self._secondary_anim.add(_SecondaryAnimation(self))
 
 # we init after initializing all of our containers
diff --git a/src/sugar/graphics/palettewindow.py 
b/src/sugar/graphics/palettewindow.py
index f51c938..4f19e0d 100644
--- a/src/sugar/graphics/palettewindow.py
+++ b/src/sugar/graphics/palettewindow.py
@@ -148,7 +148,7 @@ class PaletteWindow(gtk.Window):
 self._up = False
 self._old_alloc = None
 
-self._popup_anim = animator.Animator(.5, 10)
+self._popup_anim = animator.Animator(0.0, 10)
 self._popup_anim.add(_PopupAnimation(self))
 
 self._popdown_anim = animator.Animator(0.6, 10)
-- 
1.7.2.2

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


[Sugar-devel] [PATCH] Secondary palette appears too soon on Neighborhood view buddy icons (SL#2367)

2010-10-19 Thread shanjit
From: Shanjit Singh Jajmann 

Changes have been made to the arguments, as suggested in bug report. On 
hovering now, the name appears first. Being on the icon for a slighlty more 
time then shows the secondary palette.

Co-Authored-By: Bernie Innocenti 
Co-Authored-By: Fredrick Grose 
---
 src/sugar/graphics/palette.py   |2 +-
 src/sugar/graphics/palettewindow.py |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sugar/graphics/palette.py b/src/sugar/graphics/palette.py
index d4f844c..5be8304 100644
--- a/src/sugar/graphics/palette.py
+++ b/src/sugar/graphics/palette.py
@@ -103,7 +103,7 @@ class Palette(PaletteWindow):
 
 self._menu_content_separator = gtk.HSeparator()
 
-self._secondary_anim = animator.Animator(2.0, 10)
+self._secondary_anim = animator.Animator(1.0, 10)
 self._secondary_anim.add(_SecondaryAnimation(self))
 
 # we init after initializing all of our containers
diff --git a/src/sugar/graphics/palettewindow.py 
b/src/sugar/graphics/palettewindow.py
index f51c938..4f19e0d 100644
--- a/src/sugar/graphics/palettewindow.py
+++ b/src/sugar/graphics/palettewindow.py
@@ -148,7 +148,7 @@ class PaletteWindow(gtk.Window):
 self._up = False
 self._old_alloc = None
 
-self._popup_anim = animator.Animator(.5, 10)
+self._popup_anim = animator.Animator(0.0, 10)
 self._popup_anim.add(_PopupAnimation(self))
 
 self._popdown_anim = animator.Animator(0.6, 10)
-- 
1.7.2.2

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


[Sugar-devel] [PATCH v3] Downgrading activities not allowed. (SL#2164)

2010-10-16 Thread shanjit
Downgrading an activity is now made possible. When a .xo file of a version 
older than the currently installed version is clicked, a downgrading option is 
made available, by popping up of a confirmation alert. Depending upton the 
choice selected you can downgrade the activity.

v1 -> v2. Named according to the nomenclature suggested,inline function 
used,signal emission condition revised,global variables removed.

v2 -> v3. Taking care of all calling of misc.resume.
Signed-off-by: Shanjit Singh Jajmann , Anubhav Aggarwal 

---
 src/jarabe/journal/misc.py |   29 +---
 src/jarabe/journal/versionalert.py |  121 
 src/jarabe/model/bundleregistry.py |9 ++-
 3 files changed, 145 insertions(+), 14 deletions(-)
 create mode 100644 src/jarabe/journal/versionalert.py

diff --git a/src/jarabe/journal/misc.py b/src/jarabe/journal/misc.py
index 32a2847..99ea2d4 100644
--- a/src/jarabe/journal/misc.py
+++ b/src/jarabe/journal/misc.py
@@ -30,6 +30,7 @@ from sugar.graphics.xocolor import XoColor
 from sugar import mime
 from sugar.bundle.activitybundle import ActivityBundle
 from sugar.bundle.contentbundle import ContentBundle
+from sugar.bundle.bundle import AlreadyInstalledException
 from sugar import util
 
 from jarabe.view import launcher
@@ -150,6 +151,7 @@ def get_activities(metadata):
 
 def resume(metadata, bundle_id=None):
 registry = bundleregistry.get_registry()
+version_downgrade = False
 
 if is_activity_bundle(metadata) and bundle_id is None:
 
@@ -159,20 +161,25 @@ def resume(metadata, bundle_id=None):
 bundle = ActivityBundle(file_path)
 if not registry.is_installed(bundle):
 logging.debug('Installing activity bundle')
-registry.install(bundle)
+try:
+registry.install(bundle)
+except AlreadyInstalledException:
+v_alert = VersionAlert()
+v_alert.give_bundle(bundle)
+version_downgrade= True
 else:
 logging.debug('Upgrading activity bundle')
 registry.upgrade(bundle)
-
-logging.debug('activityfactory.creating bundle with id %r',
-bundle.get_bundle_id())
-installed_bundle = registry.get_bundle(bundle.get_bundle_id())
-if installed_bundle:
-launch(installed_bundle)
-else:
-logging.error('Bundle %r is not installed.',
-  bundle.get_bundle_id())
-
+if not version_downgrade:
+logging.debug('activityfactory.creating bundle with id %r',
+bundle.get_bundle_id())
+installed_bundle = registry.get_bundle(bundle.get_bundle_id())
+if installed_bundle:
+launch(installed_bundle)
+else:
+logging.error('Bundle %r is not installed.',
+  bundle.get_bundle_id())
+ 
 elif is_content_bundle(metadata) and bundle_id is None:
 
 logging.debug('Creating content bundle')
diff --git a/src/jarabe/journal/versionalert.py 
b/src/jarabe/journal/versionalert.py
new file mode 100644
index 000..2f27a2f
--- /dev/null
+++ b/src/jarabe/journal/versionalert.py
@@ -0,0 +1,121 @@
+
+# Copyright (C) 2008 One Laptop Per Child
+#
+# 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  USA
+
+import gtk
+from gettext import gettext as _
+
+from sugar.graphics import style
+from jarabe.model import bundleregistry
+from sugar.activity import activityfactory
+
+class VersionAlert(gtk.Window):
+
+def __init__(self):
+gtk.Window.__init__(self)
+
+self.set_border_width(style.LINE_WIDTH)
+offset = style.GRID_CELL_SIZE
+width = gtk.gdk.screen_width() - offset * 3
+height = gtk.gdk.screen_height() - offset * 8.5
+self.set_size_request(width, height)
+self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
+self.set_decorated(gtk.WINDOW_TOPLEVEL)
+self.set_resizable(False)
+self.set_modal(False)
+
+self._main_view = gtk.EventBox()
+self._vbox = gtk.VBox()
+self._vbox.set_spacing(style.DEFAULT_SPACING)
+self._vbox.set_border_width(st

[Sugar-devel] [PATCH] Downgrading activities not allowed. (#2164)

2010-10-15 Thread shanjit
Downgrading an activity is now made possible. When a .xo file of a version 
older than the currently installed version is clicked, a downgrading option is 
made available, by popping up of a confirmation alert. Depending upton the 
choice selected you can downgrade the activity.

v1 -> v2. Named according to the nomenclature suggested,inline function 
used,signal emission condition revised,global variables removed.

v2 -> v3. Taking care of all calling of misc.resume.
Signed-off-by: Shanjit Singh Jajmann , Anubhav Aggarwal 

---
 src/jarabe/journal/misc.py |   29 +---
 src/jarabe/journal/versionalert.py |  121 
 src/jarabe/model/bundleregistry.py |9 ++-
 3 files changed, 145 insertions(+), 14 deletions(-)
 create mode 100644 src/jarabe/journal/versionalert.py

diff --git a/src/jarabe/journal/misc.py b/src/jarabe/journal/misc.py
index 32a2847..99ea2d4 100644
--- a/src/jarabe/journal/misc.py
+++ b/src/jarabe/journal/misc.py
@@ -30,6 +30,7 @@ from sugar.graphics.xocolor import XoColor
 from sugar import mime
 from sugar.bundle.activitybundle import ActivityBundle
 from sugar.bundle.contentbundle import ContentBundle
+from sugar.bundle.bundle import AlreadyInstalledException
 from sugar import util
 
 from jarabe.view import launcher
@@ -150,6 +151,7 @@ def get_activities(metadata):
 
 def resume(metadata, bundle_id=None):
 registry = bundleregistry.get_registry()
+version_downgrade = False
 
 if is_activity_bundle(metadata) and bundle_id is None:
 
@@ -159,20 +161,25 @@ def resume(metadata, bundle_id=None):
 bundle = ActivityBundle(file_path)
 if not registry.is_installed(bundle):
 logging.debug('Installing activity bundle')
-registry.install(bundle)
+try:
+registry.install(bundle)
+except AlreadyInstalledException:
+v_alert = VersionAlert()
+v_alert.give_bundle(bundle)
+version_downgrade= True
 else:
 logging.debug('Upgrading activity bundle')
 registry.upgrade(bundle)
-
-logging.debug('activityfactory.creating bundle with id %r',
-bundle.get_bundle_id())
-installed_bundle = registry.get_bundle(bundle.get_bundle_id())
-if installed_bundle:
-launch(installed_bundle)
-else:
-logging.error('Bundle %r is not installed.',
-  bundle.get_bundle_id())
-
+if not version_downgrade:
+logging.debug('activityfactory.creating bundle with id %r',
+bundle.get_bundle_id())
+installed_bundle = registry.get_bundle(bundle.get_bundle_id())
+if installed_bundle:
+launch(installed_bundle)
+else:
+logging.error('Bundle %r is not installed.',
+  bundle.get_bundle_id())
+ 
 elif is_content_bundle(metadata) and bundle_id is None:
 
 logging.debug('Creating content bundle')
diff --git a/src/jarabe/journal/versionalert.py 
b/src/jarabe/journal/versionalert.py
new file mode 100644
index 000..2f27a2f
--- /dev/null
+++ b/src/jarabe/journal/versionalert.py
@@ -0,0 +1,121 @@
+
+# Copyright (C) 2008 One Laptop Per Child
+#
+# 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  USA
+
+import gtk
+from gettext import gettext as _
+
+from sugar.graphics import style
+from jarabe.model import bundleregistry
+from sugar.activity import activityfactory
+
+class VersionAlert(gtk.Window):
+
+def __init__(self):
+gtk.Window.__init__(self)
+
+self.set_border_width(style.LINE_WIDTH)
+offset = style.GRID_CELL_SIZE
+width = gtk.gdk.screen_width() - offset * 3
+height = gtk.gdk.screen_height() - offset * 8.5
+self.set_size_request(width, height)
+self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
+self.set_decorated(gtk.WINDOW_TOPLEVEL)
+self.set_resizable(False)
+self.set_modal(False)
+
+self._main_view = gtk.EventBox()
+self._vbox = gtk.VBox()
+self._vbox.set_spacing(style.DEFAULT_SPACING)
+self._vbox.set_border_width(st

[Sugar-devel] [PATCH] Downgrading activities not allowed. (#2164)

2010-10-13 Thread shanjit
Downgrading an activity is now made possible. When a .xo file of a version 
older than the currently installed version is clicked, a downgrading option is 
made available, by popping up of a confirmation alert. Depending upton the 
choice selected you can downgrade the activity.

v1 -> v2. Named according to the nomenclature suggested,inline function 
used,signal emission condition revised,global variables removed.

Signed-off-by: Shanjit Singh Jajmann , Anubhav Aggarwal 

---
 src/jarabe/journal/journalactivity.py |   15 +++
 src/jarabe/journal/listview.py|   22 ++
 src/jarabe/journal/misc.py|8 +---
 src/jarabe/model/bundleregistry.py|   11 ++-
 4 files changed, 44 insertions(+), 12 deletions(-)

diff --git a/src/jarabe/journal/journalactivity.py 
b/src/jarabe/journal/journalactivity.py
index 44cc018..d0af20a 100644
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -28,6 +28,7 @@ import os
 
 from sugar.graphics.window import Window
 from sugar.graphics.alert import ErrorAlert
+from sugar.graphics.alert import ConfirmationAlert
 
 from sugar.bundle.bundle import ZipExtractException, RegistrationException
 from sugar import env
@@ -166,6 +167,7 @@ class JournalActivity(Window):
 self._list_view = ListView()
 self._list_view.connect('detail-clicked', self.__detail_clicked_cb)
 self._list_view.connect('clear-clicked', self.__clear_clicked_cb)
+self._list_view.connect('older-version-clicked', 
self.__older_version_clicked_cb)
 self._main_view.pack_start(self._list_view)
 self._list_view.show()
 
@@ -204,6 +206,19 @@ class JournalActivity(Window):
 
 def __go_back_clicked_cb(self, detail_view):
 self.show_main_view()
+def __older_version_clicked_cb(self,a):
+alert1=ConfirmationAlert()
+alert1.props.title = _('Newer Version Found')
+alert1.props.msg = _('Newer version of the chosen activity is 
available do you still want to continue with the installation?  
If Yes click Ok and 
the activity icon of the older .xo file in the Journal')
+alert1.connect('response',self.__downgrade_alert_response_cb)
+self.add_alert(alert1)
+alert1.show()
+def __downgrade_alert_response_cb(self, alert1, response_id):
+if response_id is gtk.RESPONSE_OK:
+self.remove_alert(alert1)
+self._list_view.downgrade_confirmation()
+elif response_id is gtk.RESPONSE_CANCEL:
+self.remove_alert(alert1)
 
 def _query_changed_cb(self, toolbar, query):
 self._list_view.update_with_query(query)
diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py
index 3d6281a..653f400 100644
--- a/src/jarabe/journal/listview.py
+++ b/src/jarabe/journal/listview.py
@@ -27,6 +27,7 @@ import pango
 from sugar.graphics import style
 from sugar.graphics.icon import CanvasIcon, Icon, CellRendererIcon
 from sugar.graphics.xocolor import XoColor
+from sugar.bundle.bundle import AlreadyInstalledException
 from sugar import util
 
 from jarabe.journal.listmodel import ListModel
@@ -466,12 +467,17 @@ class ListView(BaseListView):
 __gsignals__ = {
 'detail-clicked': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
-   ([object]))
+   ([object])),
+'older-version-clicked': (gobject.SIGNAL_RUN_FIRST,
+  gobject.TYPE_NONE,
+  ([]))
 }
+
 
 def __init__(self):
 BaseListView.__init__(self)
 self._is_dragging = False
+self.downgrade = False
 
 self.tree_view.connect('drag-begin', self.__drag_begin_cb)
 self.tree_view.connect('button-release-event',
@@ -522,12 +528,20 @@ class ListView(BaseListView):
 
 def __detail_clicked_cb(self, cell, uid):
 self.emit('detail-clicked', uid)
-
+def downgrade_confirmation(self):
+self.downgrade = True
 def __icon_clicked_cb(self, cell, path):
 row = self.tree_view.get_model()[path]
 metadata = model.get(row[ListModel.COLUMN_UID])
-misc.resume(metadata)
-
+if not self.downgrade:
+try:
+misc.resume(metadata)
+except AlreadyInstalledException :
+self.emit('older-version-clicked')
+if self.downgrade:
+self.downgrade = False
+misc.resume(metadata,forcing_downgrade=True)
+ 
 def __cell_title_edited_cb(self, cell, path, new_text):
 row = self._model[path]
 metadata = model.get(row[ListModel.COLUMN_UID])
diff --git a/src/jarabe/journal/misc.py b/src/jarabe/journal/misc

[Sugar-devel] [Design]: Issue SL 2164 (Downgrading activities not allowed)

2010-10-11 Thread Shanjit Singh Jajmann
Team,

I am currently working on issue #2164 (
http://bugs.sugarlabs.org/ticket/2164 ) . Send my revised patch for review a
few minutes ago. Wish to thank Aleksey for his feedback and reviews.

In reference to Aleksey's comment on my patch yesterday -

>What about less invasive implementation, ie, instead of changing three
>files, it could be only popping up an alert in AlreadyInstalledException
>try..except block, misc.py is a part of Journal and raising an alert
>from it, sounds reasonable.

We have arrived at two approaches towards enabling this feature -

1. Instead of calling misc.resume in Listview  and then emitting the signal
to JournalActivity. Creating JournalActivty.resume , having the exact same
functionality as misc.resume. and calling it from listview.py and
implementing alertbox from there. We would then not be calling
misc.resume in Listview  and emitting the signal to JournalActivity, which
happens at this juncture in the code.

2. Replacing misc.resume to JournalActivity.resume everywhere, where ever
called.( in all files). Appropriate importing of methods and files will be
required to do this.

Wish if you could share your recommendations on the above two approaches -

Appreciate your support and feedback.

Thanks

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


[Sugar-devel] [PATCH] Downgrading activities not allowed. (#2164)

2010-10-11 Thread shanjit
From: Shanjit Singh Jajmann 

Downgrading an activity is now made possible. When a .xo file of a version 
older than the currently installed version is clicked, a downgrading option is 
made available, by popping up of a confirmation alert. Depending upton the 
choice selected you can downgrade the activity.
---
 src/jarabe/journal/journalactivity.py |   31 +++--
 src/jarabe/journal/listview.py|   7 ++-
 src/jarabe/journal/misc.py|   56 -
 src/jarabe/model/bundleregistry.py|   18 +++---
 4 files changed, 91 insertions(+), 26 deletions(-)
 mode change 100644 => 100755 src/jarabe/journal/journalactivity.py
 mode change 100644 => 100755 src/jarabe/journal/misc.py
 mode change 100644 => 100755 src/jarabe/model/bundleregistry.py

diff --git a/src/jarabe/journal/journalactivity.py 
b/src/jarabe/journal/journalactivity.py
old mode 100644
new mode 100755
index 44cc018..5f9d708
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -28,6 +28,7 @@ import os
 
 from sugar.graphics.window import Window
 from sugar.graphics.alert import ErrorAlert
+from sugar.graphics.alert import ConfirmationAlert
 
 from sugar.bundle.bundle import ZipExtractException, RegistrationException
 from sugar import env
@@ -128,7 +129,7 @@ class JournalActivity(Window):
 self.connect('window-state-event', self.__window_state_event_cb)
 self.connect('key-press-event', self._key_press_event_cb)
 self.connect('focus-in-event', self._focus_in_event_cb)
-
+
 model.created.connect(self.__model_created_cb)
 model.updated.connect(self.__model_updated_cb)
 model.deleted.connect(self.__model_deleted_cb)
@@ -136,7 +137,6 @@ class JournalActivity(Window):
 self._dbus_service = JournalActivityDBusService(self)
 
 self.iconify()
-
 self._critical_space_alert = None
 self._check_available_space()
 
@@ -145,7 +145,30 @@ class JournalActivity(Window):
 alert.connect('response', self.__alert_response_cb)
 self.add_alert(alert)
 alert.show()
-
+
+def __activity_alert1_cb(self):
+   if misc.check_previous_install() == 1 and misc.return_checked()==0:
+ alert1 = ConfirmationAlert()
+ logging.debug('value of misc is %d', 
misc.check_previous_install())
+ alert1.props.title=_('Previous Version Found')
+ alert1.props.msg = _('A previous version of an installed activity 
was found. Are you sure you want to continue with installation ?
  If Yes click Ok and the 
activity icon of the older .xo file in the Journal')
+ alert1.connect('response', self.__alert1_response_cb)
+ self.add_alert(alert1)
+ alert1.show()
+
+def __alert1_response_cb(self, alert1, response_id):
+if response_id is gtk.RESPONSE_OK:
+logging.debug('value of checked initial %d', misc.return_checked())
+logging.debug('Installing previous version')
+self.remove_alert(alert1)
+misc.checked = 1
+logging.debug('value of checked final %d', misc.return_checked())
+
+elif response_id is gtk.RESPONSE_CANCEL:
+logging.debug('Cancelled by user')
+self.remove_alert(alert1)
+
 def __alert_response_cb(self, alert, response_id):
 self.remove_alert(alert)
 
@@ -166,6 +189,8 @@ class JournalActivity(Window):
 self._list_view = ListView()
 self._list_view.connect('detail-clicked', self.__detail_clicked_cb)
 self._list_view.connect('clear-clicked', self.__clear_clicked_cb)
+self._list_view.connect('icon-clicked', self.__icon_clicked_cb)
+logging.debug('icon clicked in main')
 self._main_view.pack_start(self._list_view)
 self._list_view.show()
 
@@ -195,7 +220,11 @@ class JournalActivity(Window):
 keyname = gtk.gdk.keyval_name(event.keyval)
 if keyname == 'Escape':
 self.show_main_view()
-
+
+def __icon_clicked_cb(self):
+   logging.debug('value of misc is %d', 
misc.check_previous_install())
+   self.__activity_alert1_cb()
+   
 def __detail_clicked_cb(self, list_view, object_id):
 self._show_secondary_view(object_id)
 
diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py
index 3d6281a..4e59ed3 100644
--- a/src/jarabe/journal/listview.py
+++ b/src/jarabe/journal/listview.py
@@ -466,8 +466,12 @@ class ListView(BaseListView):
 __gsignals__ = {
 'detail-clicked': (gobje

[Sugar-devel] [PATCH] Downgrading activities not allowed. (#2164)

2010-10-07 Thread shanjit
From: Shanjit Singh Jajmann , Anubhav Aggarwal 


Downgrading an activity is now made possible. When a .xo file of a version 
older than the currently installed version is clicked, a downgrading option is 
made available, by popping up of a confirmation alert. Depending upton the 
choice selected you can downgrade the activity.
---
 src/jarabe/journal/journalactivity.py |   36 +++--
 src/jarabe/journal/listview.py|7 +++-
 src/jarabe/journal/misc.py|   56 -
 src/jarabe/model/bundleregistry.py|   18 +++---
 4 files changed, 91 insertions(+), 26 deletions(-)
 mode change 100644 => 100755 src/jarabe/journal/misc.py
 mode change 100644 => 100755 src/jarabe/model/bundleregistry.py

diff --git a/src/jarabe/journal/journalactivity.py 
b/src/jarabe/journal/journalactivity.py
index 44cc018..2af55d3 100644
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -28,6 +28,7 @@ import os
 
 from sugar.graphics.window import Window
 from sugar.graphics.alert import ErrorAlert
+from sugar.graphics.alert import ConfirmationAlert
 
 from sugar.bundle.bundle import ZipExtractException, RegistrationException
 from sugar import env
@@ -128,7 +129,7 @@ class JournalActivity(Window):
 self.connect('window-state-event', self.__window_state_event_cb)
 self.connect('key-press-event', self._key_press_event_cb)
 self.connect('focus-in-event', self._focus_in_event_cb)
-
+
 model.created.connect(self.__model_created_cb)
 model.updated.connect(self.__model_updated_cb)
 model.deleted.connect(self.__model_deleted_cb)
@@ -136,7 +137,6 @@ class JournalActivity(Window):
 self._dbus_service = JournalActivityDBusService(self)
 
 self.iconify()
-
 self._critical_space_alert = None
 self._check_available_space()
 
@@ -145,7 +145,29 @@ class JournalActivity(Window):
 alert.connect('response', self.__alert_response_cb)
 self.add_alert(alert)
 alert.show()
-
+
+def __activity_alert1_cb(self):
+   if misc.check_previous_install() == 1 and misc.return_checked()==0:
+ alert1 = ConfirmationAlert()
+ logging.debug('value of misc is %d', 
misc.check_previous_install())
+ alert1.props.title=_('Previous Version Found')
+ alert1.props.msg = _('A previous version of an installed activity 
was found. Are you sure you want to continue with installation ?
  If Yes click Ok and the 
activity icon of the older .xo file in the Journal')
+ alert1.connect('response', self.__alert1_response_cb)
+ self.add_alert(alert1)
+ alert1.show()
+
+def __alert1_response_cb(self, alert1, response_id):
+if response_id is gtk.RESPONSE_OK:
+logging.debug('value of checked initial %d', misc.return_checked())
+logging.debug('Installing previous version')
+self.remove_alert(alert1)
+misc.checked = 1
+logging.debug('value of checked final %d', misc.return_checked())
+
+elif response_id is gtk.RESPONSE_CANCEL:
+logging.debug('Cancelled by user')
+self.remove_alert(alert1)
+
 def __alert_response_cb(self, alert, response_id):
 self.remove_alert(alert)
 
@@ -166,6 +188,8 @@ class JournalActivity(Window):
 self._list_view = ListView()
 self._list_view.connect('detail-clicked', self.__detail_clicked_cb)
 self._list_view.connect('clear-clicked', self.__clear_clicked_cb)
+self._list_view.connect('icon-clicked', self.__icon_clicked_cb)
+logging.debug('icon clicked in main')
 self._main_view.pack_start(self._list_view)
 self._list_view.show()
 
@@ -195,7 +219,11 @@ class JournalActivity(Window):
 keyname = gtk.gdk.keyval_name(event.keyval)
 if keyname == 'Escape':
 self.show_main_view()
-
+
+def __icon_clicked_cb(self,a):
+   logging.debug('value of misc is %d', 
misc.check_previous_install())
+   self.__activity_alert1_cb()
+   
 def __detail_clicked_cb(self, list_view, object_id):
 self._show_secondary_view(object_id)
 
diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py
index 3d6281a..3dbcc2d 100644
--- a/src/jarabe/journal/listview.py
+++ b/src/jarabe/journal/listview.py
@@ -466,8 +466,12 @@ class ListView(BaseListView):
 __gsignals__ = {
 'detail-clicked': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
-   ([object]))
+   

Re: [Sugar-devel] #1169 NORM: Drop down menus give no indication of their existence, also are too slow to load.

2010-10-02 Thread Shanjit Singh Jajmann
Hi,

Appropriate changes have now been made to the issue and the patches have
also been uploaded. Changes have been made as suggested by FGrose in his
comment.

Wish if the patch could be reviewed.


Suggestions are welcome.


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


[Sugar-devel] Unwanted characters in mail to sugar-devel list serv when sending patch.

2010-10-01 Thread Shanjit Singh Jajmann
Hi,

I just made patch for Issue 2324, and forwarded it to the list. A lot of
unwanted characters seem to have crept in, however when i send it to my
inbox, or any other, no such thing happens.

Could some pointers be provided to resolve this problem?


Regards

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


[Sugar-devel] [PATCH] Copy and Paste feature in Abacus Activity (#2324)

2010-10-01 Thread shanjit
From: Shanjit Singh Jajmann 

Values can now be copied to the clipboard. Values can also now be pasted from 
the clipboard to the abacus activity.
---
 AbacusActivity.py |   77 +++
 abacus_window.py  |   62 ++-
 sprites.py|  222 +++--
 3 files changed, 168 insertions(+), 193 deletions(-)

diff --git a/AbacusActivity.py b/AbacusActivity.py
index d14f58a..480e351 100644
--- a/AbacusActivity.py
+++ b/AbacusActivity.py
@@ -38,11 +38,11 @@ import locale
 import logging
 _logger = logging.getLogger("abacus-activity")
 
-from abacus_window import Abacus, Custom, Suanpan, Soroban, Schety,\
+from abacus_window import Abacus,AbacusGeneric , Custom, Suanpan, Soroban, 
Schety,\
   Nepohualtzintzin, Binary, Hex, Decimal, Fractions,\
   Caacupe, Cuisenaire
 
-def _button_factory(icon_name, tooltip, callback, toolbar):
+def _button_factory(icon_name, tooltip, callback, toolbar, accelerator = None):
 """Factory for making toolbar buttons"""
 my_button = ToolButton( icon_name )
 my_button.set_tooltip(tooltip)
@@ -100,7 +100,7 @@ class AbacusActivity(activity.Activity):
 
 _abacus_toolbar = gtk.Toolbar()
 _custom_toolbar = gtk.Toolbar()
-
+edit_toolbar = gtk.Toolbar()
 if _new_sugar_system:
 # Use 0.86 toolbar design
 toolbox = ToolbarBox()
@@ -127,6 +127,14 @@ class AbacusActivity(activity.Activity):
 toolbox.toolbar.insert(_custom_toolbar_button, -1)
 _custom_toolbar_button.show()
 
+edit_toolbar_button = ToolbarButton(label=_('Edit'),
+page=edit_toolbar,
+icon_name='toolbar-edit')
+edit_toolbar_button.show()
+toolbox.toolbar.insert(edit_toolbar_button, -1)
+edit_toolbar_button.show()
+ 
+
 _separator_factory(toolbox.toolbar, True, False)
 
 stop_button = StopButton(self)
@@ -136,6 +144,7 @@ class AbacusActivity(activity.Activity):
 
 self.set_toolbox(toolbox)
 _abacus_toolbar_button.set_expanded(True)
+edit_toolbar_button.set_expanded(True)
 toolbox.show()
 
 else:
@@ -145,7 +154,8 @@ class AbacusActivity(activity.Activity):
 
 toolbox.add_toolbar( _('Project'), _abacus_toolbar )
 toolbox.add_toolbar( _('Custom'), _custom_toolbar )
-
+toolbox.add_toolbar(_('Edit'), edit_toolbar)
+
 self._basic_abacus(_abacus_toolbar)
 
 toolbox.set_current_toolbar(1)
@@ -156,18 +166,19 @@ class AbacusActivity(activity.Activity):
 elif hasattr(toolbox, 'props'):
toolbox.props.visible = False
 
+self.copyme = ' '
 # Add the buttons and spinners to the toolbars
 self.japanese = _button_factory("soroban-off", _('Soroban'),
 self._japanese_cb, _abacus_toolbar)
+self.russian = _button_factory("schety-off", _('Schety'),
+   self._russian_cb, _abacus_toolbar)
 self.mayan = _button_factory("nepohualtzintzin-off",
  _('Nepohualtzintzin'),
  self._mayan_cb, _abacus_toolbar)
-self.hex = _button_factory("hexadecimal-off", _('Hexadecimal'),
-   self._hex_cb, _abacus_toolbar)
 self.binary = _button_factory("binary-off", _('Binary'),
   self._binary_cb, _abacus_toolbar)
-self.russian = _button_factory("schety-off", _('Schety'),
-   self._russian_cb, _abacus_toolbar)
+self.hex = _button_factory("hex-off", _('Hexadecimal'),self._hex_cb, 
+   _abacus_toolbar)
 self.fraction = _button_factory("fraction-off", _('Fraction'),
 self._fraction_cb, _abacus_toolbar)
 self.caacupe = _button_factory("caacupe-off", _('Caacup??'),
@@ -195,6 +206,11 @@ class AbacusActivity(activity.Activity):
 self.custom = _button_factory("new-game", _('Custom'),
   self._custom_cb, _custom_toolbar)
 
+copy = _button_factory('edit-copy',_('Copy'), self._copy_cb,
+  edit_toolbar_button, accelerator='c')
+paste = _button_factory('edit-paste', _('Paste'), self._paste_cb,
+  e

[Sugar-devel] [PATCH] Copy and Paste feature in Abacus Activity (#2324)

2010-10-01 Thread shanjit
From: Shanjit Singh Jajmann 

Values can now be copied to the clipboard. Values can also now be pasted from 
the clipboard to the abacus activity.
---
 AbacusActivity.py |   77 +++
 abacus_window.py  |   62 ++-
 sprites.py|  222 +++--
 3 files changed, 168 insertions(+), 193 deletions(-)

diff --git a/AbacusActivity.py b/AbacusActivity.py
index d14f58a..480e351 100644
--- a/AbacusActivity.py
+++ b/AbacusActivity.py
@@ -38,11 +38,11 @@ import locale
 import logging
 _logger = logging.getLogger("abacus-activity")
 
-from abacus_window import Abacus, Custom, Suanpan, Soroban, Schety,\
+from abacus_window import Abacus,AbacusGeneric , Custom, Suanpan, Soroban, 
Schety,\
   Nepohualtzintzin, Binary, Hex, Decimal, Fractions,\
   Caacupe, Cuisenaire
 
-def _button_factory(icon_name, tooltip, callback, toolbar):
+def _button_factory(icon_name, tooltip, callback, toolbar, accelerator = None):
 """Factory for making toolbar buttons"""
 my_button = ToolButton( icon_name )
 my_button.set_tooltip(tooltip)
@@ -100,7 +100,7 @@ class AbacusActivity(activity.Activity):
 
 _abacus_toolbar = gtk.Toolbar()
 _custom_toolbar = gtk.Toolbar()
-
+edit_toolbar = gtk.Toolbar()
 if _new_sugar_system:
 # Use 0.86 toolbar design
 toolbox = ToolbarBox()
@@ -127,6 +127,14 @@ class AbacusActivity(activity.Activity):
 toolbox.toolbar.insert(_custom_toolbar_button, -1)
 _custom_toolbar_button.show()
 
+edit_toolbar_button = ToolbarButton(label=_('Edit'),
+page=edit_toolbar,
+icon_name='toolbar-edit')
+edit_toolbar_button.show()
+toolbox.toolbar.insert(edit_toolbar_button, -1)
+edit_toolbar_button.show()
+ 
+
 _separator_factory(toolbox.toolbar, True, False)
 
 stop_button = StopButton(self)
@@ -136,6 +144,7 @@ class AbacusActivity(activity.Activity):
 
 self.set_toolbox(toolbox)
 _abacus_toolbar_button.set_expanded(True)
+edit_toolbar_button.set_expanded(True)
 toolbox.show()
 
 else:
@@ -145,7 +154,8 @@ class AbacusActivity(activity.Activity):
 
 toolbox.add_toolbar( _('Project'), _abacus_toolbar )
 toolbox.add_toolbar( _('Custom'), _custom_toolbar )
-
+toolbox.add_toolbar(_('Edit'), edit_toolbar)
+
 self._basic_abacus(_abacus_toolbar)
 
 toolbox.set_current_toolbar(1)
@@ -156,18 +166,19 @@ class AbacusActivity(activity.Activity):
 elif hasattr(toolbox, 'props'):
toolbox.props.visible = False
 
+self.copyme = ' '
 # Add the buttons and spinners to the toolbars
 self.japanese = _button_factory("soroban-off", _('Soroban'),
 self._japanese_cb, _abacus_toolbar)
+self.russian = _button_factory("schety-off", _('Schety'),
+   self._russian_cb, _abacus_toolbar)
 self.mayan = _button_factory("nepohualtzintzin-off",
  _('Nepohualtzintzin'),
  self._mayan_cb, _abacus_toolbar)
-self.hex = _button_factory("hexadecimal-off", _('Hexadecimal'),
-   self._hex_cb, _abacus_toolbar)
 self.binary = _button_factory("binary-off", _('Binary'),
   self._binary_cb, _abacus_toolbar)
-self.russian = _button_factory("schety-off", _('Schety'),
-   self._russian_cb, _abacus_toolbar)
+self.hex = _button_factory("hex-off", _('Hexadecimal'),self._hex_cb, 
+   _abacus_toolbar)
 self.fraction = _button_factory("fraction-off", _('Fraction'),
 self._fraction_cb, _abacus_toolbar)
 self.caacupe = _button_factory("caacupe-off", _('Caacup??'),
@@ -195,6 +206,11 @@ class AbacusActivity(activity.Activity):
 self.custom = _button_factory("new-game", _('Custom'),
   self._custom_cb, _custom_toolbar)
 
+copy = _button_factory('edit-copy',_('Copy'), self._copy_cb,
+  edit_toolbar_button, accelerator='c')
+paste = _button_factory('edit-paste', _('Paste'), self._paste_cb,
+  e

[Sugar-devel] Issue No. 2324. Implementing Copy/Paste using Clipboard in Abacus.

2010-10-01 Thread Shanjit Singh Jajmann
Hi,


I am working on issue #2324, implementing Copy/Paste in Abacus Activity. I
had some doubts on the functionality of copy and paste.

According to what i have done,

1. The copy button when clicked copies any  expression/number present in the
output(bar) to the clipboard.

2. The paste button can however only  paste single numbers and not
expressions, on the output(bar).



Would this functionality be sufficient?


Regards

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


Re: [Sugar-devel] Bug No. #398

2010-09-29 Thread Shanjit Singh Jajmann
ile_path = None

 def set_search_text(self, text):
 self.search_text = text
+buffer = self._textview.get_buffer()

+start, end = buffer.get_bounds()
+   # buffer.remove_tag_by_name('search-hilite', start, end)
+   # buffer.remove_tag_by_name('search-select', start, end)
+
+iter = buffer.get_start_iter()
+while True:
+next = iter.forward_search(text, 0)
+if next is None: break
+start, end = next
+buffer.apply_tag_by_name('search-hilite', start, end)
+iter = end
+
+if self.get_next_result('current'):
+self.search_next('current')
+elif self.get_next_result('backward'):
+self.search_next('backward')
+
+def get_next_result(self, dir):
+buffer = self._textview.get_buffer()
+
+if dir == 'forward':
+iter = buffer.get_iter_at_mark(buffer.get_insert())
+iter.forward_char()
+else:
+iter = buffer.get_iter_at_mark(buffer.get_insert())
+
+if dir == 'backward':
+return iter.backward_search(self.search_text, 0)
+else:
+return iter.forward_search(self.search_text, 0)
+
+def search_next(self, dir):
+next = self.get_next_result(dir)
+if next:
+buffer = self._textview.get_buffer()
+
+start, end = buffer.get_bounds()
+buffer.remove_tag_by_name('search-select', start, end)
+
+start, end = next
+buffer.apply_tag_by_name('search-select', start, end)
+
+buffer.place_cursor(start)
+
+self._textview.scroll_to_iter(start, 0.1)
+self._textview.scroll_to_iter(end, 0.1)
+




--

Regards

Shan




On Mon, Sep 27, 2010 at 8:25 PM, Tomeu Vizoso  wrote:

> On Mon, Sep 27, 2010 at 16:36, Shanjit Singh Jajmann
>  wrote:
> > Team,
> >
> > I am working on http://bugs.sugarlabs.org/ticket/398  : Regarding the
> search
> > box, i have tried to introduce the same functionality as in the 'Log'
> > activity, in the toolbar of viewsource (jarabe/view/viewscreen.py),
> however
> > i have run into some searching and highlighting issues regarding working
>
> Without knowing which are the issues is a bit hard to know how to
> help. Can you be more explicit and also post the patch?
>
> Regards,
>
> Tomeu
>
> > with gtksourceview used in the sourceview function of the same file.
> Could
> > you please provide some pointers on how to achieve the searching and
> > highlighting ? (i could not get the bounds of the buffer created,
> start,end
> > . The highlight function has me confused as it isn't working) or any
> other
> > approach if possible.
> >
> > Regards
> > Shan
> >
> > ___
> > 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


[Sugar-devel] Bug No. #398

2010-09-27 Thread Shanjit Singh Jajmann
Team,

I am working on http://bugs.sugarlabs.org/ticket/398  : Regarding the search
box, i have tried to introduce the same functionality as in the 'Log'
activity, in the toolbar of viewsource (jarabe/view/viewscreen.py), however
i have run into some searching and highlighting issues regarding working
with gtksourceview used in the sourceview function of the same file. Could
you please provide some pointers on how to achieve the searching and
highlighting ? (i could not get the bounds of the buffer created, start,end
. The highlight function has me confused as it isn't working) or any other
approach if possible.

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


[Sugar-devel] Bug No. #1442

2010-09-20 Thread Shanjit Singh Jajmann
Sir/Ma'am,

I am actually facing problem with this particular bug(
http://bugs.sugarlabs.org/ticket/1442 ), it would be helpful if a few
pointers be provided. Also if someone could elaborate on how to check
between sugar / activity Compatibility it would be helpful.

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