View Single Post
Posts: 2,225 | Thanked: 3,822 times | Joined on Jun 2010 @ Florida
#330
Originally Posted by skykooler View Post
Wonko: What is the main script, and where does it draw the custom clock? I would prefer not to use a refresh rate variable, as that would result in a clock being drawn, say, 30 times a second. The animation, however, would only go for maybe half that time - so I would only need the first 15 redraws, the rest would just be wasting processor. Also, for a clock that doesn't show seconds, the benefit of redrawing a fixed number of times in a loop is huge: 15 redraws per minute (all in the first half-second) vs. 1800 redraws per minute. This is why I would like to find out where I can explicitly ask for a redraw, instead of just letting the main clock script give me one.
Couldn't you then have your clock style check whether seconds are shown?

Alternatively, I agree, it's not the MOST versatile system per se, but what exactly is your solution? Implement a way for the clock style to just 'call' for a redraw at any step? What do people who want to specify a redraw exactly every X-time-interval do then? Write an entire if-then loop just to check to see if the appropriate amount of time elapsed? (Not a big deal, but extra resources yet again.)

HOWEVER, I don't see why both can't be done. Having both a callable-from-within-clock-style 'redraw' function, and a refresh rate variable. Yet again, more customizable-ness, and the developers of clock styles can chose which one they feel fits better with what they want. (Well, other than extra work for Wonko, but hey, that's why this is open source, and uncompiled python no less.)

Also, I'm pretty sure main script is /opt/maemo/usr/lib/advanced-clock-plugin/clock.py /usr/lib/hildon-desktop/advanced-clock-plugin.py

Looks like lines 159 - 168 is what you want in that file... And it looks like you CAN just have an 'update every second' that can be set to true in-clock-style, and then you can add another or condition to line 165.

That bit of the code makes me think that it only updates once a second though. You may have to go higher up in the code and change how precisely it fetches the time, or you may also include a "or [enable forceable redraw variable name]" in the aforementioned line 165. And so then if you can call that function from within the clock style, and have set the variable to true in your init area, it won't bother checking if the time changed. (If python works that way. Way out of my league right now.)

That's how I'm envisioning it would be best from my limited perspective, though: Make two new variables, one for redraw-every-second, one for allow-forced-redraws. Include both of those in their own "or"s in the if statement on line 165 of the advanced-clock-plugin.py file.

But you guys understand this a lot better than me, and I'm a complete python newb still, so yeah. I'm sure you can think of something better/more efficient/whatever.

Last edited by Mentalist Traceur; 2011-01-30 at 08:14. Reason: Found the actual main script.