maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Flip clock pre pre pre pre release (https://talk.maemo.org/showthread.php?t=25582)

tso 2008-12-16 20:12

Re: Flip clock pre pre pre pre release
 
iirc, the french tried a base ten calendar and clock at some point.

it ould also be displaying internet time, @0000 was the format...

fpp 2008-12-16 20:20

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by TrueJournals (Post 249768)
I hate to be a nit-picker here, but... daperl: from my understanding of python (and I could be wrong, I'm still learning), items in parentheses () are a tuple, while items in brackets [] are a list. So, in this case, the items need to be in a tuple, not a list. Not a big deal here, but the terminology changes what you can do with the items. (Reference Link)

You're quite right. Although tuples are, in effect, like immutable lists, they're not equivalent in this case.

The other data structure commonly used for string formatting is the Python 'dictionary', especially when there are many variables and/or some of them are used multiple times. The placeholders are then named after the dict keys and their type, as in :

Code:

values = {'name':'Joe', 'score':10, 'rank':'first'}
print "%(name)s scored %(score)d and ranked %(rank)s, congrats %(name)s !" % values

A commonly used dict is the one returned by locals(), which contains all local variables in context.

plop 2008-12-16 20:35

Re: Flip clock pre pre pre pre release
 
ciao ciroip =) (and first post, btw).

Nice little clock and very useful. Looking in your code, I've noticed quite a bit of redundant code, so, I did a little bit of cleaning (too much loop unrolling ;)): http://python.pastebin.com/f6bdc2e1d .


EDIT: now with a more flexible event handling, you could even save a little bit of battery life increasing the delay for the redraw of the clock : http://python.pastebin.com/m363e32c .

daperl 2008-12-16 20:53

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by fpp (Post 249985)
You're quite right. Although tuples are, in effect, like immutable lists, they're not equivalent in this case.

The other data structure commonly used for string formatting is the Python 'dictionary', especially when there are many variables and/or some of them are used multiple times. The placeholders are then named after the dict keys and their type, as in :

Code:

values = {'name':'Joe', 'score':10, 'rank':'first'}
print "%(name)s scored %(score)d and ranked %(rank)s, congrats %(name)s !" % values

A commonly used dict is the one returned by locals(), which contains all local variables in context.

That's clean. But I'm still confused why the variable substitution operator (%) doesn't recognize a list as a sequence. That doesn't make sense to me. Does that make sense to you? And if so, why? Thanks.

ciroip 2008-12-16 21:56

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by plop (Post 249990)
ciao ciroip =) (and first post, btw).

Nice little clock and very useful. Looking in your code, I've noticed quite a bit of redundant code, so, I did a little bit of cleaning (too much loop unrolling ;)): http://python.pastebin.com/f6bdc2e1d .


EDIT: now with a more flexible event handling, you could even save a little bit of battery life increasing the delay for the redraw of the clock : http://python.pastebin.com/m363e32c .

Welcome to the forum
AAAHAHA, my code in thewild!!, Ashame, ashame. I knew my solution was crap (merda in italian, vedasi comment in the code...) but I was anxious to see that numbers moving a bit :) Ill study your code. Thank you

qole 2008-12-16 22:01

Re: Flip clock pre pre pre pre release
 
Don't be ashamed, ciroip!

You asked developers to write the code for you, but nobody did, so you wrote it yourself! Excellent!

Now your achievement has motivated developers to fix your code. Everybody wins!

Especially me!

lcuk 2008-12-17 00:09

Re: Flip clock pre pre pre pre release
 
ciroip,
do not be ashamed, when a diamond comes out of the ground it is uneven and dull.

its easier to spot a mistake than come up with the rough draft :)

thanks for starting this :)

ciroip 2008-12-17 01:15

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by qole (Post 250014)
Don't be ashamed, ciroip!
You asked developers to write the code for you, but nobody did, so you wrote it yourself! Excellent!
Now your achievement has motivated developers to fix your code. Everybody wins!
Especially me!

Quote:

ciroip,
do not be ashamed, when a diamond comes out of the ground it is uneven and dull.
its easier to spot a mistake than come up with the rough draft
thanks for starting this
ok guys, this is becoming odd, lets drop the argument here :)

nilchak 2008-12-17 20:02

Re: Flip clock pre pre pre pre release
 
Initially I thought that Alat was built in when I say the Alarm Off /On graphic.
But I guess that is only a graphic and is not a workable "switch as yet", Am I right ?

