Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1576 Le 18/11/2012, à 12:26

yoyo.thebest

Re : [Conky] Alternative à weather.com (2)

bonjour

Le bizu en conky que je suis a tenté de mettre en place celui-là : http://www.clapico.com/2012/11/13/conky … ment-57392 sur mon kubuntu 12.10.
Résultat il fonctionne, j'arrive à le positionné comme je veux.
Le hic c'est le fond : il devrait être transparant or je reste définitivement avec un fond noir.
Auriez vous un truc ou astuce qui permettrait d'avoir ce coté transparent (sachant que j'utilise variety pour faire tourner mon fond d'écran).

Merci par avance

Hors ligne

#1577 Le 18/11/2012, à 14:41

ti_tux

Re : [Conky] Alternative à weather.com (2)

Sous KDE quand j'utilise un conky sans image en couleur je mets ces paramètres :

own_window_hints undecorated,sticky,skip_taskbar,below,skip_pager
own_window_transparent yes
own_window_argb_visual yes
own_window_argb_value 0

Cela devrait résoudre ton petit souci.

Par contre quand tu as des images en couleurs genre images météo, cette solution va rendre tes images aussi transparentes et leur rendu est un peu fade, donc dans ce cas il est préférable de passer par feh (et de commenter les 2 dernières lignes ci-dessus).


Venez traduire KDE (doc, appli, pages web) en français http://fr.l10n.kde.org/

Hors ligne

#1578 Le 18/11/2012, à 14:43

viper69

Re : [Conky] Alternative à weather.com (2)

Pff iren de fonctionne chez moi.
même en suivant la video.
Je pense abandonner... y compris un tuto pour les noobs comme moi.


Viper69
J'ai ouvert les fenêtres - J'ai vu que l'on pouvait être libre
Le manuel disait "Nécessite Windows XP ou mieux". J'ai donc installé Linux.
Ubuntu depuis 7.04 / Laptop: PressarioC60 / Bureau: CQ5335 / Minipc:LDLC Mercure ML1-C1-2-H1

Hors ligne

#1579 Le 18/11/2012, à 16:29

yoyo.thebest

Re : [Conky] Alternative à weather.com (2)

Je viens de rajouter les ligne ssuivantes:

own_window_argb_visual yes
own_window_argb_value 0

et super cela fonctionne

Comme je suis sur ma découverte des conkys
auriez vous un scripts sympa pour afficher les infos system (cpu/temp/wifi/lan/hdd/...) sans heure et météo ?

merci

Dernière modification par yoyo.thebest (Le 18/11/2012, à 16:55)

Hors ligne

#1580 Le 18/11/2012, à 19:59

ragamatrix

Re : [Conky] Alternative à weather.com (2)

@jpdipsy
Salut !
Comment peut-on décaler sur le coté les infos conky fond écran...J'ai aussi un petit bug:

 convert: une séquence d'images est requise `+clone' @ error/convert.c/ConvertImageCommand/923.
convert: une séquence d'images est requise `+clone' @ error/convert.c/ConvertImageCommand/923.
 

image centre:
Le template ville ne s'affiche pas...
image-meteo-lua-centre

Hors ligne

#1581 Le 19/11/2012, à 02:09

Sector11

Re : [Conky] Alternative à weather.com (2)

@ Phyllinux

Been busy ... Conky PitStop

A la une (until the next one goes up) and in Galeries 2012 2

Enjoy!

Hors ligne

#1582 Le 20/11/2012, à 11:08

ragamatrix

Re : [Conky] Alternative à weather.com (2)

one more test with conky_fond_ecran
test

Hors ligne

#1583 Le 20/11/2012, à 12:16

ragamatrix

Re : [Conky] Alternative à weather.com (2)

@Didier-T
Salut;
c'est où qu'il faut regarder pour modifier le temps des mises à jour des scripts Meteo-Lua ?

Hors ligne

#1584 Le 20/11/2012, à 12:22

Phyllinux

Re : [Conky] Alternative à weather.com (2)

ragamatrix a écrit :

@Didier-T
Salut;
c'est où qu'il faut regarder pour modifier le temps des mises à jour des scripts Meteo-Lua ?

Dans le fichier meteo.cfg.
C'est la dernière ligne à renseigner.


The ship is sinking normally...

Hors ligne

#1585 Le 20/11/2012, à 13:53

ragamatrix

Re : [Conky] Alternative à weather.com (2)

