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)

WilsonBradley 2009-02-09 11:23

Re: Flip clock pre pre pre pre release
 
ciroip,

How did you get those custom Panel tabs on left side?

Rassilon7 2009-02-09 13:22

Re: Flip clock pre pre pre pre release
 
Someone please make a deb of this... pretty please!

jolouis 2009-02-09 16:19

Re: Flip clock pre pre pre pre release
 
ciroip, the progress looks awesome, can't wait to give the thing a try on my tablet here! Did you ever get around to solving the power issues (stop updating/etc when the tablet dims) or was that part of the battery monitoring stuff that you gave up on? Just curious...

In any event, awesome stuff, hope there's a final deb being released soon so everyone can enjoy this!

(and when's the "widget" based on this badboy for that new awesome looking liqbase coming out?? ;o) )

ciroip 2009-02-09 17:13

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by WilsonBradley (Post 263127)
How did you get those custom Panel tabs on left side?

Is part of the theme I made to 'match' a bit the clock's window mode (is a bit too uncomplete to made a deb out of that...maybe after Ill feel the clock complete I can spend a bit more time on that)

Quote:

Originally Posted by Rassilon7 (Post 263139)
Someone please make a deb of this... pretty please!

well, I would wait at least 1 week before beginning to beg qwerty12 to for a .deb. Im not such a great tester and Im not sure about some new issues that could show up and how it works on different tablets(led on n800, access to the OS wallpaper, writing permissions)...

Quote:

Originally Posted by jolouis (Post 263178)
ciroip, the progress looks awesome, can't wait to give the thing a try on my tablet here! Did you ever get around to solving the power issues (stop updating/etc when the tablet dims) or was that part of the battery monitoring stuff that you gave up on? Just curious...
[...]..

(and when's the "widget" based on this badboy for that new awesome looking liqbase coming out?? ;o) )

I just gave up :), I wasnt able to decide a definitive reliable (and simple ebough for me to understand) way to access that batteries numbers. The clock now check the time each 60 seconds (it have to compare it with the 'alarms set' anyway). Ill give a look at the canola sources to see how they managed the situtation (I want mess no more with root access and weird os call that works only on some tablet or with particular conditions) probably the pybatterystatus bar was the most complete piece of code to look at but is a bit too complex for me at the moment to completely grasp every aspect. Thanks to everyone for all the suggestions on the thread anyway, I learned a lot and tried as much solutions I was able to :)
In case someone have something to suggest should probably just take a look at the flipclock.py piece (where the actual main loop reside)
and see how put there some decent battery check to call the 'clock' functions. Anyway I dont think anyone is insane enough to wanted to mess with my messy codes.

liqbase: I salivate everytime I watch Gary's works. I really wish I could use some of his code, (or let him use something ) but I believe he is a perfectionist and he probably dont want release his beasts too early

jolouis 2009-02-09 21:46

Re: Flip clock pre pre pre pre release
 
Hey Ciro,
Just been playing around with your latest build, fc99, and it's pretty awesome. A few points... I did go digging around in your code (yea, it's messy, but not IMPOSSIBLE ;-) ), as I noticed your were updating the clock display every 10 seconds which was wasting CPU:
in ci_init.py, you had
Code:

pygame.time.set_timer(CLOCK_EVENT, 10000)  # Main LOOP 'trigger event' each 60 secs
last time I looked 10,000 milliseconds != 60 seconds ;-) Anyways, not sure why you went to that approach instead of the more accurate one suggested earlier:

Code:

ctime = time.ctime()
pygame.time.set_timer(CLOCK_EVENT, (60-int(str(ctime[17])+str(ctime[18])))*1000)

And then update the main loop in flipclock.py to recalculate the next time needed to redraw to be more accurate:
Code:

elif event.type == ci.CLOCK_EVENT:
                        #######################  UPDATE ###############
                        # And again, here clear the old timer, and update it after clock redraw to make sure it occurs
                        # again at exactly the right time
                        #Clear the current timer
                        ci.pygame.time.set_timer(ci.CLOCK_EVENT, 0)
                       
                        ci_clock.clock()
                 
                        #OK, update has done, so recalculate time till next minute and use that to set next event
                        ctime = time.ctime()
                        ci.pygame.time.set_timer(ci.CLOCK_EVENT, (60-int(str(ctime[17])+str(ctime[18])))*1000)
                        ###################### DONE  UPDATE #############