Also while I would love to have the alarm feature (I loved the clock so much - that I woke up quite a few times on the first night to look at the time in big clear letters - thus losing good sleep :-) , the nice clear interface made me think this would work very well as a stop-watch too - if that feature is built in (maybe).

Maybe clicking the full-screen button could start/stop the stopwatch - just a thought.

But I love this clock at last and having an alarm would make it replace the large statusbar alarm system for me (which bugs me in that it kills the sound on my tablet each time).

fpp 2008-12-17 20:47

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by qwerty12 (Post 249916)
Indeed, sure I can :). I'm making a package now of ciroip's new version (thank you ciroip for the path modification!) and will relax the versions.
I've lowered it to 2.5.1, should be fine for both diablo and chinook. Pygame version is the same so no changes there.

Yup, works fine on both now, thanks a lot !

Tiny request for the next version : escape key exits app ? :-)

fpp 2008-12-17 21:06

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by daperl (Post 249994)
That's clean. But I'm still confused why the variable substitution operator (%) doesn't recognize a list as a sequence. That doesn't make sense to me. Does that make sense to you? And if so, why? Thanks.

I'm too much of a down-to-earth, pragmatic and occasional programmer to worry about philosophical issues - and Python has few of them (see the 'Zen of Python'), which is why I like it :-)

The question is intriguing though, and while I haven't (yet) found a definitive answer, I did find the discussion on this page quite enlightening:

http://jtauber.com/blog/2006/04/15/p...onstant_lists/

ciroip 2008-12-17 22:05

Re: Flip clock pre pre pre pre release
 
I need your help people: I heavily modified the code using great PLOP's suggestions but now the clock keep crashing every 9th minutes...
I have no idea why the
x[15] a time.ctime() on the 9th minute made this expception...:mad:
Anyway, I think people can survive with a clock that crash each 9th minute....(09, 19, 29 etc)
Im pimping the clock with all the features that make China the big country that deserve to be. The cheap wood plastic case inspired me to add one of the stupidiest and tackyest feature:
let me introduce to the world the Moodorama :).
@ Qwerty12, dont loose your time packaging this version until the annoyng 9minutebug will not have a solution
https://garage.maemo.org/frs/downloa...ock003.tar.bz2
https://garage.maemo.org/frs/downloa...03_sschot1.jpg
Im testing some different input interfaces for setting the alarm clock:
tapping somewhere on the bottom should bring up a virtual keyboard i found somewhere, Ill probably use something like a semplified version of that.

daperl 2008-12-17 22:10

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by fpp (Post 250381)
I'm too much of a down-to-earth, pragmatic and occasional programmer to worry about philosophical issues - and Python has few of them (see the 'Zen of Python'), which is why I like it :-)

The question is intriguing though, and while I haven't (yet) found a definitive answer, I did find the discussion on this page quite enlightening:

http://jtauber.com/blog/2006/04/15/p...onstant_lists/

Excellent post. Enlightening to say the least. Even though it didn't answer my question, I now have enough information to make up my own answer. :cool:

ciroip 2008-12-17 22:20

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by nilchak (Post 250348)
Initially I thought that Alat was built in when I say the Alarm Off /On graphic.
But I guess that is only a graphic and is not a workable "switch as yet", Am I right ?

Also while I would love to have the alarm feature (I loved the clock so much - that I woke up quite a few times on the first night to look at the time in big clear letters - thus losing good sleep :-) , the nice clear interface made me think this would work very well as a stop-watch too - if that feature is built in (maybe).

Maybe clicking the full-screen button could start/stop the stopwatch - just a thought.

But I love this clock at last and having an alarm would make it replace the large statusbar alarm system for me (which bugs me in that it kills the sound on my tablet each time).

Right the alarm still dont work but is one of my highest priority
I have to decide how make people configure the time. Ill think about something.
When Ill be bored of the clock ill probably use the digits for a stopwatch, a counter (every tap +1)or use the number to interface finger friendly (tapping on top of each number the counter ad 1, tapping on the botton it decrease) or maybe dragging up and down. Ill see if it ill woks
thank you for the ideas

plop 2008-12-17 23:27

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by ciroip (Post 250409)
I need your help people: I heavily modified the code using great PLOP's suggestions but now the clock keep crashing every 9th minutes...
I have no idea why the
x[15] a time.ctime() on the 9th minute made this expception...:mad:
Anyway, I think people can survive with a clock that crash each 9th minute....(09, 19, 29 etc)

My bad, I've overlooked the range, it loaded from 0 to 8 before ^^.

Use

numeri = [pygame.image.load(path+str(x)+".png") for x in range(0,10)]