Merci Phyllinux !
J'ai réussi à integrer xplanet au script images_meteo_lua peut être d'une manière pas très conventionnelle.Je crois qu'il faut que je trouve un moyen de faire moins travailler "convert" pour le détourage de l'image; je ne me rappelle plus comment nous etions arrivé à reduire les ressources de cette fonction.(peut-être en réduisant la taille de l'image...je ne sais plus ?)

Dernière modification par ragamatrix (Le 20/11/2012, à 14:04)

Hors ligne

#1586 Le 20/11/2012, à 15:51

ragamatrix

Re : [Conky] Alternative à weather.com (2)

ragamatrix a écrit :

@jpdipsy
Salut !
Comment peut-on décaler sur le coté les infos conky fond écran...J'ai aussi un petit bug:

 convert: une séquence d'images est requise `+clone' @ error/convert.c/ConvertImageCommand/923.
convert: une séquence d'images est requise `+clone' @ error/convert.c/ConvertImageCommand/923.
 

image centre:
Le template ville ne s'affiche pas...
image-meteo-lua-centre

Scripts mis à jour sur la première page-->prob résolu

Hors ligne

#1587 Le 22/11/2012, à 00:02

ragamatrix

Re : [Conky] Alternative à weather.com (2)

One more : wink
chronoclear
Big thanks to Mr Peachy for the hands !

Hors ligne

#1588 Le 22/11/2012, à 09:17

Phyllinux

Re : [Conky] Alternative à weather.com (2)

ragamatrix a écrit :

One more : wink
http://pix.toile-libre.org/upload/origi … 535244.png
Big thanks to Mr Peachy for the hands !

Bonjour ragamatrix,
J'aime bien les aiguilles qui ont  l'air plus 'lisibles' que pour la version antérieure. Tu pourrais me donner le code ?


The ship is sinking normally...

Hors ligne

#1589 Le 22/11/2012, à 11:05

ragamatrix

Re : [Conky] Alternative à weather.com (2)

Phyllinux a écrit :
ragamatrix a écrit :

One more : wink
http://pix.toile-libre.org/upload/origi … 535244.png
Big thanks to Mr Peachy for the hands !

Bonjour ragamatrix,
J'aime bien les aiguilles qui ont  l'air plus 'lisibles' que pour la version antérieure. Tu pourrais me donner le code ?

Salut Phyllinux !
Comme il n'y a plus de météo dedans je poste ça ici
Avec les fontes nécessaires.

Hors ligne

#1590 Le 22/11/2012, à 13:59

ragamatrix

Re : [Conky] Alternative à weather.com (2)

@jpdipsy,Didier-T
Est-il possible de rajouter dans un nouveau cadre les prévisons des 2,4,6,8 prochaines heures dans le conkyfondecran...?
Dans ce genre là:
2_4_6_8
J'ai du mal avec le creationmodules...:/

Dernière modification par ragamatrix (Le 22/11/2012, à 14:03)

Hors ligne

#1591 Le 22/11/2012, à 15:08

Sector11

Re : [Conky] Alternative à weather.com (2)

I need help.  I am not good at LUA and have tried for days to fix this.

J'ai besoin d'aide. Je ne suis pas bon à LUA et ont essayé pendant des jours pour résoudre ce problème.

acnk5PlM.jpg

Without the "draw-bg.lua" Didier-T's "Chronograph.lua" does not work.  I thought maybe I added or changed something so I used the original with no changes and I have the same results

Sans le "draw-bg.lua" Didier-T "Chronograph.lua" ne fonctionne pas. Je pensais que peut-être je ajouter ou modifier quelque chose alors j'ai utilisé l'original sans aucun changement et j'ai les mêmes résultats

On the left the conky running with:

  • draw-bg.lua

  • v9000.lua

  • mounted.lua

  • Chronograph-Didier-T-2.lua

  • - - faded names & numbers not in use

  • - - centre circle white

In the centre: the circles commented out:

TEXT
${lua get_mounted_data 3} #${lua conky_draw_bg 12 0 0 0 0 0x000000 0.5}
#${lua conky_draw_bg 175 0 0 350 350 0xffffff 0.3}
#${lua conky_draw_bg 60 115 31 120 120 0x000000 0.3}
#${lua conky_draw_bg 58 32 118 116 116 0x000000 0.3}
#${lua conky_draw_bg 58 202 118 116 116 0x000000 0.3}
#${lua conky_draw_bg 60 115 200 120 120 0x000000 0.3}

On the right I commented out:

#lua_load /media/5/Conky/LUA/draw-bg.lua
TEXT

My: Chronograph-Didier-T-2.lua

--[[ multiple analogue clocks by mrpeachy - 18 Jun 2012
 21 Jun 2012 - Chronograph modifications by Sector11
 22 Jun 2012 - again with mrpeachy's help day names, numbers and month names
 12 Nov 2012 - memory leak plugged - mrpeachy
 14 Nov 2012 - Personnalisation - Didier-T (forum Ubuntu.fr)

use in conkyrc

lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT

-- INDEX (use find with):

-- ###### 12 OR 24 CLOCK FACE
-- SET BORDER OPTIONS ######  ALL CLOCKS

-- ### START CLOCK A ######################################
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
-- CLOCK A HOUR HAND
-- CLOCK A MINUTE HAND SETUP
-- CLOCK A SECOND HAND SETUP
-- CLOCK A ###### 24 HR TIME

-- ### START DIAL B ### Top - Week Day Names Dial #########
-- ### START DIAL C ### Right - Month Names Dial ##########
-- ### START DIAL D ### Left - Day Numbers Dial ###########

-- ### START CLOCK E ######################################
-- MARKS AROUND CLOCK E -- Bottom - 12 HR Clock
-- CLOCK E HOUR HAND
-- CLOCK E MINUTE HAND SETUP
-- CLOCK E SECOND HAND SETUP
-- CLOCK E ###### 12 HR TIME

NOTE:  Putting ### CLOCK A ### last insures that it's functions are written
       over the other dials.
]]

require 'cairo'
--Position et taille horloge
local init={
center_x=175,
center_y=175,
radius=170, -- do not touch
lang="English", --English or Spanish or French
hour=24, --12 or 24
second=true, --true or false - Seconds: dots and numbers
line=true, -- part second hand true or false
handday=false, -- DAY NAME hand - true or false
handdaynum=false, -- DAY NUMBER hand - true or false
handmonth=false, -- MONTH NAME hand - true or false
color=0xFF0000, --color for day, day number and month if no hand
alpha=1 --alpha for day, day number and month if no hand
}

local colr, colg, colb, cola=rgb_to_r_g_b(init.color,init.alpha)

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 extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
-- ########################################################
-- SETTINGS AREA
-- local cpu=conky_parse("${cpu}")
-- local red-1=conky_parse("${image ~/Conky/images/red_1.png -p 0,0 -s 35x35}")

local clock_type_A=init.hour -- Large Main 24 HR Clock

-- ###### CLOCK SETTINGS ##################################
-- SET BORDER OPTIONS FOR "CLOCKS" ########################
local clock_border_width=0
-- set color and alpha for clock border
local cbr,cbg,cbb,cba=1,1,1,1  -- full opaque white
-- gap from clock border to minute marks
local b_to_m=1

-- ########################################################
-- ### START DIAL B ### Top - Week Day Names Dial #########
-- DIAL POSITION FOR TEXT
local center_x=init.center_x
local center_y=init.center_y-85
local radius=50
-- FONT
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 11)
cairo_set_source_rgba (cr,1,1,1,0) --doesn't work - setting changed location
-- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Sun","Mon","Tue","Wed","Thr","Fri","Sat",}	end	-- English
if init.lang == "Spanish" then text_days={"Dom","Lun","Mar","Mie","Jue","Vie","Sab",}	end	-- Spanish
if init.lang == "French" then text_days={"Dim","Lun","Mar","Mer","Jeu","Ven","Sam",}		end	-- French
local day_number=tonumber(os.date("%w"))
if init.handday == true then
  for i=1,7 do
    -- work out points
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=35
  for i=1,7 do
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
  -- DRAW HAND -- snaps to current day of week
  local hand_length=30
  local point=(math.pi/180)*((360/7)*(day_number))
  local x=0+hand_length*(math.sin(point))
  local y=0-hand_length*(math.cos(point))
  local hand_width=2
  cairo_move_to (cr,center_x,center_y)
  cairo_line_to (cr,center_x+x,center_y+y)
  cairo_stroke (cr)
else
  for i=1,7 do
    -- work out points
    if day_number == i-1 then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- non-active day names
    end
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=35
  for i=1,7 do
    if day_number == i-1 then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- dots for non-active day name
    end
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end

end
-- ### END DIAL B #########################################

-- ########################################################
-- ### START DIAL C ### Right - Month Names Dial ##########
-- DIAL POSITION FOR TEXT
local center_x=init.center_x+85
local center_y=init.center_y
local radius=45
-- FONT
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 11)
cairo_set_source_rgba (cr,1,1,1,0) -- doesn't work setting moved
-- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",} end -- English
if init.lang == "Spanish" then text_days={"Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic",} end -- Spanish
if init.lang == "French" then text_days={"Jan","Fév","Mar","Avr","Mai","Jui","Jul","Aôu","Sep","Oct","Nov","Déc",} end -- French
local this_month=tonumber(os.date("%m"))