(don't forget to "import time" at the top of the flipclock.py file to make sure the calls work). Anyways, maybe there's some reason not to use that code, but with it in place CPU use is 1/6th of what it was and clock/alarm is just as accurate.

I'm working on the device state code, it's pretty straight forward (tz1 figured it out for the python status bar applet, same concept goes here) but have to spend some time to make it work (figure out what needs to run and what doesn't based on device state). I'll let you know once I get it sorted out hopefully in the next day or so.

lcuk 2009-02-09 21:59

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by ciroip (Post 263189)

liqbase: I salivate everytime I watch Gary's works. I really wish I could use some of his code, (or let him use something ) but I believe he is a perfectionist and he probably dont want release his beasts too early

not a perfectionist, I just make sure I can handle everything required first.
The little clock you see on the video is actually called "ciroclock.c" in source here.

It will be filled up with your data and stuff and will be your own personalized example of using liqbase :)

ciroip 2009-02-10 01:17

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by jolouis (Post 263282)
Hey Ciro,
, as I noticed your were updating the clock display every 10 seconds which was wasting CPU:
in ci_init.py, you had
Code:

pygame.time.set_timer(CLOCK_EVENT, 10000)  # Main LOOP 'trigger event' each 60 secs
last time I looked 10,000 milliseconds != 60 seconds ;-) Anyways, not sure why you went to that approach instead of the more accurate one suggested earlier:
[...]

I keep changing the update time for a faster debug and I keep forget to reset to 60 before upload in garage :(.
I dont always follow the suggestions because Im a goat. I set the priority to other parts of the code and I forget the core (anyway the clock+alarm is just an excuse to play with python and graphic :) ).

I warned about the code quality... I beginned to feel guilty about when qwerty had to touch it to adapt for the .deb. I really need someone that keep an eye on the important part of the thing :)

ciroip 2009-02-10 01:42

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by lcuk (Post 263287)
not a perfectionist, I just make sure I can handle everything required first.
The little clock you see on the video is actually called "ciroclock.c" in source here.

It will be filled up with your data and stuff and will be your own personalized example of using liqbase :)

Finally I found someone that write that clock for me :)
[reading the very 1st post of this thread]
http://www.internettablettalk.com/fo...ad.php?t=25582
Let me know if u need different resolutions, or more frame for the animations or whatever.

Im working to 'pimp' a bit the clock building some eyecandies:
it seem they can work decently even in python.
Could they make sense for something a bit more ambitious?
A collections of themable finger friendly animated gadgets (with transparencies, sound, cinetics, etc) heavely connected with the code (a step a bit above over the usual 2 state bitmap): again python seem perfect for prototyping things like these, then a serious programmer (I hear in uk there are this kind of animals) could just port the code in c and use the graphics:
https://garage.maemo.org/frs/downloa...48/gadgets.jpg
https://garage.maemo.org/frs/downloa...47/gadgets.tgz

ciroip 2009-02-15 00:09

Re: Flip clock pre pre pre pre release
 
Finally used the jolouis's suggestions for the clock update.
Trying 2 versions of the new slide button for the alarm switch
1 in full screen (sliding with snaps)
1 in window mode (just on - off)
I personally prefer the 1st version but could be a bit tricky sometime (that maybe is not bad in this case to avoid false engaging...)
https://garage.maemo.org/frs/download.php/5489/fc10.tgz

http://files.myopera.com/ciroip/albums/695073/fc10.jpg

like usual: happy sunday

ciroip 2009-02-17 21:26

Re: Flip clock pre pre pre pre release
 
Ok, my kung fu is growing. Now thanks to Kerthan's pypackager I can nearly manage the .deb beast.
https://garage.maemo.org/frs/downloa....1.0.armel.deb

qole 2009-02-17 22:11

Re: Flip clock pre pre pre pre release
 
I love pypackager too, I wish Khertan had kept developing it.

EDIT: I use it to package all my stuff, including Easy Debian... :)

BrentDC 2009-02-17 22:13

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by qole (Post 265209)
I love pypackager too, I wish Khertan had kept developing it.

Ditto. That's how I packaged up Quick Clip.

Tabster 2009-02-17 23:36

