SEARCH

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

You are not logged in.

#776 2012-11-04 20:12:08

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,008
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

curly brakets denote a table while square brackets are how you look up something in a table
so

table = { 1 , 2 , 3 }

to get first entry in table

first = table[1]

as for the moon phase image i'll have to take a look... just noticed that the link in my sig to lua weather isnt working

ops Oh OK, that explains that part but not the "Moon" ops

My sig "v9000" needs fixing too.  sad   - blame it on tiny.cc  wink  -->> this works: tiny.cc/lxm9mw

Last edited by Sector11 (2012-11-04 20:25:26)


#! Conky = 13 Threads & the Conky Archives | Conky PitStop | OHCG'er
#! Forum Moderator   |   StartPage -  protect your privacy   |   BBQ Linux

Offline

Be excellent to each other!

#777 2012-11-05 00:32:31

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

Re: weather in conky (LUA scripts) updated 12/26/13!

Sector11 wrote:

ops Oh OK, that explains that part but not the "Moon" ops

My sig "v9000" needs fixing too.  sad   - blame it on tiny.cc  wink  -->> this works: tiny.cc/lxm9mw

thanks, ill update my sig... dont know why it was that one in particular while the others continued working...

re the moon... i cant think of a reason why its not showing up
post the your template and ill test it on my puter

Offline

#778 2012-11-05 02:43:16

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,008
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:
Sector11 wrote:

ops Oh OK, that explains that part but not the "Moon" ops

My sig "v9000" needs fixing too.  sad   - blame it on tiny.cc  wink  -->> this works: tiny.cc/lxm9mw

thanks, ill update my sig... dont know why it was that one in particular while the others continued working...

re the moon... i cant think of a reason why its not showing up
post the your template and ill test it on my puter

Yea, I've been trying, it just doesn't want to show.

See lines 72 & 73 of the template - this was just as a test.

--image({x=25,y=imgy,file=weather_icon[2]})
image({x=25,y=imgy,file=moon_icon[1]})

S11_V9_R-template.lua

--[[
 The latest script is a lua only weather script. aka: v9000
 http://crunchbanglinux.org/forums/topic/16100/weather-in-conky/

 the file:
 http://dl.dropbox.com/u/19008369/current%20v9000/v9000.tar.gz

 mrppeachys LUA Tutorial
 http://crunchbanglinux.org/forums/topic/17246/how-to-using-lua-scripts-in-conky/
]]
_G.weather_script = function()--#### 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="CorporateMonoExtraBold"--font must be in quotes
default_font_size=10
default_color=0xffffff--white
default_alpha=1--fully opaque
default_image_width=20
default_image_height=20
--END OF DEFAULTS #######################################################
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE
datay=28
datayy=13 --datay+(datayy*1)
imgy=150
imgyy=39 -- imgy+(imgyy*1)
-- out({c=0x9ACD32,a=1,x=12,y=15,txt="Bs As"})
-- out({c=0x9ACD32,,a=1,x=6,y=50,txt="cpu:"..conky_parse("${cpu}")})
-- image({x=25,y=20,file=now["weather_icon"]})
-- image({x=25,y=55,w=20,h=20,file=/media/5/Conky/images/blue-1.png})
-- out({x=25,y=55,txt=""..conky_parse("${image /media/5/Conky/images/blue-1.png -p 25,55 -s 20x20}")})
--[[out({c=0x9ACD32,a=1,x=5,y=datay,txt=now["temp"]})
out({c=0x00BFFF,a=1,x=5,y=datay+(datayy*1),txt=now["feels_like"]})
out({c=0xFAFAEC,a=1,x=5,y=datay+(datayy*2),txt="B"})
out({c=0x48D1CC,a=1,x=15,y=datay+(datayy*2),txt=now["pressure_mb"]})
out({c=0xFAFAEC,a=1,x=5,y=datay+(datayy*3),txt="H"})
out({c=0x48D1CC,a=1,x=25,y=datay+(datayy*3),txt=now["humidity"].."%"})
out({c=0xFAFAEC,a=1,x=5,y=datay+(datayy*4),txt="DP"})
out({c=0x48D1CC,a=1,x=25,y=datay+(datayy*4),txt=now["dew_point"].."°"})

out({c=0xFAFAEC,a=1,x=5,y=datay+(datayy*5),txt="UV"})
out({c=0x48D1CC,a=1,x=25,y=datay+(datayy*5),txt=uv_index_num[1]})
out({c=0x48D1CC,a=1,x=5,y=datay+(datayy*6),txt=uv_index_txt[1]})
----]]
-- today is
out({c=0x9ACD32,a=1,x=5,y=15,txt=forecast_day_short[1]})
out({c=0x9ACD32,a=1,x=35,y=15,txt=forecast_date[1]})
-- 3 hour output
-- 1st hour
out({c=0xA4FFA4,x=11,y=datay,txt=now["fc_hour1_time_24"]..":00"})
image({x=25,y=33,file=now["fc_hour1_wicon"]})
--  image({x=25,y=33,file="/media/5/Conky/images/red_1.png"})
out({x=5,y=45,txt=now["fc_hour1_temp"] .."°"})
-- 2nd hour
out({c=0xA4FFA4,x=11,y=datay+(datayy*3),txt=now["fc_hour2_time_24"]..":00"})
image({x=25,y=33+39,file=now["fc_hour2_wicon"]})
--  image({x=25,y=33+39,file="/media/5/Conky/images/red_1.png"})
out({x=5,y=45+40,txt=now["fc_hour2_temp"] .."°"})
-- 3rd hour
out({c=0xA4FFA4,x=11,y=datay+(datayy*6),txt=now["fc_hour3_time_24"]..":00"})
image({x=25,y=33+(39*2),file=now["fc_hour3_wicon"]})
-- image({x=25,y=33+(39*2),file="/media/5/Conky/images/red_1.png"})
out({x=5,y=45+80,txt=now["fc_hour3_temp"] .."°"})
-- yellow line
image({w=45,h=1,x=5,y=134,file="/media/5/Conky/images/yellow_1.png"})
-- start of forcast days
out({c=0x9ACD32,a=1,x=5,y=datay+(datayy*9),txt=forecast_day_short[2]})
out({c=0x9ACD32,a=1,x=35,y=datay+(datayy*9),txt=forecast_date[2]})
--image({x=25,y=imgy,file=weather_icon[2]})
image({x=25,y=imgy,file=moon_icon[1]})
out({c=0xFF8C00,a=1,x=5,y=datay+(datayy*10),txt=high_temp[2]})
out({c=0x00BFFF,a=1,x=5,y=datay+(datayy*11),txt=low_temp[2]})

out({c=0x9ACD32,a=1,x=5,y=datay+(datayy*12),txt=forecast_day_short[3]})
out({c=0x9ACD32,a=1,x=35,y=datay+(datayy*12),txt=forecast_date[3]})
image({x=25,y=imgy+(imgyy*1),file=weather_icon[3]})
out({c=0xFF8C00,a=1,x=5,y=datay+(datayy*13),txt=high_temp[3]})
out({c=0x00BFFF,a=1,x=5,y=datay+(datayy*14),txt=low_temp[3]})

out({c=0x9ACD32,a=1,x=5,y=datay+(datayy*15),txt=forecast_day_short[4]})
out({c=0x9ACD32,a=1,x=35,y=datay+(datayy*15),txt=forecast_date[4]})
image({x=25,y=imgy+(imgyy*2),file=weather_icon[4]})
out({c=0xFF8C00,a=1,x=5,y=datay+(datayy*16),txt=high_temp[4]})
out({c=0x00BFFF,a=1,x=5,y=datay+(datayy*17),txt=low_temp[4]})