if init.handmonth == true then
  for i=1,12 do
    -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=32
  for i=1,12 do
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
  -- DRAW HAND -- snaps to current month
  local hand_length=28 --radius for this calculation
  local point=(math.pi/180)*((360/12)*(this_month-1))
  local x=0+hand_length*(math.sin(point))
  local y=0-hand_length*(math.cos(point))
  cairo_move_to (cr,center_x,center_y)
  cairo_line_to (cr,center_x+x,center_y+y)
  cairo_stroke (cr)
else
  for i=1,12 do
    if this_month == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- non-active month names
    end
    -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=32
  for i=1,12 do
    if this_month == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- dots for non-active month names
    end
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end

end
-- ### END CLOCK C ########################################

-- ########################################################
-- ### START DIAL D ### Left - Day Numbers Dial ###########
-- GET NUMBER OF DAYS IN CURRENT MONTH
-- calculate Feb, then set up table
year4num=os.date("%Y")
t1=os.time({year=year4num,month=03,day=01,hour=00,min=0,sec=0});
t2=os.time({year=year4num,month=02,day=01,hour=00,min=0,sec=0});
if init.hour == 12 then
  febdaynum=tonumber((os.difftime(t1,t2))/(12*60*60))
else
  febdaynum=tonumber((os.difftime(t1,t2))/(24*60*60))
