*

Welcome, Guest. Please login or register.

Get your own OLPC - Buy an XO laptop on eBay!
Pages: 1 [2]
Print
Author Topic: Clock in home frame  (Read 17111 times)

#15 Re: Clock in home frame

teapot
OLPC News Forum Expert
****
Posts: 662



WWW
October 21, 2008, 04:46:59 AM

So that means that we can expect an updated version ?  Wink
Yes, however I have a lot of other things in front of me -- power management for Ubuntu, updating Ubuntu port for Intrepid release, now this problem with booting from USB...
Quote
and if not could you provide some hints so we can mess around with it? Grin

Code in /usr/share/sugar/shell/view/frame/frame.py that immediately follows
Code:
def _create_bottom_panel(self):
and
Code:
def _create_bottom_panel(self):
is responsible for widgets at the top and bottom sides/panels of the frame.
Logged

#16 Re: Clock in home frame

XOIOWA
Senior Contributor
**
Posts: 119



October 21, 2008, 04:54:25 AM

Thanks, teapot, for the extra info.  I'll probably play with that tonight to put my clock in the bottom instead of the top.

For any interested, I think the line for the clock above should be changed from:
clock = FrameClock("%a %b %d %I:%H:%M %p")
to
clock = FrameClock("%a %b %d %I:%M:%S %p")

The %I and %H are, respectively, 12-hour and 24-hour representations of the hour.  I wanted mine more simple, so I just used this:

clock = FrameClock("%I:%M %p")

You can discover the different options by going into terminal and typing
date --help


Logged

#17 Re: Clock in home frame

mavrothal
Administrator
OLPC News Forum Expert
*****
Posts: 1289


October 21, 2008, 09:21:57 AM

Quote
Code in /usr/share/sugar/shell/view/frame/frame.py that immediately follows
Code:

def _create_bottom_panel(self):

and
Code:

def _create_bottom_panel(self):

is responsible for widgets at the top and bottom sides/panels of the frame.

So a simple way to put the clock in the bottom panel is instead of modifying the zoomtoolbar.py and frame.py files, modify the devicestray.py file in the same directory so will look like that (added lines start with the plus sign - the plus sign should not be in the file):
Code:
from model import shellmodel

+from frameclock import FrameClock

_logger = logging.getLogger('DevicesTray')

class DevicesTray(tray.HTray):
    def __init__(self):
        tray.HTray.__init__(self, align=tray.ALIGN_TO_END)
        self._device_icons = {}

+       clock = FrameClock("%a %b %d %I:%H:%M %p")
+       self.add(clock)
+       clock.show()
+       clock.start()

        devices_model = shellmodel.get_instance().get_devices()

There are 2 problems with it though... One is aesthetics   Shocked the devices are about half the distance from the center to the left and the clock symmetrically to the right. Is not bad but the other way around would be better Smiley. Changing the position of the "clock=..." etc does not improve things.
The other is more serious, the clock letters are black Grin There are easily visible but far from nice. Any ideas???
« Last Edit: October 21, 2008, 09:47:39 AM by mavrothal » Logged

XO-1: Is never going to run Flash, but is certainly flashy!
(If you want Flash, get an XO-1.5 running OLPC 11.2.0 or XOpup Grin )

#18 Re: Clock in home frame

teapot
OLPC News Forum Expert
****
Posts: 662



WWW
October 21, 2008, 01:10:12 PM

Any ideas???
If you place clock (and possibly other widgets) into a separate tray, you will be able to control its layout on the panel relative to other trays. It can become somewhat like notification area applet, system tray or dock in other desktop systems -- a variable part of the panel that is controlled by applications running in background, but not something that user configures directly (startup icons that in Sugar are only allowed on desktop) or something that corresponds to fixed functionality (zoom, battery/radio/volume, running activities, etc.).
Logged

#19 Re: Clock in home frame

teapot
OLPC News Forum Expert
****
Posts: 662



WWW
October 21, 2008, 01:18:30 PM

There are 2 problems with it though... One is aesthetics   Shocked the devices are about half the distance from the center to the left and the clock symmetrically to the right. Is not bad but the other way around would be better Smiley. Changing the position of the "clock=..." etc does not improve things.
Code:
self.set_expand(True)
in frameclock.py does that. Changing it to False keeps clock from centering itself on the unused part of the panel.
Logged