out({c=0x9ACD32,a=1,x=5,y=datay+(datayy*18),txt=forecast_day_short[5]})
out({c=0x9ACD32,a=1,x=35,y=datay+(datayy*18),txt=forecast_date[5]})
image({x=25,y=imgy+(imgyy*3),file=weather_icon[5]})
out({c=0xFF8C00,a=1,x=5,y=datay+(datayy*19),txt=high_temp[5]})
out({c=0x00BFFF,a=1,x=5,y=datay+(datayy*20),txt=low_temp[5]})

out({c=0x9ACD32,a=1,x=5,y=datay+(datayy*21),txt=forecast_day_short[6]})
out({c=0x9ACD32,a=1,x=35,y=datay+(datayy*21),txt=forecast_date[6]})
image({x=25,y=imgy+(imgyy*4),file=weather_icon[6]})
out({c=0xFF8C00,a=1,x=5,y=datay+(datayy*22),txt=high_temp[6]})
out({c=0x00BFFF,a=1,x=5,y=datay+(datayy*23),txt=low_temp[6]})

out({c=0x9ACD32,a=1,x=5,y=datay+(datayy*24),txt=forecast_day_short[7]})
out({c=0x9ACD32,a=1,x=35,y=datay+(datayy*24),txt=forecast_date[7]})
image({x=25,y=imgy+(imgyy*5),file=weather_icon[7]})
out({c=0xFF8C00,a=1,x=5,y=datay+(datayy*25),txt=high_temp[7]})
out({c=0x00BFFF,a=1,x=5,y=datay+(datayy*26),txt=low_temp[7]})

out({c=0x9ACD32,a=1,x=5,y=datay+(datayy*27),txt=forecast_day_short[8]})
out({c=0x9ACD32,a=1,x=35,y=datay+(datayy*27),txt=forecast_date[8]})
image({x=25,y=imgy+(imgyy*6),file=weather_icon[8]})
out({c=0xFF8C00,a=1,x=5,y=datay+(datayy*28),txt=high_temp[8]})
out({c=0x00BFFF,a=1,x=5,y=datay+(datayy*29),txt=low_temp[8]})

out({c=0x9ACD32,a=1,x=5,y=datay+(datayy*30),txt=forecast_day_short[9]})
out({c=0x9ACD32,a=1,x=35,y=datay+(datayy*30),txt=forecast_date[9]})
image({x=25,y=imgy+(imgyy*7),file=weather_icon[9]})
out({c=0xFF8C00,a=1,x=5,y=datay+(datayy*31),txt=high_temp[9]})
out({c=0x00BFFF,a=1,x=5,y=datay+(datayy*32),txt=low_temp[9]})
-- yellow line
image({w=45,h=1,x=5,y=450,file="/media/5/Conky/images/yellow_1.png"})

--########################################################################################
--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 Sector11 (2012-11-05 03:11:31)


#! Conky = 13 Threads & the Conky Archives | Conky PitStop | OHCG'er
#! Forum Moderator   |   StartPage -  protect your privacy   |   BBQ Linux

Offline

#779 2012-11-05 02:49:46

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

Re: weather in conky (LUA scripts) updated 12/26/13!

strange indeed
you checked that you have the images in /home/username/v9000/additional_files/weathericons/ ?
Screenshot_at_2012_11_04_20_45_49.jpg

Last edited by mrpeachy (2012-11-05 02:50:01)

Offline

#780 2012-11-05 03:09:02

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,008
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

strange indeed
you checked that you have the images in /home/username/v9000/additional_files/weathericons/ ?
http://s7.postimage.org/l97tkimev/Screenshot_at_2012_11_04_20_45_49.jpg

Yea, they are there:
acrA3ChO.jpg

cry


#! Conky = 13 Threads & the Conky Archives | Conky PitStop | OHCG'er
#! Forum Moderator   |   StartPage -  protect your privacy   |   BBQ Linux

Offline

#781 2012-11-05 03:30:30

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,008
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

Interesting, this works:

--image({x=25,y=imgy,file=weather_icon[2]})
--image({x=25,y=imgy,file=moon_icon[1]})
image ({x=25,y=imgy,file="/home/sector11/v9000/additional_files/weathericons/moon_waning_gibbous.png"})

adg2WpG1.jpg


#! Conky = 13 Threads & the Conky Archives | Conky PitStop | OHCG'er
#! Forum Moderator   |   StartPage -  protect your privacy   |   BBQ Linux

Offline

#782 2012-11-05 03:47:11

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,008
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

Starting that conky in a terminal produces no errors, do I started it in debug mode.

Any of this make sense:

 05 Nov 12 | 00:42:37 ~
         $ conky -c /media/5/Conky/S11_v9_R.conky &
[1] 24145

 05 Nov 12 | 00:43:10 ~
         $ Conky: desktop window (260) is root window
Conky: window type - normal
Conky: drawing to created window (0x1a00001)
Conky: drawing to double buffer
gathering data with curl
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 70928  100 70928    0     0  68896      0  0:00:01  0:00:01 --:--:--   98k
not checking for alerts
processing complete
Conky: received SIGINT or SIGTERM to terminate. bye!

[1]+  Done                    conky -c /media/5/Conky/S11_v9_R.conky

 05 Nov 12 | 00:43:32 ~
         $ conky -c /media/5/Conky/S11_v9_R.conky -D &
[1] 24166

 05 Nov 12 | 00:43:44 ~
         $ DEBUG(0) [../../src/conky.c:5338]: reading contents from config file '/media/5/Conky/S11_v9_R.conky'
Conky: desktop window (260) is root window
Conky: window type - normal
Conky: drawing to created window (0x1a00001)
Conky: drawing to double buffer
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '48 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '48 < 100'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 100'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 100'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '0 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '3 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '3 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '1 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '2 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '9 < 10'
gathering data with curl
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 70928  100 70928    0     0  77718      0 --:--:-- --:--:-- --:--:-- 97161
not checking for alerts
processing complete
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '48 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '48 < 100'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 100'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 100'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '0 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '7 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '7 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '4 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '6 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '9 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '48 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '48 < 100'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 100'
{keeps on repeating}

#! Conky = 13 Threads & the Conky Archives | Conky PitStop | OHCG'er
#! Forum Moderator   |   StartPage -  protect your privacy   |   BBQ Linux

Offline

#783 2012-11-05 04:03:44

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

Re: weather in conky (LUA scripts) updated 12/26/13!

Sector11 wrote:

Interesting, this works:

--image({x=25,y=imgy,file=weather_icon[2]})
--image({x=25,y=imgy,file=moon_icon[1]})
image ({x=25,y=imgy,file="/home/sector11/v9000/additional_files/weathericons/moon_waning_gibbous.png"})

http://t.imgbox.com/adg2WpG1.jpg

put this line into the template and watch the terminal

print(moon_icon[1])

Offline

#784 2012-11-05 04:49:14

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,008
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:
Sector11 wrote:

Interesting, this works:

--image({x=25,y=imgy,file=weather_icon[2]})
--image({x=25,y=imgy,file=moon_icon[1]})
image ({x=25,y=imgy,file="/home/sector11/v9000/additional_files/weathericons/moon_waning_gibbous.png"})

http://t.imgbox.com/adg2WpG1.jpg

put this line into the template and watch the terminal

print(moon_icon[1])

mrpeachy you may kick my no so royal behind . I was going yo show this ... with a I'm jinxed:
aburHudx.jpg
Noticed I changed my location in my /home/sector11/.v9000_config.lua script thinking it was my location... when I noticed this line:

local weathericons="/media/5/Conky/images/weathericons/"

OH DUH!!!!!!!!!!!!!!!!!!!
But still no moon:
actni6ev.jpg

Bending over - but: Getting there- off to bed

Last edited by Sector11 (2012-11-05 04:49:49)


#! Conky = 13 Threads & the Conky Archives | Conky PitStop | OHCG'er
#! Forum Moderator   |   StartPage -  protect your privacy   |   BBQ Linux

Offline

#785 2012-11-05 17:13:51

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,008
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

@ mrpeachy

OK, I'm bent over and waiting for a good swift kick in the not so royal behind!

ops You will NOT believe this, well maybe you will.

Recently I moved all my conkys and all conky related stuff to /media/5 and freed up +/-20% of my /home space (Conkys total +1GB)

ran "search and replace - in session" on almost every conky related file I have, changing:

  • ~/Conky to /media/5/Conky

  • ~/conky to /media/5/conky

  • /home/sector11/Conky to /media/5/Conky

  • /home/sector11/conky to /media/5/conky

v9000 still worked... never though about it but last night I looked in /home/sector11/.v9000_config.lua and what do I see:

local weathericons="/media/5/Conky/images/weathericons/"

OUCH!  It hit me when v9000 was brand new I put the weathericon there and forgot them.  Then came some v9000 updates - with new images ... guess what never got updated.

NOW it reads:

local weathericons="/home/sector11/v9000/additional_files/weathericons/"

and works properly.

I apologize for any anguish ...
Ready to receive kick!
3 ... 2 ... 1 ...


#! Conky = 13 Threads & the Conky Archives | Conky PitStop | OHCG'er
#! Forum Moderator   |   StartPage -  protect your privacy   |   BBQ Linux

Offline

#786 2012-11-05 18:14:49

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

Re: weather in conky (LUA scripts) updated 12/26/13!

*kicks sector11 in his royal behind*

Offline

#787 2012-11-05 19:09:13

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,008
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

*kicks sector11 in his royal behind*

lol  I can understand a missing or misplaced comma - but a whole directory!  lol

I deserved that kick!


#! Conky = 13 Threads & the Conky Archives | Conky PitStop | OHCG'er
#! Forum Moderator   |   StartPage -  protect your privacy   |   BBQ Linux

Offline

#788 2012-11-07 19:57:39

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,008
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy I have another question/problem.

My Horizontal 10 day v9000 conky should look like this:
abwcRqTe.jpg
Note:

  1. digitalk font for 22 22

  2. Note the: Temp       WC·HI - for Wind Chill·Heat Index (Feels Like)

  3. Zekton font for Scat Clouds

  4. Wind Chill font

But it's had problems since changing /home/sector11/v9000/v9000.lua:

function out(tx)--##############################################################
--#############################
--additional face settings
face=nil
face=(tx.face or default_face)  -- old is: face=(tx.face or "normal")
if face=="normal" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bold" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
elseif face=="italic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bolditalic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
end
--##############################################################################
c=nil
c=(tx.c or default_color)
a=nil
a=(tx.a or default_alpha)
f=nil
f=(tx.f or default_font)
fs=nil
fs=(tx.fs or default_font_size)
x=nil
x=(tx.x or 0)
y=nil
y=(tx.y or 0)
txt=nil
txt=(tx.txt or "set txt")
local function col(c,a)
return ( (c/0x10000) % 0x100)/255,( (c/0x100) % 0x100)/255,(c % 0x100)/255,a
end--local function
cairo_set_font_size (cr, fs)
cairo_set_source_rgba (cr,col(c,a))
cairo_move_to (cr,x,y)
cairo_show_text (cr,txt)
cairo_stroke (cr)
end--function out ##############################################################

What happens now without the added section for the template:

-- ## New Options ###
default_face="normal"
-- "normal" for normal/normal
-- "bold" for normal/bold
-- "italic" for italic/normal
-- "bolditalic" for italic/bold

Everything is "the default font" - Anonymous Pro - even where I call for digitalk (32 32) and Zekton (Clear)
adq2bq8u.jpg

Once I add the "New Options" section into the template --- weird stuff happens:
adtbJtwd.jpg
Take a look at the highlighted lines in medit.

Sizes seem to be working just fine - changing font names is messing up.

My: h-10d-template.lua with the commented lines.

--[[
 The latest script is a lua only weather script. aka: v9000
 http://crunchbanglinux.org/forums/topic/16100/weather-in-conky/

 the file:
http://dl.dropbox.com/u/19008369/v9000.tar.gz

 mrppeachys LUA Tutorial
 http://crunchbanglinux.org/forums/topic/17246/how-to-using-lua-scripts-in-conky/

sun_rise_24[n]
sun_set_24[n]
moon_rise_24[n]
moon_set_24[n]
now["time_24"]
now["fc_hour1_time_24"]
now["fc_hour2_time_24"]
now["fc_hour3_time_24"]

]]
_G.weather_script = function()--#### 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="Anonymous Pro"--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
-- ## New Options ###
default_face="normal"
-- "normal" for normal/normal
-- "bold" for normal/bold
-- "italic" for italic/normal
-- "bolditalic" for italic/bold
--END OF DEFAULTS #######################################################
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE
out({c=0x00BFFF,a=1,x=10,y=15,txt=now["date"].." "..now["month_short"].." "..now["year"]..": Fetched @ "..now["time_24"]})
image({x=20,y=20,h=40,w=40,file=now["weather_icon"]})
-- Temp / FeelsLike & CONDITIONS TEXT
out({c=0x48D1CC,a=1,f="digitalk",fs=50,x=80,y=60,txt=now["temp"]})			-- this is not digitalk font
out({c=0x00BFFF,a=1,f="digitalk",fs=50,x=140,y=60,txt=now["feels_like"]})		-- this is     digitalk font
out({c=0xA4FFA4,a=1,x=81,y=72,txt="Temp          WC · HI"})					-- this does not show Under "Sun    32 . 32"

out({c=0x48D1CC,a=1,f="Zekton",fs=18,x=10,y=94,txt=now["conditions_short"]})	-- this is not Zekton (Clear)

-- data titles
--    data output
datay=110   -- y=datay or
datayy=15   -- y=datay+(datayy*1) use 1 or more

out({c=0xFAFAEC,a=1,x=10,y=datay,txt="Wind Chill:"})						-- this is Zekton font ???????
   out({c=0x48D1CC,a=1,x=70,y=datay,txt=now["wind_chill"].."°"})
out({c=0xFAFAEC,a=1,x=100,y=datay,txt="Heat Index:"})
   out({c=0xFF8C00,a=1,x=165,y=datay,txt=now["heat_index"].."°"})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*1),txt="Today's Hi·Lo:"})
   out({c=0xFF8C00,a=1,x=100,y=datay+(datayy*1),txt=high_temp[1].."°"})
   out({c=0x48D1CC,a=1,x=140,y=datay+(datayy*1),txt=low_temp[1].."°"})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*2),txt="Wind:"})
   out({c=0x48D1CC,a=1,x=60,y=datay+(datayy*2),txt=now["wind_km"]})
   out({c=0x48D1CC,a=1,x=110,y=datay+(datayy*2),txt=now["wind_nesw"]})
   out({c=0xFAFAEC,a=1,x=140,y=datay+(datayy*2),txt="@"})
   out({c=0x48D1CC,a=1,x=165,y=datay+(datayy*2),txt=now["wind_deg"]})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*3),txt="Hum:"})
   out({c=0x48D1CC,a=1,x=60,y=datay+(datayy*3),txt=now["humidity"].."%"})