end
-- MONTH TABLE
monthdays={31,febdaynum,31,30,31,30,31,31,30,31,30,31}
this_month=tonumber(os.date("%m"))
number_days=monthdays[this_month]
-- TEXT positioning
local center_x=init.center_x-85
local center_y=init.center_y
local radius=50
cairo_select_font_face (cr, "Liquid Crystal", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 12)
cairo_set_source_rgba (cr,1,1,1,0) -- does not work - settings relocated
local this_day=tonumber(os.date("%d"))
if init.handdaynum == true then
  for i=1,number_days do
    -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/number_days)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    --only print even numbers
    if math.mod(i, 2) == 0 then
      --set text when even
      text=string.format("%02d",i) --formats numbers to double digits
    else
      --set text when odd
      text=""
    end--odd even matching
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=40
  for i=1,number_days do
    local point=(math.pi/180)*((360/number_days)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
  -- DRAW HAND -- snaps to current DAY
  local hand_length=35--radius for this calculation
  local point=(math.pi/180)*((360/number_days)*(this_day-1))
  local x=0+hand_length*(math.sin(point))
  local y=0-hand_length*(math.cos(point))
  cairo_move_to (cr,center_x,center_y)
  cairo_line_to (cr,center_x+x,center_y+y)
  cairo_stroke (cr)
else
  for i=1,number_days do
    if this_day == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- non-active day numbers
    end
    -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/number_days)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    --only print even numbers
    if math.mod(i, 2) == 0 then
      --set text when even
      text=string.format("%02d",i) --formats numbers to double digits
    else
      --set text when odd
      text=""
    end--odd even matching
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=40
  for i=1,number_days do
    if this_day == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- dots non-active day numbers
    end
    local point=(math.pi/180)*((360/number_days)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
end
-- ### END CLOCK D ########################################

-- ########################################################
-- ### START CLOCK E ######################################
-- MARKS AROUND CLOCK E -- Bottom - 12 HR Clock
local number_marks_E=12
-- set mark length
local m_length_E=0
-- set mark width
local m_width_E=0
-- set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
-- set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,0,1-- opaque white
-- SETUP HOUR HANDS #######################################
-- CLOCK E HOUR HAND
-- set length of hour hand
hh_length_E=25
-- set hour hand width
hh_width_E=2
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
hhr,hhg,hhb,hha=1,1,0,1-- fully opaque white
-- SETUP MINUTE HANDS #####################################
-- CLOCK E MINUTE HAND SETUP
-- set length of minute hand
mh_length_E=35
-- set minute hand width
mh_width_E=2
-- set minute hand line cap
mh_cap=CAIRO_LINE_CAP_ROUND
-- set minute hand color
mhr,mhg,mhb,mha=1,1,0,1-- fully opaque white
-- SETUP SECOND HANDS #####################################
-- CLOCK E SECOND HAND SETUP
-- set length of seconds hand
sh_length_E=32
-- set hour hand width
sh_width_E=1
-- set hour hand line cap
sh_cap=CAIRO_LINE_CAP_ROUND
-- set seconds hand color
shr,shg,shb,sha=1,0,0,1-- fully opaque red
-- CLOCK E ###### 12 HR TIME ##############################
-- CLOCK SETTINGS
clock_radius=45
clock_centerx=init.center_x
clock_centery=init.center_y+85
-- DRAWING CODE
-- DRAW BORDER
cairo_set_source_rgba (cr,169/255,169/255,169/255,1)
cairo_set_line_width (cr,clock_border_width)
cairo_arc (cr,clock_centerx,clock_centery,clock_radius,0,2*math.pi)
cairo_stroke (cr)
-- DRAW MARKS
-- stuff that can be moved outside of the loop, needs only be set once
-- calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length_E
-- set line cap type
cairo_set_line_cap  (cr, m_cap)
-- set line width
cairo_set_line_width (cr,m_width_E)
-- set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
-- START LOOP FOR SECOND MARKS
for i=1,number_marks_E do
-- drawing code using the value of i to calculate degrees
-- calculate start point for 12/24 hour mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks_E))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
-- calculate end point for 12/24 hour mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks_E))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- draw the line-- MARKS AROUND CLOCK A
cairo_stroke (cr)
end-- of for loop
-- SET MARKS ##############################################
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
local number_marks_A=init.hour
-- set mark length
local m_length_A=0
-- set mark width
local m_width_A=0
-- set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
-- set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,1,1 -- opaque white
-- SETUP HOUR HANDS #######################################
-- CLOCK A HOUR HAND
-- set length of hour hand
hh_length_A=130
-- set hour hand width
hh_width_A=3
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
hhr,hhg,hhb,hha=1,1,1,.5-- fully opaque white
-- SETUP MINUTE HANDS #####################################
-- CLOCK A MINUTE HAND SETUP
-- set length of minute hand
mh_length_A=145
-- set minute hand width
mh_width_A=2
-- set minute hand line cap
mh_cap=CAIRO_LINE_CAP_ROUND
-- set minute hand color
mhr,mhg,mhb,mha=1,1,1,.5-- fully opaque white
-- SETUP SECOND HANDS #####################################
-- CLOCK A SECOND HAND SETUP
-- set length of seconds hand
sh_length_A=150
-- set hour hand width
sh_width_A=2
-- set hour hand line cap
sh_cap=CAIRO_LINE_CAP_ROUND
-- set seconds hand color
shr,shg,shb,sha=1,0,0,1-- fully opaque red
-- CLOCK A ###### 12 HR TIME ##############################
-- CLOCK SETTINGS
clock_radius=200
clock_centerx=init.center_x
clock_centery=init.center_y
-- DRAWING CODE
-- DRAW BORDER
cairo_set_source_rgba (cr,cbr,cbg,cbb,cba)
cairo_set_line_width (cr,clock_border_width)
cairo_arc (cr,clock_centerx,clock_centery,clock_radius,0,2*math.pi)
cairo_stroke (cr)
-- DRAW MARKS
-- stuff that can be moved outside of the loop, needs only be set once
-- calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length_A
-- set line cap type
cairo_set_line_cap  (cr, m_cap)
-- set line width
cairo_set_line_width (cr,m_width_A)
-- set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
-- START LOOP FOR HOUR MARKS
for i=1,number_marks_A do
-- drawing code using the value of i to calculate degrees
-- calculate start point for 12/24 hour mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
-- calculate end point for 12/24 hour mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- draw the line
cairo_stroke (cr)
end-- of for loop
-- HOUR MARKS
-- TIME CALCULATIONS CLOCK A
if clock_type_A==12 then
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
elseif clock_type_A==24 then
hours=tonumber(os.date("%H"))
-- convert hours to seconds
h_to_s=hours*60*60
end
minutes=tonumber(os.date("%M"))
-- convert minutes to seconds
m_to_s=minutes*60
-- get current seconds
seconds=tonumber(os.date("%S"))
-- DRAW HOUR HAND
-- get hours minutes seconds as just seconds
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*clock_type_A))-- use equation ~ eliminate decimals
-- set radius to calculate hand points
radius=hh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of hour hand
point=(math.pi/180)*hsec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,hh_width_A)
--cairo_set_source_rgba (cr,hhr,hhg,hhb,hha)
cairo_set_source_rgba (cr,169/255,169/255,169/255,1)
cairo_set_line_cap  (cr, hh_cap)
cairo_stroke (cr)
-- DRAW MINUTE HAND
-- get minutes and seconds just as seconds
msecs=m_to_s+seconds
-- calculate degrees for each second
msec_degs=msecs*0.1
-- set radius to calculate hand points
radius=mh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of minute hand
point=(math.pi/180)*msec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,mh_width_A)
--cairo_set_source_rgba (cr,mhr,mhg,mhb,mha)
cairo_set_source_rgba (cr,169/255,169/255,169/255,1)
cairo_set_line_cap  (cr, mh_cap)
cairo_stroke (cr)
-- DRAW SECOND HAND
--[[
-- calculate degrees for each second
sec_degs=seconds*6
-- set radius to calculate hand points
radius=sh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of seconds hand
point=(math.pi/180)*sec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))BOLD
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes
cairo_set_line_width (cr,sh_width_A)
cairo_set_source_rgba (cr,shr,shg,shb,sha)
cairo_set_line_cap  (cr, sh_cap)
cairo_stroke (cr)
]]
-- ####################################################################
local center_x=init.center_x
local center_y=init.center_y
local radius=init.radius-5
cairo_select_font_face (cr, "Liquid Crystal", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 15)
cairo_set_source_rgba (cr,1,1,1,1) -- 12 HR Clock numbers
-- TABLE OF TEXT -- in order
if init.hour == 12 then
  text_days={"00","01","02","03","04","05","06","07","08","09","10","11",}
  for i=1,12 do
    -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=150
  for i=1,12 do
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
end
if init.hour == 24 then
  text_days={"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23",}
  for i=1,24 do
    -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/24)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=150
  for i=1,24 do
    local point=(math.pi/180)*((360/24)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
end

-- PART SECOND HAND
--position
--get seconds value
local seconds=tonumber(os.date("%S"))
--calculate rotation of second hand in degrees
if init.line == true then
  local arc=(math.pi/180)*((360/60)*seconds)
  --calculate point 1
  local radius1=140
  local x1=0+radius1*math.sin(arc)
  local y1=0-radius1*math.cos(arc)
  --calculate point 2
  local radius2=155
  local x2=0+radius2*math.sin(arc)
  local y2=0-radius2*math.cos(arc)
  --draw line connecting points
  cairo_move_to (cr, center_x+x1,center_y+y1)
  cairo_line_to (cr, center_x+x2, center_y+y2)
  cairo_set_source_rgba (cr,255/255,0/255,0/255,1) -- PART SECOND HAND
  cairo_stroke (cr)
end
-- ####################################################################
-- POSITION FOR TEXT HOUR NUMBERS
--affiche secondes
  if init.hour == 12 and init.second == true then
    text_days={"","1","2","3","4","","6","7","8","9","","11","12","13","14","","16","17","18","19","","21","22","23","24","","26","27","28","29","","31","32","33","34","","36","37","38","39","","41","42","43","44","","46","47","48","49","","51","52","53","54","","56","57","58","59","",}
    -- INNER POINTS POSITION, radius smaller than text circle
    cairo_set_source_rgba (cr,1,1,1,0.3) -- does not work -- settings moved
    cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    for i=1,60 do
      local radius=150 -- dots for seconds A Clock
      local point=(math.pi/180)*((360/60)*(i-1))
      local x=0+radius*(math.sin(point))
      local y=0-radius*(math.cos(point))
      if seconds == i-1 then
        cairo_set_source_rgba (cr,255/255,0/255,0/255,0.3) -- does not work - settings moved
      else
        if i-1 == 0 or i-1 == 5 or i-1 == 10 or i-1 == 15 or i-1 == 25 or i-1 == 30 or i-1 == 35 or i-1 == 40 or i-1 == 45 or i-1 == 50 or i-1 == 55 then
          cairo_set_source_rgba (cr,0,1,1,1) --??
        else
          cairo_set_source_rgba (cr,0,1,1,0.3) -- dots for seconds A Clock
        end
      end
      cairo_arc (cr,center_x+x,center_y+y,1/2,0,2*math.pi)
      cairo_stroke (cr)
    end
    radius=radius-3
    cairo_set_font_size (cr, 10)
    for i=1,60 do
      -- OUTTER POINTS POSTION FOR TEXT
      local point=(math.pi/180)*((360/60)*(i-1))
      local x=0+radius*(math.sin(point))
      local y=0-radius*(math.cos(point))
      -- CALCULATE CENTRE OF TEXT
      local text=text_days[i]--gets text from table
      if seconds == tonumber(text) then
        cairo_set_source_rgba (cr,1,0,0,1) -- ??
      else
        cairo_set_source_rgba (cr,1,1,1,0.3) -- seconds numbers
      end
      --local extents=cairo_text_extents_t:create()
      cairo_text_extents(cr,text,extents)
      local width=extents.width
      local height=extents.height
      cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
      cairo_show_text (cr, text)
      cairo_stroke (cr)
    end
  end
-- Fin affiche secondes
-- FONT

-- ########################################################
cairo_stroke (cr)
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function

function rgb_to_r_g_b(col,alp) -- ONLY NEED ONE COPY OF THIS FUNCTION
  return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end

Does anyone else have this problem?
Est-ce que quelqu'un a déjà eu ce problème?

Hors ligne

#1592 Le 22/11/2012, à 20:06

Didier-T

Re : [Conky] Alternative à weather.com (2)

@ Sector11,

J'aurais besoins du script conky en entier (celui qui pose problème)
ainsi que les informations retournées en Terminal

Merci.

Hors ligne

#1593 Le 22/11/2012, à 21:44

Sector11

Re : [Conky] Alternative à weather.com (2)

Didier-T a écrit :

@ Sector11,

J'aurais besoins du script conky en entier (celui qui pose problème)
ainsi que les informations retournées en Terminal

Merci.

Sorry I should have known:

Line 57:

local colr, colg, colb, cola=rgb_to_r_g_b(init.color,init.alpha)

Terminal:

 22 Nov 12 | 16:01:15 ~
         $ conky -c ~/Chrono-TEST/Chronograph_TEST.conky &
[1] 10757

 22 Nov 12 | 16:01:49 ~
         $ Conky: llua_load: .../sector11/Chrono-TEST/LUA/Chronograph-Didier-T-2.lua:57: attempt to call global 'rgb_to_r_g_b' (a nil value)
Conky: forked to background, pid is 10762

Conky: desktop window (322) is root window
Conky: window type - normal
Conky: drawing to created window (0x2200001)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: received SIGINT or SIGTERM to terminate. bye!

[1]+  Done                    conky -c ~/Chrono-TEST/Chronograph_TEST.conky

 22 Nov 12 | 16:02:05 ~
         $ conky -c ~/Chrono-TEST/Chronograph_TEST.conky -DD &
[1] 10774

 22 Nov 12 | 16:02:11 ~
         $ Conky: llua_load: .../sector11/Chrono-TEST/LUA/Chronograph-Didier-T-2.lua:57: attempt to call global 'rgb_to_r_g_b' (a nil value)
DEBUG(0) [../../src/conky.c:5338]: reading contents from config file '/home/sector11/Chrono-TEST/Chronograph_TEST.conky'
DEBUG(1) [../../src/core.c:1225]: no templates to replace
DEBUG(1) [../../src/core.c:354]: Adding $cpu for CPU 1
DEBUG(1) [../../src/core.c:354]: Adding $cpu for CPU 2
DEBUG(1) [../../src/core.c:354]: Adding $cpu for CPU 3
Conky: forked to background, pid is 10779

Conky: desktop window (322) is root window
Conky: window type - normal
Conky: drawing to created window (0x2200001)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: received SIGINT or SIGTERM to terminate. bye!

My Chrono-TEST.tar.gz - extract to ~/Chrono-TEST and run the conky:

conky -c ~/Chrono-TEST/Chronograph_TEST.conky &

There are 15 test chronograph.lua files in there, it's the last two in the conky that have problems.  Others do as well, but they are tests that were/are under development.

################### Chronograph ##############################################
#lua_load ~/Chrono-TEST/LUA/Chronograph_full.lua
#lua_load ~/Chrono-TEST/LUA/chrono.lua
#lua_load ~/Chrono-TEST/LUA/Chronograph.lua
#lua_load ~/Chrono-TEST/LUA/Chronograph_2.lua
#lua_load ~/Chrono-TEST/LUA/Chronograph_2_noE.lua
#lua_load ~/Chrono-TEST/LUA/Chronograph-2.lua
#lua_load ~/Chrono-TEST/LUA/Chronograph_fr.lua
#lua_load ~/Chrono-TEST/LUA/Chronograph-mclovin.lua
#lua_load ~/Chrono-TEST/LUA/Chronograph-mclovin-2.lua
#lua_load ~/Chrono-TEST/LUA/Chronograph-mclovin-12-60.lua
#lua_load ~/Chrono-TEST/LUA/Chronograph-big.lua
#lua_load ~/Chrono-TEST/LUA/chrono_mix.lua
#lua_load ~/Chrono-TEST/LUA/Chronograph-ragamatrix.lua
#lua_load ~/Chrono-TEST/LUA/Chronograph-Didier-T.lua
lua_load ~/Chrono-TEST/LUA/Chronograph-Didier-T-2.lua
lua_draw_hook_post main

============================================
These are my next project  big_smile

#lua_load ~/Chrono-TEST/LUA/Chronograph_2.lua
#lua_load ~/Chrono-TEST/LUA/Chronograph_2_noE.lua

- not finished yet. If you want to use them it's OK, they are now public as of this post
abw2NTjp.jpg

EDIT:
If you want it ALL here it is

Dernière modification par Sector11 (Le 22/11/2012, à 21:49)

Hors ligne

#1594 Le 22/11/2012, à 22:11

Didier-T

Re : [Conky] Alternative à weather.com (2)

@ Sector11,

Bon c'est ma faute, avant d'appeler une fonction il faut l'initialiser. roll
Donc petite modification. big_smile

Chronograph-Didier-T-2.lua

--[[ multiple analogue clocks by mrpeachy - 18 Jun 2012
 21 Jun 2012 - Chronograph modifications by Sector11
 22 Jun 2012 - again with mrpeachy's help day names, numbers and month names
 12 Nov 2012 - memory leak plugged - mrpeachy
 14 Nov 2012 - Personnalisation - Didier-T (forum Ubuntu.fr)

use in conkyrc

lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT

-- INDEX (use find with):

-- ###### 12 OR 24 CLOCK FACE
-- SET BORDER OPTIONS ######  ALL CLOCKS

-- ### START CLOCK A ######################################
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
-- CLOCK A HOUR HAND
-- CLOCK A MINUTE HAND SETUP
-- CLOCK A SECOND HAND SETUP
-- CLOCK A ###### 24 HR TIME

-- ### START DIAL B ### Top - Week Day Names Dial #########
-- ### START DIAL C ### Right - Month Names Dial ##########
-- ### START DIAL D ### Left - Day Numbers Dial ###########

-- ### START CLOCK E ######################################
-- MARKS AROUND CLOCK E -- Bottom - 12 HR Clock
-- CLOCK E HOUR HAND
-- CLOCK E MINUTE HAND SETUP
-- CLOCK E SECOND HAND SETUP
-- CLOCK E ###### 12 HR TIME

NOTE:  Putting ### CLOCK A ### last insures that it's functions are written
       over the other dials.
]]

require 'cairo'
--Position et taille horloge
local init={
center_x=175,
center_y=175,
radius=170, -- do not touch
lang="English", --English or Spanish or French
hour=24, --12 or 24
second=true, --true or false - Seconds: dots and numbers
line=true, -- part second hand true or false
handday=false, -- DAY NAME hand - true or false
handdaynum=false, -- DAY NUMBER hand - true or false
handmonth=false, -- MONTH NAME hand - true or false
color=0xFF0000, --color for day, day number and month if no hand
alpha=1 --alpha for day, day number and month if no hand
}

function rgb_to_r_g_b(col,alp) -- ONLY NEED ONE COPY OF THIS FUNCTION
  return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end

local colr, colg, colb, cola=rgb_to_r_g_b(init.color,init.alpha)

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 extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
-- ########################################################
-- SETTINGS AREA
-- local cpu=conky_parse("${cpu}")
-- local red-1=conky_parse("${image ~/Conky/images/red_1.png -p 0,0 -s 35x35}")

local clock_type_A=init.hour -- Large Main 24 HR Clock

-- ###### CLOCK SETTINGS ##################################
-- SET BORDER OPTIONS FOR "CLOCKS" ########################
local clock_border_width=0
-- set color and alpha for clock border
local cbr,cbg,cbb,cba=1,1,1,1  -- full opaque white
-- gap from clock border to minute marks
local b_to_m=1

-- ########################################################
-- ### START DIAL B ### Top - Week Day Names Dial #########
-- DIAL POSITION FOR TEXT
local center_x=init.center_x
local center_y=init.center_y-85
local radius=50
-- FONT
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 11)
cairo_set_source_rgba (cr,1,1,1,0) --doesn't work - setting changed location
-- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Sun","Mon","Tue","Wed","Thr","Fri","Sat",}	end	-- English
if init.lang == "Spanish" then text_days={"Dom","Lun","Mar","Mie","Jue","Vie","Sab",}	end	-- Spanish
if init.lang == "French" then text_days={"Dim","Lun","Mar","Mer","Jeu","Ven","Sam",}		end	-- French
local day_number=tonumber(os.date("%w"))
if init.handday == true then
  for i=1,7 do
    -- work out points
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=35
  for i=1,7 do
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
  -- DRAW HAND -- snaps to current day of week
  local hand_length=30
  local point=(math.pi/180)*((360/7)*(day_number))
  local x=0+hand_length*(math.sin(point))
  local y=0-hand_length*(math.cos(point))
  local hand_width=2
  cairo_move_to (cr,center_x,center_y)
  cairo_line_to (cr,center_x+x,center_y+y)
  cairo_stroke (cr)