Re: Flip clock pre pre pre pre release
 
I just tried this for the first time. I was not able to find the pygame dependency though. I thought it was in Maemo Extras but I don't see it there.

any hints?

Tabster 2009-02-18 01:09

Re: Flip clock pre pre pre pre release
 
I ended up installing maemo-python-device-env
to get the pygame component.

Then I could install from the deb in post 1 (version 0.1.0)

The first time I ran it I got a few errors
"Can't read the user wallpaper"
"unable to save the user config" (or something like that)
then it crashed.
I ran it a few more times and now the only error I get is
"Can't read the user wallpaper"
everytime I launch it.
It does now seem to save my settings after restarts.

ciroip 2009-02-18 07:44

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by Tabster (Post 265249)
I just tried this for the first time. I was not able to find the pygame dependency though. I thought it was in Maemo Extras but I don't see it there.

I thought was there too :(
The cleaneast and easier solution I found is to install an application already in the repository that use python and pygame like solarwolf. If the clock will ever reach the extras the application manager should take care of the dependencies
Quote:

Originally Posted by Tabster (Post 265249)
I ended up installing maemo-python-device-env
to get the pygame component.

Then I could install from the deb in post 1 (version 0.1.0)

The first time I ran it I got a few errors
"Can't read the user wallpaper"
"unable to save the user config" (or something like that)
then it crashed.
I ran it a few more times and now the only error I get is
"Can't read the user wallpaper"
everytime I launch it.
It does now seem to save my settings after restarts.

These are NOT errors: are FEATURES :p
Since the application is not 100% complete I want notify what is going on (using the very convenient
Code:

osso_c = osso.Context("osso_test_note", "0.0.1", False)
for some 'except' in the code):
- The 1st time the application create the .flipclock.conf under the user path (try to delete it under /home/user if you want see that notify again :)).
- I knew that using the user wallpaper would end in a mess: I'll try to take a look before trash that feature (anyway the clock just wanted to use the user background image for the window mode (slide down on the main clock screen) and under the about screen: In case the app could not find the wallpaper I manage to use the color from the mood).
Thank You for the feedback

Didge 2009-02-18 08:33

Re: Flip clock pre pre pre pre release
 
I just installed the last Deb, ciroip you are a genius!!! Realy great.
Will test it tomorrow in the morning, also testing the women acceptance factor. :-)

ciroip 2009-02-18 09:15

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by Didge (Post 265322)
Will test it tomorrow in the morning, also testing the women acceptance factor. :-)

lol, I dont think the application will have this huge success on women and the n810 is everything but sexy: maybe with the pink mood and with a softer ringertones... anyway since Im a graphic guy (and packaging with pypackager is a breeze) Ill probably do a lessgeek version: originally I was thinking to use a flickr account and some facebook notify for the window mode: that will probably make the app a bit more appealing.
I guess the WAF is pretty low for 99% of the entire tablet applications 'panorama' anyway; developers: more lolcatz and hellokitty themed applications

Tabster 2009-02-18 12:41

Re: Flip clock pre pre pre pre release
 
thanks for the explanation ciroip.

My background is in the Images folder rather than using one of the built-in from a theme. Maybe you can search this folder too?

A suggestion: Can you make the date have a large day rather than year? I would much rather see

Wed - 2009
Feb - 18

Thanks for the great app :)

jolouis 2009-02-18 16:15

Re: Flip clock pre pre pre pre release
 
Yea forgot to mention last time in my post about the clock updates ciroip, I fixed the user background thing too because it didn't work for me; anyone who's got "user background not found" error, just open up ci_init.py, and somewhere around line 83 it reads:
Code:

    config.read (userpath+"/.osso/hildon-desktop/home-background.conf")
    userbg = config.get("Hildon Home", "BackgroundImage")

Right after that just add:
Code:

    #fix reading background file for absolute file locations
    userbg = userbg.replace("file://", "")

That'll fix it. If you use a background that's not in the default directory, it's stored in the config file as "file:///path/to/image", so this just strips that initial file:// off to make it work properly.

Is there supposed to be an actual clock display in "Window" mode by the way? I see the layout and alarm info, but no actual clock...

fpp 2009-02-18 17:07

Re: Flip clock pre pre pre pre release
 
