SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#801 2014-03-18 17:05:14

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Wun Weather Script for Conky (Lua)

--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 localize these defaults if you use a separate 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 #######################################################
--#########################################################################
cairo_set_source_rgba(cr,1,1,1,1)
cairo_set_line_width(cr,1)
--center settings
cx,cy=250,220
rad1=80
rad2=rad1+10
rad3=rad2+50
rad4=rad3+20
srad1=50
srad2=45
px=cx
py=cy
prad=rad4
pdeg=0
local x3,y3=pt(px,py,prad,pdeg)
px=cx
py=cy
prad=rad4
pdeg=45
local x4,y4=pt(px,py,prad,pdeg)
px=cx
py=cy
prad=rad4
pdeg=90
local x5,y5=pt(px,py,prad,pdeg)
px=cx
py=cy
prad=rad4
pdeg=135
local x6,y6=pt(px,py,prad,pdeg)
px=cx
py=cy
prad=rad4
pdeg=180
local x7,y7=pt(px,py,prad,pdeg)
px=cx
py=cy
prad=rad4
pdeg=225
local x8,y8=pt(px,py,prad,pdeg)
px=cx
py=cy
prad=rad4
pdeg=270
local x9,y9=pt(px,py,prad,pdeg)
local function r2d(rad)
return(180/math.pi)*rad
end
local function d2r(deg)
return deg*(math.pi/180)
end
local function tangles(a,b,c)
if a>b and a>c then
sc=a
sa=b
sb=c
elseif b>a and b>c then
sc=b
sa=c
sb=a
elseif c>a and c>b then
sc=c
sa=a
sb=b
end
cosac=((sa^2)+(sb^2)-(sc^2))/(2*sa*sb)
ac=r2d(math.acos(cosac))
sinaa=(sa*(math.sin(d2r(ac))))/sc
aa=r2d(math.asin(sinaa))
ab=180-ac-aa
if a>b and a>c then
return ab,ac,aa
elseif b>a and b>c then
return ac,aa,ab
elseif c>a and c>b then
return aa,ab,ac
end
end
A,B,C=tangles(rad4,srad1,rad3)
px=cx
py=cy
prad=rad3
pdeg=C
local x10,y10=pt(px,py,prad,pdeg)
px=x3
py=y3
prad=srad1
pdeg=-A-180
local x11,y11=pt(px,py,prad,pdeg)
px=cx
py=cy
prad=rad2
pdeg=0
local x1,y1=pt(px,py,prad,pdeg)
px=x3
py=y3
prad=srad1
pdeg=180
local x2,y2=pt(px,py,prad,pdeg)
--short line up
cairo_move_to(cr,x1,y1)
cairo_line_to(cr,x2,y2)
cairo_stroke(cr)
--circles
cairo_set_source_rgba (cr,1,1,1,1)
cairo_set_line_width (cr,2)
cairo_arc(cr,cx,cy,rad1,0,2*math.pi)
cairo_stroke(cr)
cairo_arc(cr,x3,y3,srad2,0,2*math.pi)
cairo_stroke(cr)
cairo_arc(cr,x4,y4,srad2,0,2*math.pi)
cairo_stroke(cr)
cairo_arc(cr,x5,y5,srad2,0,2*math.pi)
cairo_stroke(cr)
cairo_arc(cr,x6,y6,srad2,0,2*math.pi)
cairo_stroke(cr)
cairo_arc(cr,x7,y7,srad2,0,2*math.pi)
cairo_stroke(cr)
cairo_arc(cr,x8,y8,srad2,0,2*math.pi)
cairo_stroke(cr)
cairo_arc(cr,x9,y9,srad2,0,2*math.pi)
cairo_stroke(cr)
--bumpy curve
cairo_set_source_rgba (cr,1,1,1,1)
cairo_set_line_width (cr,2)
cairo_arc(cr,cx,cy,rad2,d2r(-90+180),d2r(-90+360))
cairo_arc_negative(cr,x3,y3,srad1,d2r(180-90),d2r(360-A+90))
cairo_arc(cr,cx,cy,rad3,d2r(C-90),d2r(45-C-90))
cairo_arc_negative(cr,x4,y4,srad1,d2r(-90-90-45+A),d2r(180-A-45))
cairo_arc(cr,cx,cy,rad3,d2r(C-90+45),d2r(90-C-90))
cairo_arc_negative(cr,x5,y5,srad1,d2r(-90-90+A),d2r(180-A))
cairo_arc(cr,cx,cy,rad3,d2r(C-90+90),d2r(135-C-90))
cairo_arc_negative(cr,x6,y6,srad1,d2r(-135+A),d2r(-90-A-45))
cairo_arc(cr,cx,cy,rad3,d2r(C-90+135),d2r(180-C-90))
cairo_arc_negative(cr,x7,y7,srad1,d2r(-90+A),d2r(-90-A))
cairo_arc(cr,cx,cy,rad3,d2r(C-90+180),d2r(225-C-90))
cairo_arc_negative(cr,x8,y8,srad1,d2r(-90+A+45),d2r(-90-A+45))
cairo_arc(cr,cx,cy,rad3,d2r(C-90+225),d2r(270-C-90))
cairo_arc_negative(cr,x9,y9,srad1,d2r(A),d2r(-A))
cairo_stroke(cr)
ptab={
{x3,y3},
{x4,y4},
{x5,y5},
{x6,y6},
{x7,y7},
{x8,y8},
{x9,y9}
}
ims=90
cadj=ims/2
image({x=cx-cadj,y=cy-cadj-20,h=ims,w=ims,file=now.weather_icon})
for i=1,7 do--###############################################################
--repeat for outer image and day names
ims=60
cadj=ims/2
image({x=ptab[i][1]-cadj,y=ptab[i][2]-cadj-20,h=ims,w=ims,file=day[i].weather_icon})
local t=string.lower(day[i].weekday)
local l=string.len(t)
local dl=18
local s=180+((l*dl)/2)
local f=180-((l*dl)/2)
conky_ctxt({fs=18,to=2,f=default_font,r=srad2-5,x=ptab[i][1],y=ptab[i][2],sa=s,fa=f,t=t})--(delay=,t,f,fs,r,x,y,c,a,sa,fa,to,padz)
end--###############################################################3
local t=string.lower(time.weekday)
local l=string.len(t)
local dl=20
local s=180+((l*dl)/2)
local f=180-((l*dl)/2)
conky_ctxt({fs=24,to=2,f=default_font,r=rad1-5,x=cx,y=cy,sa=s,fa=f,t=t})--(delay=,t,f,fs,r,x,y,c,a,sa,fa,to,padz)
local t=string.upper("PPT D/H: "..now.precip_today_imperial..now.precip_today_imperial_unit.."/"..now.precip_1hr_imperial..now.precip_1hr_imperial_unit)
local l=string.len(t)
local dl=7
local s=5
local f=10+(l*dl)
conky_ctxt({fs=16,to=1,f=default_font,r=rad1+8,x=cx,y=cy,sa=s,fa=f,t=t})