else
  for i=1,7 do
    -- work out points
    if day_number == i-1 then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- non-active day names
    end
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=35
  for i=1,7 do
    if day_number == i-1 then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- dots for non-active day name
    end
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end

end
-- ### END DIAL B #########################################

-- ########################################################
-- ### START DIAL C ### Right - Month Names Dial ##########
-- DIAL POSITION FOR TEXT
local center_x=init.center_x+85
local center_y=init.center_y
local radius=45
-- FONT
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 11)
cairo_set_source_rgba (cr,1,1,1,0) -- doesn't work setting moved
-- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",} end -- English
if init.lang == "Spanish" then text_days={"Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic",} end -- Spanish
if init.lang == "French" then text_days={"Jan","Fév","Mar","Avr","Mai","Jui","Jul","Aôu","Sep","Oct","Nov","Déc",} end -- French
local this_month=tonumber(os.date("%m"))

if init.handmonth == true then
  for i=1,12 do
    -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=32
  for i=1,12 do
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
  -- DRAW HAND -- snaps to current month
  local hand_length=28 --radius for this calculation
  local point=(math.pi/180)*((360/12)*(this_month-1))
  local x=0+hand_length*(math.sin(point))
  local y=0-hand_length*(math.cos(point))
  cairo_move_to (cr,center_x,center_y)
  cairo_line_to (cr,center_x+x,center_y+y)
  cairo_stroke (cr)