when you load the images and it will work.

ciroip 2008-12-18 15:15

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by plop (Post 250440)
My bad, I've overlooked the range, it loaded from 0 to 8 before ^^.

Use

numeri = [pygame.image.load(path+str(x)+".png") for x in range(0,10)]

when you load the images and it will work.

thank you, perfect :)

ciroip 2008-12-19 09:12

Re: Flip clock pre pre pre pre release
 
Another crappy release Just to show a bit the status.
The code really need to be checked and cleaned:
@ qwerty12: trust me, you dont want touch it.
Anyway the clock should be stable enough for a drive test.
The alarm should work. I decided to not use the maemo alarmd but to simple store the setting in a variable (the alarm need to be re-set every crash...:) )
For the python gurus out there: dont waste your time checking the code, is pure trash, Ill give a clean up asap
https://garage.maemo.org/frs/downloa...ock004.tar.bz2
https://garage.maemo.org/frs/downloa...eenshot004.jpg
The alarm sound loop every sec (more or less) following the screen refresh (WORK, STUPID CPU WORK!) The final version will probably refresh every 5 seconds.
Anyone know how control the N810 LED? Would be lovely to have a blinking alarm.
Buonanotte a tutti

qwerty12 2008-12-19 12:26

Re: Flip clock pre pre pre pre release
 
ciroip, you really don't want me to package it? I honestly don't mind doing so :)

Oh, N810 led can be controlled via dbus:
http://www.internettablettalk.com/fo...ad.php?t=17024

(But spare a thought for us N800 users please! :))

pycage 2008-12-19 13:08

Re: Flip clock pre pre pre pre release
 
Yes, please package it. Users will love having this in extras! :)

ciroip 2008-12-19 15:40

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by qwerty12 (Post 250846)
ciroip, you really don't want me to package it? I honestly don't mind doing so :)

I let you decide is just a sharp pain just reading that code, there are wacko use of variable names, random paths, python blasphemies and functions that overlap features. Is just acceptable to watch it run.
It will just save you a lot of headace wait for next release. Now I know how have the thing make some noise I can focus on cleaning up a bit the things. Beside the fun to misue python the application still really need a developer to rewrite everything from scratch :)
+ plus + my major concern is the way I keep opening new pygame screens for the alarm setting and reloading the graphics over and over.
I have no idea how much pyhton can let me write everything pass trough my mind without any conseguences on the system.
The weekend is here so ill probably have more time to work on the code.
So, If you are really bored or you love digg **** feel free to package it :)

Quote:

(But spare a thought for us N800 users please! )
Do you really think I have idea of what is going on? :) I dont think Ill sacrifice the other tablet versions, (that is another reason why Im scared to use hardware buttons, I have no idea how that could work on different devices, since im writing everything without using any gui (and you are the one in charge of the minumun hildonizing to make it installable) should be pretty compatible with everything have a 800x480 screen that run python+pygame.

Quote:

Oh, N810 led can be controlled via dbus:
http://www.internettablettalk.com/fo...ad.php?t=17024
Ill take a look and see how much I can understand. I want try an OLD trick popular in the amiga days to make the leds smoothly glowing...

ciroip 2008-12-20 06:34

Re: Flip clock pre pre pre pre release
 
Ok, it wasnt as hard as I thought...
I moved the general variables in _init (note for qwerty12: path compreso!).
I substitute the wav with something a bit more serious (and smaller).
I tested a bit the thing and seem working pretty flawless; the alarm works corretcly with the application minimized but obviously not when the clock is closed.
Until I dont learn a way to hildonize the <Unnamed> menus ill keep posting new icons to avoid a bit of confusion with different versions.
Version 005 will have the led flashing (seem pretty straighfor, thank qwerty for the link: seem possible to find everything on the ITT forum... :) ) and a working alarm display
https://garage.maemo.org/frs/downloa...ck004a.tar.bz2
https://garage.maemo.org/frs/downloa...k004a_ss01.jpg
https://garage.maemo.org/frs/downloa...9/ico64x64.png

qwerty12 2008-12-20 10:00

Re: Flip clock pre pre pre pre release
 
I'll package it (I promise) but I've just woken up and I need time to get around all the cool new files :D

gemniii42 2008-12-20 10:42

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by qwerty12 (Post 251090)
I'll package it (I promise) but I've just woken up and I need time to get around all the cool new files :D

C'mon qwerty12 - your slacking off! You used to package in your sleep!

anidel 2008-12-20 11:18

Re: Flip clock pre pre pre pre release
 