ciroip, have you seen the recent announcement on planet maemo about the new "debmaster" for maemo.org ? That guy is a packaging guru and he's here specifically to help out community developers with that black magic stuff...

ciroip 2009-02-18 17:20

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by Tabster (Post 265345)
thanks for the explanation ciroip.

My background is in the Images folder rather than using one of the built-in from a theme. Maybe you can search this folder too?

A suggestion: Can you make the date have a large day rather than year? I would much rather see

Wed - 2009
Feb - 18

Thanks for the great app :)

The idea was to use the wallpaper that people actually using and go directly for that (i hate the applications that begin to scan my devices :) ) Ill check the solution that seem jolouis found.
Date: sure, showing the month and year bigger is pretty stupid but sometime happen that u cane see something always in front of you :)
Ill swap the sizes.

ciroip 2009-02-18 17:28

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by jolouis (Post 265380)

Is there supposed to be an actual clock display in "Window" mode by the way? I see the layout and alarm info, but no actual clock...


Ill check your suggestions on the wallpaper: onj my device the actual user background is under a directory of the user. Anyway is time to reflash the tablet to clean it up a bit so I can check where this damn wallpaper is stored :)

[window mode]: well, im not sure what put there, I just wanted not force people to keep the application in full window all the time and still be able to turn on and off the alarm. Now I use the window title for that (just because I thinked was cool to use that space in some creative way) but any idea for that window mode is appreciate.

ciroip 2009-02-18 17:37

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by fpp (Post 265393)
ciroip, have you seen the recent announcement on planet maemo about the new "debmaster" for maemo.org ? That guy is a packaging guru and he's here specifically to help out community developers with that black magic stuff...

yes, I saw him but my code is pretty ugly and I dont want bore him with something that probably will change every day in an irrational way (yes, that's me) and I want at least understand a bit better what is going on during a packaging to avoid dumb errors.
Meanwhile I managed to debianize something by myself with pypackager: I will see how many tablet arounds Ill be able to crash before ask advice to Jeremiah.
Ill keep last version avaible on the 1st post of this thread:
http://www.internettablettalk.com/fo...ad.php?t=25582

nilchak 2009-02-19 11:55

Re: Flip clock pre pre pre pre release
 
Hi ciroip,

I gave your 'home made' deb a try and it works beautifully. Never crashed a thing.... so dont you worry.

I loved this 'made in china' version of flip clock. nice, efficient with just enough lightings and all that. Particularly loved the night light mode - since at night I leave my N810 on the charger is stays lit all night - hence night light mode is perfect.

Did I say perfect again ?

BTW how come the alarm screen is made in finland ? I liked your sense of homour with the made in china logo there. so much that I just woke up to flip clock alarm and am posting from bed now.

Nice app indeed. Whats the workbench screen for ? Maybe I might have missed a few posts on this thread where you explained.

ciroip 2009-02-19 12:29

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by nilchak (Post 265628)
Hi ciroip,

I gave your 'home made' deb a try and it works beautifully. Never crashed a thing.... so dont you worry.

I loved this 'made in china' version of flip clock. nice, efficient with just enough lightings and all that. Particularly loved the night light mode - since at night I leave my N810 on the charger is stays lit all night - hence night light mode is perfect.

Did I say perfect again ?

BTW how come the alarm screen is made in finland ? I liked your sense of homour with the made in china logo there. so much that I just woke up to flip clock alarm and am posting from bed now.

Nice app indeed ? Whats the workbench screen for ? Maybe I might have missed a few posts on this thread where u explained.

thank you for testin'it! About the workbench disk there is not too much to explain: I usually just put down some random things to make ever release a bit more interesting than a 'simple' code modify: more people than I originally hoped, followed and downloaded all the different releases and builded up this incredible (for me) thread: I thinked making every version a bit more spice to kill the bore of following a clock developing :).
Glad you enjoed the trip till now :)

jolouis 2009-02-19 18:30

Re: Flip clock pre pre pre pre release
 
