Active Topics

 



Notices


Reply
Thread Tools
Posts: 94 | Thanked: 61 times | Joined on Feb 2010 @ Shoreham
#51
I did read rhrough the whole thread but must of missed that, sorry & thanks
 

The Following User Says Thank You to Raif For This Useful Post:
Posts: 482 | Thanked: 550 times | Joined on Oct 2010
#52
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)
Attached Images
 
Attached Files
File Type: zip BinaryClockColor.py.zip (963 Bytes, 107 views)
 

The Following 2 Users Say Thank You to skykooler For This Useful Post:
Posts: 306 | Thanked: 106 times | Joined on Feb 2010
#53
Is it possible to have two clocks in the status tray, with different time zones?
__________________
------------------------------------------------------------------
Voice choppy on sip calls
Please vote for bug number 10388
 

The Following User Says Thank You to rajil.s For This Useful Post:
Posts: 1,042 | Thanked: 430 times | Joined on May 2010
#54
Originally Posted by skykooler View Post
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
 
Posts: 456 | Thanked: 1,580 times | Joined on Dec 2009
#55
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.
__________________
 

The Following 2 Users Say Thank You to Wonko For This Useful Post:
Posts: 482 | Thanked: 550 times | Joined on Oct 2010
#56
Originally Posted by Radicalz38 View Post
Good idea for this...! Might as well implement this style also to BCD Clock as that's the one I use
Certainly. Here is the BCD version.
Attached Files
File Type: zip BcdClockColor.py.zip (1.0 KB, 98 views)
 

The Following 2 Users Say Thank You to skykooler For This Useful Post:
Posts: 482 | Thanked: 550 times | Joined on Oct 2010
#57
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's Avatar
Posts: 335 | Thanked: 51 times | Joined on May 2010
#58
cant update to version 6......or i have to remove the old first??
__________________
Best Regard,

CasTTeLLo

Last edited by CasTTeLLo; 2010-12-29 at 04:49.
 
Posts: 2,225 | Thanked: 3,822 times | Joined on Jun 2010 @ Florida
#59
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's Avatar
Posts: 335 | Thanked: 51 times | Joined on May 2010
#60
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.....
__________________
Best Regard,

CasTTeLLo
 
Reply


 
Forum Jump


All times are GMT. The time now is 02:36.