*

Welcome, Guest. Please login or register.
Did you miss your activation email?

Pages: [1]
Print
Author Topic: Ordering Activities?  (Read 17463 times)

Ordering Activities?

jefeliz
Contributor
*
Posts: 47


December 19, 2007, 10:32:59 AM

Does anyone know if it is possible to rearrange the order that the Activities are displayed along the bottom of the frame? My anal-retentiveness is having a hard time dealing with them not being in alphabetical order!

Jeff. .
Logged

#1 Re: Ordering Activities?

Gabey8
Global Moderator
OLPC News Forum Expert
****
Posts: 591



WWW
December 20, 2007, 12:44:16 PM

I was wondering the same thing. I would like to get the Opera browser, which I installed yesterday, onto the first screen of activities since I use it all the time. Right now, it's the most recently installed activity (and the only one so far that didn't come pre-installed on the XO), and it was added to the end of the second screen. Moving it close to the start of the list will mean one less click of the mouse button every timeI want to start the Opera browser.
Logged

Mesh name: Donna. XO icon: purple outline and orange fill color. From Philadelphia, PA, USA. If you see me in the Neighborhood, say hi. Smiley Currently using jabber server xo1share.org .

#2 Re: Ordering Activities?

Ben James Ben
Senior Contributor
**
Posts: 142



December 20, 2007, 07:38:14 PM

The code that adds icons to the tray is in /usr/share/sugar/shell/view/frame/activitiestray.pl:

Code:
  75     def _load_config(self):
  76         config = []
  77
  78         f = open(env.get_data_path('activities.defaults'), 'r')
  79         for line in f.readlines():
  80             line = line.strip()
  81             if line and not line.startswith('#'):
  82                 config.append(line)
  83         f.close()
  84
  85         return config
  86
  87     def _get_activities_cb(self, activity_list):
  88         known_activities = []
  89         unknown_activities = []
  90         name_to_activity = {}
  91
  92         while activity_list:
  93             info = activity_list.pop()
  94             name_to_activity[info.bundle_id] = info
  95
  96             if info.bundle_id in self._config:
  97                 known_activities.append(info)
  98             else:
  99                 unknown_activities.append(info)
 100
 101         sorted_activities = []
 102         for name in self._config:
 103             if name in name_to_activity:
 104                 sorted_activities.append(name_to_activity[name])
 105
 106         for info in sorted_activities + unknown_activities:
 107             if info.show_launcher:
 108                 self.add_activity(info)

The activities.defaults file is /usr/share/sugar/data/activities.defaults. It contains the first 16 activites in the same order they appear in the Activities tray. I assume that re-ordering the lines in this file will cause the tray to be re-ordered (after restarting Sugar, of course):

Code:
   1 # Ordered list of the activities displayed in the frame
   2
   3 org.laptop.Chat
   4 org.laptop.WebActivity
   5 org.laptop.AbiWordActivity
   6 org.laptop.RecordActivity
   7 org.laptop.Oficina
   8 org.laptop.TamTamJam
   9 org.vpri.EtoysActivity
  10 org.laptop.TurtleArtActivity
  11 org.laptop.Pippy
  12 org.laptop.Calculate
  13 org.laptop.MeasureActivity
  14 org.laptop.TamTamEdit
  15 org.laptop.TamTamSynthLab
  16 org.laptop.Memorize
  17 org.laptop.BlockPartyActivity
  18 org.laptop.Connect

The activities that aren't in the activities.default file seem to get picked up elsewhere, probably in /usr/share/sugar/shell/view/frame/activitiestray.pl lines 64-65:

Code:
  64         registry = activity.get_registry()
  65         registry.get_activities_async(reply_handler=self._get_activities_cb)

I'm not sure how the registry works. However, it seems that you should be able to sort any activity you want by adding them to the activities.defaults file, in the order you want.
« Last Edit: December 20, 2007, 07:41:17 PM by Ben James Ben » Logged

#3 Re: Ordering Activities?

Gollumer
Contributor
*
Posts: 61


December 22, 2007, 04:11:30 PM

I reversed the order for the browser and chat. re-started X and guess what?  The icon order  changed.

I am not a programmer, but reading that perl script hinted to me the solution to re-ordering items that are not in it.  Add them (be careful typing)

How do I find the names of my apps?
ls /home/olpc/default/.sugar

all of the Activities you installed have entries like:
org.laptop.SimCity
or Opera is
com.opera.OperaActivity

Add your activities to the activities.defaults file in the place you want them to be make sure what you enter is formatted the same as the existing entries.

Have fun!
« Last Edit: December 22, 2007, 04:35:06 PM by Gollumer » Logged

#4 Re: Ordering Activities?

vkoser
Commenter

Posts: 11


December 22, 2007, 05:59:48 PM

works great!

I'm going to have to start scripting all this stuff for a quick restore of customization once I end up flashing a new OS image.
Logged

#5 Re: Ordering Activities?

xzela
Commenter

Posts: 10


December 23, 2007, 12:41:37 PM

I second that, worked like a champ.

Thanks for the info.
Logged

#6 Re: Ordering Activities?

oldkid
New

Posts: 1


December 30, 2007, 03:22:30 PM

  In case anyone else had trouble figuring it out, the
name of the News Reader is com.ywwg.PenguinTV.
  Another place to look for info about these activities
is /usr/share/activities
  Thanks OLPC and Forum responders.  What
a neat machine and group.
Logged

#7 Re: Ordering Activities?

Frank Scott
Senior Contributor
**
Posts: 115


1st Hour Donor, Rocklin, CA


December 30, 2007, 04:15:31 PM

works great!

I'm going to have to start scripting all this stuff for a quick restore of customization once I end up flashing a new OS image.