Is Nokia permitting the use of their logo into that?

qwerty12 2008-12-20 12:06

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by gemniii42 (Post 251097)
C'mon qwerty12 - your slacking off! You used to package in your sleep!

Hehe :P

Well, I can do it 3 hours after I've woken up it seems :D :

https://garage.maemo.org/frs/downloa...0.004a_all.deb

The packaging changes were vast because of the new python files etc but I packaged it :D

ciroip 2008-12-20 17:52

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by qwerty12 (Post 251115)
Hehe :P

Well, I can do it 3 hours after I've woken up it seems :D :

https://garage.maemo.org/frs/downloa...0.004a_all.deb

The packaging changes were vast because of the new python files etc but I packaged it :D

It is a pleasure to see the things packaged just after the morning coffe :) . Great Job qwerty12!
kudos, peace and love

ciroip 2008-12-20 18:06

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by anidel (Post 251101)
Is Nokia permitting the use of their logo into that?

well, daniel, I dont know if nokia is in the alarm clock business,
To me sound like opening a fish and chip shop and name it microsoft... :)

Beside jokes the clock is in a nokia controlled repository: in case we'll try to promote the application to maemo.org extra Im sure someone will notice that and, in case, ask to remove it.
Something similar happened on my theme and Quin Gil politely asked to remove the maemo.org logo.
Worste case scenario they ll ask to remove completely the app; that probably mean ill convert the thing is a vista widget; "the mokia flip clock vista widget " sound cool to me.
Anyway is just a dumb script with fun graphics, I just hope nokia people have enough sense of humor, I always supposed european companies were a bit more relaxed than the americans.

TrueJournals 2008-12-20 18:31

Re: Flip clock pre pre pre pre release
 
Well, a guy named Mike Rowe (no relation to the Dirty Jobs guy as far as I know), who was a programmer, did register the domain name mikerowesoft.com to promote his software. Microsoft ended up suing him because of the phonetic similarities, and they came to an out-of-court settlement (Wikipedia). Quite ridiculous if you ask me.

Anyway, I think Nokia will probably ask you to remove their logo from it, just because most companies don't want things that aren't associated with them to be associated with them. Who knows, though.

Anyway, I've been enjoying the flip clock. Keep up the good work!

Jaffa 2008-12-20 20:47

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by ciroip (Post 251189)
Beside jokes the clock is in a nokia controlled repository: in case we'll try to promote the application to maemo.org extra Im sure someone will notice that and, in case, ask to remove it.

Just remove the Nokia logo and prevent any worrying about it. maemo.org isn't Nokia controlled, anyway. It's community-controlled with Nokia just sponsoring it.

Sense of humour has nothing to do with it when it comes to trademarks.

Personally, less visual cruft and just being a simple, visually-appealing full-screen clock (which responds to power save events so can be kept running) is what I want to see from this app :-)

allnameswereout 2008-12-20 21:35

Re: Flip clock pre pre pre pre release
 
Just remove the logo. It isn't worth the hassle or discussion. It bears no use, and once Nokia is aware of it you waste 74.83 seconds of the legal team's time. ;)

tso 2008-12-20 21:45

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by TrueJournals (Post 251197)
Well, a guy named Mike Rowe (no relation to the Dirty Jobs guy as far as I know), who was a programmer, did register the domain name mikerowesoft.com to promote his software. Microsoft ended up suing him because of the phonetic similarities, and they came to an out-of-court settlement (Wikipedia). Quite ridiculous if you ask me.

he may have gotten away with it had it not been for the computer related stuff...

basically, trademarks can overlap as long as the companies do not deal in the same kind of biz.

thats why apple computers and apple records (beatles) can exist side by side (altho they have a history or arguments, but then steve jobs seems to love stepdancing on peoples toes, just check out the iphone naming dance)...

the tipping point is something like "reasonable chance of confusion" or some interesting legalese of that nature...

lcuk 2008-12-20 21:46

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by allnameswereout (Post 251256)
Just remove the logo. It isn't worth the hassle or discussion. It bears no use, and once Nokia is aware of it you waste 74.83 seconds of the legal team's time. ;)

which works out at €945,753.80

ciroip 2008-12-20 22:29

Re: Flip clock pre pre pre pre release
 
wow, I didnt think was so easy to lights up a flame...
I know is not a matter of sense of humor but I still like to think with a light heart about this kind of projects. The clock, like the theme I did before, is just a personal stunt; they made me know some cool people around and that is their biggest merit.
Anyway thanks to everyone for the comments, I always need different points of view and Ill probably remove the nokia refers from there. Im sure Ill can find some other topic to mock up and spicy a bit the thing.