One of the coolest things about following the development of this app is that at any stage you can jump in and start tweaking and playing with the code yourself to add new features and change things around. If they make sense and are "reasonably helpful" just keep bugging ciro about 'em and he might consider rolling it back into the "official clock" (it could happen... one day! lol)
Right now I've modified mine to have 12 hr AM/PM display instead of 24hour, and with a bit more tweaking should have it so that the colour of the "night mode" can be changed through the clock app (crazy alpha channels!). The two biggest points that need work as far as I'm concerned are:
Hildon Integration - This app would be a LOT cooler if you could use it, minimize it, etc without having to run from the command line. Not sure if the latest deb addresses this or not, but it's definitely something to be addressed
Alarm Intergration - I'm still looking to integrate this app with the build in alarmd functionality, so that you can use this to set alarms, and have the alarmd daemon trigger this application to launch and playback/visualize alarms. That way you don't have to have the app open all the time, or worry about accidentally closing it and missing your alarm. Not as important as teh Hildon stuff, but still...

nilchak 2009-02-19 18:59

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by jolouis (Post 265722)
just keep bugging ciro about 'em and he might consider rolling it back into the "official clock" (it could happen... one day! lol)
Right now I've modified mine to have 12 hr AM/PM display instead of 24hour,

Alarm Intergration - I'm still looking to integrate this app with the build in alarmd functionality, so that you can use this to set alarms, and have the alarmd daemon trigger this application to launch and playback/visualize alarms. That way you don't have to have the app open all the time, or worry about accidentally closing it and missing your alarm. Not as important as teh Hildon stuff, but still...


Ciroip - here I am bugging you - please please do incorporate jolouis's 12 hrs hack into your official version. Even I would love the 12 hr am/pm format - when I am nearly asleep at night (at 23:54 hrs) its tough for me to do mental arithmatic to translate that to 11:54 O-clock at night.
Seriously !
(and I half wake up with the effort of the mental calisthenics to do the arithmatic) :p

Jolouis - while the alarmd daemon does offer many benefits - you don't have to setup up seperate snooze reminders like in Flip clock now and the fact that it still wakes up the tablet even when switched off etc ... the one bug that puts me off is that on the 2nd snooze reminder Alarmd kills my sound totally. I have to reboot the tablet every morning to get my sound back.

At least in this regards Flip clock alarm does kill any system sounds or anything. So I am a bit ambivalent about the alarmd integration - as I want to get away from using alarmd (unless the problem is fixed).

danramos 2009-02-19 19:13

Re: Flip clock pre pre pre pre release
 
Much want for the 12hr format! Danke!

jolouis 2009-02-19 21:37

Re: Flip clock pre pre pre pre release
 
I'll clean up the code a bit and try and send Ciro a quick "how to patch" for the 12 hour stuff if he's interested... personally I prefer it to the 24 hour time, but there's no reason that there couldn't be an option for either.

As far as the Alarmd stuff goes, I think there's a bit of misunderstanding on what most of us see as "alarmd" compared to what alarmd actually is. My idea would be not for flipclock to simply schedule alarms (you could do that using the normal clock app); but rather to use flipclock to schedule alarmd "events" that will then trigger flipclock to re-act/play/display alarms. Functionally this provides two benefits: first, if you close flipclock for some reason, but had an alarm scheduled, when it's time for the alarm to occur flip clock would automatically open and start doing it's little music/flashing/whatever thing; the result would be the same, but the alarm would happen whether flipclock was open or not. Same deal goes for whether the tablet is on or not, etc.
Second key advantage to using alarmd in this way is that it means the regular flipclock app should be able to properly sleep/hibernate without having to have any processes running (since the alarmd daemon will handle notifying it of alarm times); this in turn should mean slightly better battery life, especially when using other apps that implement alarmd (rss reader, etc).
Again, not really horribly important, but a few nice little advantages...

ciroip 2009-02-19 22:55

Re: Flip clock pre pre pre pre release
 
well, sure I will put the 12/24 hours features: I know how hard is if you live in a country that never use the 24 hours convention (and have to daily manage 3 different timezones) :). I just never set the mind to find a cute spot for the AM/PM...
Ill take a look at the jolouis code to see if I can understand what to do (sometime I choosed some weird way to make that app running so I dont envy anyone who is brave enough to digg it).