else
  for i=1,12 do
    if this_month == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- non-active month names
    end
    -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=32
  for i=1,12 do
    if this_month == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- dots for non-active month names
    end
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end

end
-- ### END CLOCK C ########################################

-- ########################################################
-- ### START DIAL D ### Left - Day Numbers Dial ###########
-- GET NUMBER OF DAYS IN CURRENT MONTH
-- calculate Feb, then set up table
year4num=os.date("%Y")
t1=os.time({year=year4num,month=03,day=01,hour=00,min=0,sec=0});
t2=os.time({year=year4num,month=02,day=01,hour=00,min=0,sec=0});
if init.hour == 12 then
  febdaynum=tonumber((os.difftime(t1,t2))/(12*60*60))
else
  febdaynum=tonumber((os.difftime(t1,t2))/(24*60*60))
end
-- MONTH TABLE
monthdays={31,febdaynum,31,30,31,30,31,31,30,31,30,31}
this_month=tonumber(os.date("%m"))
number_days=monthdays[this_month]
-- TEXT positioning
local center_x=init.center_x-85
local center_y=init.center_y
local radius=50
cairo_select_font_face (cr, "Liquid Crystal", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 12)
cairo_set_source_rgba (cr,1,1,1,0) -- does not work - settings relocated
local this_day=tonumber(os.date("%d"))
if init.handdaynum == true then
  for i=1,number_days do
    -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/number_days)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    --only print even numbers
    if math.mod(i, 2) == 0 then
      --set text when even
      text=string.format("%02d",i) --formats numbers to double digits
    else
      --set text when odd
      text=""
    end--odd even matching
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=40
  for i=1,number_days do
    local point=(math.pi/180)*((360/number_days)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
  -- DRAW HAND -- snaps to current DAY
  local hand_length=35--radius for this calculation
  local point=(math.pi/180)*((360/number_days)*(this_day-1))
  local x=0+hand_length*(math.sin(point))
  local y=0-hand_length*(math.cos(point))
  cairo_move_to (cr,center_x,center_y)
  cairo_line_to (cr,center_x+x,center_y+y)
  cairo_stroke (cr)
else
  for i=1,number_days do
    if this_day == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- non-active day numbers
    end
    -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/number_days)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    --only print even numbers
    if math.mod(i, 2) == 0 then
      --set text when even
      text=string.format("%02d",i) --formats numbers to double digits
    else
      --set text when odd
      text=""
    end--odd even matching
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=40
  for i=1,number_days do
    if this_day == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- dots non-active day numbers
    end
    local point=(math.pi/180)*((360/number_days)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
end
-- ### END CLOCK D ########################################

-- ########################################################
-- ### START CLOCK E ######################################
-- MARKS AROUND CLOCK E -- Bottom - 12 HR Clock
local number_marks_E=12
-- set mark length
local m_length_E=0
-- set mark width
local m_width_E=0
-- set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
-- set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,0,1-- opaque white
-- SETUP HOUR HANDS #######################################
-- CLOCK E HOUR HAND
-- set length of hour hand
hh_length_E=25
-- set hour hand width
hh_width_E=2
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
hhr,hhg,hhb,hha=1,1,0,1-- fully opaque white
-- SETUP MINUTE HANDS #####################################
-- CLOCK E MINUTE HAND SETUP
-- set length of minute hand
mh_length_E=35
-- set minute hand width
mh_width_E=2
-- set minute hand line cap
mh_cap=CAIRO_LINE_CAP_ROUND
-- set minute hand color
mhr,mhg,mhb,mha=1,1,0,1-- fully opaque white
-- SETUP SECOND HANDS #####################################
-- CLOCK E SECOND HAND SETUP
-- set length of seconds hand
sh_length_E=32
-- set hour hand width
sh_width_E=1
-- set hour hand line cap
sh_cap=CAIRO_LINE_CAP_ROUND
-- set seconds hand color
shr,shg,shb,sha=1,0,0,1-- fully opaque red
-- CLOCK E ###### 12 HR TIME ##############################
-- CLOCK SETTINGS
clock_radius=45
clock_centerx=init.center_x
clock_centery=init.center_y+85
-- DRAWING CODE
-- DRAW BORDER
cairo_set_source_rgba (cr,169/255,169/255,169/255,1)
cairo_set_line_width (cr,clock_border_width)
cairo_arc (cr,clock_centerx,clock_centery,clock_radius,0,2*math.pi)
cairo_stroke (cr)
-- DRAW MARKS
-- stuff that can be moved outside of the loop, needs only be set once
-- calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length_E
-- set line cap type
cairo_set_line_cap  (cr, m_cap)
-- set line width
cairo_set_line_width (cr,m_width_E)
-- set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
-- START LOOP FOR SECOND MARKS
for i=1,number_marks_E do
-- drawing code using the value of i to calculate degrees
-- calculate start point for 12/24 hour mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks_E))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
-- calculate end point for 12/24 hour mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks_E))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- draw the line-- MARKS AROUND CLOCK A
cairo_stroke (cr)
end-- of for loop
-- SET MARKS ##############################################
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
local number_marks_A=init.hour
-- set mark length
local m_length_A=0
-- set mark width
local m_width_A=0
-- set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
-- set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,1,1 -- opaque white
-- SETUP HOUR HANDS #######################################
-- CLOCK A HOUR HAND
-- set length of hour hand
hh_length_A=130
-- set hour hand width
hh_width_A=3
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
hhr,hhg,hhb,hha=1,1,1,.5-- fully opaque white
-- SETUP MINUTE HANDS #####################################
-- CLOCK A MINUTE HAND SETUP
-- set length of minute hand
mh_length_A=145
-- set minute hand width
mh_width_A=2
-- set minute hand line cap
mh_cap=CAIRO_LINE_CAP_ROUND
-- set minute hand color
mhr,mhg,mhb,mha=1,1,1,.5-- fully opaque white
-- SETUP SECOND HANDS #####################################
-- CLOCK A SECOND HAND SETUP
-- set length of seconds hand
sh_length_A=150
-- set hour hand width
sh_width_A=2
-- set hour hand line cap
sh_cap=CAIRO_LINE_CAP_ROUND
-- set seconds hand color
shr,shg,shb,sha=1,0,0,1-- fully opaque red
-- CLOCK A ###### 12 HR TIME ##############################
-- CLOCK SETTINGS
clock_radius=200
clock_centerx=init.center_x
clock_centery=init.center_y
-- DRAWING CODE
-- DRAW BORDER
cairo_set_source_rgba (cr,cbr,cbg,cbb,cba)
cairo_set_line_width (cr,clock_border_width)
cairo_arc (cr,clock_centerx,clock_centery,clock_radius,0,2*math.pi)
cairo_stroke (cr)
-- DRAW MARKS
-- stuff that can be moved outside of the loop, needs only be set once
-- calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length_A
-- set line cap type
cairo_set_line_cap  (cr, m_cap)
-- set line width
cairo_set_line_width (cr,m_width_A)
-- set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
-- START LOOP FOR HOUR MARKS
for i=1,number_marks_A do
-- drawing code using the value of i to calculate degrees
-- calculate start point for 12/24 hour mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
-- calculate end point for 12/24 hour mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- draw the line
cairo_stroke (cr)
end-- of for loop
-- HOUR MARKS
-- TIME CALCULATIONS CLOCK A
if clock_type_A==12 then
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
elseif clock_type_A==24 then
hours=tonumber(os.date("%H"))
-- convert hours to seconds
h_to_s=hours*60*60
end
minutes=tonumber(os.date("%M"))
-- convert minutes to seconds
m_to_s=minutes*60
-- get current seconds
seconds=tonumber(os.date("%S"))
-- DRAW HOUR HAND
-- get hours minutes seconds as just seconds
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*clock_type_A))-- use equation ~ eliminate decimals
-- set radius to calculate hand points
radius=hh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of hour hand
point=(math.pi/180)*hsec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,hh_width_A)
--cairo_set_source_rgba (cr,hhr,hhg,hhb,hha)
cairo_set_source_rgba (cr,169/255,169/255,169/255,1)
cairo_set_line_cap  (cr, hh_cap)
cairo_stroke (cr)
-- DRAW MINUTE HAND
-- get minutes and seconds just as seconds
msecs=m_to_s+seconds
-- calculate degrees for each second
msec_degs=msecs*0.1
-- set radius to calculate hand points
radius=mh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of minute hand
point=(math.pi/180)*msec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,mh_width_A)
--cairo_set_source_rgba (cr,mhr,mhg,mhb,mha)
cairo_set_source_rgba (cr,169/255,169/255,169/255,1)
cairo_set_line_cap  (cr, mh_cap)
cairo_stroke (cr)
-- DRAW SECOND HAND
--[[
-- calculate degrees for each second
sec_degs=seconds*6
-- set radius to calculate hand points
radius=sh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of seconds hand
point=(math.pi/180)*sec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))BOLD
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes
cairo_set_line_width (cr,sh_width_A)
cairo_set_source_rgba (cr,shr,shg,shb,sha)
cairo_set_line_cap  (cr, sh_cap)
cairo_stroke (cr)
]]
-- ####################################################################
local center_x=init.center_x
local center_y=init.center_y
local radius=init.radius-5
cairo_select_font_face (cr, "Liquid Crystal", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 15)
cairo_set_source_rgba (cr,1,1,1,1) -- 12 HR Clock numbers
-- TABLE OF TEXT -- in order
if init.hour == 12 then
  text_days={"00","01","02","03","04","05","06","07","08","09","10","11",}
  for i=1,12 do
    -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=150
  for i=1,12 do
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
end
if init.hour == 24 then
  text_days={"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23",}
  for i=1,24 do
    -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/24)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    --local extents=cairo_text_extents_t:create()
    --tolua.takeownership(extents)
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
  -- INNER POINTS POSITION, radius smaller than text circle
  local radius=150
  for i=1,24 do
    local point=(math.pi/180)*((360/24)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
end

-- PART SECOND HAND
--position
--get seconds value
local seconds=tonumber(os.date("%S"))
--calculate rotation of second hand in degrees
if init.line == true then
  local arc=(math.pi/180)*((360/60)*seconds)
  --calculate point 1
  local radius1=140
  local x1=0+radius1*math.sin(arc)
  local y1=0-radius1*math.cos(arc)
  --calculate point 2
  local radius2=155
  local x2=0+radius2*math.sin(arc)
  local y2=0-radius2*math.cos(arc)
  --draw line connecting points
  cairo_move_to (cr, center_x+x1,center_y+y1)
  cairo_line_to (cr, center_x+x2, center_y+y2)
  cairo_set_source_rgba (cr,255/255,0/255,0/255,1) -- PART SECOND HAND
  cairo_stroke (cr)
end
-- ####################################################################
-- POSITION FOR TEXT HOUR NUMBERS
--affiche secondes
  if init.hour == 12 and init.second == true then
    text_days={"","1","2","3","4","","6","7","8","9","","11","12","13","14","","16","17","18","19","","21","22","23","24","","26","27","28","29","","31","32","33","34","","36","37","38","39","","41","42","43","44","","46","47","48","49","","51","52","53","54","","56","57","58","59","",}
    -- INNER POINTS POSITION, radius smaller than text circle
    cairo_set_source_rgba (cr,1,1,1,0.3) -- does not work -- settings moved
    cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    for i=1,60 do
      local radius=150 -- dots for seconds A Clock
      local point=(math.pi/180)*((360/60)*(i-1))
      local x=0+radius*(math.sin(point))
      local y=0-radius*(math.cos(point))
      if seconds == i-1 then
        cairo_set_source_rgba (cr,255/255,0/255,0/255,0.3) -- does not work - settings moved
      else
        if i-1 == 0 or i-1 == 5 or i-1 == 10 or i-1 == 15 or i-1 == 25 or i-1 == 30 or i-1 == 35 or i-1 == 40 or i-1 == 45 or i-1 == 50 or i-1 == 55 then
          cairo_set_source_rgba (cr,0,1,1,1) --??
        else
          cairo_set_source_rgba (cr,0,1,1,0.3) -- dots for seconds A Clock
        end
      end
      cairo_arc (cr,center_x+x,center_y+y,1/2,0,2*math.pi)
      cairo_stroke (cr)
    end
    radius=radius-3
    cairo_set_font_size (cr, 10)
    for i=1,60 do
      -- OUTTER POINTS POSTION FOR TEXT
      local point=(math.pi/180)*((360/60)*(i-1))
      local x=0+radius*(math.sin(point))
      local y=0-radius*(math.cos(point))
      -- CALCULATE CENTRE OF TEXT
      local text=text_days[i]--gets text from table
      if seconds == tonumber(text) then
        cairo_set_source_rgba (cr,1,0,0,1) -- ??
      else
        cairo_set_source_rgba (cr,1,1,1,0.3) -- seconds numbers
      end
      --local extents=cairo_text_extents_t:create()
      cairo_text_extents(cr,text,extents)
      local width=extents.width
      local height=extents.height
      cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
      cairo_show_text (cr, text)
      cairo_stroke (cr)
    end
  end
-- Fin affiche secondes
-- FONT

-- ########################################################
cairo_stroke (cr)
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function

Dernière modification par Didier-T (Le 22/11/2012, à 22:11)

Hors ligne

#1595 Le 22/11/2012, à 22:20

Didier-T

Re : [Conky] Alternative à weather.com (2)

Sector11 a écrit :

...
These are my next project  big_smile

#lua_load ~/Chrono-TEST/LUA/Chronograph_2.lua
#lua_load ~/Chrono-TEST/LUA/Chronograph_2_noE.lua

- not finished yet. If you want to use them it's OK, they are now public as of this post
http://t.imgbox.com/abw2NTjp.jpg

EDIT:
If you want it ALL here it is

Sympa, mais il y a trop d'aiguilles, sa gêne la visibilité (du moins a mon avis).
Mais une horloge qui ferait juste calendrier, ce serait une nouveauté intéressante, bien sur avec les aiguilles fonctionnant sur le même principe que pour les heures (de manière progressive).

Quand j'aurais fini de me prendre la tête sur mon eeepc je ferais ce calendrier (si personne ne ma pris de vitesse tongue ).

Hors ligne

#1596 Le 22/11/2012, à 22:59

Sector11

Re : [Conky] Alternative à weather.com (2)

Didier-T a écrit :

@ Sector11,

Bon c'est ma faute, avant d'appeler une fonction il faut l'initialiser. roll
Donc petite modification. big_smile

Chronograph-Didier-T-2.lua

{cut}
alpha=1 --alpha for day, day number and month if no hand
}