local t="T:"..now.temp_imperial..now.temp_imperial_unit.." F:"..now.feelslike_imperial..now.feelslike_imperial_unit
local l=string.len(t)
local dl=10
local s=180+((l*dl)/2)
local f=180-((l*dl)/2)
conky_ctxt({fs=12,to=2,f="mono",r=rad1-25,x=cx,y=cy,sa=s,fa=f,t=t})--(delay=,t,f,fs,r,x,y,c,a,sa,fa,to,padz)

--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--########################################################################################]]
end--of weather_display function do not edit this line ##################
--#######################################################################

function conky_ctxt(ctab)--(delay=,t,f,fs,r,x,y,c,a,sa,fa,to,padz) #############################################################
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)
local cr = cairo_create(cs)
if ctab.x==nil then
ctab=loadstring("return" .. ctab)()
end
--#########################################################################################################
local function color(col,alp)
return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end
--####################################  DEFAULT VALUE  ###################################################
local text=ctab.t			or "set text"
local font=ctab.f			or "mono"
local fsize=ctab.fs			or 12
local radi=ctab.r			or 25
local horiz=ctab.x			--no default
local verti=ctab.y			--no default
local col=ctab.c			or 0xffffff
local alp=ctab.a			or 1
local start=ctab.sa			or -90
local finish=ctab.fa			or 90
local orient=ctab.to			or 1
local padz=ctab.padz 			or 0
local delay=ctab.delay			or 0
--########################################################################################################
if delay==1 then
updates=tonumber(conky_parse('${updates}'))
delay=3
elseif delay==0 then
updates=1
delay=0
end
if updates>delay then --as this function may use conky_parse("${cpu}")
--#########################################################################################################
if padz==1 then
	if string.len(text)==1 then
	text="00"..text
	elseif string.len(text)==2 then
	text="0"..text
	end