Like nilchak pointed out the alarmd sometime is a bit tricky. The original idea was to use that and let all the responability to the OS but I was never be able to understand how things really worked (and felt challenging to make some noise by myself :).
Im still thinking to use the alarmd anyway but I must have a way to be able to check the status (and probably keep checking) I dont want the clock showing an icon of alarm on when the alarm is not really on.
Anyway I cant see why we cant have 2 different version: the tablet is a pretty extreme device and average user is probably smart enough to understand the difference between an alarmd based clock and a 'simple' direct alarmclock. The actual solution is not really ideal, the plan was to have a different alarm for each day + a general alarm but was a bit too brainy (even for me). Now there are just 7 different alarms to switch manually

Ill check the jolouis work then I could try to reorganize a bit the modules and make the alarm part more manageble (or I could reorganize the modules and let jolouis works on a bit, I have no clue of OO programming so the code is pretty horrid on that side)

The clock now is hildonized enough :) to be the able to:
- switch from full to window (need check how use the hardware butt.)
- show the icon on task bar and task menu (but no app. name there)
- recognize the hardware home/menu button
- show the clock and date on the title bar
- let the user close and minimize using the standard os buttons

ciroip 2009-02-20 03:19

Re: Flip clock pre pre pre pre release
 
nothing too exciting: just moved the mood to leave space for the future am/pm switch

https://garage.maemo.org/frs/downloa....1.1.armel.deb
http://files.myopera.com/ciroip/albu...ton-window.jpg

jolouis 2009-02-20 15:25

Re: Flip clock pre pre pre pre release
 
Latest stuff looks pretty awesome! And stop ragging about your code, yea it's not the cleanest stuff ever, but it's pretty easy to follow along with (hardest part for me is understanding your variable names/comments because they're all in Italian, but I've got most of it figured out now!).

As far as the AM/PM thing goes, there's a few changes, and obviously you can do the extra tweaks to add the button controls to the interface and things/update the graphics however you want, but the general concept is:

in ci_init.py, add an extra variable to be used as the toggle for 24 hour time or 12 hour time; I called mine "militaryTime", with 0 meaning 12hour format, and 1 meaning 24 hour.
Code:

################### ROB UPDATE ###############
militaryTime=0
################### DONE ROB UPDATE ##########

Then it's just a matter of updating your drawing functions. The drawnight, for example:
Code:

################### ROB UPDATE ###############
def drawnight():
  #Draw 12 Hour mode instead of 24 hour
  if (ci.militaryTime == 0):
        hours = (int(ci.orario[11]) * 10) + int(ci.orario[12])
        isPM = 0
        if (hours > 11):
                isPM = 1
        if (hours > 12):
                hours = hours - 12
       

        hoursStr = str(hours)
        if (hours < 10):
                hoursStr = "0" + hoursStr
       
        if (int(hoursStr[0]) > 0):
                ci.ni_screen.blit(ci.ni_numeri[int(hoursStr[0])], ci.ni_coords["ore_decine"])    #ORE    (11ma lettera)

               
        ci.ni_screen.blit(ci.ni_numeri[int(hoursStr[1])], ci.ni_coords["ore_unita"])
        ci.ni_screen.blit(ci.ni_numeri[int(ci.orario[14])], ci.ni_coords["minuti_decine"])  #MINUTI (14ma lettera)
        ci.ni_screen.blit(ci.ni_numeri[int(ci.orario[15])], ci.ni_coords["minuti_unita"])
        if ci.sw_help==1:    ci.cl_screen.blit(ci.gr_help[0],(210,120))
  else:
    ci.ni_screen.blit(ci.ni_numeri[int(ci.orario[11])], ci.ni_coords["ore_decine"])    #ORE    (11ma lettera)
    ci.ni_screen.blit(ci.ni_numeri[int(ci.orario[12])], ci.ni_coords["ore_unita"])
    ci.ni_screen.blit(ci.ni_numeri[int(ci.orario[14])], ci.ni_coords["minuti_decine"])  #MINUTI (14ma lettera)
    ci.ni_screen.blit(ci.ni_numeri[int(ci.orario[15])], ci.ni_coords["minuti_unita"])
    if ci.sw_help==1:    ci.cl_screen.blit(ci.gr_help[0],(210,120))
################### DONE ROB UPDATE ##########