out({c=0xFAFAEC,a=1,x=110,y=datay+(datayy*3),txt="DP:"})
   out({c=0x48D1CC,a=1,x=145,y=datay+(datayy*3),txt=now["dew_point"].."°"})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*4),txt="Bar:"})
   out({c=0x48D1CC,a=1,x=60,y=datay+(datayy*4),txt=now["pressure_mb"]})
out({c=0xFAFAEC,a=1,x=110,y=datay+(datayy*4),txt="Vis:"})
   out({c=0x48D1CC,a=1,x=145,y=datay+(datayy*4),txt=now["visibility"]})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*5),txt="Ceil:"})
   out({c=0x48D1CC,a=1,x=60,y=datay+(datayy*5),txt=now["ceiling"]})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*6),txt="Precip:"})
   out({c=0x48D1CC,a=1,x=60,y=datay+(datayy*6),txt=precipitation[1].."%"})
out({c=0xFAFAEC,a=1,x=110,y=datay+(datayy*6),txt="Cloud:"})
   out({c=0x48D1CC,a=1,x=150,y=datay+(datayy*6),txt=cloud_cover[1].."%"})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*7),txt="UV:"})
   out({c=0x48D1CC,a=1,x=60,y=datay+(datayy*7),txt=uv_index_num[1]})
   out({c=0x48D1CC,a=1,x=110,y=datay+(datayy*7),txt=uv_index_txt[1]})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*8),txt="Sun:"})
   out({c=0xFAFAEC,a=1,x=60,y=datay+(datayy*8),txt=sun_rise_24[1]})
   out({c=0x48D1CC,a=1,x=120,y=datay+(datayy*8),txt=sun_set_24[1]})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*9),txt="Moon:"})
   out({c=0xFAFAEC,a=1,x=60,y=datay+(datayy*9),txt=moon_rise_24[1]})
   out({c=0x48D1CC,a=1,x=120,y=datay+(datayy*9),txt=moon_set_24[1]})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*10),txt="Phase:"})
   out({c=0x48D1CC,a=1,x=60,y=datay+(datayy*10),txt=moon_phase[1]})

-- line
image({x=205,y=5,w=1,h=260,file="/home/sector11/Conky/images/cyan-1.png"})
-- 3 hour output
out({c=0x48D1CC,a=1,f="Anonymous Pro:bold",fs=12,x=220,y=15,txt="Next 3"})
out({c=0x48D1CC,a=1,f="Anonymous Pro:bold",fs=12,x=220,y=30,txt="Hours"})
-- 1st hour
out({c=0xA4FFA4,x=220,y=50,txt=now["fc_hour1_time_24"]..":00"})
image({w=30,h=30,x=223,y=55,file=now["fc_hour1_wicon"]}) -- image({w=30,h=30,x=223,y=55,file="/home/sector11/Conky/images/red-1.png"})
out({x=228,y=100,txt=now["fc_hour1_temp"] .."°"})
-- 2nd hour
out({c=0xA4FFA4,x=220,y=datay+(datayy*1),txt=now["fc_hour2_time_24"]..":00"})
image({w=30,h=30,x=223,y=130,file=now["fc_hour2_wicon"]}) -- image({w=30,h=30,x=223,y=130,file="/home/sector11/Conky/images/red-1.png"})
out({x=228,y=180,txt=now["fc_hour2_temp"] .."°"})
-- 3rd hour
out({c=0xA4FFA4,x=220,y=210,txt=now["fc_hour3_time_24"]..":00"})
image({w=30,h=30,x=223,y=215,file=now["fc_hour3_wicon"]}) -- image({w=30,h=30,x=223,y=215,file="/home/sector11/Conky/images/red-1.png"})
out({x=228,y=datay+(datayy*10),txt=now["fc_hour3_temp"] .."°"})
-- line
image({x=275,y=5,w=1,h=260,file="/home/sector11/Conky/images/cyan-1.png"})

--start or weather forecast table section
--set start forecast day
start_day=1
--set total forecast days you want to display
number_of_days=10
topy=15
topyy=135 -- topy+(topyy*1)
topx=285
topxx=120
--set coordinates for top lef corners for each repeat
top_left_x_coordinate[1],top_left_y_coordinate[1]        =topx            ,topy
   top_left_x_coordinate[2],top_left_y_coordinate[2]     =topx+(topxx*1)  ,topy
top_left_x_coordinate[3],top_left_y_coordinate[3]        =topx+(topxx*2)  ,topy
   top_left_x_coordinate[4],top_left_y_coordinate[4]     =topx+(topxx*3)  ,topy
top_left_x_coordinate[5],top_left_y_coordinate[5]        =topx+(topxx*4)  ,topy
   top_left_x_coordinate[6],top_left_y_coordinate[6]     =topx            ,topy+(topyy*1)
top_left_x_coordinate[7],top_left_y_coordinate[7]        =topx+(topxx*1)  ,topy+(topyy*1)
   top_left_x_coordinate[8],top_left_y_coordinate[8]     =topx+(topxx*2)  ,topy+(topyy*1)
top_left_x_coordinate[9],top_left_y_coordinate[9]        =topx+(topxx*3)  ,topy+(topyy*1)
   top_left_x_coordinate[10],top_left_y_coordinate[10]   =topx+(topxx*4)  ,topy+(topyy*1)
--########################################################################################
for i=start_day,number_of_days-(start_day-1) 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 ##################
--########################################################################################
out({c=0xA4FFA4,a=1,x=tlx,y=tly,txt=forecast_day_short[i].."  "..forecast_date[i].."  "..forecast_month_short[i]})
image({x=tlx,y=tly+5,h=30,w=30,file=weather_icon[i]})
out({c=0xFF8C00,a=1,x=tlx+35,y=tly+15,txt=high_temp[i].."°"})
out({c=0x48D1CC,a=1,x=tlx+35,y=tly+30,txt=low_temp[i].."°"})
out({c=0x48D1CC,a=1,x=tlx,y=tly+50,txt=conditions_short[i]})

out({c=0xFAFAEC,a=1,x=tlx,y=tly+65,txt="P: "..precipitation[i].."%"})
   out({c=0xFAFAEC,a=1,x=tlx+50,y=tly+65,txt="UV: "..uv_index_num[i]})
out({c=0xFAFAEC,a=1,x=tlx,y=tly+80,txt="H: "..humidity[i].."%"})
	out({c=0xFAFAEC,a=1,x=tlx+50,y=tly+80,txt=uv_index_txt[i]})
out({c=0xFAFAEC,a=1,x=tlx,y=tly+95,txt="S: "..sun_rise_24[i]})
   out({c=0x48D1CC,a=1,x=tlx+60,y=tly+95,txt=sun_set_24[i]})
out({c=0xFAFAEC,a=1,x=tlx,y=tly+110,txt="M: "..moon_rise_24[i]})
   out({c=0x48D1CC,a=1,x=tlx+60,y=tly+110,txt=moon_set_24[i]})
--########################################################################################
end--of forecast repeat section ##########################################################
--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################

Any help appreciated ... I've run out of idea here.

Last edited by Sector11 (2012-11-07 19:58:05)


#! Conky = 13 Threads & the Conky Archives | Conky PitStop | OHCG'er
#! Forum Moderator   |   StartPage -  protect your privacy   |   BBQ Linux

Offline

#789 2012-11-07 20:12:48

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

Re: weather in conky (LUA scripts) updated 12/26/13!

oops... another oversight on my part im afraid

you need to move the lines that set f above the lines that set face

it is like this

