You are not logged in.
but please by no means hold me to that statement.
hammer - nail - foot ... HUH!
RUUUUN! His wife is coming and that's a BIG broom!
Take your time, no punch clock here, a master should never be pressured.
Last edited by Sector11 (2014-01-17 13:18:02)
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
BTW, I missed changing a couple of: /home/'..username..'/wun/ to /media/5/Conky/wun-v1/ that's why it didn't work ... running smooth now.
Opinion: that complete thing would be nice as a variable, not just 'username'. So when it's changed, it's changed everywhere in the script.
my initial intention was that users shouldn't ever have to open and edit the main wun.lua script
and for most people , as long as the wun folder is in the hole directory, it shouldnt need to be edited
have you tried the script unedited to see if it detects your username?
if there was going to be an option to set path to wun folder it would have to be in the wun.lua script
Offline
Peachy Hmmmm.. bargraph.lua.. I have about 6 interactive conkys with that lovely script. I will have to break those out when I have time. I don't think that you have seen them all.
S11.. A broom... if you would be so lucky!
Also S11 if you are looking to add an easy editable path within your
weather.lua
iweather.lua
you can do something like this..
--PATH TO FILE #############################################
ptf="/home/username/path/to/file
--#########################################################
and use it like so
image({x=10,y=10,w=10,h=10,file=ptf})
This is very useful if you use this location several times.
Last edited by falldown (2014-01-17 17:42:19)
Peachy's Wun Lua / Peachy's v9000 / Conky PitStop / My DA Page
........
Offline
@mrpeachy
I could really get to liking this.
Two small problems I haven't been able to figure out the wedge in the boarder above January (it appears at anything above sw=200) and now.wind_icon doesn't appear. Strange thing is day[1].avewind_icon will work and hour[1].wind_icon will work. I haven't made any changes to gradrec.lua and here's my template
--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION-
_G.weather_script = function(update,time,now,text_forecast,day,hour)--#### DO NOT EDIT THIS LINE ##############
--#######################################################################
--these tables hold the coordinates for each repeat do not edit #########
top_left_xcoordinate={}--################################################
top_left_ycoordinate={}--################################################
--#######################################################################
--SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
default_font="Liberation Sans"--font must be in quotes
default_font_size=12
default_face="normal"
default_color=0xffffff--white
default_alpha=1--fully opaque
default_image_width=50
default_image_height=50
--END OF DEFAULTS #######################################################
--#########################################################################
--START WEATHER DATA
out({a=1,fs=14,x=15,y=35,txt=os.date("%A").." "..os.date("%B").." "..os.date("%d").." "..os.date("%G")})
out({a=1,fs=12,x=15,y=50,txt="Last Update at "..update.hour_12..":"..update.min.." "..update.ampm.." CST "})
out({a=1,fs=25,x=15,y=75,txt=now.conditions})
image({x=195,y=30,h=75,w=75,file=now.weather_icon})
gap=16
ypos=75+gap
out({a=1,fs=12,x=15,y=ypos,txt="Temp: "..now.temp_imperial..now.temp_imperial_unit})
out({a=1,fs=12,x=120,y=ypos,txt="Feels: "..now.feelslike_imperial..now.feelslike_imperial_unit})
ypos=ypos+gap
out({a=1,fs=12,x=15,y=ypos,txt="High: "..day[1].high_imperial..day[1].high_imperial_unit})
out({a=1,fs=12,x=120,y=ypos,txt="Low: "..day[1].low_imperial..day[1].low_imperial_unit})
ypos=ypos+gap
out({a=1,fs=12,x=15,y=ypos,txt="Hum: "..now.humidity.."%"})
out({a=1,fs=12,x=120,y=ypos,txt="Dew: "..now.dewpoint_imperial..now.dewpoint_imperial_unit})
ypos=ypos+gap
out({a=1,fs=12,x=15,y=ypos,txt="Vis: "..now.visibility_imperial..now.visibility_imperial_unit})
out({a=1,fs=12,x=120,y=ypos,txt="Bar: "..now.pressure_imperial..now.pressure_imperial_unit})
ypos=ypos+gap
out({a=1,fs=12,x=15,y=ypos,txt="Wind: "..now.wind_imperial..now.wind_imperial_unit})
out({a=1,fs=12,x=120,y=ypos,txt=now.wind_dir})
ypos=ypos+gap
out({a=1,fs=12,x=15,y=ypos,txt="Gusts: "..now.wind_gust_imperial..now.wind_gust_imperial_unit})
image({x=220,y=ypos-40,h=40,w=40,file=now.wind_icon})
ypos=ypos+gap
wrapy=out({wrap_len=45,wrap_gap=15,fs=12,x=15,y=ypos+5,txt=text_forecast[1].fctext_imperial})
--END WEATHER DATA--]]
--BIG FILLED IN RECTANGLE
tlx,tly=10,15
cra=10
sw=250
sh=200
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=sh},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-sh},
{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0xffffff,a=0.1,p=0},{c=0xffffff,a=0.0,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
--HIGHLIGHT TOP RECTANGLE
cra=cra
sw=250
sh=90
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=sh},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-sh},
{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0xffffff,a=0.5,p=0.1},{c=0xffffff,a=0.05,p=0.9}},
lw=1,
sub=1,
db=0,
subtab=subtab})
--OUTLINE
lt=2--line thickness
tlx,tly=tlx-lt,tly-lt
cra=cra
cra1=cra+lt
sw=250
sh=200
subtab={
{d="start",x=tlx+cra1+50,y=tly},
{d="rline",x=sw-50,y=0},
{d="arc_c",q=1,r=cra1,degs=90},
{d="rline",x=0,y=sh},
{d="arc_c",q=2,r=cra1,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra1,degs=90},
{d="rline",x=0,y=-sh},
{d="arc_c",q=4,r=cra1,degs=90},
{d="rline",x=50,y=0},
{d="rline",x=0,y=lt},
{d="rline",x=-50,y=0},
{d="arc_a",q=4,r=cra,degs=90},
{d="rline",x=0,y=sh},
{d="arc_a",q=3,r=cra,degs=90},
{d="rline",x=sw,y=0},
{d="arc_a",q=2,r=cra,degs=90},
{d="rline",x=0,y=-sh},
{d="arc_a",q=1,r=cra,degs=90},
{d="rline",x=-150,y=0},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0xffffff,a=1,p=0},{c=0x505050,a=1,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
--########################################################################################
--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--########################################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################
Any tips would be greatly appreciated.
A person who has a cat by the tail knows a whole lot more about cats than someone who has just read about them.
Mark Twain
Offline
@mrpeachy
I could really get to liking this.![]()
http://ccs-wtn.com/webimg/gradrec_tmb.jpg
Two small problems I haven't been able to figure out the wedge in the boarder above January (it appears at anything above sw=200) and now.wind_icon doesn't appear. Strange thing is day[1].avewind_icon will work and hour[1].wind_icon will work. I haven't made any changes to gradrec.lua and here's my template
Any tips would be greatly appreciated.
for the icon try this
just above your image call to the icon put this line
print (now.wind_icon)
take a look at the terminal and see what it says then see if that file exists
it may be that there is a typo in the name of a specific wind icon
for the wedge, that is because you have something off in your settings so that the line is not meeting up exactly with where it started..
my mistake, this line
{d="rline",x=-150,y=0},
is hard coded rather than calculating off the setting for sw
change to:
{d="rline",x=-(sw-50),y=0},
Offline
re grec settings for glassy boxes
i found there were some mistakes in how i had set it up
i fixed it and turned the code into a function:
function glassybox(tlx,tly,cra,sw,sh)
sho=sh
sw=sw-cra-cra
sh=sh-cra-cra
--BIG FILLED IN RECTANGLE
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=sh},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-sh},
{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0xffffff,a=0.1,p=0},{c=0xffffff,a=0.0,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
--HIGHLIGHT TOP RECTANGLE
shh=((80/150)*sho)-cra-cra
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=shh},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-shh},
{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=shh+cra+cra,
grad={{c=0xffffff,a=0.6,p=0},{c=0xffffff,a=0.1,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
--OUTLINE
lt=2
tlx,tly=tlx-lt,tly-lt
cra1=cra+lt
subtab={
{d="start",x=tlx+cra1,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra1,degs=90},
{d="rline",x=0,y=sh},
{d="arc_c",q=2,r=cra1,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra1,degs=90},
{d="rline",x=0,y=-sh},
{d="arc_c",q=4,r=cra1,degs=90},
{d="rline",x=sw,y=0},
{d="rline",x=0,y=lt},
{d="rline",x=-sw,y=0},
{d="arc_a",q=4,r=cra,degs=90},
{d="rline",x=0,y=sh},
{d="arc_a",q=3,r=cra,degs=90},
{d="rline",x=sw,y=0},
{d="arc_a",q=2,r=cra,degs=90},
{d="rline",x=0,y=-sh},
{d="arc_a",q=1,r=cra,degs=90},
{d="rline",x=-sw,y=0},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0xffffff,a=1,p=0},{c=0x505050,a=1,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
end
put it at the very top of the weather template BEFORE thes lines
paste function here!
--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION-
_G.weather_script = function(update,time,now,text_forecast,day,hour)--#### DO NOT EDIT THIS LINE ##############
then use it within the weather script like this
tlx=5--top left x
tly=20--top left y
cra=30--corner radius
sw=260--total width, including corners
sh=200--total height including corners
glassybox(tlx,tly,cra,sw,sh)--calls function and sends variables
Last edited by mrpeachy (2014-01-17 21:14:13)
Offline
@mrpeachy
Turning the code into a function worked perfectly.
When I put this
print (now.wind_icon)
above the image call, i get this in a terminal
joe@crunchbang:~$ conky -c ~/wun/wunrc
Conky: desktop window (155) is root window
Conky: window type - normal
Conky: drawing to created window (0x2800001)
Conky: drawing to double buffer
pinging www.wunderground.com
wunderground ping test passed
data url= http://api.wunderground.com/api/"my key"/conditions/forecast10day/astronomy/hourly/lang:EN/q/38343.json
processed text data for 20 time periods, padded 0
processed data for 10 days, padded 0
processed data for 36 hours, padded 0
weather data processed
pinging www.usno.navy.mil
www.usno.navy.mil ping test passed
processed data for 10 days, padded 0
done!
/home/joe/wun/additional_files/weathericons/wind/green_360.png
/home/joe/wun/additional_files/weathericons/wind/green_360.png
/home/joe/wun/additional_files/weathericons/wind/green_360.png
/home/joe/wun/additional_files/weathericons/wind/green_360.png
/home/joe/wun/additional_files/weathericons/wind/green_360.png
/home/joe/wun/additional_files/weathericons/wind/green_360.png
/home/joe/wun/additional_files/weathericons/wind/green_360.png
/home/joe/wun/additional_files/weathericons/wind/green_360.png
/home/joe/wun/additional_files/weathericons/wind/green_360.png
/home/joe/wun/additional_files/weathericons/wind/green_360.png
/home/joe/wun/additional_files/weathericons/wind/green_360.png
/home/joe/wun/additional_files/weathericons/wind/green_360.png
/home/joe/wun/additional_files/weathericons/wind/green_360.png
/home/joe/wun/additional_files/weathericons/wind/green_360.png
/home/joe/wun/additional_files/weathericons/wind/green_360.png
/home/joe/wun/additional_files/weathericons/wind/green_360.png
I also noticed when I had this in my iweather.lua template
out({a=1,fs=12,x=115,y=ypos,txt=now.wind_degrees.."°"})
it always printed 360°.
Hope this helps.
A person who has a cat by the tail knows a whole lot more about cats than someone who has just read about them.
Mark Twain
Offline
Offline
@mrpeachy
Turning the code into a function worked perfectly.![]()
When I put this/home/joe/wun/additional_files/weathericons/wind/green_360.png
I also noticed when I had this in my iweather.lua template
out({a=1,fs=12,x=115,y=ypos,txt=now.wind_degrees.."°"})
it always printed 360°.
Hope this helps.
yes, that pinpoints the problem to line 70 in wun.lua
if d>=348 and d<=12 then
change the and to an or
if d>=348 or d<=12 then
updated in the main archive
Last edited by mrpeachy (2014-01-17 23:11:58)
Offline
here is an attempt at skinny side weather
ill post the template in a sec once its cleaned up
function glassybox(tlx,tly,cra,sw,sh)
sho=sh
sw=sw-cra-cra
sh=sh-cra-cra
--BIG FILLED IN RECTANGLE
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=sh},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-sh},
{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0xffffff,a=0.1,p=0},{c=0xffffff,a=0.0,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
--HIGHLIGHT TOP RECTANGLE
shh=((80/150)*sho)-cra-cra
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=shh},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-shh},
{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=shh+cra+cra,
grad={{c=0xffffff,a=0.6,p=0},{c=0xffffff,a=0.4,p=0.2},{c=0xffffff,a=0,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
--OUTLINE
lt=2
tlx,tly=tlx-lt,tly-lt
cra1=cra+lt
subtab={
{d="start",x=tlx+cra1,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra1,degs=90},
{d="rline",x=0,y=sh},
{d="arc_c",q=2,r=cra1,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra1,degs=90},
{d="rline",x=0,y=-sh},
{d="arc_c",q=4,r=cra1,degs=90},
{d="rline",x=sw,y=0},
{d="rline",x=0,y=lt},
{d="rline",x=-sw,y=0},
{d="arc_a",q=4,r=cra,degs=90},
{d="rline",x=0,y=sh},
{d="arc_a",q=3,r=cra,degs=90},
{d="rline",x=sw,y=0},
{d="arc_a",q=2,r=cra,degs=90},
{d="rline",x=0,y=-sh},
{d="arc_a",q=1,r=cra,degs=90},
{d="rline",x=-sw,y=0},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0xffffff,a=1,p=0},{c=0x505050,a=1,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
end
--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION-
_G.weather_script = function(update,time,now,text_forecast,day,hour)--#### DO NOT EDIT THIS LINE ##############
--#######################################################################
--these tables hold the coordinates for each repeat do not edit #########
top_left_xcoordinate={}--################################################
top_left_ycoordinate={}--################################################
--#######################################################################
--SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
default_font="White Rabbit"--font must be in quotes
default_font_size=8
default_face="normal"
default_color=0xffffff
default_alpha=1--fully opaque
default_image_width=50
default_image_height=50
--END OF DEFAULTS #######################################################
tlx=350
tly=10
cra=20
sw=100
sh=100
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+15,txt="CONDITIONS"})
image({x=tlx+(sw/2)-30,y=tly+15,h=60,w=60,file=now.weather_icon})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+15+60,txt=now.temp_imperial..now.temp_imperial_unit})
out({c=0x00BFFF,hj="r",a=1,fs=12,x=tlx+(sw/2)-5,y=tly+15+60+15,txt=now.windchill_imperial..now.windchill_imperial_unit})
out({c=0xFFD700,hj="l",a=1,fs=12,x=tlx+(sw/2)+5,y=tly+15+60+15,txt=now.heatindex_imperial..now.heatindex_imperial_unit})
glassybox(tlx,tly,cra,sw,sh)
tlx=350
tly=120
cra=20
sw=100
sh=100
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+15,txt="RAIN TODAY"})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+30,txt=day[1].precipitation.."% "..day[1].rain_allday_imperial..day[1].rain_allday_imperial_unit})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+45,txt="NEXT HOUR"})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+60,txt=hour[1].precipitation.."% "..hour[1].rain_imperial..hour[1].rain_imperial_unit})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+75,txt="HUMIDITY"})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+90,txt=now.pressure_imperial..now.humidity.."%"})
glassybox(tlx,tly,cra,sw,sh)
tlx=350
tly=230
cra=20
sw=100
sh=100
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+15,txt="WIND"})
image({x=tlx+(sw/2)-50,y=tly+15,h=50,w=50,file=now.wind_icon})
out({hj="l",a=1,fs=12,x=tlx+(sw/2)+5,y=tly+30,txt=now.wind_imperial..now.wind_imperial_unit})
out({hj="l",a=1,fs=12,x=tlx+(sw/2)+5,y=tly+45,txt=now.wind_dir})
out({hj="l",a=1,fs=12,x=tlx+(sw/2)+5,y=tly+60,txt=now.wind_degrees.."°"})
glassybox(tlx,tly,cra,sw,sh)
out({hj="r",a=1,fs=12,x=tlx+(sw/2)-2,y=tly+75,txt="GUST:"})
out({hj="l",a=1,fs=12,x=tlx+(sw/2)+2,y=tly+75,txt=now.wind_gust_imperial..now.wind_gust_imperial_unit})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+90,txt=now.pressure_imperial..now.pressure_imperial_unit.." "..now.pressure_trend})
tlx=350
tly=340
cra=20
sw=100
sh=100
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+15,txt="ULTRAVIOLET"})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+30,txt=now.uvi.." "..now.uvi_text})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+45,txt="VISIBILITY"})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+60,txt=now.visibility_imperial..now.visibility_imperial_unit})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+75,txt="UPDATED AT"})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+90,txt=update.hour_24_pad..":"..update.min})
glassybox(tlx,tly,cra,sw,sh)
tlx=350
tly=450
cra=20
sw=100
sh=100
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+15,txt="TOMORROW"})
image({x=tlx+(sw/2)-30,y=tly+15,h=60,w=60,file=day[2].weather_icon})
out({c=0xFFD700,hj="r",a=1,fs=12,x=tlx+(sw/2)-5,y=tly+15+60,txt=day[2].high_imperial..day[2].high_imperial_unit})
out({c=0x00BFFF,hj="l",a=1,fs=12,x=tlx+(sw/2)+5,y=tly+15+60,txt=day[2].low_imperial..day[2].low_imperial_unit})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+15+60+15,txt=day[2].precipitation.."% "..day[2].rain_allday_imperial..day[1].rain_allday_imperial_unit})
glassybox(tlx,tly,cra,sw,sh)
tlx=350
tly=560
cra=20
sw=100
sh=100
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+15,txt=string.upper(day[3].weekday)})
image({x=tlx+(sw/2)-30,y=tly+15,h=60,w=60,file=day[3].weather_icon})
out({c=0xFFD700,hj="r",a=1,fs=12,x=tlx+(sw/2)-5,y=tly+15+60,txt=day[3].high_imperial..day[3].high_imperial_unit})
out({c=0x00BFFF,hj="l",a=1,fs=12,x=tlx+(sw/2)+5,y=tly+15+60,txt=day[3].low_imperial..day[3].low_imperial_unit})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+15+60+15,txt=day[3].precipitation.."% "..day[3].rain_allday_imperial..day[1].rain_allday_imperial_unit})
glassybox(tlx,tly,cra,sw,sh)
tlx=350
tly=670
cra=20
sw=100
sh=100
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+15,txt=string.upper(day[4].weekday)})
image({x=tlx+(sw/2)-30,y=tly+15,h=60,w=60,file=day[4].weather_icon})
out({c=0xFFD700,hj="r",a=1,fs=12,x=tlx+(sw/2)-5,y=tly+15+60,txt=day[4].high_imperial..day[4].high_imperial_unit})
out({c=0x00BFFF,hj="l",a=1,fs=12,x=tlx+(sw/2)+5,y=tly+15+60,txt=day[4].low_imperial..day[4].low_imperial_unit})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+15+60+15,txt=day[4].precipitation.."% "..day[4].rain_allday_imperial..day[1].rain_allday_imperial_unit})
glassybox(tlx,tly,cra,sw,sh)
tlx=350
tly=780
cra=20
sw=100
sh=100
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+15,txt=string.upper(day[5].weekday)})
image({x=tlx+(sw/2)-30,y=tly+15,h=60,w=60,file=day[3].weather_icon})
out({c=0xFFD700,hj="r",a=1,fs=12,x=tlx+(sw/2)-5,y=tly+15+60,txt=day[5].high_imperial..day[5].high_imperial_unit})
out({c=0x00BFFF,hj="l",a=1,fs=12,x=tlx+(sw/2)+5,y=tly+15+60,txt=day[5].low_imperial..day[5].low_imperial_unit})
out({hj="c",a=1,fs=12,x=tlx+(sw/2),y=tly+15+60+15,txt=day[5].precipitation.."% "..day[5].rain_allday_imperial..day[1].rain_allday_imperial_unit})
glassybox(tlx,tly,cra,sw,sh)
--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--########################################################################################]]
end--of weather_display function do not edit this line ##################
--#######################################################################
Last edited by mrpeachy (2014-01-17 23:30:56)
Offline
^ Perfect
Thanks for all you do.
A person who has a cat by the tail knows a whole lot more about cats than someone who has just read about them.
Mark Twain
Offline
here is an attempt at skinny side weather
http://s21.postimg.org/od5rj4fmr/Screenshot_from_2014_01_17_17_16_12.jpgill post the template in a sec once its cleaned up
Nice I'm thinking of trying to incorporate the updated gradrec.lua with iweather.lua.
Think it will work or am I in for a big F&%@! up?
A person who has a cat by the tail knows a whole lot more about cats than someone who has just read about them.
Mark Twain
Offline
mrpeachy wrote:here is an attempt at skinny side weather
http://s21.postimg.org/od5rj4fmr/Screenshot_from_2014_01_17_17_16_12.jpgill post the template in a sec once its cleaned up
Nice I'm thinking of trying to incorporate the updated gradrec.lua with iweather.lua.
Think it will work or am I in for a big F&%@! up?
the problem will come with the lua_load in the conky config
you can only have 2 scripts one running pre one running post above TEXT
however im not sure that the gradrec script needs to be activated, and could be loaded then called in the template script, leaving a slot for the button script which does need to be activated above TEXT
ill try it out in a little while
Offline
jst_joe wrote:mrpeachy wrote:here is an attempt at skinny side weather
http://s21.postimg.org/od5rj4fmr/Screenshot_from_2014_01_17_17_16_12.jpgill post the template in a sec once its cleaned up
Nice I'm thinking of trying to incorporate the updated gradrec.lua with iweather.lua.
Think it will work or am I in for a big F&%@! up?the problem will come with the lua_load in the conky config
you can only have 2 scripts one running pre one running post above TEXThowever im not sure that the gradrec script needs to be activated, and could be loaded then called in the template script, leaving a slot for the button script which does need to be activated above TEXT
ill try it out in a little while
If it will work you could make some really nice button covers with gradrec
A person who has a cat by the tail knows a whole lot more about cats than someone who has just read about them.
Mark Twain
Offline
6 hours no power ... came on started to respond - went off -- hope this is it!
have you tried the script unedited to see if it detects your username?
if there was going to be an option to set path to wun folder it would have to be in the wun.lua script
Yes, it did a few time and missed a few so I always add it:
username = os.getenv("USERNAME")
--you can enter your username here in case of errors,
--enter username in quotes like this username = "yourname"
username = "sector11"
package.path = '/home/'..username..'/wun/wun_config.lua'
require 'wun_config'
I do run ~/wun on occasion but it is because I an testing the "default" setup.
However, I do not keep conkys in ~/ ( see this post ) so when I move it I have to change:
--username = os.getenv("USERNAME")
--you can enter your username here in case of errors,
--enter username in quotes like this username = "yourname"
--username = "sector11"
--package.path = '/home/'..username..'/wun/wun_config.lua'
package.path = '/media/5/Conky/wun/wun_config.lua'
require 'wun_config'
and then search the lua files for things like:
local file = io.open("/home/"..username.."/wun/backup_data/backup_data.txt", "w")
to change.
Granted, most people will be using the default settings, I have:
/home/sector11/wun
which is where I test and create/develop (bend fold an mutilate) templates
But I have these as well:
/media/5/wun1
/media/5/wun2
/media/5/wun3
/media/5/wun4
/media/5/wun5i
/media/5/wun_archives
/media/5/wun_mine
/media/5/wun_mine_2
/media/5/wunt
/media/5/wuntt
and the last one: /media/5/Conky/wun-v1 that is running my default wun script.
won't go into the v9000 stuff I have, different thread
I don't just test scripts I bend fold and mutilate them.
S11.. A broom... if you would be so lucky!
Also S11 if you are looking to add an easy editable path within your
weather.lua
iweather.lua
you can do something like this..--PATH TO FILE ############################################# ptf="/home/username/path/to/file --#########################################################
and use it like so
image({x=10,y=10,w=10,h=10,file=ptf})
This is very useful if you use this location several times.
NICE!!!!!!!!!!!
I'll remember that for my red+x.png that I used to check transparent image limits. But that's not what it's about.
Last edited by Sector11 (2014-01-18 00:16:49)
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
one thing you can try is loading gradrec in the wun.lua script using require, in the same way as the config is loaded
line 9 of wun.lua
require 'wun_config'
add
require 'wun_config'
require 'gradrec'
then use the wunrci config without any changes
as long as gradrec.lua is in the wun folder
Offline
one thing you can try is loading gradrec in the wun.lua script using require, in the same way as the config is loaded
line 9 of wun.luarequire 'wun_config'
add
require 'wun_config' require 'gradrec'
then use the wunrci config without any changes
as long as gradrec.lua is in the wun folder
So, if I break things is there a warranty?
Just kidding
A person who has a cat by the tail knows a whole lot more about cats than someone who has just read about them.
Mark Twain
Offline
Take a look at my indicator dots and you can see where I'm going with this.
EDIT: to add
Sleep!!!
We don't need no stinking sleep.
Last edited by jst_joe (2014-01-18 00:52:38)
A person who has a cat by the tail knows a whole lot more about cats than someone who has just read about them.
Mark Twain
Offline
very nice
well the require method didnt work
EDIT - but i know why and it would if it was done right
easiest way would to be open gradrec.lua
and copy the whole function grec(gtab) into the top of which ever template script you want to work with
either that or copy it into the bottom of wun.lua so it will be available in all templates
Last edited by mrpeachy (2014-01-18 02:48:17)
Offline
However, I do not keep conkys in ~/ ( see this post ) so when I move it I have to change:
--username = os.getenv("USERNAME") --you can enter your username here in case of errors, --enter username in quotes like this username = "yourname" --username = "sector11" --package.path = '/home/'..username..'/wun/wun_config.lua' package.path = '/media/5/Conky/wun/wun_config.lua' require 'wun_config'
and then search the lua files for things like:
local file = io.open("/home/"..username.."/wun/backup_data/backup_data.txt", "w")
to change.
Granted, most people will be using the default settings, I have:
/home/sector11/wun
which is where I test and create/develop (bend fold an mutilate) templates
yes i see what you mean, instead of tracking down all the places that use the default path, just set it once and if its changed it will change everywhere, that should be pretty easy to do
Offline
yes i see what you mean, instead of tracking down all the places that use the default path, just set it once and if its changed it will change everywhere, that should be pretty easy to do
Yes, that's it.
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
That's easy for you guys to say.
A person who has a cat by the tail knows a whole lot more about cats than someone who has just read about them.
Mark Twain
Offline
so with the latest testing update posted, im sitting twiddling my fingers and wondering if wun is done LOL
edit, need to add additional time formats for sun set and rise times to match moon options
Last edited by mrpeachy (2014-01-18 03:49:55)
Offline
Here is what I've got iweather.lua combined with gradrec.lua hope you all like it.
Here's the working iweather.lua code
-- iweather.lua combind with gradrec.lua Have Fun! ;) ##################
--MAIN GTAB FUNCTION####################################################
--easy compound shape drawing with gradients by mrpeachy 8/13/12
require 'cairo'
function conky_main()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end--end main function
function grec(gtab)--#################################################################################
local function color(col,alp)
return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end
local function pt(px,py,prad,pdeg)
local ppo=(math.pi/180)*pdeg
local px1=px+prad*(math.sin(ppo))
local py1=py-prad*(math.cos(ppo))
return px1,py1
end
local function sub_draw(sdtab)
cdsx={}
cdsy={}
dr={}
limit=#sdtab
for i=1,limit do
local d=sdtab[i].d
if d=="start" then
table.insert(dr,"cairo_move_to(cr,"..tostring(sdtab[i].x)..","..tostring(sdtab[i].y)..");")
table.insert(cdsx,sdtab[i].x)
table.insert(cdsy,sdtab[i].y)
end
if d=="line" then
table.insert(dr,"cairo_line_to(cr,"..tostring(sdtab[i].x)..","..tostring(sdtab[i].y)..");")
table.insert(cdsx,sdtab[i].x)
table.insert(cdsy,sdtab[i].y)
end
if d=="rline" then
table.insert(dr,"cairo_rel_line_to(cr,"..tostring(sdtab[i].x)..","..tostring(sdtab[i].y)..");")
table.insert(cdsx,cdsx[i-1]+sdtab[i].x)
table.insert(cdsy,cdsy[i-1]+sdtab[i].y)
end
if d=="aline" then
--pt(px,py,prad,pdeg)
local alx,aly=pt(cdsx[i-1],cdsy[i-1],sdtab[i].l,sdtab[i].a)
table.insert(dr,"cairo_line_to(cr,"..tostring(alx)..","..tostring(aly)..");")
table.insert(cdsx,alx)
table.insert(cdsy,aly)
end
if d=="arc" then
local ang1=(math.pi/180)*((sdtab[i].a1)-90)
local ang2=(math.pi/180)*((sdtab[i].a2)-90)
local rad=sdtab[i].r
local x=sdtab[i].x
local y=sdtab[i].y
table.insert(dr,"cairo_arc(cr,"..tostring(x)..","..tostring(y)..","..tostring(rad)..","..tostring(ang1)..","..tostring(ang2)..");")
local ang2=(math.pi/180)*(sdtab[i].a2)
local ax=0+rad*(math.sin(ang2))
local ay=0-rad*(math.cos(ang2))
table.insert(cdsx,x+ax)
table.insert(cdsy,y+ay)
end
if d=="arc_c" then
local q=sdtab[i].q
local rad=sdtab[i].r
if q==4 then
ang1=(math.pi/180)*(270-90)
x=cdsx[i-1]+rad
y=cdsy[i-1]
elseif q==1 then
ang1=(math.pi/180)*(360-90)
x=cdsx[i-1]
y=cdsy[i-1]+rad
elseif q==2 then
ang1=(math.pi/180)*(90-90)
x=cdsx[i-1]-rad
y=cdsy[i-1]
elseif q==3 then
ang1=(math.pi/180)*(180-90)
x=cdsx[i-1]
y=cdsy[i-1]-rad
end
local ang2=ang1+((math.pi/180)*(sdtab[i].degs))
table.insert(dr,"cairo_arc(cr,"..tostring(x)..","..tostring(y)..","..tostring(rad)..","..tostring(ang1)..","..tostring(ang2)..");")
local ang2=ang2+((math.pi/180)*90)
local ax=0+rad*(math.sin(ang2))
local ay=0-rad*(math.cos(ang2))
table.insert(cdsx,x+ax)
table.insert(cdsy,y+ay)
end
if d=="arc_a" then
local q=sdtab[i].q
local rad=sdtab[i].r
if q==4 then
ang1=(math.pi/180)*(360-90)
x=cdsx[i-1]
y=cdsy[i-1]+rad
elseif q==1 then
ang1=(math.pi/180)*(90-90)
x=cdsx[i-1]-rad
y=cdsy[i-1]
elseif q==2 then
ang1=(math.pi/180)*(180-90)
x=cdsx[i-1]
y=cdsy[i-1]-rad
elseif q==3 then
ang1=(math.pi/180)*(270-90)
x=cdsx[i-1]+rad
y=cdsy[i-1]
end
local ang2=ang1-(math.pi/180)*(sdtab[i].degs)
table.insert(dr,"cairo_arc_negative(cr,"..tostring(x)..","..tostring(y)..","..tostring(rad)..","..tostring(ang1)..","..tostring(ang2)..");")
local ang2=ang2+((math.pi/180)*90)
local ax=0+rad*(math.sin(ang2))
local ay=0-rad*(math.cos(ang2))
table.insert(cdsx,x+ax)
table.insert(cdsy,y+ay)
end
end
return table.concat(dr)
end--of local function sub_draw
local g=gtab.g or 1
local x=gtab.x or 0
local y=gtab.y or 0
local w=gtab.w or 50
local h=gtab.h or 50
local r=gtab.r or 50
local rgx=gtab.rgx or x
local rgy=gtab.rgy or y
local grad=gtab.grad or {{c=0xffffff}}
local gan=gtab.gan or 45
local lw=gtab.lw or 1
local sub=gtab.sub or 0
local db=gtab.db or 0
local subtab=gtab.subtab
if db==1 and g~=6 then
cairo_set_source_rgba (cr,1,1,1,1)
cairo_set_line_width (cr,1)
cairo_rectangle (cr,x,y,w,h)
cairo_stroke (cr)
elseif db==1 and g==6 then
cairo_set_source_rgba (cr,1,1,1,1)
cairo_set_line_width (cr,1)
cairo_arc (cr,x,y,r,0,2*math.pi)
cairo_stroke (cr)
end
--##########################################
if g==1 or g==2 or g==5 or g==6 then --rectangular gradients
if g==1 then
pat = cairo_pattern_create_linear (0,y,0,y+h);
elseif g==2 then
pat = cairo_pattern_create_linear (x,0,x+w,0);
elseif g==5 then
--calculate hypotenuse across middle of rectange
local hyp=math.sqrt((w^2)+(h^2))
local rad=hyp/2
--center point of rectangle
local crx=x+(w/2)
local cry=y+(h/2)
--calculate point 1
local point=(math.pi/180)*gan
local x1=crx+rad*(math.sin(point))
local y1=cry-rad*(math.cos(point))
--calculate point 2
local point=(math.pi/180)*(gan+180)
local x2=crx+rad*(math.sin(point))
local y2=cry-rad*(math.cos(point))
--gradient
pat = cairo_pattern_create_linear (x1,y1,x2,y2);
elseif g==6 then
pat = cairo_pattern_create_radial (rgx, rgy, 0, x, y, r);
end
local gnum=#grad
for i=1,gnum do
cairo_pattern_add_color_stop_rgba (pat,grad[i].p,color(grad[i].c,grad[i].a));
end--for loop
if sub==1 then
cairo_save (cr)
cairo_clip(cr)
cairo_new_sub_path(cr)
local drawstring=sub_draw(subtab)
loadstring(drawstring)()
cairo_restore (cr)
end
cairo_set_source (cr, pat);
cairo_fill(cr);
cairo_pattern_destroy (pat);
--###########################################
elseif g==0 and sub==1 then --non gradient
local drawstring=sub_draw(subtab)
loadstring(drawstring)()
cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
cairo_fill(cr)
elseif g==3 and sub==1 then
local drawstring=sub_draw(subtab)
loadstring(drawstring)()
cairo_set_line_width(cr,lw)
cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
cairo_close_path (cr)
cairo_stroke(cr);
elseif g==4 and sub==1 then
local drawstring=sub_draw(subtab)
loadstring(drawstring)()
cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
cairo_fill_preserve(cr);
cairo_set_line_width(cr,lw)
cairo_set_source_rgba (cr,color(grad[2].c,grad[2].a));
cairo_close_path (cr)
cairo_stroke(cr);
elseif g==0 and sub~=1 then
cairo_rectangle (cr,x,y,w,h)
cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
cairo_fill(cr);
elseif g==3 and sub~=1 then
cairo_rectangle (cr,x,y,w,h)
cairo_set_line_width(cr,lw)
cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
cairo_close_path (cr)
cairo_stroke(cr);
elseif g==4 and sub~=1 then
cairo_rectangle (cr,x,y,w,h)
cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
cairo_fill_preserve(cr);
cairo_set_line_width(cr,lw)
cairo_set_source_rgba (cr,color(grad[2].c,grad[2].a));
cairo_close_path (cr)
cairo_stroke(cr);
--radial gradients
elseif g==6 then
pat = cairo_pattern_create_radial (cx, cy, crad-(clw/2)-2,--
cx, cy, crad+(clw/2)+4);
cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0, 0, 1);
cairo_pattern_add_color_stop_rgba (pat, 0.5, 0, 0, 0, 0);
cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 1);
cairo_set_source (cr, pat);
cairo_arc (cr, cx, cy, crad+(clw/2), 0, 2*math.pi);
cairo_fill (cr);
cairo_pattern_destroy (pat);
end--of g type
end--of function grec
--END MAIN GTAB FUNCTION################################################--]]
--GRADREC FUNCTION--GRADREC FUNCTION--GRADREC FUNCTION--GRADREC FUNCTION-
function glassybox(tlx,tly,cra,sw,sh)
sho=sh
sw=sw-cra-cra
sh=sh-cra-cra
--BIG FILLED IN RECTANGLE
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=sh},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-sh},
{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0xffffff,a=0.1,p=0},{c=0xffffff,a=0.0,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
--HIGHLIGHT TOP RECTANGLE
shh=((80/150)*sho)-cra-cra
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=shh},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-shh},
{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=shh+cra+cra,
grad={{c=0xffffff,a=0.3,p=0},{c=0xffffff,a=0.05,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})--]]
--OUTLINE
lt=2 --BOARDER WIDTH
tlx,tly=tlx-lt,tly-lt
cra1=cra+lt
subtab={
{d="start",x=tlx+cra1,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra1,degs=90},
{d="rline",x=0,y=sh},
{d="arc_c",q=2,r=cra1,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra1,degs=90},
{d="rline",x=0,y=-sh},
{d="arc_c",q=4,r=cra1,degs=90},
{d="rline",x=sw,y=0},
{d="rline",x=0,y=lt},
{d="rline",x=-sw,y=0},
{d="arc_a",q=4,r=cra,degs=90},
{d="rline",x=0,y=sh},
{d="arc_a",q=3,r=cra,degs=90},
{d="rline",x=sw,y=0},
{d="arc_a",q=2,r=cra,degs=90},
{d="rline",x=0,y=-sh},
{d="arc_a",q=1,r=cra,degs=90},
{d="rline",x=-sw,y=0},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0xffffff,a=1,p=0},{c=0x050505,a=0.8,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
end
--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION-
_G.weather_script = function(update,time,now,text_forecast,day,hour)--#### DO NOT EDIT THIS LINE ##############
--[#######################################################################
--these tables hold the coordinates for each repeat do not edit #########
top_left_x_coordinate={}--###############################################
top_left_y_coordinate={}--###############################################
--#######################################################################
--SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
default_font="Liberation Sans"--font must be in quotes
default_font_size=11
default_color=0xffffff--white
default_alpha=1--fully opaque
default_image_width=50
default_image_height=50
--END OF DEFAULTS #######################################################
--#######################################################################
--START OF BUTTON CODE -- START OF BUTTON CODE -- START OF BUTTON CODE
--########################################################################################
function button_settings()
dh=do_button({blx_on=9,blx_off=9,bly_off=166+240,fs_off={"14"},fs_on={"14"},fxadj_off={10},fxadj_on={15},fyadj_off={-6},fyadj_on={-6},text=1,font_off={"Liberation Sans"},font_on={"Liberation Sans"},txt_on={"DAYS"},txt_off={"HOURS"},fcol_off={0xffffff},fcol_on={0xffffff},dolw_on=2,dolw_off=2,docol_off=0x000000,doal_off=0.50,docol_on=0x000000,doal_on=0.50,dtype_off=3,dfal_on=1.0,dfcol_on=0x0000ff,dfcol_off=0x000000,dfal_off=1.0,btype=1,bname="dayhour",bw_off=70,bh_off=23,draw=1,on_on_on={"current"},on_on_off={"mlh","current"},off_on_off={"mlh","day1","day2","day3","day4","day5","day6","day7","day8","day9","day10"},off_on_on={"day1","day2","day3","day4","day5","day6","day7","day8","day9","day10","mlh"}})
if dh==1 then
hm=do_button({blx_on=296.5,fs_off={"14"},fs_on={"14"},fxadj_off={15},fxadj_on={17},fyadj_off={-6},fyadj_on={-6},text=1,font_off={"Liberation Sans"},font_on={"Liberation Sans"},txt_on={"LESS"},txt_off={"MORE"},fcol_off={0xffffff},fcol_on={0xffffff},dolw_on=2,dolw_off=2,docol_off=0x000000,doal_off=0.50,docol_on=0x000000,doal_on=0.50,dtype_off=3,dfal_on=1.0,dfcol_on=0x0000ff,dfcol_off=0x000000,dfal_off=1.0,btype=1,bname="mlh",blx_off=296.5,bly_off=166+240,bw_off=70,bh_off=23,draw=1})
else
hm=0
end
local b1=do_button({dfcol_on=0x0000ff,dfcol_off=0x000000,btype=1,bname="day1",blx_off=9.5,bly_off=166,bw_off=70,bh_off=23,draw=1, off_on_on={"day2","day3","day4","day5","day6","day7","day8","day9","day10","current"}})
local b2=do_button({dfcol_on=0x0000ff,dfcol_off=0x000000,btype=1,bname="day2",blx_off=81.5,bly_off=166,bw_off=69.5,bh_off=23,draw=1, off_on_on={"day1","day3","day4","day5","day6","day7","day8","day9","day10","current"}})
local b3=do_button({dfcol_on=0x0000ff,dfcol_off=0x000000,btype=1,bname="day3",blx_off=153,bly_off=166,bw_off=70,bh_off=23,draw=1, off_on_on={"day1","day2","day4","day5","day6","day7","day8","day9","day10","current"}})
local b4=do_button({dfcol_on=0x0000ff,dfcol_off=0x000000,btype=1,bname="day4",blx_off=225,bly_off=166,bw_off=69.5,bh_off=23,draw=1, off_on_on={"day1","day2","day3","day5","day6","day7","day8","day9","day10","current"}})
local b5=do_button({dfcol_on=0x0000ff,dfcol_off=0x000000,btype=1,bname="day5",blx_off=296.5,bly_off=166,bw_off=70,bh_off=23,draw=1, off_on_on={"day1","day2","day3","day4","day6","day7","day8","day9","day10","current"}})
local b6=do_button({dfcol_on=0x0000ff,dfcol_off=0x000000,btype=1,bname="day6",blx_off=9.5,bly_off=166+120,bw_off=70,bh_off=23,draw=1, off_on_on={"day1","day2","day3","day4","day5","day7","day8","day9","day10","current"}})
local b7=do_button({dfcol_on=0x0000ff,dfcol_off=0x000000,btype=1,bname="day7",blx_off=81.5,bly_off=166+120,bw_off=69.5,bh_off=23,draw=1, off_on_on={"day1","day2","day3","day4","day5","day6","day8","day9","day10","current"}})
local b8=do_button({dfcol_on=0x0000ff,dfcol_off=0x000000,btype=1,bname="day8",blx_off=153,bly_off=166+120,bw_off=70,bh_off=23,draw=1, off_on_on={"day1","day2","day3","day4","day5","day6","day7","day9","day10","current"}})
local b9=do_button({dfcol_on=0x0000ff,dfcol_off=0x000000,btype=1,bname="day9",blx_off=225,bly_off=166+120,bw_off=69.5,bh_off=23,draw=1, off_on_on={"day1","day2","day3","day4","day5","day6","day7","day8","day10","current"}})
local b10=do_button({dfcol_on=0x0000ff,dfcol_off=0x000000,btype=1,bname="day10",blx_off=296.5,bly_off=166+120,bw_off=70,bh_off=23,draw=1, off_on_on={"day1","day2","day3","day4","day5","day6","day7","day8","day9","current"}})
local bc=do_button({dfcol_on=0x0000ff,dfcol_off=0x000000,st_type=1,btype=1,bname="current",blx_off=264,bly_off=134.5,bw_off=23,bh_off=98,draw=1, off_on_on={"day1","day2","day3","day4","day5","day6","day7","day8","day9","day10"}})
if hm==1 then add=10 elseif hm==0 then add=0 end
if b1==1 and b2==0 and b3==0 and b4==0 and b5==0 and b6==0 and b7==0 and b8==0 and b9==0 and b10==0 and bc==0 then
showday=1+add
elseif b1==0 and b2==1 and b3==0 and b4==0 and b5==0 and b6==0 and b7==0 and b8==0 and b9==0 and b10==0 and bc==0 then
showday=2+add
elseif b1==0 and b2==0 and b3==1 and b4==0 and b5==0 and b6==0 and b7==0 and b8==0 and b9==0 and b10==0 and bc==0 then
showday=3+add
elseif b1==0 and b2==0 and b3==0 and b4==1 and b5==0 and b6==0 and b7==0 and b8==0 and b9==0 and b10==0 and bc==0 then
showday=4+add
elseif b1==0 and b2==0 and b3==0 and b4==0 and b5==1 and b6==0 and b7==0 and b8==0 and b9==0 and b10==0 and bc==0 then
showday=5+add
elseif b1==0 and b2==0 and b3==0 and b4==0 and b5==0 and b6==1 and b7==0 and b8==0 and b9==0 and b10==0 and bc==0 then
showday=6+add
elseif b1==0 and b2==0 and b3==0 and b4==0 and b5==0 and b6==0 and b7==1 and b8==0 and b9==0 and b10==0 and bc==0 then
showday=7+add
elseif b1==0 and b2==0 and b3==0 and b4==0 and b5==0 and b6==0 and b7==0 and b8==1 and b9==0 and b10==0 and bc==0 then
showday=8+add
elseif b1==0 and b2==0 and b3==0 and b4==0 and b5==0 and b6==0 and b7==0 and b8==0 and b9==1 and b10==0 and bc==0 then
showday=9+add
elseif b1==0 and b2==0 and b3==0 and b4==0 and b5==0 and b6==0 and b7==0 and b8==0 and b9==0 and b10==1 and bc==0 then
showday=10+add
elseif b1==0 and b2==0 and b3==0 and b4==0 and b5==0 and b6==0 and b7==0 and b8==0 and b9==0 and b10==0 and bc==1 then
showday=0
elseif b1==0 and b2==0 and b3==0 and b4==0 and b5==0 and b6==0 and b7==0 and b8==0 and b9==0 and b10==0 and bc==0 then
showday=0
end
end--function button_settings
--########################################################################################
--END OF BUTTON CODE ----END OF BUTTON CODE ----END OF BUTTON CODE ---
--#######################################################################
--image({x=-7,y=-5,w=390,h=293*(620/421),file="/home/joe/wun/additional_files/iweather_bg.png"})
--MAIN GRADREC BOX #####################################################
tlx=2--top left x
tly=5--top left y
cra=3--corner radius
sw=370--total width, including corners
sh=410--total height including corners
glassybox(tlx,tly,cra,sw,sh)--calls function and sends variables
-- START GRADREC BUTTON DISPLAY ########################################
--CURRENT GRADREC BUTTON ###############################################
tlx=264--top left x
tly=35--top left y
cra=1--corner radius
sw=23--total width, including corners
sh=100--total height including corners
glassybox(tlx,tly,cra,sw,sh)--calls function and sends variables
--FIRST ROW GRADREC BUTTONS ############################################
tlx=10--top left x
tly=143--top left y
cra=1--corner radius
sw=354--total width, including corners
sh=23--total height including corners
glassybox(tlx,tly,cra,sw,sh)--calls function and sends variables
-- SECOND ROW GRADREC BUTTONS ##########################################
tlx=10--top left x
tly=263--top left y
cra=1--corner radius
sw=354--total width, including corners
sh=23--total height including corners
glassybox(tlx,tly,cra,sw,sh)--calls function and sends variables
-- D/H GRADREC BUTTON ##################################################
tlx=10--top left x
tly=383--top left y
cra=1--corner radius
sw=69--total width, including corners
sh=23--total height including corners
glassybox(tlx,tly,cra,sw,sh)--calls function and sends variables
-- M/L GRADREC BUTTON ##################################################
tlx=297--top left x
tly=383--top left y
cra=1--corner radius
sw=69--total width, including corners
sh=23--total height including corners
glassybox(tlx,tly,cra,sw,sh)--calls function and sends variables
-- INDICATOR DOT GRADREC WINDOW ########################################
tlx=165--top left x
tly=387--top left y
cra=1--corner radius
sw=48--total width, including corners
sh=16--total height including corners
glassybox(tlx,tly,cra,sw,sh)--calls function and sends variables
-- END GRADREC BUTTON DISPLAY ######################################--]]
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE
out({a=1,fs=15,x=15,y=25,txt="Conditions For "..now.location_full.." "..now.location_zip})
out({a=1,fs=15,x=295,y=25,txt=os.date("%I:%M %p")})
ct={"C","U","R","R","E","N","T"}
for i=1,7 do
out({hj="c",a=1,fs=14,x=275,y=51+(13*(i-1)),txt=ct[i]})
end
--current window
image({x=300,y=35,h=65,w=65,file=now.weather_icon})
out({a=1,fs=20,x=300,y=125,txt=now.temp_imperial..now.temp_imperial_unit})
--DATA WINDOW
if showday==nil then showday=0 end
if dh==0 and showday>0 then
local sd=tonumber(showday)
out({a=1,fs=14,x=15,y=43,txt=day[sd].weekday.." "..day[sd].monthname.." "..day[sd].day_pad})
out({a=1,fs=18,x=15,y=65,txt=day[sd].conditions})
gap=13
ypos=67+gap
out({a=1,fs=14,x=15,y=ypos,txt="High: "..day[sd].high_imperial..day[sd].high_imperial_unit})
out({a=1,fs=14,x=90,y=ypos,txt="Low: "..day[sd].low_imperial..day[sd].low_imperial_unit})
out({a=1,fs=14,x=165,y=ypos,txt="Hum: "..day[sd].avehumidity.."%"})
ypos=ypos+gap
out({a=1,fs=14,x=15,y=ypos,txt="Rain: "..day[sd].precipitation.."%"})
ypos=ypos+gap
out({a=1,fs=14,x=15,y=ypos,txt="Ave Wind: "..day[sd].avewind_imperial..day[sd].avewind_imperial_unit})
out({a=1,fs=14,x=165,y=ypos,txt=day[sd].avewind_dir})
ypos=ypos+gap
out({a=1,fs=12,x=15,y=ypos,txt="Max Wind: "..day[sd].maxwind_imperial..day[sd].maxwind_imperial_unit})
out({a=1,fs=14,x=165,y=ypos,txt=day[sd].maxwind_dir})
image({x=220,y=ypos-25,h=30,w=30,file=day[sd].avewind_icon})
elseif dh==1 and showday>0 then
local sd=tonumber(showday)
out({a=1,fs=14,x=15,y=43,txt=hour[sd].hour_12..hour[sd].ampm.." "..hour[sd].weekday.." "..hour[sd].monthname.." "..hour[sd].day})
out({a=1,fs=18,x=15,y=65,txt=hour[sd].conditions})
gap=13
ypos=67+gap
out({a=1,fs=12,x=15,y=ypos,txt="Temp: "..hour[sd].temp_imperial..hour[sd].temp_imperial_unit})
out({a=1,fs=12,x=90,y=ypos,txt="Feels Like: "..hour[sd].feelslike_imperial..hour[sd].feelslike_imperial_unit})
ypos=ypos+gap
out({a=1,fs=12,x=15,y=ypos,txt="Dew: "..hour[sd].dewpoint_imperial..hour[sd].dewpoint_imperial_unit})
out({a=1,fs=12,x=90,y=ypos,txt="Chill: "..hour[sd].windchill_imperial..hour[sd].windchill_imperial_unit})
out({a=1,fs=12,x=165,y=ypos,txt="Heat: "..hour[sd].heatindex_imperial..hour[sd].heatindex_imperial_unit})
ypos=ypos+gap
out({a=1,fs=12,x=15,y=ypos,txt="Rain: "..hour[sd].precipitation.."%"})
out({a=1,fs=12,x=90,y=ypos,txt="QPF: "..hour[sd].rain_imperial..hour[sd].rain_imperial_unit})
out({a=1,fs=12,x=165,y=ypos,txt="Snow: "..hour[sd].snow_imperial..hour[sd].snow_imperial_unit})
ypos=ypos+gap
out({a=1,fs=12,x=15,y=ypos,txt="UV: "..hour[sd].uvi.."/"..hour[sd].uvi_text})
out({a=1,fs=12,x=115,y=ypos,txt="Pressure: "..hour[sd].pressure_imperial..hour[sd].pressure_imperial_unit})
ypos=ypos+gap
out({a=1,fs=12,x=15,y=ypos,txt="Wind: "..hour[sd].wind_imperial..hour[sd].wind_imperial_unit})
out({a=1,fs=12,x=115,y=ypos,txt=hour[sd].wind_degrees.."°"})
out({a=1,fs=12,x=165,y=ypos,txt=hour[sd].wind_dir})
image({x=220,y=ypos-25,h=30,w=30,file=hour[sd].wind_icon})
elseif showday==0 then
out({a=1,fs=12,x=15,y=43,txt=now.observation_time})
out({a=1,fs=18,x=15,y=65,txt=now.conditions})
gap=13
ypos=67+gap
out({a=1,fs=12,x=15,y=ypos,txt="Temp: "..now.temp_imperial..now.temp_imperial_unit})
out({a=1,fs=12,x=165,y=ypos,txt="Feels: "..now.feelslike_imperial..now.feelslike_imperial_unit})
ypos=ypos+gap
out({a=1,fs=12,x=15,y=ypos,txt="Hum: "..now.humidity.."%"})
out({a=1,fs=12,x=165,y=ypos,txt="Dew: "..now.dewpoint_imperial..now.dewpoint_imperial_unit})
ypos=ypos+gap
out({a=1,fs=12,x=165,y=ypos,txt="Vis: "..now.visibility_imperial..now.visibility_imperial_unit})
out({a=1,fs=12,x=15,y=ypos,txt="Pressure: "..now.pressure_imperial..now.pressure_imperial_unit})
ypos=ypos+gap
out({a=1,fs=12,x=15,y=ypos,txt="Wind: "..now.wind_imperial..now.wind_imperial_unit})
out({a=1,fs=12,x=165,y=ypos,txt=now.wind_dir})
ypos=ypos+gap
out({a=1,fs=12,x=15,y=ypos,txt="Gusts: "..now.wind_gust_imperial..now.wind_gust_imperial_unit})
image({x=220,y=ypos-25,h=30,w=30,file=now.wind_icon})
else
out({a=1,fs=18,x=15,y=50,txt="oops!"})
end
--FORECAST DAY BOXES
--set start forecast day
start_day=1
--set total forecast days you want to display
number_of_days=5
topx=20
py=160
--set coordinates for top lef corners for each repeat
top_left_x_coordinate[1],top_left_y_coordinate[1] =topx ,py
top_left_x_coordinate[2],top_left_y_coordinate[2] =topx+70 ,py
top_left_x_coordinate[3],top_left_y_coordinate[3] =topx+70+71.5 ,py
top_left_x_coordinate[4],top_left_y_coordinate[4] =topx+70+72+71.5 ,py
top_left_x_coordinate[5],top_left_y_coordinate[5] =topx+70+72+71.5+71.5 ,py
top_left_x_coordinate[6],top_left_y_coordinate[6] =topx+70+72+71.5+71.5+71.5 ,py
if dh==0 then
--########################################################################################
for i=start_day,number_of_days do --start of day repeat, do not edit #######
tlx=top_left_x_coordinate[i] --sets top left x position for each repeat ##################
tly=top_left_y_coordinate[i] --sets top left y position for each repeat ##################
--########################################################################################
--top row
out({a=1,fs=12,x=tlx-1,y=tly-1,txt=day[i].weekday_short.." "..day[i].month_pad.."/"..day[i].day_pad})
image({x=tlx,y=tly+10,h=50,w=50,file=day[i].weather_icon})
out({a=1,fs=12,x=tlx-5,y=tly+91,txt=day[i].high_imperial..day[i].high_imperial_unit})
out({a=1,fs=12,x=tlx+30,y=tly+91,txt=day[i].low_imperial..day[i].low_imperial_unit})
out({a=1,fs=14,x=tlx+15,y=tly+73,txt=day[i].precipitation.."%"})
tly=tly+120
--bottom row
out({a=1,fs=12,x=tlx-1,y=tly-1,txt=day[i+5].weekday_short.." "..day[i+5].month_pad.."/"..day[i+5].day_pad})
image({x=tlx,y=tly+10,h=50,w=50,file=day[i+5].weather_icon})
out({a=1,fs=12,x=tlx-5,y=tly+91,txt=day[i+5].high_imperial..day[i+5].high_imperial_unit})
out({a=1,fs=12,x=tlx+30,y=tly+91,txt=day[i+5].low_imperial..day[i+5].low_imperial_unit})
out({a=1,fs=14,x=tlx+15,y=tly+73,txt=day[i+5].precipitation.."%"})
--########################################################################################
end--of forecast repeat section ##########################################################
elseif dh==1 then
--########################################################################################
for i=start_day,number_of_days do --start of day repeat, do not edit #######
tlx=top_left_x_coordinate[i] --sets top left x position for each repeat ##################
tly=top_left_y_coordinate[i] --sets top left y position for each repeat ##################
--########################################################################################
i=i+add
--top row
out({a=1,fs=11,x=tlx-1,y=tly,txt=hour[i].hour_12..hour[i].ampm.." "..hour[i].month_pad.."/"..hour[i].day_pad})
image({x=tlx,y=tly+10,h=45,w=45,file=hour[i].weather_icon})
out({a=1,fs=12,x=tlx-5,y=tly+91,txt=hour[i].temp_imperial..hour[i].temp_imperial_unit})
out({a=1,fs=12,x=tlx+30,y=tly+91,txt=hour[i].windchill_imperial..hour[i].windchill_imperial_unit})
out({a=1,fs=14,x=tlx+15,y=tly+73,txt=hour[i].precipitation.."%"})
tly=tly+120
out({a=1,fs=11,x=tlx-1,y=tly,txt=hour[i+5].hour_12..hour[i+5].ampm.." "..hour[i+5].month_pad.."/"..hour[i+5].day_pad})
image({x=tlx,y=tly+10,h=45,w=45,file=hour[i+5].weather_icon})
out({a=1,fs=12,x=tlx-5,y=tly+91,txt=hour[i+5].temp_imperial..hour[i+5].temp_imperial_unit})
out({a=1,fs=12,x=tlx+30,y=tly+91,txt=hour[i+5].windchill_imperial..hour[i+5].windchill_imperial_unit})
out({a=1,fs=14,x=tlx+15,y=tly+73,txt=hour[i+5].precipitation.."%"})
--########################################################################################
end--of forecast repeat section ##########################################################
end--if dh
--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--########################################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################
@mrpeachy if you see anything that needs cleaning up...
well, at least it'll beat twiddling my fingers
A person who has a cat by the tail knows a whole lot more about cats than someone who has just read about them.
Mark Twain
Offline
is all that lau generated?
very nicely done
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat