| Prev |   4     5   6   7     8   16 | Next | Last
maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Announce] Advanced Clock Plugin (https://talk.maemo.org/showthread.php?t=67408)

Raif 2010-12-28 20:48

Re: [Announce] Advanced Clock Plugin
 
I did read rhrough the whole thread but must of missed that, sorry & thanks :)

skykooler 2010-12-28 22:11

Re: [Announce] Advanced Clock Plugin
 
2 Attachment(s)
I created a clock plugin, it is based on the binary clock but the color changes based on the time. Here is the code:

Code:

#
# Original program copyright 2010 Ruediger Gad <r.c.g@gmx.de>
# Modified by Skyler Lehmkuhl
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
#

import cairo
from datetime import datetime
import gtk
import math

import clock

def get_name():
    return "Binary Clock with Color"

class BinaryClockColor(clock.Clock):
    def __init__(self, drawing_area):
        clock.Clock.__init__(self, drawing_area)

    def draw_bits_horizontally(self, x, y, radius, value, n):
        for i in range(n):
            self.context.set_source_rgb(y/26.0, value/60.0, i/6.0)
            self.context.arc(x + (1.5 * radius) + (3 * radius * i), y + radius, radius, 0, 2 * math.pi)
            if (value >> (n - i - 1) & 1) > 0:
                self.context.fill_preserve()
            self.context.stroke()

    def draw_clock(self):
        if self.show_seconds :
            self.draw_bits_horizontally(12, 2, 4, self.time.hour, 5)
            self.draw_bits_horizontally(0, 14, 4, self.time.minute, 6)
            self.draw_bits_horizontally(0, 26, 4, self.time.second, 6)
        else :
            self.draw_bits_horizontally(18, 2, 6, self.time.hour, 5)
            self.draw_bits_horizontally(0, 20, 6, self.time.minute, 6)

    def resize(self):
        if self.show_seconds :
            self.drawing_area.set_size_request(76, 36)
        else:
            self.drawing_area.set_size_request(110, 36)


rajil.s 2010-12-28 22:36

Re: [Announce] Advanced Clock Plugin
 
Is it possible to have two clocks in the status tray, with different time zones?

Radicalz38 2010-12-28 22:46

Re: [Announce] Advanced Clock Plugin
 
Quote:

Originally Posted by skykooler (Post 906319)
I created a clock plugin, it is based on the binary clock but the color changes based on the time. Here is the code:

Code:

#
# Original program copyright 2010 Ruediger Gad <r.c.g@gmx.de>
# Modified by Skyler Lehmkuhl
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
#

import cairo
from datetime import datetime
import gtk
import math

import clock

def get_name():
    return "Binary Clock with Color"

class BinaryClockColor(clock.Clock):
    def __init__(self, drawing_area):
        clock.Clock.__init__(self, drawing_area)

    def draw_bits_horizontally(self, x, y, radius, value, n):
        for i in range(n):
            self.context.set_source_rgb(y/26.0, value/60.0, i/6.0)
            self.context.arc(x + (1.5 * radius) + (3 * radius * i), y + radius, radius, 0, 2 * math.pi)
            if (value >> (n - i - 1) & 1) > 0:
                self.context.fill_preserve()
            self.context.stroke()

    def draw_clock(self):
        if self.show_seconds :
            self.draw_bits_horizontally(12, 2, 4, self.time.hour, 5)
            self.draw_bits_horizontally(0, 14, 4, self.time.minute, 6)
            self.draw_bits_horizontally(0, 26, 4, self.time.second, 6)
        else :
            self.draw_bits_horizontally(18, 2, 6, self.time.hour, 5)
            self.draw_bits_horizontally(0, 20, 6, self.time.minute, 6)

    def resize(self):
        if self.show_seconds :
            self.drawing_area.set_size_request(76, 36)
        else:
            self.drawing_area.set_size_request(110, 36)


Good idea for this...! Might as well implement this style also to BCD Clock as that's the one I use :p

Wonko 2010-12-29 00:33

Re: [Announce] Advanced Clock Plugin
 
Nice to see more and more custom clocks being created. :)


I just uploaded version 0.6.0 to extras devel.
This version finally uses gconf for storing the settings.
Hence, your settings will be persistent and not getting lost, e.g., on reboots.

The use of gconf also enables other applications to set option values.
This could be particularly useful for implementing a "settings application" which could hook into the control panel.

Furthermore, this version adds a setting for "scaling" the font size.
This is especially useful for fonts that are too big (as pointed out by Raif), or just if you want a smaller display.

skykooler 2010-12-29 00:38

Re: [Announce] Advanced Clock Plugin
 
1 Attachment(s)
Quote:

Originally Posted by Radicalz38 (Post 906336)
Good idea for this...! Might as well implement this style also to BCD Clock as that's the one I use :p

Certainly. Here is the BCD version.

skykooler 2010-12-29 00:51

Re: [Announce] Advanced Clock Plugin
 
How do you create a package? I am working on a few more clock themes and want to post them to extras-devel, but I don't know where to start. Is there a good tutorial somewhere (or a few steps someone could list)?

CasTTeLLo 2010-12-29 04:42

Re: [Announce] Advanced Clock Plugin
 
cant update to version 6......or i have to remove the old first??

Mentalist Traceur 2010-12-29 04:48

Re: [Announce] Advanced Clock Plugin
 
Were you able to install the earlier versions? What error is it giving you? What do the logs say? It's useless to just say it didn't work if you aren't going to go into as much detail as you possibly can.

CasTTeLLo 2010-12-29 04:52

Re: [Announce] Advanced Clock Plugin
 
i'm not saying it did't work for me.....i just cant update to the latest version(CURRENT v5) via app man and xterm.....


| Prev |   4     5   6   7     8   16 | Next | Last
All times are GMT. The time now is 21:28.

vBulletin® Version 3.8.8