--#############################
--additional face settings
face=nil
face=(tx.face or default_face)
if face=="normal" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bold" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
elseif face=="italic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bolditalic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
end
--##############################
c=nil
c=(tx.c or default_color)
a=nil
a=(tx.a or default_alpha)
f=nil
f=(tx.f or default_font)

should be like this

--font needs to be set first #########
f=nil
f=(tx.f or default_font)
--#############################
--additional face settings
face=nil
face=(tx.face or default_face)
if face=="normal" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bold" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
elseif face=="italic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bolditalic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
end
--##############################
c=nil
c=(tx.c or default_color)
a=nil
a=(tx.a or default_alpha)

Offline

#790 2012-11-07 20:34:18

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,008
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

oops... another oversight on my part im afraid

you need to move the lines that set f above the lines that set face

it is like this

Reading that it seems so easy.  Could have saved hours asking you earlier but wanted to try on my own.

Works perfectly!  Thanks again for #1,000,027.  big_smile

Last edited by Sector11 (2012-11-08 00:13:19)


#! Conky = 13 Threads & the Conky Archives | Conky PitStop | OHCG'er
#! Forum Moderator   |   StartPage -  protect your privacy   |   BBQ Linux

Offline

#791 2012-11-07 21:46:13

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

Re: weather in conky (LUA scripts) updated 12/26/13!

this is one thing that you have to watch out for when writing lua for conky
the way that variables "hang around"

i have often been working on a script as it is running in conky, everything seems to be working fine, then on conky restart nil errors!

Offline

#792 2012-11-08 00:47:48

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,008
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

this is one thing that you have to watch out for when writing lua for conky
the way that variables "hang around"

i have often been working on a script as it is running in conky, everything seems to be working fine, then on conky restart nil errors!

Just coming back after three hours of no power - 33°C (95°F) - not fun.  Almost the entire city was out - 3,000,000 people! And tomorrow promises to be the same.

Yea, picked up on that a while back - - - not just LUA but conky as well.  For that reason 98% of my conkys have a line at or near the top of the conky similar to:

# killall conky && conky -c /media/5/Conky/S11_Chronograph.conky &

and one of two things ...
1. Medit open with the terminal at the bottom:
abtVeroD.jpg, or

2. medit and terminator set with two windows one for conky and one for KFC!
acxdXZy2.jpg

Nothing worse than an hours work - getting it 'just right' and then KFC - restart and - HUH! WAHAPPENED!


#! Conky = 13 Threads & the Conky Archives | Conky PitStop | OHCG'er
#! Forum Moderator   |   StartPage -  protect your privacy   |   BBQ Linux

Offline

#793 2012-11-16 23:39:47

DrakarNoir
#! CrunchBanger
From: just beyond the sign post
Registered: 2011-09-02
Posts: 132
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

@MrPeachy, (or anyone... smile )

I am working on a V9000 for a freind who wants to see weather for two cities (not at the same time) and was wondering if you might help me with this. Here is the template I want to use:

click_start=1
weatherbutton=0
--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION-
_G.weather_script = function()--#### 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="DroidSans"--font must be in quotes
default_font_size=11
default_color=0xffffff--white
default_alpha=5--fully opaque
default_image_width=50
default_image_height=50
--END OF DEFAULTS #######################################################
--start clickfunction and resturn coordinates
localx,localy=clickfunction()
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE
--####################################
--MAIN WEATHER BUTTON ################
--####################################
--weatherbutton button
local weatherbuttonx=10.5
local weatherbuttony=5.5
local weatherbuttonw=45
local weatherbuttonh=45
--calculate if click was inside box
if localx>=weatherbuttonx and localx<=weatherbuttonx+weatherbuttonw and localy>=weatherbuttony and localy<=weatherbuttony+weatherbuttonh and weatherbutton~=1 then 
weatherbutton=1 
elseif localx>=weatherbuttonx and localx<=weatherbuttonx+weatherbuttonw and localy>=weatherbuttony and localy<=weatherbuttony+weatherbuttonh and weatherbutton==1 then 
weatherbutton=0
end
if weatherbutton==0 then
alsx=15
alsy=75
out ({c=0x71A1DF,f="DroidSans",fs=11,x=weatherbuttonx+45,y=weatherbuttony+8,txt=now["conditions"]})
out ({c=0x2C3949,f="DroidSans:bold",fs=24,x=weatherbuttonx+44,y=weatherbuttony+32,txt=now["temp"].."°"})
out ({c=0x6f99b4,f="DroidSans:bold",fs=24,x=weatherbuttonx+43,y=weatherbuttony+31,txt=now["temp"].."°"})
out ({c=0xFFFFFF,f="DroidSans",fs=10,x=weatherbuttonx+45,y=weatherbuttony+43,txt="Feels Like: "})
  out ({c=0xFFFFFF,f="DroidSans",fs=10,x=weatherbuttonx+92,y=weatherbuttony+43,txt=now["temp"].."°"})
image({x=weatherbuttonx,y=weatherbuttony+2,h=40,w=40,file=now["weather_icon"]})
out({c=0x00BFFF,a=1,f="DroidSans",fs=11,x=weatherbuttonx,y=weatherbuttony+60,txt=weather_location})
end
--###########################################################
--THIS SECTION TURNED ON BY MAIN WEATHER BUTTON #############
--###########################################################
if weatherbutton==1 then
out ({c=0xFFFFFF,f="DroidSans",fs=11,x=weatherbuttonx+45,y=weatherbuttony+8,txt=now["conditions"]})
out ({c=0xFAFAEC,f="DroidSans:bold",fs=24,x=weatherbuttonx+44,y=weatherbuttony+32,txt=now["temp"].."°"})
out ({c=0x48D1CC,f="DroidSans:bold",fs=24,x=weatherbuttonx+43,y=weatherbuttony+31,txt=now["temp"].."°"})
out ({c=0xFFFFFF,f="DroidSans",fs=10,x=weatherbuttonx+45,y=weatherbuttony+43,txt="Feels Like: "})
  out ({c=0xFFFFFF,f="DroidSans",fs=10,x=weatherbuttonx+92,y=weatherbuttony+43,txt=now["temp"].."°"})
image({x=weatherbuttonx,y=weatherbuttony+2,h=40,w=40,file=now["weather_icon"]})
out({c=0x00BFFF,a=1,f="DroidSans",fs=11,x=weatherbuttonx,y=weatherbuttony+60,txt=weather_location})

--Display Weather Information
x1=15--Start of column 1 (Data Label)
x2=85--Start of column 2 (Data)
x3=140--Start of column 3 (Data Label)
x4=200--Start of column 4 (Data)
ypos=85
yypos=12
gap=15

--image({x=x1-7,y=ypos-12,h=210,w=260,file="~/.conky/NightDrive/images/1_pixel/bk_20.png"})
--data titles
  --output of data options
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos,txt="Wind Chill:"})
  out({c=0x00BFFF,a=1,f="DroidSans",fs=11,x=x2,y=ypos,txt=now["wind_chill"].."°"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x3,y=ypos,txt="Heat Index:"})
  out({c=0xFF8C00,a=1,f="DroidSans",fs=11,x=x4,y=ypos,txt=now["heat_index"].."°"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*1),txt="Today's Hi:"})
  out({c=0xFF8C00,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*1),txt=high_temp[1].."°"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*1),txt="Today's Lo:"})
  out({c=0x00BFFF,a=1,f="DroidSans",fs=11,x=x4,y=ypos+(yypos*1),txt=low_temp[1].."°"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*2),txt="Dew Point:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*2),txt=now["dew_point"].."°"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*2),txt="Humidity:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x4,y=ypos+(yypos*2),txt=now["humidity"].."%"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*3),txt="Pressure:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*3),txt=round((now["pressure_mb"]*0.0295301), 2).."\""})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*4),txt="Wind:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*4),txt=now["wind_nesw"].." @ "..now["wind_mph"]..", ".."gusting to: "..now["wind_gusts"]})
