forked from enlightenment/enlightenment
- new look for clock (clock2.fe)
- old look still default, read README to see how to change SVN revision: 5934
This commit is contained in:
parent
3f4ec34adf
commit
e3b4c7e88a
|
@ -0,0 +1,12 @@
|
|||
This directory contains the following epplets:
|
||||
- clock.fe
|
||||
- large time-only display
|
||||
- clock2.fe
|
||||
- more graphical clock display with date as well as time
|
||||
|
||||
To use these epplets, simply copy this directory to ~/.e/desktop/default/.e_epplets. This will show clock.fe by default. In order to use clock2.fe, simply rename clock2.fe to clock.fe.
|
||||
|
||||
Thanks to:
|
||||
- Brian Mattern for helping me get started
|
||||
- Thibaud for the clock2 background graphic
|
||||
- The graphic is from his Saona theme (http://www.deviantart.com/deviation.php?id=73252) for HoverDesk
|
|
@ -21,7 +21,7 @@ function clock_update(object data, number val){
|
|||
string seconds = String.copySection(time,6,8);
|
||||
string timeofday = "AM";
|
||||
|
||||
if(hour > 12 || hour==12){
|
||||
if(hour=>12){
|
||||
timeofday = "PM";
|
||||
hour -= 12;
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ function clock_update(object data, number val){
|
|||
|
||||
/* declare vars */
|
||||
object clock;
|
||||
object ebits;
|
||||
|
||||
/* create a new epplet */
|
||||
epp = new Epplet();
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
/*-------------------------------------------------------*
|
||||
* Simple clock epplet *
|
||||
* by Brendon Davidson *
|
||||
* Thanks to Brian Mattern for helping me understand *
|
||||
* how epplets work. *
|
||||
*-------------------------------------------------------*/
|
||||
|
||||
uses String, Time;
|
||||
|
||||
/* global vars */
|
||||
global {
|
||||
object epp;
|
||||
object dateObj;
|
||||
string theDay = "";
|
||||
}
|
||||
|
||||
/* function to update time display */
|
||||
function time_update(object data, number val){
|
||||
string date = Time.ctime(Time.time());
|
||||
string month = String.copySection(date,4,7);
|
||||
string day = String.copySection(date,8,10);
|
||||
string time = String.copySection(date,11,20);
|
||||
number hour = String.toLong(String.copySection(time,0,2));
|
||||
string min = String.copySection(time,3,5);
|
||||
string seconds = String.copySection(time,6,8);
|
||||
string timeofday = "AM";
|
||||
|
||||
if(hour>12||hour==12){
|
||||
timeofday = "PM";
|
||||
hour = hour - 12;
|
||||
}
|
||||
if(hour==0) hour = 12;
|
||||
|
||||
|
||||
/* Is it time to update the date? */
|
||||
if(day!=theDay){
|
||||
theDay = day;
|
||||
switch(month){
|
||||
case "Jan":
|
||||
month = "January";
|
||||
break;
|
||||
case "Feb":
|
||||
month = "February";
|
||||
break;
|
||||
case "Mar":
|
||||
month = "March";
|
||||
break;
|
||||
case "Apr":
|
||||
month = "April";
|
||||
break;
|
||||
case "Jun":
|
||||
month = "June";
|
||||
break;
|
||||
case "Jul":
|
||||
month = "July";
|
||||
break;
|
||||
case "Aug":
|
||||
month = "August";
|
||||
break;
|
||||
case "Sep":
|
||||
month = "September";
|
||||
break;
|
||||
case "Oct":
|
||||
month = "October";
|
||||
break;
|
||||
case "Nov":
|
||||
month = "November";
|
||||
break;
|
||||
case "Dec":
|
||||
month = "December";
|
||||
break;
|
||||
}
|
||||
dateObj.setText(month+" "+day+", 2002");
|
||||
}
|
||||
|
||||
|
||||
data.setText(""+hour+" "+min+" "+seconds+" "+timeofday);
|
||||
epp.addTimer("clockTimer",0.5,"time_update",0,data);
|
||||
}
|
||||
|
||||
/* main function */
|
||||
|
||||
/* declare vars */
|
||||
object timeObj;
|
||||
object backgroundObj;
|
||||
|
||||
/* create a new epplet */
|
||||
epp = new Epplet();
|
||||
|
||||
/* move the epplet to desired position*/
|
||||
epp.move(epp.getViewW() - 250, 2);
|
||||
epp.resize(100, 30);
|
||||
|
||||
/* create background image object for clock */
|
||||
backgroundObj = new EvasObject(epp);
|
||||
backgroundObj.addImage("clockbg.png");
|
||||
backgroundObj.move(epp.getX(),epp.getY());
|
||||
backgroundObj.setLayer(9998);
|
||||
backgroundObj.show();
|
||||
|
||||
/* create text object for clock display */
|
||||
timeObj = new EvasObject(epp);
|
||||
timeObj.addText("borzoib",6,"Hi");
|
||||
timeObj.move(epp.getX()+epp.getW()-40, epp.getY()+4);
|
||||
timeObj.setLayer(9999);
|
||||
timeObj.setColor(0,0,0,140);
|
||||
timeObj.show();
|
||||
|
||||
/* create text object for date display */
|
||||
dateObj = new EvasObject(epp);
|
||||
dateObj.addText("borzoib",6,"Hello");
|
||||
dateObj.move(epp.getX()+epp.getW()-60,epp.getY()+12);
|
||||
dateObj.setLayer(9999);
|
||||
dateObj.setColor(0,0,0,140);
|
||||
dateObj.show();
|
||||
|
||||
/* update clock display */
|
||||
time_update(timeObj,0);
|
||||
|
||||
|
||||
|
||||
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in New Issue