end
local text=text:gsub("°","|")
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
cairo_set_source_rgba (cr,color(col,alp))
local inum=string.len(text)
if orient==1 then
	local deg=(finish-start)/(inum)
	local r2d=(math.pi/180)
	for i=1,inum do
	local cha=string.sub(text,i,i)
	local interval=(r2d*(start+(deg*(i-1))))
	local txs=0+radi*(math.sin(interval))
	local tys=0-radi*(math.cos(interval))
	cairo_move_to (cr, txs+horiz, tys+verti);
	cairo_rotate (cr, interval)
	local cha=cha:gsub("|","°")
	cairo_show_text (cr,cha)
	cairo_stroke (cr)
	cairo_rotate (cr, -interval)
	end
elseif orient==2 then
	local deg=(start-finish)/(inum)
	local r2d=(math.pi/180)
	for i=1,inum do
	local cha=string.sub(text,i,i)
	local interval=(r2d*(start-(deg*(i-1))))
	local txs=0+radi*(math.sin(interval))
	local tys=0-radi*(math.cos(interval))
	cairo_move_to (cr, txs+horiz, tys+verti);
	cairo_rotate (cr, (interval+math.pi))
	local cha=cha:gsub("|","°")
	cairo_show_text (cr,cha)
	cairo_stroke (cr)
	cairo_rotate (cr, (interval+math.pi)*-1)
	end
end--orient type
--#########################################################################################################
end--if updates>delay
ctab=nil
text=nil
updates=nil
delay=nil
cairo_destroy(cr)
cairo_surface_destroy (cs)
cr=nil
return ""
end--of ctxt function ######################################################################################

Offline

Help fund CrunchBang, donate to the project!

#802 2014-03-18 17:08:17

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Wun Weather Script for Conky (Lua)

I saw Sector11's UV index color guide in the conky thread

UVI		Web Colour
		Table (HEX)
1		4eb400 - green
2		a0ce00 - green
3		f7e400 - yellow
4		f8b600 - yellow
5		f88700 - yellow
6		f85900 - orange
7		e82c0e - orange
8		d8001d - red
9		ff0099 - red
10		b54cff - red
11+		998cff - purple

and that gave me an idea to make a UV indicator smile , probably in the form of a sizable dot

Offline

#803 2014-03-18 17:52:42

jst_joe
#! Junkie
From: Here, There and After
Registered: 2012-07-03
Posts: 297

Re: Wun Weather Script for Conky (Lua)

Offline

#804 2014-03-18 19:13:53

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Wun Weather Script for Conky (Lua)

out({c=now.uvi_color,a=1,x=100,	y=ystart+(datayy*8),	txt=now.uvi_text})
uvindicator(150,ystart+(datayy*8)-10,10,now.uvi_color,1)

Offline

#805 2014-03-18 22:34:42

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Wun Weather Script for Conky (Lua)

Offline

#806 2014-03-18 23:04:51

jst_joe
#! Junkie
From: Here, There and After
Registered: 2012-07-03
Posts: 297

Re: Wun Weather Script for Conky (Lua)

Offline

#807 2014-03-18 23:54:52

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Wun Weather Script for Conky (Lua)

Offline

#808 2014-03-19 00:02:43

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Wun Weather Script for Conky (Lua)