ypos=ypos+2
yypos=12
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*5),txt="Visibility:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*5),txt=now["visibility"]})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*5),txt="Ceiling:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x4,y=ypos+(yypos*5),txt=now["ceiling"]})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*6),txt="Cloud Cover:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*6),txt=cloud_cover[1].."%"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*6),txt="UV Index:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x4,y=ypos+(yypos*6),txt=uv_index_num[1].." ".."("..uv_index_txt[1]..")"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*7),txt="Chance of Precipitation:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*7),txt=precipitation[1].."%"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*8),txt="Snow Probability:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*8),txt=snow[1].."%"})
ypos=ypos+2
yypos=12
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*9),txt="Sun Rise:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*9),txt=sun_rise_lc[1]})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*9),txt="Sun Set:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x4,y=ypos+(yypos*9),txt=sun_set_lc[1]})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*10),txt="Moon Rise:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*10),txt=moon_rise_lc[1]})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*10),txt="Moon Set:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x4,y=ypos+(yypos*10),txt=moon_set_lc[1]})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*11),txt="Moon Phase:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*11),txt=moon_phase[1]})
  image({x=x4,y=ypos+(yypos*10),h=20,w=20,file=moon_icon[1]})

--next 3 hour forecast button
--next3button button
local next3buttonx=10.5
local next3buttony=230
local next3buttonw=70
local next3buttonh=15
local next3buttononc={1,0,0,1}
local next3buttonoffc={1,1,1,1}
if localx>=next3buttonx and localx<=next3buttonx+next3buttonw and localy>=next3buttony and localy<=next3buttony+next3buttonh and next3button~=1 then next3button=1 elseif localx>=next3buttonx and localx<=next3buttonx+next3buttonw and localy>=next3buttony and localy<=next3buttony+next3buttonh and next3button==1 then next3button=0 end
if next3button==1 then cairo_set_source_rgba (cr,next3buttononc[1],next3buttononc[2],next3buttononc[3],next3buttononc[4]) else cairo_set_source_rgba (cr,next3buttonoffc[1],next3buttonoffc[2],next3buttonoffc[3],next3buttonoffc[4]) end;cairo_set_line_width (cr,1);cairo_rectangle (cr,next3buttonx,next3buttony,next3buttonw,next3buttonh);cairo_stroke (cr)
out ({f="DroidSans",fs=10,x=next3buttonx+5,y=next3buttony+next3buttonh-4,txt="Next 3 Hours"})font="DroidSans"
--THIS SECTION CONTROLLED BY NEXT3 BUTTON
--set adjustments for forecast buttons when next 3 on or off
if next3button==1 then
fcb=355
alsy=355
fcb1x=10.5
fcb1y=330
n3x=20
nxy=next3buttony+45

--image({x=x1-7,y=ypos-12,h=210,w=260,file="~/.conky/NightDrive/images/1_pixel/bk_20.png"})
--Hour 1
image({w=30,h=30,x=n3x+15,y=nxy-5,file=now["fc_hour1_wicon"]})--good
out({c=0xFF8C00,x=n3x+18,y=nxy-13,txt=now["fc_hour1_time"].." "..now["fc_hour1_ampm_lc"]})
out({c=0x48D1CC,x=n3x,y=nxy+40,txt=now["fc_hour1_temp"].."°".." / "..now["fc_hour1_cond_short"]})
--Hour 2
n3x=112
image({w=30,h=30,x=n3x+15,y=nxy-5,file=now["fc_hour2_wicon"]})--good
out({c=0xFF8C00,x=n3x+18,y=nxy-13,txt=now["fc_hour2_time"].." "..now["fc_hour2_ampm_lc"]})
out({c=0x48D1CC,x=n3x,y=nxy+40,txt=now["fc_hour2_temp"].."°".." / "..now["fc_hour2_cond_short"]})
--Hour 3
n3x=200
image({w=30,h=30,x=n3x+15,y=nxy-5,file=now["fc_hour3_wicon"]})--good
out({c=0xFF8C00,x=n3x+18,y=nxy-13,txt=now["fc_hour3_time"].." "..now["fc_hour3_ampm_lc"]})
out({c=0x48D1CC,x=n3x,y=nxy+40,txt=now["fc_hour3_temp"].."°".." / "..now["fc_hour3_cond_short"]})

else
fcb=255
alsy=255
fcb1x=100.5
fcb1y=230
end--next3button

--forecast button
--forecastbutton button
local forecastbuttonx=fcb1x
local forecastbuttony=fcb1y
local forecastbuttonw=100
local forecastbuttonh=15
local forecastbuttononc={1,0,0,1}
local forecastbuttonoffc={1,1,1,1}
if localx>=forecastbuttonx and localx<=forecastbuttonx+forecastbuttonw and localy>=forecastbuttony and localy<=forecastbuttony+forecastbuttonh and forecastbutton~=1 then forecastbutton=1 elseif localx>=forecastbuttonx and localx<=forecastbuttonx+forecastbuttonw and localy>=forecastbuttony and localy<=forecastbuttony+forecastbuttonh and forecastbutton==1 then forecastbutton=0 end
if forecastbutton==1 then cairo_set_source_rgba (cr,forecastbuttononc[1],forecastbuttononc[2],forecastbuttononc[3],forecastbuttononc[4]) else cairo_set_source_rgba (cr,forecastbuttonoffc[1],forecastbuttonoffc[2],forecastbuttonoffc[3],forecastbuttonoffc[4]) end;cairo_set_line_width (cr,1);cairo_rectangle (cr,forecastbuttonx,forecastbuttony,forecastbuttonw,forecastbuttonh);cairo_stroke (cr)
out ({f="DroidSans",fs=10,x=forecastbuttonx+5,y=forecastbuttony+forecastbuttonh-4,txt="Extended Forecast"})font="DroidSans"

if forecastbutton==1 then
alsy=255
--fc2button button
local fc2buttonx=10.5
local fc2buttony=fcb
local fc2buttonw=30
local fc2buttonh=15
local fc2buttononc={1,0,0,1}
local fc2buttonoffc={1,1,1,1}
if localx>=fc2buttonx and localx<=fc2buttonx+fc2buttonw and localy>=fc2buttony and localy<=fc2buttony+fc2buttonh and fc2button~=1 then fc8button=0;fc6button=0;fc4button=0;fc2button=1 elseif localx>=fc2buttonx and localx<=fc2buttonx+fc2buttonw and localy>=fc2buttony and localy<=fc2buttony+fc2buttonh and fc2button==1 then fc2button=0 end
if fc2button==1 then cairo_set_source_rgba (cr,fc2buttononc[1],fc2buttononc[2],fc2buttononc[3],fc2buttononc[4]) else cairo_set_source_rgba (cr,fc2buttonoffc[1],fc2buttonoffc[2],fc2buttonoffc[3],fc2buttonoffc[4]) end;cairo_set_line_width (cr,1);cairo_rectangle (cr,fc2buttonx,fc2buttony,fc2buttonw,fc2buttonh);cairo_stroke (cr)
out ({f="DroidSans",fs=10,x=fc2buttonx+3,y=fc2buttony+fc2buttonh-5,txt="2 Day"})