ciroip 2008-12-20 22:43

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by Jaffa (Post 251232)
Just remove the Nokia logo and prevent any worrying about it. maemo.org isn't Nokia controlled, anyway. It's community-controlled with Nokia just sponsoring it.

Yep, I meant 'under the nokia radar' ( the italian word 'controllare' overlap the 2 english terms 'check on' and 'control') sorry for the confusion.

Quote:

Originally Posted by Jaffa (Post 251232)
Personally, less visual cruft and just being a simple, visually-appealing full-screen clock (which responds to power save events so can be kept running) is what I want to see from this app :-)

lol, I know, all my things end up looking like a mexican pinata, when Ill reach the final version Ill probably ask qwerty12 to 'deb' a serious allbusiness/noparty gray version.
For the power save event I have no idea what are you talking about and I have no clue how implement any powe save feature.
I was just thinking to save some graphic callings when the application is in background, anyway the thing have to check for the alarm in any case.

daperl 2008-12-20 23:09

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by ciroip (Post 251287)
lol, I know, all my things end up looking like a mexican pinata, when Ill reach the final version Ill probably ask qwerty12 to 'deb' a serious allbusiness/noparty gray version.

I vote for one version with as much user configurable stuff that you can jam in there. I definitely want a party/noparty check box. I have some wakeup alarm songs already picked out. Don't stop now; you're on fire!

allnameswereout 2008-12-21 01:53

Re: Flip clock pre pre pre pre release
 
ciroip its nothing personal to you, I appreciate your work very much! Its just, there are enough prior cases which prove they will complain once they know, it isn't worth the trouble it can cause, and because of the early stage it is easy to remove the logo with hardly anyone noticing, because hardly anyone uses it (for now!! ;) ).

ciroip 2008-12-21 03:51

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by allnameswereout (Post 251323)
ciroip its nothing personal to you, I appreciate your work very much! Its just, there are enough prior cases which prove they will complain once they know, it isn't worth the trouble it can cause, and because of the early stage it is easy to remove the logo with hardly anyone noticing, because hardly anyone uses it (for now!! ;) ).

I get this and I decided to follow your advice :).
Im pretty relaxed at this stage and sometime Im like a kid that push the parents patience just to know the limits...
thank you all for the suggestions and comments

nilchak 2008-12-21 04:21

Re: Flip clock pre pre pre pre release
 
Ciroip, while I love this clock app, I much preferred the earlier version with the larger display and small bar at the bottom (with logo on the bottom and no mood button on it).

That way the clock letters could be bigger.

I do very much appreciate the alarm function you put in. Could you in any way make the alarm sound louder a bit more ? My worry is that it is a bit on the low side (even with volume up to the top), that I may actually just sleep though it. And since there is no snooze function and repeat function (as yet), and the alarm lasts only for that 1 minute, a louder alarm might just work better.

But kudos to you for this simple but effective app.

ciroip 2008-12-21 05:52

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by nilchak (Post 251344)
Ciroip, while I love this clock app, I much preferred the earlier version with the larger display and small bar at the bottom (with logo on the bottom and no mood button on it).

That way the clock letters could be bigger.

I do very much appreciate the alarm function you put in. Could you in any way make the alarm sound louder a bit more ? My worry is that it is a bit on the low side (even with volume up to the top), that I may actually just sleep though it. And since there is no snooze function and repeat function (as yet), and the alarm lasts only for that 1 minute, a louder alarm might just work better.

But kudos to you for this simple but effective app.

Yes, since you are not the 1st to request the simple/bigger version (better know as the 'noparty' version) Ill make it to the next release. then, since both version will share the same code but with different graphics i will alternate it with the 'party' version so that I can have the 2 type pretty updated :).
Yes, the wav I used have the volume pretty low. I will test some different sounds each version, so the people who follow the project develop will have an idea of what will be the definitive.
More good news, I just tested that pygame support the mp3 (that library is amazing).

ciroip 2008-12-21 08:11

Re: Flip clock pre pre pre pre release
 
the project procede but now the application timing is getting a bit critical. I 'compressed' every function in the 1sec gap between each refresh and the clock became less responsive each new version.
I probably need a new way to manage the events. By now I m 'working' the new 'No party' version (just to keep me a bit motivate, the plastic fakewood version begin to became a bit boring...
https://garage.maemo.org/frs/downloa...5084/fondo.png


All times are GMT. The time now is 07:27.

vBulletin® Version 3.8.8