Notices


Reply
Thread Tools
ciroip's Avatar
Posts: 334 | Thanked: 366 times | Joined on Nov 2008 @ Italy
#231
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
__________________
I can't do it. No one can help.
[SIGPIC][/SIGPIC]

Flip Alarm Clock - 3DMania Theme - Synesthesia - Deluxepain
http://ciroip.blogspot.com/
http://twitter.com/ciroippolito
 

The Following User Says Thank You to ciroip For This Useful Post:
Posts: 631 | Thanked: 837 times | Joined on May 2007 @ Milton, Ontario, Canada
#232
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.
 

The Following 3 Users Say Thank You to jolouis For This Useful Post:
ciroip's Avatar
Posts: 334 | Thanked: 366 times | Joined on Nov 2008 @ Italy
#233
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...

Buon fine settimana a tutti.
__________________
I can't do it. No one can help.
[SIGPIC][/SIGPIC]

Flip Alarm Clock - 3DMania Theme - Synesthesia - Deluxepain
http://ciroip.blogspot.com/
http://twitter.com/ciroippolito
 

The Following 2 Users Say Thank You to ciroip For This Useful Post:
ciroip's Avatar
Posts: 334 | Thanked: 366 times | Joined on Nov 2008 @ Italy
#234
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


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
__________________
I can't do it. No one can help.
[SIGPIC][/SIGPIC]

Flip Alarm Clock - 3DMania Theme - Synesthesia - Deluxepain
http://ciroip.blogspot.com/
http://twitter.com/ciroippolito
 

The Following 5 Users Say Thank You to ciroip For This Useful Post:
Rassilon7's Avatar
Posts: 220 | Thanked: 41 times | Joined on Oct 2008
#235
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
 

The Following User Says Thank You to Rassilon7 For This Useful Post:
Posts: 336 | Thanked: 47 times | Joined on Jul 2008
#236
it loads fine onto my n810 but when i try to open it in extras nothing happens-any help

mucho appreco
 
ciroip's Avatar
Posts: 334 | Thanked: 366 times | Joined on Nov 2008 @ Italy
#237
Originally Posted by yukop4 View Post
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
__________________
I can't do it. No one can help.
[SIGPIC][/SIGPIC]

Flip Alarm Clock - 3DMania Theme - Synesthesia - Deluxepain
http://ciroip.blogspot.com/
http://twitter.com/ciroippolito

Last edited by ciroip; 2009-02-22 at 11:18.
 

The Following User Says Thank You to ciroip For This Useful Post:
Posts: 336 | Thanked: 47 times | Joined on Jul 2008
#238
downloaded solarwolf-works perfectly-impressive app
 

The Following User Says Thank You to yukop4 For This Useful Post:
ciroip's Avatar
Posts: 334 | Thanked: 366 times | Joined on Nov 2008 @ Italy
#239
Originally Posted by yukop4 View Post
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
__________________
I can't do it. No one can help.
[SIGPIC][/SIGPIC]

Flip Alarm Clock - 3DMania Theme - Synesthesia - Deluxepain
http://ciroip.blogspot.com/
http://twitter.com/ciroippolito
 

The Following User Says Thank You to ciroip For This Useful Post:
BrentDC's Avatar
Posts: 903 | Thanked: 632 times | Joined on Apr 2008
#240
Originally Posted by ciroip View Post
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
 

The Following User Says Thank You to BrentDC For This Useful Post:
Reply

Tags
clock, flip clock


 
Forum Jump


All times are GMT. The time now is 13:35.