--fc4button button
local fc4buttonx=10.5+35
local fc4buttony=fcb
local fc4buttonw=30
local fc4buttonh=15
local fc4buttononc={1,0,0,1}
local fc4buttonoffc={1,1,1,1}
if localx>=fc4buttonx and localx<=fc4buttonx+fc4buttonw and localy>=fc4buttony and localy<=fc4buttony+fc4buttonh and fc4button~=1 then fc8button=0;fc6button=0;fc4button=1;fc2button=0 elseif localx>=fc4buttonx and localx<=fc4buttonx+fc4buttonw and localy>=fc4buttony and localy<=fc4buttony+fc4buttonh and fc4button==1 then fc4button=0 end
if fc4button==1 then cairo_set_source_rgba (cr,fc4buttononc[1],fc4buttononc[2],fc4buttononc[3],fc4buttononc[4]) else cairo_set_source_rgba (cr,fc4buttonoffc[1],fc4buttonoffc[2],fc4buttonoffc[3],fc4buttonoffc[4]) end;cairo_set_line_width (cr,1);cairo_rectangle (cr,fc4buttonx,fc4buttony,fc4buttonw,fc4buttonh);cairo_stroke (cr)
out ({f="DroidSans",fs=10,x=fc4buttonx+3,y=fc4buttony+fc4buttonh-5,txt="4 Day"})font="DroidSans"

--fc6button button
local fc6buttonx=10.5+70
local fc6buttony=fcb
local fc6buttonw=30
local fc6buttonh=15
local fc6buttononc={1,0,0,1}
local fc6buttonoffc={1,1,1,1}
if localx>=fc6buttonx and localx<=fc6buttonx+fc6buttonw and localy>=fc6buttony and localy<=fc6buttony+fc6buttonh and fc6button~=1 then fc8button=0;fc6button=1;fc4button=0;fc2button=0 elseif localx>=fc6buttonx and localx<=fc6buttonx+fc6buttonw and localy>=fc6buttony and localy<=fc6buttony+fc6buttonh and fc6button==1 then fc6button=0 end
if fc6button==1 then cairo_set_source_rgba (cr,fc6buttononc[1],fc6buttononc[2],fc6buttononc[3],fc6buttononc[4]) else cairo_set_source_rgba (cr,fc6buttonoffc[1],fc6buttonoffc[2],fc6buttonoffc[3],fc6buttonoffc[4]) end;cairo_set_line_width (cr,1);cairo_rectangle (cr,fc6buttonx,fc6buttony,fc6buttonw,fc6buttonh);cairo_stroke (cr)
out ({f="DroidSans",fs=10,x=fc6buttonx+3,y=fc6buttony+fc6buttonh-5,txt="6 Day"})font="DroidSans"

--fc8button button
local fc8buttonx=10.5+105
local fc8buttony=fcb
local fc8buttonw=30
local fc8buttonh=15
local fc8buttononc={1,0,0,1}
local fc8buttonoffc={1,1,1,1}
if localx>=fc8buttonx and localx<=fc8buttonx+fc8buttonw and localy>=fc8buttony and localy<=fc8buttony+fc8buttonh and fc8button~=1 then fc8button=1;fc6button=0;fc4button=0;fc2button=0 elseif localx>=fc8buttonx and localx<=fc8buttonx+fc8buttonw and localy>=fc8buttony and localy<=fc8buttony+fc8buttonh and fc8button==1 then fc8button=0 end
if fc8button==1 then cairo_set_source_rgba (cr,fc8buttononc[1],fc8buttononc[2],fc8buttononc[3],fc8buttononc[4]) else cairo_set_source_rgba (cr,fc8buttonoffc[1],fc8buttonoffc[2],fc8buttonoffc[3],fc8buttonoffc[4]) end;cairo_set_line_width (cr,1);cairo_rectangle (cr,fc8buttonx,fc8buttony,fc8buttonw,fc8buttonh);cairo_stroke (cr)
out ({f="DroidSans",fs=10,x=fc8buttonx+3,y=fc8buttony+fc8buttonh-4,txt="8 Day"})font="DroidSans"


if fc8button==1 then 
number_of_days=8
alsy=860
elseif fc6button==1 then 
number_of_days=6
alsy=740
elseif fc4button==1 then 
number_of_days=4
alsy=620
elseif fc2button==1 then 
number_of_days=2
alsy=500
else
number_of_days=0
alsy=380
end

else
number_of_days=0
end--if forecast buttonelse


--###########################################################
--start or weather forecast repeat section
--set start forecast day
if number_of_days>0 then--so that section is only active if you want to see it!
start_day=1
--set total forecast days you want to display
topy=fcb+40
ygap=120
--set coordinates for top lef corners for each repeat
top_left_x_coordinate[1],top_left_y_coordinate[1]=20,topy
top_left_x_coordinate[2],top_left_y_coordinate[2]=140,topy
ady=topy+ygap
top_left_x_coordinate[3],top_left_y_coordinate[3]=20,ady
top_left_x_coordinate[4],top_left_y_coordinate[4]=140,ady
ady=topy+ygap+ygap
top_left_x_coordinate[5],top_left_y_coordinate[5]=20,ady
top_left_x_coordinate[6],top_left_y_coordinate[6]=140,ady
ady=topy+ygap+ygap+ygap
top_left_x_coordinate[7],top_left_y_coordinate[7]=20,ady
top_left_x_coordinate[8],top_left_y_coordinate[8]=140,ady
--########################################################################################
for i=start_day,number_of_days-(start_day-1) do--start of day repeat, do not edit ########
local tlx=top_left_x_coordinate[i]--sets top left x position for each repeat ###################
local tly=top_left_y_coordinate[i]--sets top left y position for each repeat ###################
--########################################################################################
out({c=0xFAFAEC,x=tlx,y=tly,txt=forecast_day[i].." \- "..forecast_month_short[i].."\, "..forecast_date[i]})
image({x=tlx,y=tly+5,h=30,w=30,file=weather_icon[i]})
out({c=0xFF8C00,x=tlx+35,y=tly+33,txt=high_temp[i].."°"})
out({c=0xFAFAEC,x=tlx+52,y=tly+33,txt="/"})
out({c=0x00BFFF,x=tlx+60,y=tly+33,txt=low_temp[i].."°"})
out({c=0x48D1CC,x=tlx+35,y=tly+18,txt=conditions_short[i]})
out({c=0xFAFAEC,x=tlx-1,y=tly+50,txt="Chance Precip:"})
  out({c=0x48D1CC,x=tlx+78,y=tly+50,txt=precipitation[i].."%"})
out({c=0xFAFAEC,x=tlx,y=tly+62,txt="Wind:"})
  out({c=0x48D1CC,x=tlx+30,y=tly+62,txt=wind_nesw[i].." @ "..wind_mph[i].." mph"})
out({c=0xFAFAEC,x=tlx,y=tly+74,txt="Sunrise:"})
  out({c=0x48D1CC,x=tlx+55,y=tly+74,txt=sun_rise[i]})
out({c=0xFAFAEC,x=tlx,y=tly+86,txt="Sunset:"})
  out({c=0x48D1CC,x=tlx+55,y=tly+86,txt=sun_set[i]})
--out({c=0xFAFAEC,x=tlx,y=tly+98,txt="Moon:"})
  --out({c=0x48D1CC,x=tlx+30,y=tly+98,txt=moon_phase[i]})
--########################################################################################
end--of forecast repeat section ##########################################################
--########################################################################################
end--if number_of_days>0

end--OF WEATHER SECTION CONTROLLED BY MAIN WEATHER BUTTON