function rgb_to_r_g_b(col,alp) -- ONLY NEED ONE COPY OF THIS FUNCTION
  return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end

local colr, colg, colb, cola=rgb_to_r_g_b(init.color,init.alpha)
{cut}
function conky_main()

I would NEVER have found that.  I was going crazy as it was  big_smile
Thank you, I owe you one.

Hors ligne

#1597 Le 22/11/2012, à 23:09

Sector11

Re : [Conky] Alternative à weather.com (2)

Didier-T a écrit :

Sympa, mais il y a trop d'aiguilles, sa gêne la visibilité (du moins a mon avis).
Mais une horloge qui ferait juste calendrier, ce serait une nouveauté intéressante, bien sur avec les aiguilles fonctionnant sur le même principe que pour les heures (de manière progressive).

Quand j'aurais fini de me prendre la tête sur mon eeepc je ferais ce calendrier (si personne ne ma pris de vitesse tongue ).

One of the reasons I wanted the other Chronograph fixed, I want to look at it and apply the same principle that allows "No Hands", other than the big clock - the day numbers, month names and day names will be highlighted with the inactive numbers and names get an alpha of 0.5.

The only hands will be on the clock - so it will be smaller as well.

Hors ligne

#1598 Le 23/11/2012, à 07:38

Didier-T