I'm glad you mentioned this. I haven't read anything yet on any of these OLPC threads about an effective way to back up our files. Like a lot of you, I've spent a lot of time customizing my setup. I've added Opera, Midnight Commander, and several other applications. I'd hate to have to repeat all of my actions every time I install a new build. I had to do this once already when I upgraded from build 650 to 653. Any ideas?
Logged

#8 Re: Ordering Activities?

wirzcat
Contributor
*
Posts: 34


January 04, 2008, 08:33:38 AM

Make a simple bash script that will reload your files.  I have on that adds opera, does yum installs, etc.  You need to know basic bash concepts.



works great!

I'm going to have to start scripting all this stuff for a quick restore of customization once I end up flashing a new OS image.

I'm glad you mentioned this. I haven't read anything yet on any of these OLPC threads about an effective way to back up our files. Like a lot of you, I've spent a lot of time customizing my setup. I've added Opera, Midnight Commander, and several other applications. I'd hate to have to repeat all of my actions every time I install a new build. I had to do this once already when I upgraded from build 650 to 653. Any ideas?

Logged

#9 Re: Ordering Activities?

Frank Scott
Senior Contributor
**
Posts: 115


1st Hour Donor, Rocklin, CA


January 04, 2008, 11:51:18 AM




Make a simple bash script that will reload your files.  I have on that adds opera, does yum installs, etc.  You need to know basic bash concepts.


Thank, wirzcat, but unfortunately I don't have those Linux skills yet, and from what I've seen on these forums, it appears that most of us here are not familiar with Linux or the Sugar OS. It would be great if there was a section here where these types of scripts could be uploaded, so we could study them, and modify them for our own use.
Logged

#10 Re: Ordering Activities?

wirzcat
Contributor
*
Posts: 34


January 07, 2008, 09:06:01 PM

I'll be the first to admit I don't know jack about Sugar development.   And I am no Linux expert by any means.  But, I know how to figure stuff out....usually starting with Google. 

My first suggestion is to get the book Classic Shell Scripting.  The best generic shell scripting book I have and will give you the basics.  Next, get any starter Linux book that is focused on Fedora to learn the basics of the OS.  This will give you the basics of where the different files are and which ones need to be changed for what purpose.

And use the command line. (Period)  You will gain zero knowledge using some gui application when it only takes a quick file edit in a command shell.

I have my bash script set up as a "case" statement where I can specify the option I want.       
This is a few lines of the 300 line version I have.  I like simple.

#!/bin/sh

case "$1" in
   key)
      cat > /security/develop.sig <<EOT
dev01: CSN74702A20 A 00000000T000000Z sig01: sha256 [big number here]
EOT
            ;;
   opera)
      rpm -vi opera-9.12-20070122.10-static-qt.i386-en.rpm
      tar -xzvf opera-activity.tar.gz -C /usr/share/activities
      rpm -vi flash-plugin-9.0.48.0-release.i386.rpm
           ;;
      yum)
             yum -y install dosfstools
             yum -y install mc
             yum -y install minicom
             yum -y install cups
            ;;
       *)
          echo "need an option"
          ;;
esac







Make a simple bash script that will reload your files.  I have on that adds opera, does yum installs, etc.  You need to know basic bash concepts.


Thank, wirzcat, but unfortunately I don't have those Linux skills yet, and from what I've seen on these forums, it appears that most of us here are not familiar with Linux or the Sugar OS. It would be great if there was a section here where these types of scripts could be uploaded, so we could study them, and modify them for our own use.

« Last Edit: January 08, 2008, 11:28:34 AM by wirzcat » Logged

#11 Re: Ordering Activities?

ashtond33
Contributor
*
Posts: 85



January 22, 2008, 10:47:46 AM

Great idea wirzcat! I'll be working on that next time I'm in front of my XO
Logged

#12 Re: Ordering Activities?

crackhead
Commenter

Posts: 19


February 03, 2008, 10:15:38 PM

For some reason, adding Activities that begin with "com." don't seem to be ordered when editing /usr/share/sugar/data/activities.default. (i.e. com.opera.operaActivity)  They're simply ignored and always appear at the end of the list.  Any ideas?
Logged

#13 Re: Ordering Activities?

zdharv
New

Posts: 1


February 07, 2008, 10:52:09 AM

I had no problem ordering Opera...that is, after I typed it correctly.

Try  com.opera.OperaActivity

Note the capital O.
Logged

#14 Re: Ordering Activities?

Sarah Elkins
Contributor
*
Posts: 73


WWW
February 07, 2008, 04:59:33 PM

Just to mention an alternate approach:  I just resume activities from Journal.  The most frequently-used activities bubble up to the top! 
Logged
Pages: [1]
Print
Jump to:  

Welcome, Guest. Please login or register.
Did you miss your activation email?
September 06, 2010, 12:47:03 AM

Login with username, password and session length
Recent Topics
[September 05, 2010, 11:51:10 PM]

[September 05, 2010, 09:25:21 PM]

by Rao
[September 05, 2010, 08:27:23 AM]

by anna
[September 04, 2010, 01:56:30 PM]

[August 30, 2010, 11:26:07 PM]

[August 30, 2010, 11:23:56 PM]

[August 30, 2010, 10:40:34 AM]

[August 28, 2010, 10:00:01 PM]

[August 25, 2010, 03:10:02 PM]

[August 22, 2010, 09:48:07 AM]
Members
Total Members: 4557
Latest: Helenwh
Stats
Total Posts: 31126
Total Topics: 3759
Online Today: 43
Online Ever: 220
(February 05, 2009, 11:29:32 AM)
Users Online
Users: 0
Guests: 41
Total: 41