--ALERTS SECTION
--show alert icon
image({x=alsx,y=alsy,h=15,w=10,file=alert_icon})
--show number of alerts
out({x=alsx+15,y=alsy+15,fs=12,txt=alert_number})
--display alert information
display_alerts=2--set number of alerts to show,set 0 to show all
top_left_alert_x=28--set top left coordinates for entire alerts section
top_left_alert_y=15--^alerts will display in a single column
alert_gap=40--sets the gap between the TOP of one alert and the Top of the next alert
--#######################################################################################################################################
if alert_number==0 then noal=1 elseif alert_number~=0 and display_alerts>alert_number then noal=alert_number else noal=display_alerts end
for i=1,noal do--start of alerts display section. do not edit ###########################################################################
local tlx=alsx+top_left_alert_x--write output relative to tlx #################################
local tly=alsy+top_left_alert_y+((i-1)*alert_gap)--write output relative to tlx ###############
--########################################################################################
out({c=0xffffff,a=1,f="DroidSans",fs=8,x=tlx,y=tly,   txt=alert_type[i]})
out({c=0xffffff,a=1,f="DroidSans",fs=8,x=tlx,y=tly+15,txt=alert_issued[i]})
--########################################################################################
end--of alert display section ############################################################
--########################################################################################]]

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

function clickfunction()
--start click logging and calculations ##########################################
if click_start==1 then
print (click_start)
click_start=nil
xdot=conky_parse("${if_running xdotool}1${else}0${endif}")
if tonumber(xdot)==1 then
os.execute("killall xdotool && echo 'xdo killed' &")
end
os.execute("xdotool search --name conky_weather behave %@ mouse-click getmouselocation >> /tmp/xdo &")
start=nil
local f = io.popen("xwininfo -name 'conky_weather' | grep 'Absolute'")
geometry = f:read("*a")
f:close()
geometry=string.gsub(geometry,"[\n]","")
s,f,abstlx=string.find(geometry,"X%p%s*(%d*)")
s,f,abstly=string.find(geometry,"Y%p%s*(%d*)")
end--if click_start=1 ######################################
--click calculations #################################
local f=io.open("/tmp/xdo")
click=f:read()
f:close()
if click~=nil then
local f = io.open("/tmp/xdo","w")
f:write("")
f:close() 
end--if click=nil
if click==nil then click="x:0 y:0 " end
s,f,mousex=string.find(click,"x%p(%d*)%s")
s,f,mousey=string.find(click,"y%p(%d*)%s")
mousex=tonumber(mousex)
mousey=tonumber(mousey)
localx=mousex-abstlx
localy=mousey-abstly
--END CLICK CALCULATIONS #################################
return localx,localy
end--function
--rounding function
function round(number, decimal)
	local multiplier = 10^(decimal or 0)
	return math.floor(number * multiplier + 0.5) / multiplier
end

My thoughts are to have  the two city names listed side by side (or...) and clickable. The template, when initially loaded would show the ibnfo for the "home" city. When clicked the template would load the template for the requested city (ie: Detroit & New Orleans) thus displaying the weather for only one city at a time.

Thanks for any help...

DrakarNoir


"The nine most terrifying words in the English language are, 'I'm from the government and I'm here to help.'.”  ~Ronald Reagan

Offline

#794 2012-11-16 23:53:53

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

Re: weather in conky (LUA scripts) updated 12/26/13!

^this is not possible with v9000 as it currently exists
however, it would be possible to have 2 instances of v9000 running 2 different templates consecutively

you would have to duplicate the v9000 main script and rename it, for example v9001.lua
you would also have to edit some lines in v9001
lines 8 and 9 - you would need a second config file containing the second city location for 9001

package.path = '/home/'..username..'/.v9000_config.lua'
require '.v9000_config'

to

package.path = '/home/'..username..'/.v9001_config.lua'
require '.v9001_config'

so you would have to duplicate the config and rename the duplicate as above

also - line 985
from this:

if processall==0 or testing==1 then
_G.weather_script()
end

to something like this

if processall==0 or testing==1 then
_G.weather_script_9001()
end

then in the template that v9001 is running change line 2 to this

_G.weather_script_9001 = function()--#### DO NOT EDIT THIS LINE ##############

Offline

#795 2012-11-17 00:04:14

DrakarNoir
#! CrunchBanger
From: just beyond the sign post
Registered: 2011-09-02
Posts: 132
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

^this is not possible with v9000 as it currently exists
however, it would be possible to have 2 instances of v9000 running 2 different templates consecutively

you would have to duplicate the v9000 main script and rename it, for example v9001.lua
you would also have to edit some lines in v9001
lines 8 and 9 - you would need a second config file containing the second city location for 9001

package.path = '/home/'..username..'/.v9000_config.lua'
require '.v9000_config'

to

package.path = '/home/'..username..'/.v9001_config.lua'
require '.v9001_config'

so you would have to duplicate the config and rename the duplicate as above

also - line 985
from this:

if processall==0 or testing==1 then
_G.weather_script()
end

to something like this

if processall==0 or testing==1 then
_G.weather_script_9001()
end

then in the template that v9001 is running change line 2 to this

_G.weather_script_9001 = function()--#### DO NOT EDIT THIS LINE ##############

Thanks for the quick response. I was thinking that might be thge way it would need to be accomplished (though I was hoping that the interactive feature could be used to "choose" the template... sad ) Further, I assume that the two instances would necessarily need to occupy different screen real estate, correct?


"The nine most terrifying words in the English language are, 'I'm from the government and I'm here to help.'.”  ~Ronald Reagan

Offline

#796 2012-11-17 00:49:46

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

Re: weather in conky (LUA scripts) updated 12/26/13!

hmm, so you want to be able to select one or the other city's information
and have the info in just one place

certainly possible but not particularly easy smile

if you have ine interactive weather, you could place a button in both templates occupying the same position, click turns one template off and the other on and vice versa

Offline

#797 2012-11-17 00:53:56

DrakarNoir
#! CrunchBanger
From: just beyond the sign post
Registered: 2011-09-02
Posts: 132
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

hmm, so you want to be able to select one or the other city's information
and have the info in just one place

certainly possible but not particularly easy smile

if you have ine interactive weather, you could place a button in both templates occupying the same position, click turns one template off and the other on and vice versa

Yes, exactly what I am thinking of. The "buttons" would be the city names. The initial launch of the conky would display the "home" (default?) cityand then the user would click on the other city name to display that template then click the "home" city to return (if one so chose).

EDIT:

Just read more carefully! ops Or one button that is a toggle would work also.

Last edited by DrakarNoir (2012-11-17 01:09:35)


"The nine most terrifying words in the English language are, 'I'm from the government and I'm here to help.'.”  ~Ronald Reagan

Offline

#798 2012-11-17 02:11:53

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,726

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

hmm, so you want to be able to select one or the other city's information
and have the info in just one place

certainly possible but not particularly easy smile

if you have ine interactive weather, you could place a button in both templates occupying the same position, click turns one template off and the other on and vice versa

I think this would be the solution.

It would be easy enough to copy and paste the layout.. just changing the location.

button off could have text for local location
and button on could have other location text.

Offline

#799 2012-11-17 13:01:59

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,008
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

Watching this with great interest, I am.


#! Conky = 13 Threads & the Conky Archives | Conky PitStop | OHCG'er
#! Forum Moderator   |   StartPage -  protect your privacy   |   BBQ Linux

Offline

Be excellent to each other!

#800 2012-11-17 17:28:36

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,726

Re: weather in conky (LUA scripts) updated 12/26/13!

local web="http://www.intellicast.com/Local/Forecast.aspx?unit=F&location=USMO9688"

Needs to added within the button on-off code.. so that location can be changed when the button is activated.

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.

Debian Logo