Re : [Conky] Alternative à weather.com (2)

Sector11 a écrit :
Didier-T a écrit :

Sympa, mais il y a trop d'aiguilles, sa gêne la visibilité (du moins a mon avis).
Mais une horloge qui ferait juste calendrier, ce serait une nouveauté intéressante, bien sur avec les aiguilles fonctionnant sur le même principe que pour les heures (de manière progressive).

Quand j'aurais fini de me prendre la tête sur mon eeepc je ferais ce calendrier (si personne ne ma pris de vitesse tongue ).

One of the reasons I wanted the other Chronograph fixed, I want to look at it and apply the same principle that allows "No Hands", other than the big clock - the day numbers, month names and day names will be highlighted with the inactive numbers and names get an alpha of 0.5.

The only hands will be on the clock - so it will be smaller as well.

En effet, sa devrais être très bien, je ne suis malheureusement pas certain que tu puisse beaucoup diminuer la taille de l'horloge.
Mais je suis impatient de voir le résultat.

Hors ligne

#1599 Le 23/11/2012, à 19:36

Phyllinux

Re : [Conky] Alternative à weather.com (2)

@ Didier-T :

Si j'ai bien compris, il est donc possible de lancer le chronograph sans lancer le script draw-bg.lua, avec la dernière modif que tu viens d'apporter au script ?
Car actuellement, cela fonctionne chez moi en lançant les 2 scripts lua : le draw-bg et le chronograph.


The ship is sinking normally...

Hors ligne

#1600 Le 23/11/2012, à 20:23

Didier-T

Re : [Conky] Alternative à weather.com (2)

Phyllinux a écrit :

@ Didier-T :

Si j'ai bien compris, il est donc possible de lancer le chronograph sans lancer le script draw-bg.lua, avec la dernière modif que tu viens d'apporter au script ?
Car actuellement, cela fonctionne chez moi en lançant les 2 scripts lua : le draw-bg et le chronograph.

c'est exacte.

Hors ligne