WIP Clock Screensaver [Alpha Released]
#1
So, i found an snippet from Sphere for an python screensaver, using the default skinning engine.
So no more C++ dizzle for screensavers.

I found it weird that there were no nice clock screensavers, so i decided to give it a go.

This was my first python experiment, so carefully opened up the code.

As a result this came out
Image
Image
Image
Image
Image
Image

Features:
- Able to hide the date
- Jumping across screen to prevent burn-ins
- Bounce mode
- Setting a single background image
- Setting a directory for multiple backgrounds (sliding)
- Setting time color
- 12/24 hour + AM/PM

What does not work:
- Skins

Also there will be some skin support so you can make your own clocks.

Download it from Github
Reply
#2
Hi,

afaik only skin-addons can provide fonts. But you can just use their defined fonts like "font13".

Have a look to my Big Pictures Screensaver.

regards,
sphere
My GitHub. My Add-ons:
Image
Reply
#3
The issue with that is that the screensaver gets dependent on the skin in use, which is a bit weird.
It would make sense to include the ability for scripts or plugins to provide their own fonts (or extend the skins Font.xml and fonts)

That would make it possible to design some great 'skinned' screensavers and circumvent the issues that Qlock and this screensaver have when being used with any not-confluence skin.
Reply
#4
An other option is to use images.
But how the heck do i apply that.

@kibje thnks for idea =)
Reply
#5
(2013-06-24, 12:56)Kibje Wrote: The issue with that is that the screensaver gets dependent on the skin in use, which is a bit weird.
It would make sense to include the ability for scripts or plugins to provide their own fonts (or extend the skins Font.xml and fonts)

That would make it possible to design some great 'skinned' screensavers and circumvent the issues that Qlock and this screensaver have when being used with any not-confluence skin.

Yes, you need to trust on that all skins provide some kind of basic set of fonts by name (e.g. font10, font13, ...) - which is the case in most™ skins.

This feature request is already one of My 30 Add-on API wishes. We need more conventions between plugins/scripts and skins...
My GitHub. My Add-ons:
Image
Reply
#6
Oh, so using fonts is a no-go.
Sphere, how can i pass python var's to the XML?
aka, i want to pass the hour and minute.

i have this now:
Code:
class Screensaver(xbmcgui.WindowXMLDialog):

    class ExitMonitor(xbmc.Monitor):

        def __init__(self, exit_callback):
            self.exit_callback = exit_callback

        def onScreensaverDeactivated(self):
            print '3 ExitMonitor: sending exit_callback'
            self.exit_callback()
    def TickTack(self):
        self.hour_control = self.getControl(30000)
        self.minute_control = self.getControl(30001)
        now  = datetime.datetime.now()
        hour = now.hour
        minute = now.minute
        

        
        self.hour_control.setImage(picture_url)
        self.minute_control.setImage(picture_url)
        
    
            
    def onInit(self):
        print '2 Screensaver: onInit'
        self.monitor = self.ExitMonitor(self.exit)

    def exit(self):
        print '4 Screensaver: Exit requested'
        self.close()
Reply
#7
(2013-06-24, 13:17)brantje Wrote: Oh, so using fonts is a no-go.
Sphere, how can i pass python var's to the XML?
aka, i want to pass the hour and minute

Just have a look to my Screensaver.

In short:
- give the control you want to edit an ID in the xml file
- get the control instance in python (control_instance = window_instance.getControl(ID))
- use the instance method to set the Text/Label/Texture (control_instance.setLabel('foo')).

But if you only need the time, there is no need for python. There is an infolabel which automatically gets parsed to the actual time (System.Time and System.Time(format)), see here.
My GitHub. My Add-ons:
Image
Reply
#8
(2013-06-24, 13:21)sphere Wrote:
(2013-06-24, 13:17)brantje Wrote: Oh, so using fonts is a no-go.
Sphere, how can i pass python var's to the XML?
aka, i want to pass the hour and minute

Just have a look to my Screensaver.

In short:
- give the control you want to edit an ID in the xml file
- get the control instance in python (control_instance = window_instance.getControl(ID))
- use the instance method to set the Text/Label/Texture (control_instance.setLabel('foo')).

But if you only need the time, there is no need for python. There is an infolabel which automatically gets parsed to the actual time (System.Time and System.Time(format)), see here.

Whoa, that was exactly what i need!
So if i use something like this
Code:
<imagepath background="true">clock/default/$INFO[System.Time(hh)]</imagepath>

Then it gets the images from:
plugin-dir/resiurces/skin/default/media right?
Reply
#9
(2013-06-24, 13:26)brantje Wrote: Whoa, that was exactly what i need!
So if i use something like this
Code:
<imagepath background="true">clock/default/$INFO[System.Time(hh)]</imagepath>

Then it gets the images from:
plugin-dir/resiurces/skin/default/media right?

I can't answer that. Not all infolabels get parsed in all properties, so $INFO gets parsed in <label> but I cant tell for <imagepath>.
My GitHub. My Add-ons:
Image
Reply
#10
(2013-06-24, 13:39)sphere Wrote:
(2013-06-24, 13:26)brantje Wrote: Whoa, that was exactly what i need!
So if i use something like this
Code:
<imagepath background="true">clock/default/$INFO[System.Time(hh)]</imagepath>

Then it gets the images from:
plugin-dir/resiurces/skin/default/media right?

I can't answer that. Not all infolabels get parsed in all properties, so $INFO gets parsed in <label> but I cant tell for <imagepath>.

This works
Code:
    <control type="image" id="1">
          <description>My first image control</description>
          <posx>80</posx>
          <posy>60</posy>
          <width>250</width>
          <height>200</height>
          <visible>true</visible>
          <colordiffuse>FFFFFFFF</colordiffuse>
          <fadetime>200</fadetime>
          <texture>clock/$INFO[System.Time(hh)].png</texture>
          <bordersize>5</bordersize>
          <aspectratio>keep</aspectratio>
        </control>
Reply
#11
Cool Smile

One small thing: Be careful with the control-IDs (and window/string/whatever IDs), they map overlap with the builtin ones resulting in strange side effects. IIRC scripts should use control ids > 3000 (sry, can't find the official list atm).

Good luck with your screensaver.
My GitHub. My Add-ons:
Image
Reply
#12
this. is. awesome.

:D
Reply
#13
So now we are here
Image
Reply
#14
What i want to know, are there any python commands to change the colordiffuse?
And how can i pass variables from the python script to the xml? Can come in handy for setting clock colors. (if i can't set colors with python)
Reply
#15
Assuming it is the same as in a script addon you can add more variables when you create the object.

ui = gui.GUI( "script_linux_nm-main.xml" , __cwd__ , "default",msg='', first=True)
Reply

Logout Mark Read Team Forum Stats Members Help
Clock Screensaver [Alpha Released]0