It's pretty straight forward: basically you have an if statement that checks for 24 hour or 12 hour mode; if 12 hour mode (militaryTime == 0). If you're in 24 hour mode, then the code is your original stuff (all the stuff after the else statement). If you're in 12 hour mode, then it takes the 2 digit time (ci.orario[11] and ci.orario[12]) and converts them into the actual number (i.e. string "23" becomes int 23). Then, check to see if hours is > 11, in which case we know we're in PM (remember midnight = 00, so this works). Then, check to see if that number is larger than 12, and if it is, subtract 12 from it (thus 23 becomes 11). Finally, convert the number hours back into a string (hoursStr), and pad with a zero infront if necessary. Finally, do an if statement to see if we need to draw the first digit or not (you don't want the clock to show 02:45, it should just be 2:45). All the rest of the code is pretty straight forward.
The final detail is that you need to update the background image so that it doesn't have any digits on it (just blank spaces, or for the night BG, just black spaces instead of the 8's). Of course you also need to add a "am/pm" graphic to the display, but I figured I'd leave that up to your awesome designer abilities ;o)

I've updated my code since to put all that math in the main clock() function (that way you don't have to do it for each different clock mode), but it was easier to explain for just one mode. If you want to see the final changes just let me know, but it's really just a matter of moving the if statements and things.

ciroip 2009-02-20 18:00

Re: Flip clock pre pre pre pre release
 
great jolouis, Ill take a look after dinner and probably during the weekend Ill have enough time to fix up a bit of things.

sorry for the italian variables and comments but when I beginned the thing I really didn't think anyone could ever touch it beside me: at least I hope you learned some new curses...:o

Buon fine settimana a tutti.

ciroip 2009-02-22 04:06

Re: Flip clock pre pre pre pre release
 
Dawn Release:
FlipAlarmClock 0.1.2 Plankton with the 12/24 jolouis mod.
Seem working fine.
https://garage.maemo.org/frs/downloa....1.2.armel.deb
http://files.myopera.com/ciroip/albu...3/fc-0.1.2.jpg

I still have to decide what really do with the AM/PM thing but the function is there.
I cleanedup a bit the code (now is nearly a graphic library...ok not really) but I made a bit easier to add buttons and slides.
Thanks to jolouis for the military time code that saved me a bit of time; I think Im leaving only the '24 mode' for the alarm setting anyway.

Buonanotte

Rassilon7 2009-02-22 05:38

Re: Flip clock pre pre pre pre release
 
I am really loving the updated look and functionality. Is see that it now remembers alarm times between sessions. Is there any chance of getting it to remember what mode you prefer? I'm a 24 hour clock kinda guy!

Thanks again

Steve

yukop4 2009-02-22 06:44

Re: Flip clock pre pre pre pre release
 
it loads fine onto my n810 but when i try to open it in extras nothing happens-any help

mucho appreco

ciroip 2009-02-22 10:45

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by yukop4 (Post 266217)
it loads fine onto my n810 but when i try to open it in extras nothing happens-any help

mucho appreco

if is the 1st version you install is probably because you dont have the pygame lib installed (I removed the dependence tag because I wanted check different versions and inever set back properly the .deb).
Anyway installing 'solarwolf' (a game with the proper installation process) should fix that.

If it is not the 1st version and other versions worked could be someething in the .flipclock.conf under /home/user. Deleting it should help.

To have the real error anyway you should try to open the X terminal and launch the clock with
Code:

flipclock
paste here the result in case any ov the above idea worked out for you.
thank you for spendig time on this :)

@Rassilon7/steve
yes, the idea will be to save the 'mode setting' and 'alarm status' in .flipclock.conf: Like usual I just rush the .deb (still need to decide where put the am/pm and make a new graphic for the mode slide).
Buona Domenica

yukop4 2009-02-22 19:48

Re: Flip clock pre pre pre pre release
 
downloaded solarwolf-works perfectly-impressive app

ciroip 2009-02-22 22:39

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by yukop4 (Post 266297)
downloaded solarwolf-works perfectly-impressive app

Im sorry to make you download another app just for testing the clock but I still dont know any easier way to install the pygame.
Glad you liked anyway

BrentDC 2009-02-22 23:06

Re: Flip clock pre pre pre pre release
 
Quote:

Originally Posted by ciroip (Post 266327)
Im sorry to make you download another app just for testing the clock but I still dont know any easier way to install the pygame.

This it?

http://repository.maemo.org/extras/p...sso2_armel.deb


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

vBulletin® Version 3.8.8