#20 Re: Clock in home frame

mavrothal
Administrator
OLPC News Forum Expert
*****
Posts: 1289


October 21, 2008, 02:02:13 PM

Teapot, Thanks for the info.
However, it appears to be a more fundamental problem with the FrameClock than position. Regardless of its position, it updates once in a blue moon. Did anyone else noticed this or I just messed up something?
Logged

XO-1: Is never going to run Flash, but is certainly flashy!
(If you want Flash, get an XO-1.5 running OLPC 11.2.0 or XOpup Grin )

#21 Re: Clock in home frame

XOIOWA
Senior Contributor
**
Posts: 119



October 21, 2008, 02:32:43 PM

Check the clock callout.  The original post above is using the hour callout twice.

%I:%H:%M   ( Hour : Hour : Minute )

Instead you want to use this: 
%I:%M:%S  ( Hour : Min : Sec )
Logged

#22 Re: Clock in home frame

mavrothal
Administrator
OLPC News Forum Expert
*****
Posts: 1289


October 21, 2008, 03:33:29 PM

Check the clock callout.  The original post above is using the hour callout twice.

%I:%H:%M   ( Hour : Hour : Minute )

Instead you want to use this: 
%I:%M:%S  ( Hour : Min : Sec )
This did it. Thanks. Maybe it should be changed in the original teapot's post too.
Any idea about the color?
Quote
Code:

   self.set_expand(True)

in frameclock.py does that. Changing it to False keeps clock from centering itself on the unused part of the panel.
No it did not change its original position in the devicestray.
Logged

XO-1: Is never going to run Flash, but is certainly flashy!
(If you want Flash, get an XO-1.5 running OLPC 11.2.0 or XOpup Grin )

#23 Re: Clock in home frame

teapot
OLPC News Forum Expert
****
Posts: 662



WWW
October 21, 2008, 05:18:44 PM

No it did not change its original position in the devicestray.

Hmm, it worked when I made it into a separate tray... The new patch is at http://mars.illtel.denver.co.us/~abelits/software/olpc/frameclock/frameclock.patch

It is intended to be applied to the original configuration, so please restore it if you want to use patch utility.

Before installation make sure you have patch and wget utilities. If you get "command not found" when running them, use "yum install" to install them.

Download frameclock.patch to your home directory:

cd
rm -f frameclock.patch
wget http://mars.illtel.denver.co.us/~abelits/software/olpc/frameclock/frameclock.patch

After downloading, become root:

sudo -s

As root:

cd /usr/share/sugar/shell/view/frame
patch < ~olpc/frameclock.patch

Reboot or restart Sugar to get the new clock.

(this is how usually changes to sources are distributed by developers before they are placed into distributions).
Logged

#24 Re: Clock in home frame

mavrothal
Administrator
OLPC News Forum Expert
*****
Posts: 1289


October 21, 2008, 11:01:57 PM

Quote
It is intended to be applied to the original configuration, so please restore it if you want to use patch utility.
Original implies as described in the original tdang's post, or before applying the changes/patch suggested in your original post in this thread eg having ONLY the original frameclock.py file and nothing else changed?

Edit I guess the correct answer is none Smiley since the frameclock.py is also created by the patch. So a clean 767 install should work fine.
Looks really nice! well done!

Mac top right, Windows/Ubuntu bottom right, Sugar bottom left. It's easier for me to look at my watch Grin Grin Grin

Seriously though, maybe this can be pushed upstream and become an option in the frame control panel. You do not necessarily need a 7-9-year old to be constantly  time-aware but is a very nice feature to have.
« Last Edit: October 22, 2008, 04:40:53 AM by mavrothal » Logged

XO-1: Is never going to run Flash, but is certainly flashy!
(If you want Flash, get an XO-1.5 running OLPC 11.2.0 or XOpup Grin )
Pages: 1 [2]
Print
Jump to:  

Members
Total Members: 2405
Latest: sembik
Stats
Total Posts: 31943
Total Topics: 3843
Online Today: 27
Online Ever: 238
(April 18, 2011, 09:48:50 PM)
Users Online
Users: 0
Guests: 22
Total: 22