uvindicator(x,y,radius,data_option,alpha)
uvindicator(150,ystart+(datayy*8)-10,10,now.uvi_color,1)
or
uvindicator(100,100,10,hour[1].uvi_color,1)

Last edited by mrpeachy (2014-03-19 00:06:03)

Offline

#809 2014-03-19 01:14:29

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Wun Weather Script for Conky (Lua)

oops missed a color
line 184 in the uv color wun.lua should be this:

uvc={0x4eb400,0xa0ce00,0xf7e400,0xf8b600,0xf88700,0xf85900,0xe82c0e,0xd8001d,0xff0099,0xb54cff,0x998cff}

Offline

#810 2014-03-19 14:02:49

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Wun Weather Script for Conky (Lua)

Offline

#811 2014-03-19 14:04:12

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Wun Weather Script for Conky (Lua)

uvc={0x4eb400,0xa0ce00,0xf7e400,0xf8b600,0xf88700,0xf85900,0xe82c0e,0xd8001d,0xff0099,0xb54cff,0x998cff}

Offline

#812 2014-03-19 14:06:04

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Wun Weather Script for Conky (Lua)

uvindicator(x,y,radius,data_option,alpha)
uvindicator(150,ystart+(datayy*8)-10,10,now.uvi_color,1)
or
uvindicator(100,100,10,hour[1].uvi_color,1)

Offline

#813 2014-03-19 14:07:14

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Wun Weather Script for Conky (Lua)

Offline

#814 2014-03-19 15:24:21

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Wun Weather Script for Conky (Lua)

UVI	Text		Colour	Code - For text

0	Low			green	327600 - 1
1	Low			green	4EB400 - 1
2	Low			green	A0CE00 - 1
3	Moderate	yellow	F7E400 - 2
4	Moderate	yellow	F8B600 - 2
5	Moderate	yellow	F88700 - 2
6	High		orange	F85900 - 3
7	High		orange	E82C0E - 3
8	Very High	red		D8001D - 4
9	Very High	red		FF0099 - 4
10	Very High	red		7933AB - 4
11+	Extreme		purple	998CFF - 5

Last edited by Sector11 (2014-03-19 15:25:26)

Offline

#815 2014-03-20 00:48:05

jst_joe
#! Junkie
From: Here, There and After
Registered: 2012-07-03
Posts: 297

Re: Wun Weather Script for Conky (Lua)

Got the new PSU in & installed today and all is good. big_smile
Haven't had time to try out the new stuff yet but...
now it's time to play! devil  devil  devil

Offline

#816 2014-03-20 15:16:41

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Wun Weather Script for Conky (Lua)

Offline

#817 2014-03-20 23:25:28

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Wun Weather Script for Conky (Lua)

Offline

#818 2014-03-20 23:27:07

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Wun Weather Script for Conky (Lua)

Offline

#819 2014-03-20 23:33:45

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Wun Weather Script for Conky (Lua)

thanks lionhead and sector11
i think i need to look at the circlewriting function
when the text is close together, like in the day names on the outside it doesnt look right i think

Offline

#820 2014-03-20 23:56:29

jst_joe
#! Junkie
From: Here, There and After
Registered: 2012-07-03
Posts: 297

Re: Wun Weather Script for Conky (Lua)

Offline

#821 2014-03-21 00:05:22

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Wun Weather Script for Conky (Lua)

Offline

#822 2014-03-21 00:11:57

jst_joe
#! Junkie
From: Here, There and After
Registered: 2012-07-03
Posts: 297

Re: Wun Weather Script for Conky (Lua)

Offline

#823 2014-03-21 00:16:42

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Wun Weather Script for Conky (Lua)

Offline

#824 2014-03-21 00:20:09

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Wun Weather Script for Conky (Lua)

Offline

Be excellent to each other!

#825 2014-03-21 00:28:23

jst_joe
#! Junkie
From: Here, There and After
Registered: 2012-07-03
Posts: 297

Re: Wun Weather Script for Conky (Lua)

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: bleh

Debian Logo