I tono mai a Fecfactor ki ahau inanahi ki te whakaputa i te whirihoranga o te conky e whakaatuhia ana e au i te Whakaahuamata i raro
Kei te kite koe, e 3 pea nga koeko, e whakamahia ana e te tuhinga, kei runga te whirihoranga tenei pou i tukuna e te kaiwhakamahi Bruce M. i nga huihuinga o Ubuntu-Ar me etahi whakarereketanga kei roto i te kaeraeraera, mo taku mo Gmail.
I roto i te pou korero he pai te whakamarama a Bruce, engari hei awhina maumahara hoki ki ahau, ka kape au i nga kaupae hei whai me te waehere o aku konihi mo te hunga kei a ia.
Ae ra, ko te tikanga me whakauru he koikoi, koti me te python kia whakauruhia ki roto i te papatohu:
sudo apt-tiki tāuta conky curl python
Te putake o te rangi.ttf me nga pere.ttf kei konei. Te putake o te marama.ttf kei konei ka oti te tango me kape e koe ki / usr / tohatoha / momotuhi
Me hanga e maatau taatau tuhinga ~ ~ / Startconky
gksudo gedit ~ / .startconky
i roto i te konae kore ka whakapiri matou i nga mea e whai ake nei
#! / bin / bash
moe 0 & # 0 pai mo Xfce - whakamahia te 20 ki te 30 mo Gnome
conky -c ~ / Conky / conkymain &
# moe 0 & # 0 pai mo Xfce - whakamahia 1 mo Gnome
Conky -c ~ / Conky / conkyforecast me te
# moe 0 & # 0 pai mo Xfce - whakamahia 1 mo Gnome
conky -c ~ / Conky / conkymail &
Na ka hangaia e maatau te konae kohinga ki te kōpaki ~ / Conky, ki te kore o maatau kōpaki Conky, me hanga e tatou.
gedit ~ / Conky / conkymain
Ka whakamahia e au te momotuhi Calibri, ki te kore koe, whakakapi ki nga mea e hiahia ana koe.
Ka piri matou ki roto ka whai ake
papamuri No.
ake_window āe
ake_window_transparent āe
ake_window_hints undecorated, i raro, tāpiapia, tīpoka_taskbar, tīpoka_pager
ake_window_colour mangu
Double_buffer āe
whakamahi_whiwhi i mahue
whakamahi_xft ae
momotuhi calibri: rahi = 9
xftbest calibri: rahi = 9
xftalpha 0.5
whakahou_interval 5.0
Pūmatua kahore # kua tautuhia ki te ae mena kei te hiahia koe kia noho nga kuputuhi katoa ki runga ake
stippled_bounds 3
rohe_margin 9
rohe_width 10
default_color ma
default_outline_color pango
default_shade_color pango
karakara0 cyan
tae1 maaka marama
karakara2 karaka
tae3 kowhai
kara4 witi
tae5 ma
tae6 ma
tae7 ma
tae8 ma
tae9 ma
tīaroaro runga_ matau # runga ranei_ maui, raro_konga, raro_ matau
āputa_x 10
āputa_y 35
text_buffer_size 128 # whakamahi 1024 mo te matapae
no_buffers āe # Tangohia nga peepi punaha o te konae mai i te whakamaharatanga o mua?
draw_border no
draw_outline ae # whakarakei ana i te tuhinga mena ka ae
draw_shades ae # shadecolor manguTEXT
$ {font calibri: size = 12} $ {alignc} $ {color1} $ sysname $ kernel on $ machine} $ tae $ momotuhi
$ {font calibri: size = 12} $ {alignc} $ {color2} $ {exec whoami} @ $ nodename $ tae $ momotuhi
$ {color0} $ {hr 1} $ tae
$ {font calibri: size = 20} $ {alignc} $ {wā% H:% M} $ momotuhi
$ {font calibri: size = 12} $ {color1} $ {alignc} $ {time% A,% d% b. % Y} $ tae $ momotuhi
$ {color3} Wā Ake: $ {alignr 2} $ uptime $ tae
$ {color0} $ {hr 1} $ tae
$ {voffset 5} $ {color2} PTM: $ {alignc} $ color $ running_processes $ {color1} / $ color $ tukatuka $ {alignr 2} $ {color2} $ {cpubar cpu0 14,80} $ tae
$ {color1} $ {voffset -16} $ {alignr 5} $ cpu% $ tae
$ {voffset 2} $ {color1} Uta Avg ($ {color3} Min $ {color1}): $ {alignr 2} $ {color3} 1: $ tae $ {loadavg 1} $ {color3} 5: $ tae $ {loadavg 2} $ {color3} 15: $ tae $ {loadavg 3}
$ {voffset 5} $ {color2} RAM: $ tae $ mem $ {color2} / $ tae $ memmax $ {alignr 2} $ {color2} $ {membar 14,80} $ tae
$ {color1} $ {voffset -16} $ {alignr 5} $ memperc% $ tae
$ {voffset 2} $ {color1} Buffered: $ tae $ {buffers} $ {alignr 2} $ {color1} Keteroki: $ tae $ {keteroki}
$ {voffset 5} $ {color2} SWAP: $ color $ swap $ {color2} / $ color $ {swapmax} $ {alignr 2} $ {color2} $ {swapbar 14,80} $ tae
$ {color1} $ {voffset -16} $ {alignr 5} $ swapperc%
$ {color0} $ {hr 1} $ tae
$ {voffset 5} $ {tae2} Mōhiohio HD $ {tae1} - $ tae Koreutu $ {tae1} - Whakamahia - $ {tae2} Tapeke
$ {voffset 5} $ {color1} Root: $ tae $ {fs_free_perc /}% $ {alignr 2} $ {fs_free /} $ {color2} / $ {color1} $ {fs_used /} $ tae / $ {color2} $ {fs_size /} $ tae
$ {color1} Kaainga: $ tae $ {fs_free_perc / home / kaiwhakamahi}% $ {alignr 2} $ {fs_free / home / user} $ {color2} / $ {color1} $ {fs_used / home / kaiwhakamahi} $ tae / $ {color2} $ {fs_size / home / kaiwhakamahi} $ tae
$ {color0} $ {hr 1} $ tae
$ {color1} Mai i: $ tae Buenos Aires, Argentina
$ {color1} Lat: $ {color2} 34 ° 35'S $ {color1} Roa: $ {color2} 58 ° 21'W $ {color1} Alt: $ {color2} 25 m $ tae
$ {voffset 5} $ {color2} $ {font calibri: size = 12} i tenei ra: $ font $ {color3} $ {ex 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = CC} $ tae $ {alignr 2} $ {color1} ST: $ {color2} $ {ex 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = LT}
$ {color3} $ {font Weather: size = 50} $ {ex 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = WF} $ momotuhi $ tae
$ {alignr 50} $ {voffset -55} $ {font calibri: size = 25} $ {ex 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = HT} $ momotuhi
$ {alignc 20} $ {voffset -30} $ {font Pere: rahi = 20} $ {color4} $ {ex 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = BF} $ tae $ momotuhi
$ {alignc 10} $ {voffset 5} $ {color4} Hau: $ {ex 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = WS} $ tae
$ {color1} Haumaru: $ {color3} $ {ex 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = HM} $ {alignr 2} $ {color1} Precipitation: $ {color3} $ { whakawhiwhia 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = PC} $ tae
$ {alignc} $ {color1} Pressure: $ {color3} $ {ex 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = BR} - $ {color3} $ {execi 3600 python ~ / Conky /scripts/conkyForecast.py –location = ARBA0009 –datatype = BD} $ tae
$ {color4} $ {hr} $ tae
$ {color1} Sunrise: $ {color3} $ {ex 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = SR} $ {alignr 2} $ {color1} Sunset: $ {color3} $ { whakanui 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = SS} $ tae
$ {voffset 15} $ {color1} Marama: $ {color4} $ {alignr 2} $ {color3} $ {ex 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = MP} $ tae
$ {voffset -20} $ {offset 80} $ {color4} $ {font moon phase: size = 20} $ {ex 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = MF} $ momotuhi $ tae
$ {color0} $ {hr} $ tae
$ {voffset 5} $ {color2} IP: $ {alignc} $ tae $ {addr eth0}
$ {color1} Whakararo: $ tae $ {downspeed eth0} k / s $ {alignr 2} $ {color1} Whakatika: $ tae $ {upspeed eth0} k / s
$ {color1} Tapeke: $ tae $ {totaldown eth0} $ {alignr 2} $ {color1} Tapeke: $ tae $ {totalup eth0}
$ {color1} Inbound: $ tae $ {tcp_portmon 1 32767 tatau} $ {color1} Outbound: $ color $ {tcp_portmon 32768 61000 count} $ {alignr 2} $ {color1} Tapeke: $ tae $ {tcp_portmon 1 65535 tatau}
$ {voffset 5} $ {color2} Hononga: $ tae $ {tcp_portmon 32768 61000 kaute} $ {alignr 2} $ {color2} Ratonga / Tauranga $ tae
$ {voffset 5} $ {tcp_portmon 32768 61000 rhost 0} $ {alignr 2} $ {tcp_portmon 32768 61000 rservice 0}
$ {tcp_portmon 32768 61000 rhost 1} $ {alignr 2} $ {tcp_portmon 32768 61000 rservice 1}
$ {tcp_portmon 32768 61000 rhost 2} $ {alignr 2} $ {tcp_portmon 32768 61000 rservice 2}
$ {tcp_portmon 32768 61000 rhost 3} $ {alignr 2} $ {tcp_portmon 32768 61000 rservice 3}
$ {tcp_portmon 32768 61000 rhost 4} $ {alignr 2} $ {tcp_portmon 32768 61000 rservice 4}
$ {tcp_portmon 32768 61000 rhost 5} $ {alignr 2} $ {tcp_portmon 32768 61000 rservice 5} $ tae
hanga ana e matou te konae ~ / Conky / conkyforecast
gedit ~ / Conky / conkyforecast
a ka whakapirihia e matou nga mea e whai ake nei
papamuri No.
ake_window āe
ake_window_transparent āe
ake_window_hints undecorated, i raro, tāpiapia, tīpoka_taskbar, tīpoka_pager
ake_window_colour mangu
Double_buffer āe
whakamahi_whiwhi i mahue
whakamahi_xft ae
momotuhi calibri: rahi = 8
xftbest calibri: rahi = 8
xftalpha 0.5
whakahou_interval 5.0
Pūmatua kahore # kua tautuhia ki te ae mena kei te hiahia koe kia noho nga kuputuhi katoa ki runga ake
stippled_bounds 3
rohe_margin 9
rohe_width 10
default_color ma
default_outline_color pango
default_shade_color pango
karakara0 cyan
tae1 maaka marama
karakara2 karaka
tae3 kowhai
kara4 witi
tae5 ma
tae6 ma
tae7 ma
tae8 ma
tae9 ma
whakatikatika i raro_ i te taha maui # ki runga ranei, maui, raro, matau
āputa_x 10
āputa_y 35
text_buffer_size 1024 # whakamahi 1024 mo te matapae
no_buffers āe # Tangohia nga peepi punaha o te konae mai i te whakamaharatanga o mua?
draw_border no
draw_outline ae # whakarakei ana i te tuhinga mena ka ae
draw_shades ae # shadecolor manguTEXT
$ {color4} $ {font calibri: size = 11} Matapae Whanui $ font $ tae
$ {color0} $ {hr} $ tae
$ {color4} $ {font calibri: size = 9} $ {exzed 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –template = / home / user / Conky / scripts / myweather.template} $ momotuhi $ tae
hangaia ana e matou te konae ~ / Conky / conkymail
gedit ~ / Conky / conkymail
whakapiri matou i te whai ake ki te konae
papamuri No.
ake_window āe
ake_window_transparent āe
ake_window_hints undecorated, i raro, tāpiapia, tīpoka_taskbar, tīpoka_pager
ake_window_colour mangu
Double_buffer āe
whakamahi_whiwhi i mahue
whakamahi_xft ae
momotuhi calibri: rahi = 8
xftbest calibri: rahi = 8
xftalpha 0.5
whakahou_interval 5.0
Pūmatua kahore # kua tautuhia ki te ae mena kei te hiahia koe kia noho nga kuputuhi katoa ki runga ake
stippled_bounds 3
rohe_margin 9
rohe_width 10
default_color ma
default_outline_color pango
default_shade_color pango
karakara0 cyan
tae1 maaka marama
karakara2 karaka
tae3 kowhai
kara4 witi
tae5 ma
tae6 ma
tae7 ma
tae8 ma
tae9 ma
whakatikatika i raro_ i te taha maui # ki runga ranei, maui, raro, matau
āputa_x 565
āputa_y 35
text_buffer_size 128 # whakamahi 1024 mo te matapae
no_buffers āe # Tangohia nga peepi punaha o te konae mai i te whakamaharatanga o mua?
draw_border no
draw_outline ae # whakarakei ana i te tuhinga mena ka ae
draw_shades ae # shadecolor manguTEXT
$ {font calibri: size = 11} $ {alignc} $ {color4} Gmail
$ {color0} $ {hr} $ tae
$ {font calibri: size = 11} $ {color4} Kei a matou te $ {color3} $ {exzed 300 python ~ / Conky / scripts / mail / conkyEmail.py} $ {color4} email (s) $ font
Ka hangaia e matou he konae ki ~ / Conky / scripts / conkyForecast.py (me hanga e matou te kōpaki tuhinga)
gedit ~ / Conky / scripts / conkyForecast.py
#! / usr / bin / python
# - * - waehere: utf-8 - * -
#### # ####
# conkyForecast.py he (kore pera) he huahua python ngawari (ano) hei kohikohi
# taipitopito o te huarere o tenei wa hei whakamahi i conky
#
# Kaituhi: Kaivalagi
# Hangaia: 13/04/2008
# Whakakētanga:
# 14/04/2008 Tukua he awhe awatea mo nga raraunga matapae
# 14/04/2008 Tirohia te hononga ki te ratonga xoap
# 18/04/2008 Whakaaetia te waahi mokowhiti mo te awhe
# 18/04/2008 Tukua te putanga matapae o te Po me te Ra
# 18/04/2008 Tautoko i te takiwa mo te waehere waehere tohu «CC» whiringa, e tatari ana mo te whakamaoritanga o te reo Paniora
# 18/04/2008 Whakamahia te kohi mo nga raraunga a te akomanga kaua ki te whakatuwhera xml, ka kore e tika ana te uiui i nga raraunga keteroki
# 19/04/2008 Kua taapirihia he tuhinga ahua Pakeha - Mauruuru Bruce M
# 19/04/2008 Kua taapirihia te huringa tatauranga mo nga putanga nama katoa me nga waarangi o muri
# 19/04/2008 Kua whakaingoa te konae pīkara ki te whakauru ki te waehere tauwāhi
# 19/04/2008 Kua taapirihia nga wiki wiki Paniora te hurihuri ma te rohe
# 20/04/2008 Kua taapirihia te kaiwhakataetae tohetohe whakahau
# 20/04/2008 Kua Taapirihia -Te kowhiri pooti, mena ka whakawhiwhia te ra o te wiki ka poroa nga momo raraunga ki te 3 nga kiripuaki
# 21/04/2008 Ko nga whiringa kaainga pumau hei whakaputa matapae
# 21/04/2008 Kua Taapirihia –Teira whakaahuatanga hei tuku i nga putanga ritenga ma te piiraa kotahi ec
# 21/04/2008 Kua taapirihia te -hideunits whiringa hei tango, hei tauira, mph me C mai i te putanga
# 23/04/2008 Kua nekehia atu-tia whiringa waahanga mai i te tauira, me whakarite tenei hei whiringa paerewa i runga i te waeatanga tuhinga engari kaua e whakamahia i te konae tauira.
# 23/04/2008 Panui –piringa rua ki te tauira, whakahoahoahia nga uara me te emepaea o ia momo. Kia maumahara ki te whakamahi i te raina whakahau raina kaore e mahi.
# 23/04/2008 Kua taapirihia te whakaputa korero ki te kaiwhakamahi mena he kino te waahi ka hoatu
# 24/04/2008 Kua taapirihia te whakahaere mo te kore honohono, ka hoki ki nga raraunga keteroki inaianei (he hapa mena kaore he keteroki). Nga whakamatautau ma te tarai ki te whakatuwhera i te xoap.weather.com
# 24/04/2008 Kua Whakatauhia a Celsius ki te huri i te fahrenheit
# 06/05/2008 Url whakahoutia i whakamahia i muri i te whakahoutanga o te ratonga paetukutuku
# 09/05/2008 I whakahiatohia te ahuatanga o naianei me nga matapae o te tatauranga ka riro hei waea kotahi
# 09/05/2008 Kua taapirihia te putanga mai o te Ra me te rerenga o te ra ki nga putunga raraunga, he motuhake enei ki nga ahuatanga e rua o tenei wa me nga korero matapae
# 09/05/2008 Kua taapirihia te waahanga marama, te paanui paanui me te paanui paanui ki nga papaanga raraunga, he mea motuhake enei mo nga ahuatanga o inaianei me te N / A mo nga putanga matapae
# 09/05/2008 Kua taapirihia nga waahanga hurihuri mo te paemita mai i te mb ki te inihi (emepaea)
# 09/05/2008 Kua whakahoutia te tuhinga ahua Pakeha - Mauruuru Bruce M
# 10/05/2008 Kua taapirihia nga rohe kaainga French - Thanks benpaka
# 12/05/2008 Kua taapirihia he momo taatai BF (momotuhi whanau) hei whakarato i te tohu pere (whakamahia me te momotuhi Pere.ttf) hei utu mo te putanga NSEW mai i te WD (ahunga hau)
# 12/05/2008 Kua whakahoutia te putanga WD hei tautoko i te rohe, kei te tautoko i te waa Ingarihi me te Paniora. - Mihi Bruce M
# 18/05/2008 Kua taapirihia he momo taatai MF (momotuhi marama) hei whakarato i te tohu momotuhi marama (he he nga kiripuaki kaore ano he momotuhi whakatapua)
# 21/05/2008 Mo nga ahuatanga onaianei ko te –datatype = whiringa LT inaianei kei te whakaatu «ahua penei» te paemahana kaua te paemahana o inaianei
#
# KATOA:
# Whakakotahitia nga konae pkl ki roto i te konae kotahi / akomanga
# Taapirihia he momotuhi huarere i runga i te putanga waahanga marama i runga i nga tohu tohu marama
# ??? He whakaritenga ano kei reira?kawemai sys, os, turanga, urllib2, wa-roa, te waa
mai i te xml.dom kawemai minidom
mai i te stat import *
mai i te kawemai kawemai OptionParser
rohe kawemai
kawemai gettext
kawemai pīkara
mai i te kawemai pangarau *APP = »conkyForecast.py»
DIR = os.path.dirname (__file__) + '/ takiwā'
gettext.bindtextdomain (APP, DIR)
gettext.textdomain (APP)
_ = gettext.gettextakomangaTohuAunoaParser:
parser = Kore
def __init __ (whaiaro):
self.parser = OptionParser ()
self.parser.add_option («- l», »- tauwāhi», dest = »wāhi», taunoa = »UKXX0103 ″, momo =» aho », metavar =» CODE », awhina = u» waehere tauwāhi mo te raraunga huarere [ taunoa:% taunoa], Whakamahia nga url e whai ake nei hei whakatau i to waehere tauwāhi ma te ingoa pa: http://xoap.weather.com/search/search?where=Norwich »)
self.parser.add_option ("- d", "- datatype", dest = "datatype", taunoa = "HT", momo = "aho", metavar = "DATATYPE", awhina = u "[taunoa:% taunoa] Ko nga whiringa momo momo raraunga ko: DW (Ra O Te Wiki), WF (Putanga Momotuhi Te huarere), LT (Matapae: Iti Rangimarie, Naianei: Nga Wa penei i te Temp), HT (Matapae: Tae Nui, Naianei: Nawai Tae) Tikanga), CT (Tikanga Kupu), PC (Maamaa Motuhake), HM (Haumaru), WD (Aronga Hau), WS (Tere Hau), WG (Hau Hau), CN (Ingoa Taone), SR (whiti), SS (topenga o te ra), MP (waahanga marama), MF (momotuhi marama), BR (paanui paanui), BD (whakaahuatanga barometera). Kaore e pa ki te raina whakahau ina whakamahi tauira. »)
self.parser.add_option («- s», »- startday», dest = »startday», type = »int», metavar = »NUMBER», help = u »tautuhia te ra timatanga, mena ka kore e puta nga ahuatanga onaianei . Kaore e pa ki te raina whakahau ina whakamahi tauira. »)
self.parser.add_option ("- e", "- endday", dest = "endday", type = "int", metavar = "NUMBER", help = u "tautuhia te ra mutunga o te ra, mena ka waihohia nga ra timatanga he putanga. Kaore e pa ki te raina whakahau ina whakamahi tauira. »)
self.parser.add_option («- S», »- mokowā», dest = »waahi», momo = »int», taunoa = 1, metavar = »NUMBER», awhina = u »[taunoa:% taunoa] Ka tautuhia te te maha o nga waahi i waenga i nga putanga. Kaore e pa ki te raina whakahau i te wa e whakamahia ana he tauira. »)
self.parser.add_option («- t», »- tauira», dest = »tauira», momo = »aho», metavar = »FAI», awhina = u »tautuhia he konae tauira hei whakaputa i te piiraa kotahi. A Ko nga mea e taea ana te whakaatu i te konae ko te puka {–datatype = HT –startday = 1}. Ko nga waahanga e whai ake nei ka taea i roto i ia taonga: –datatype, –startday, –endday, –night, –shortweekday, –imperial, –hideunits, –Whakaa. Kia mahara ko nga waahanga poto o nga waahanga kaore i te tautokohia i tenei wa! Kaore tetahi o enei waahanga e pa ana ki te raina whakahau ina whakamahi tauira. »)
self.parser.add_option («- L», »- takiwā», dest = »takiwā», momo = »aho», awhina = u »whakakorengia te rohe punaha mo te whakaputa reo (en = Ingarihi, es = Paniora, fr = French, he mea kei te haere mai) »)
self.parser.add_option ("- i", "- emepaea", dest = "emepaea", taunoa = Hape, mahi = "store_true", awhina = u "tono waeine emepaea, mena ka haukotia te putanga. Kaore e pa ki raina whakahau ina whakamahi tauira. »)
self.parser.add_option («- n», »- po», dest = »po», taunoa = Hape, mahi = »store_true», awhina = u »whakawhiti putanga ki nga korero o te po, mena ka ngaro te putanga o te ra. Kaore e pa ki te raina whakahau ina whakamahi tauira. »)
self.parser.add_option («- w», »- shortweekday», dest = »shortweekday», taunoa = Hape, mahi = »store_true», awhina = u »Whakapotohia te ra o te wiki momo momo tuhinga ki nga tohu e toru. Kaore e tika ana i raina whakahau ina whakamahi tauira. »)
self.parser.add_option («- u», »- hideunits», dest = »hideunits», taunoa = Hape, mahi = »store_true», awhina = u »Hunaia nga waahanga penei i te mph C ranei, tohu tohu (°) whakaaturia tonu. Kaore e pa ki te raina whakahau i te wa e whakamahi ana koe i nga tauira. »)
self.parser.add_option («- v», »- verose», dest = »verbose», taunoa = Hape, mahi = »store_true», awhina = u »tono putanga kupu, kaore he whakaaro pai i te wa e rere ana koe!)
self.parser.add_option ("- r", "- refetch", dest = "refetch", taunoa = Hape, mahi = "store_true", awhina = u "tiki raraunga ahakoa nga korero kua paunga"def parse_args (whaiaro):
(kōwhiringa, tohenga) = self.parser.parse_args ()
hokinga (whiringa, tohenga)def print_help (whaiaro):
hoki mai koe.parser.print_help ()karaehe WeatherData:
def __init __ (whaiaro, ra_o te wiki, iti, teitei, ahua_code, ahua_text, piko, haumākū, hau_dir, hau
self.day_of_week = u »» + day_of_week
self.low = u »» + iti
self.high = u »» + teitei
self.condition_code = u »» + huru_ waehere
whaiaro.condition_text = u »» + herenga_text
self.precip = u »» + pari
whaiaro.humidity = u »» + haumākū
whaiaro.wind_dir = u »» + hau_dir
whaiaro.wind_speed = u »» + hau
whaiaro.wind_gust = u »» + hau
self.city = u »» + taone nui
whaiaro.sunrise = u »» + whiti
whaiaro.sunset = u »» + toenga o te ra
self.moon_phase = u »» + marama_phase
self.moon_icon = u »» + marama_icon
self.bar_read = u »» + bar_read
self.bar_desc = u »» + bar_descakomangaTauira Panui:
tikanga_text = {
«0»: _ (u »Hurihuri»),
«1»: _ (u »Āwhiowhio Tino»),
«2»: _ (u »Huripari»),
«3»: _ (u »Pakaru Tuarua»),
«4»: _ (u »Pakaru Pakaru»),
«5»: _ (u »Te ranu me te hukarere»),
«6»: _ (u »Te Tini Haangai me te Haruru»),
«7»: _ (u »Utu Miihini»),
«8»: _ (u »Te Whakaturu Tere»),
«9»: _ (u »Parahu»),
«10»: _ (u »Te ua Tino»),
«11»: _ (u »Te ua»),
«12»: _ (u »Te ua»),
«13»: _ (u »Snow Flurries»),
«14»: _ (u »Te ua Hukarere Maama»),
«15»: _ (u »Pupuhi Hukarere»),
«16»: _ (u »Snow»),
«17»: _ (u »Kia ora»),
«18»: _ (u »Sleet»),
«19»: _ (u »Puehu»),
«20»: _ (u »Kohu» »,
«21»: _ (u »Aue»),
«22»: _ (u »Auahi»),
«23»: _ (u »Blustery»),
«24»: _ (u »Hau» »,
«25»: _ (u »Makariri»),
«26»: _ (u »Kapua»),
«27»: _ (u »Kapua Kairangi»),
«28»: _ (u »Kapua Kairangi»),
«29»: _ (u »Kapua Kapua»),
«30»: _ (u »Kapua Kapua»),
«31»: _ (u »Maama»),
«32»: _ (u »Maama»),
«33»: _ (u »He tika»),
«34»: _ (u »He tika»),
«35»: _ (u »Te Tairua Me Te Rangi»),
«36»: _ (u »Wera»),
«37»: _ (u »Nga Whaititiri Motuhake»),
«38»: _ (u »Pakaru Pakaru»),
«39»: _ (u »Pakaru Pakaru»),
«40»: _ (u »Marara Marara»),
«41»: _ (u »Snow Taumaha»),
«42»: _ (u »Marara Hukarere Makere»),
«43»: _ (u »Snow Taumaha»),
«44»: _ (u »Kapua Kapua»),
«45»: _ (u »Papa Utu»),
«46»: _ (u »Te ua Hukarere»),
«47»: _ (u »Nga Whaititiri Motuhake»),
«Na»: _ (u »N / A»),
"-": _ (a ")
}tikanga_text_es = {
«0»: _ (u »Hurihuri»),
«1»: _ (u »Āwhiowhio Tino»),
«2»: _ (u »Huracá¡n»),
«3»: _ (u »Nga Whawhai Kaha»),
«4»: _ (u »Āwha»),
«5»: _ (u »Te ranu me te hukarere»),
«6»: _ (u »Te Tini Haangai me te Haruru»),
«7»: _ (u »Sleet»),
«8»: _ (u »Te Whakaturu Tere»),
«9»: _ (u »Parahu»),
«10»: _ (u »Te ua Tino»), # he ua whakato ranei
«11»: _ (u »Te ua»),
«12»: _ (u »Te ua»),
«13»: _ (u »Snow Maama»),
«14»: _ (u »Snow Maama»),
«15»: _ (u »Snow Blizzard»),
«16»: _ (u »Snow»),
«17»: _ (u »Kia ora»),
«18»: _ (u »Sleet»),
«19»: _ (u »Paura»),
«20»: _ (u »Kohu» »,
«21»: _ (u »Haumaru»),
«22»: _ (u »Auahi»),
«23»: _ (u »Wharu» »,
«24»: _ (u »Hau» »,
«25»: _ (u »Fráo»),
«26»: _ (u »Kapua Tino»),
«27»: _ (u »Kapua Kairangi»),
«28»: _ (u »Kapua Kairangi»),
«29»: _ (u »Kapua Kapua»),
«30»: _ (u »Kapua Kapua»),
«31»: _ (u »Maama»),
«32»: _ (u »Maama»),
«33»: _ (u »He Mea Kapua»),
«34»: _ (u »He Mea Kapua»),
«35»: _ (u »Te ua me te ua»),
«36»: _ (u »Wera»),
«37»: _ (u »Nga Aahi Tuuturu»),
«38»: _ (u »Nga marara kua marara»),
«39»: _ (u »Nga marara kua marara»),
«40»: _ (u »Marara Marara»),
«41»: _ (u »Snow Taumaha»),
«42»: _ (u »He Hukarere ngoikore me te marara»),
«43»: _ (u »Kaha Nevada»),
«44»: _ (u »Kapua Marara»),
«45»: _ (u »Āwha»),
«46»: _ (ko »Nga Hukarere Huripara»),
«47»: _ (u »Nga Aahi Tuuturu»),
«Na»: _ (u »N / A»),
"-": _ (a ")
}tikanga_text_fr = {
«0»: _ (u »Tornade»),
«1»: _ (u »Tempëte Tropicale»),
«2»: _ (ranei »Ouragan»),
«3»: _ (ranei »Kaikaha Kaha»),
«4»: _ (or »Orageux»),
«5»: _ (u »Pluie et Neige»),
«6»: _ (u »Pluie et Neige Mouillée»),
«7»: _ (u »Ka taea te rereke»),
«8»: _ (u »Givrante Pono»),
«9»: _ (u »Pono»),
«10»: _ (u »Pluie Glacante»),
«11»: _ (u »Averses»),
«12»: _ (u »Averses»),
«13»: _ (u »Légère Neige»),
«14»: _ (u »Forte Neige»),
«15»: _ (u »Tempête de Neige»),
«16»: _ (u »Neige»),
«17»: _ (u »Grêle»),
«18»: _ (u »Pluie / Neige»),
«19»: _ (u »Nuage de poussière»),
«20»: _ (u »Brouillard»),
«21»: _ (u »Whakahu»),
«22»: _ (u »Fumée»),
«23»: _ (u »Tres Venteux»),
«24»: _ (u »Venteux»),
«25»: _ (u »Froid»),
«26»: _ (u »Nuageux»),
«27»: _ (u »Tres Nuageux»),
«28»: _ (u »Tres Nuageux»),
«29»: _ (u »Nuages Disséminés»),
«30»: _ (u »Nuages Disséminés»),
«31»: _ (u »Beau»),
«32»: _ (u »Beau»),
«33»: _ (u »Belles Éclaircies»),
«34»: _ (u »Belles Éclaircies»),
«35»: _ (u »Pluie avec Grêle»),
«36»: _ (u »Chaleur»),
«37»: _ (or »Orages Isolés»),
«38»: _ (or »Orages Localisés»),
«39»: _ (or »Orages Localisés»),
«40»: _ (u »Averses Localisées»),
«41»: _ (u »Neige Lourde»),
«42»: _ (u »Tempête de Neige Localisées»),
«43»: _ (u »Neige Lourde»),
«44»: _ (u »Nuages Disséminés»),
«45»: _ (or »Orages»),
«46»: _ (u »Tempête de Neige»),
«47»: _ (or »Orages Isolés»),
«Na»: _ (u »N / A»),
"-": _ (a ")
}tikanga_whakarewaka_pata = {
«0»: _ (u »W»),
«1»: _ (u »V»),
«2»: _ (u »W»),
«3»: _ (u »s»),
«4»: _ (u »p»),
«5»: _ (u »k»),
«6»: _ (u »k»),
«7»: _ (u »g»),
«8»: _ (u »g»),
«9»: _ (u »g»),
«10»: _ (u »h»),
«11»: _ (u »g»),
«12»: _ (u »g»),
«13»: _ (u »k»),
«14»: _ (u »k»),
«15»: _ (u »k»),
«16»: _ (u »k»),
«17»: _ (u »k»),
«18»: _ (u »k»),
«19»: _ (u »e»),
«20»: _ (u »e»),
«21»: _ (u »a»),
«22»: _ (u »d»),
«23»: _ (u »d»),
«24»: _ (u »d»),
«25»: _ (u »d»),
«26»: _ (u »e»),
«27»: _ (u »e»),
«28»: _ (u »e»),
«29»: _ (u »c»),
«30»: _ (u »c»),
«31»: _ (u »a»),
«32»: _ (u »a»),
«33»: _ (u »b»),
«34»: _ (u »b»),
«35»: _ (u »k»),
«36»: _ (u »a»),
«37»: _ (u »f»),
«38»: _ (u »f»),
«39»: _ (u »f»),
«40»: _ (u »g»),
«41»: _ (u »k»),
«42»: _ (u »k»),
«43»: _ (u »k»),
«44»: _ (u »b»),
«45»: _ (u »g»),
«46»: _ (u »k»),
«47»: _ (u »f»),
«Na»: _ (u »»),
"-": _ (ko "")
}tikanga_moon_ font = {
«0»: _ (u »1 ″),
«1»: _ (u »N»),
«2»: _ (u »O»),
«3»: _ (u »P»),
«4»: _ (u »Q»),
«5»: _ (u »R»),
«6»: _ (u »S»),
«7»: _ (u »T»),
«8»: _ (u »U»),
«9»: _ (u »V»),
«10»: _ (u »W»),
«11»: _ (u »X»),
«12»: _ (u »Y»),
«13»: _ (u »Z»),
«14»: _ (u »0 ″),
«15»: _ (u »0 ″),
«16»: _ (u »A»),
«17»: _ (u »B»),
«18»: _ (u »C»),
«19»: _ (u »D»),
«20»: _ (u »E»),
«21»: _ (u »F»),
«22»: _ (u »G»),
«23»: _ (u »H»),
«24»: _ (u »I»),
«25»: _ (u »J»),
«26»: _ (u »K»),
«27»: _ (u »L»),
«28»: _ (u »M»),
«29»: _ (u »1 ″),
«Na»: _ (u »»),
"-": _ (ko "")
}rā_o_wiki = {
"I tenei ra": _ (ko "I tenei ra"),
«Mane»: _ (u »Mane»),
«Turei»: _ (u »Turei»),
«Wenerei»: _ (u »Wenerei»),
«Taite»: _ (u »Taite»),
"Paraire": _ (u "Paraire"),
"Rahoroi": _ (u "Rahoroi"),
"Rātapu": _ (u "Rātapu")
}ra_o_wiki_poto = {
"I tenei ra": _ (u "Inaianei"),
«Mane»: _ (u »Mane»),
«Turei»: _ (u »Turei)),
«Wenerei»: _ (u »Wed»),
«Taite»: _ (u »Thu»),
«Paraire»: _ (u »Parae»),
"Rahoroi": _ (u "Sat"),
"Rātapu": _ (u "Ra")
}rā_o_wiki = {
"I tenei ra": _ (u "i tenei ra"),
"Mane": _ (u "Mane"),
«Turei»: _ (or »Turei»),
«Wenerei»: _ (u »Wenerei»),
«Taite»: _ (u »Taite»),
«Paraire»: _ (u »Paraire»),
"Rahoroi": _ (u "Rahoroi"),
"Rātapu": _ (u "Rātapu")
}ra_o_wiki_poto = {
"I tenei ra": _ (u "i tenei ra"),
"Mane": _ (u "mon"),
«Turei»: _ (u »moana»),
«Wenerei»: _ (u »marena»),
«Taite»: _ (u »Taima»),
"Paraire": _ (u "pray"),
"Rahoroi": _ (u "noho"),
"Rātapu": _ (u "dom")
}rā_o_wiki_fr = {
«I tenei ra»: _ (u »Aujourd'hui»),
«Mane»: _ (u »Lundi»),
«Turei»: _ (u »Mardi»),
«Wenerei»: _ (u »Mercredi»),
«Taite»: _ (u »Jeudi»),
«Paraire»: _ (u »Vendredi»),
"Rahoroi": _ (u "Samedi"),
"Rātapu": _ (u "Dimanche")
}rā_o_wiki_poto_fr = {
«I tenei ra»: _ (u »Auj»),
"Mane": _ (u "Mane"),
«Turei»: _ (u »Mar»),
"Wenerei": _ (u "Mer"),
«Taite»: _ (u »Jeu»),
«Paraire»: _ (u »Haere mai»),
"Rahoroi": _ (u "Sam"),
"Rātapu": _ (u "Muri")
}bearing_arrow_best = {
«N»: _ (u »i»),
«NNE»: _ (u »j»),
«NE»: _ (u »k»),
«ENE»: _ (u »l»),
«E»: _ (u »m»),
«ESE»: _ (u »n»),
"SE": _ (u "o"),
«SSE»: _ (u »p»),
«S»: _ (u »a»),
«SSW»: _ (u »b»),
«SW»: _ (u »c»),
"WSW": _ (u "d"),
«W»: _ (u »e»),
"WNW": _ (u "f"),
«NW»: _ (u »g»),
«NNW»: _ (u »h»),
«N / A»: _ (u »«)
}mau_kupu_es = {
«N»: _ (u »N»),
«NNE»: _ (u »NNE»),
«NE»: _ (u »NE»),
«ENE»: _ (u »ENE»),
«E»: _ (u »E»),
«ESE»: _ (u »ESE»),
«SE»: _ (u »SE»),
"SSE": _ (u "SSE"),
"Ratou"),
"SSW": _ (u "SSO"),
«SW»: _ (u »SO»),
"WSW": _ (u "WOW"),
«W»: _ (u »O»),
«WNW»: _ (u »ONO»),
«NW»: _ (u »KORE»),
«NNW»: _ (u »NNO»),
«N / A»: _ (u »N \ A»)
}whanau_text_fr = {
«N»: _ (u »N»),
«NNE»: _ (u »NNE»),
«NE»: _ (u »NE»),
«ENE»: _ (u »ENE»),
«E»: _ (u »E»),
«ESE»: _ (u »ESE»),
«SE»: _ (u »SE»),
"SSE": _ (u "SSE"),
"Ratou"),
"SSW": _ (u "SSO"),
«SW»: _ (u »SO»),
"WSW": _ (u "WOW"),
«W»: _ (u »O»),
«WNW»: _ (u »ONO»),
«NW»: _ (u »KORE»),
«NNW»: _ (u »NNO»),
«N / A»: _ (u »N \ A»)
}akomanga GlobalWeather:
tikanga_ianei = []
rangi_matapae = []
matapae_po = []rohe = "i roto i"
kōwhiringa = Kore
huarerexmldoc = «»TEMP_FILEPATH_CURRENT = "/tmp/conkyForecast-c-LOCATION.pkl"
TEMP_FILEPATH_DAYFORECAST = "/tmp/conkyForecast-df-LOCATION.pkl"
TEMP_FILEPATH_NIGHTFORECAST = "/tmp/conkyForecast-nf-LOCATION.pkl"
EXPIRY_MINUTES = 30
DEFAULT_SPACING = u »«def __init __ (whaiaro, whiringa):
self.options = whiringa
ki te whaiaro.options.locale == Kore:
whakamatau:
# self.locale = locale.getdefaultlocale () [0] [0: 2]
self.locale = «es» # whakatikahia tenei raina kia kaha te takiwa o Paniora
# self.locale = "fr" # whakatikahia tenei raina kia kaha te takiwa o Wiwi
ki te:
tā "kāhore i whakatauhia te rohe"
atu:
# self.locale = self.options.locale
self.locale = «es» # whakatikahia tenei raina kia kaha te takiwa o Paniora
# self.locale = "fr" # whakatikahia tenei raina kia kaha te takiwa o Wiwimena he whakaaro.options.verbose == Pono:
tāngia >> sys.stdout, "ka whakatauhia te rohe ki", self.localedef getTxt (ko koe ano, nodelist):
rc = ""
mo te kōpuku i te nodelist:
ki te kōpuku.nodeType == kōpuku.TEXT_NODE:
rc = rc + kōpuku.data
whakahoki rcdef getSpaces (whaiaro, waahi):
aho = u »»
mena he mokowhiti == Kore:
aho = whaiaro.DEFAULT_SPACING
atu:
mo au i te awhe (0, waahi + 1):
aho = aho + u »«
whakahoki ahodef isNumarua (whaiaro, aho):
whakamatau:
dummy = rewa (aho)
whakahoki Pono
ki te:
whakahoki Hapedef isConnectionAe waatea (whaiaro):
# whakarite ka taea e taatau te uru atu ki te kaiwhakarato huarere.com ma te whakatuwhera i te url
whakamatau:
Usock = urllib2.urlopen ('http://xoap.weather.com')
Usock. kati ()
whakahoki Pono
ki te:
whakahoki Hapedef getBearingTxt (whaiaro, whanau):
whanau = rewa (whanau)
ki te whanau <11.25:
hoki mai koe »N»
ahunga whanau <33.75:
hoki mai koe »NNE»
ahunga whanau <56.25:
hoki mai koe »NE»
ahunga whanau <78.75:
hoki mai koe »JAN»
ahunga whanau <101.25:
hoki mai koe »E»
ahunga whanau <123.75:
hoki mai koe »ESE»
ahunga whanau <146.25:
hoki mai koe »SE»
ahunga whanau <168.75:
hoki mai koe »SSE»
ahunga whanau <191.25:
hoki mai koe »S»
ahunga whanau <213.75:
hoki mai koe »SSW»
ahunga whanau <236.25:
hoki mai koe »SW»
ahunga whanau <258.75:
whakahoki u »WSW»
ahunga whanau <281.25:
hoki u »W»
ahunga whanau <303.75:
hoki mai koe »WNW»
ahunga whanau <326.25:
whakahoki u »NW»
ahunga whanau <348.75:
hoki mai koe »NNW»
atu:
hoki «N / A»def convertCelsiusToFahrenheit (whaiaro, rango):
whakahoki str (int (papa (((float (temp) * 9.0) /5.0) +32)))def convertKilometresToMiles (whaiaro, dist):
hoki str (int (papa (rewa (dist) * 0.621371192)))def convertMillibarsToInches (whaiaro, mb):
whakahoki str (int (papa (rewa (mb) /33.8582)))def getTemplateList (whaiaro, tauira):
rārangi tauira = []
hoki tauira_wahanga i te tauira.split («{«):
mena he tauira_part! = «»:
hoki tauira_part i te tauira_part.split ("}"):
mena he tauira_part! = «»:
templatelist.append (u »» + template_part)whakahoki templatelist
def getOutputText (ko koe, ko te datatype, te tiimatanga, te mutunga o te po, te po poto
#whakamatau:
putanga = u »»# tautuhia nga waahanga o naianei mo te putanga
mena ka huna == Hapa:
ki te emepaea == Hape:
tempunit = u »° C»
speedunit = u »kph»
pressureunit = u »mb»
atu:
tempunit = u »° F»
speedunit = u »mph»
pressureunit = u »i roto i»
atu:
tempunit = u »°»
speedunit = u »»
pressureunit = u »»mena ka tiimata == Kore: # nga ahuatanga o naianei
mena he momo datatype == "DW":
mena he whaiaro.locale == "kei":
mena he wiki poto == Pono:
putanga = WeatherText.day_of_week_short_es [self.current_conditions [0] .day_of_week]
atu:
putanga = WeatherText.day_of_week_es [self.current_conditions [0] .day_of_week]
elif whaiaro.locale == "fr":
mena he wiki poto == Pono:
putanga = WeatherText.day_of_week_short_fr [self.current_conditions [0] .day_of_week]
atu:
putanga = WeatherText.day_of_week_fr [self.current_conditions [0] .day_of_week]
atu:
mena he wiki poto == Pono:
putanga = WeatherText.day_of_week_short [self.current_conditions [0] .day_of_week]
atu:
putanga = WeatherText.day_of_week [self.current_conditions [0] .day_of_week]
elif datatype == "WF": # huarere huarere
putanga = WeatherText.conditions_weather_font [self.current_conditions [0] .condition_code]
elif datatype == "LT":
aho = whaiaro.current_conditions [0] .low
mena he nama.is Nama (aho) == Pono:
ki te emepaea == Pono:
aho = whaiaro.convertCelsiusToFahrenheit (aho)
aho = aho + tempunit
putanga = aho
elif datatype == "HT":
aho = whaiaro.current_conditions [0]. teitei
mena he nama.is Nama (aho) == Pono:
ki te emepaea == Pono:
aho = whaiaro.convertCelsiusToFahrenheit (aho)
aho = aho + tempunit
putanga = aho
elif datatype == "CC":
mena he whaiaro.locale == "kei":
putanga = WeatherText.conditions_text_es [self.current_conditions [0] .condition_code]
elif whaiaro.locale == "fr":
putanga = WeatherText.conditions_text_fr [self.current_conditions [0] .condition_code]
atu:
putanga = WeatherText.conditions_text [self.current_conditions [0] .condition_code]
elif datatype == "CT":
putanga = whaiaro.current_conditions [0] .condition_text
elif datatype == "PC":
aho = whaiaro.current_conditions [0] .precip
mena he nama.is Nama (aho) == Pono:
aho = aho + u »%»
putanga = aho
elif datatype == "HM":
aho = whaiaro.current_conditions [0] .humidity
mena he nama.is Nama (aho) == Pono:
aho = aho + u »%»
putanga = aho
elif datatype == "WD":
aho = whaiaro.current_conditions [0] .wind_dir
mena he nama.is Nama (aho) == Pono:
aho = whaiaro.getBearingTxt (aho)mena he whaiaro.locale == "kei":
putanga = WeatherText.bearing_text_es [aho]
elif whaiaro.locale == "fr":
putanga = WeatherText.bearing_text_fr [aho]
atu:
putanga = ahoelif datatype == "BF":
aho = whaiaro.current_conditions [0] .wind_dir
mena he nama.is Nama (aho) == Pono:
aho = WeatherText.bearing_arrow_font [whaiaro.getBearingTxt (aho)]
putanga = aho
elif datatype == "WS":
aho = whaiaro.current_conditions [0] .wind_speed
mena he nama.is Nama (aho) == Pono:
ki te emepaea == Pono:
aho = whaiaro.convertKilometresToMiles (aho)
aho = aho + tere
putanga = aho
elif datatype == "WG":
aho = whaiaro.current_conditions [0] .wind_gust
mena he nama.is Nama (aho) == Pono:
ki te emepaea == Pono:
aho = whaiaro.convertKilometresToMiles (aho)
aho = aho + tere
putanga = aho
elif datatype == "CN":
putanga = whaiaro.current_conditions [0] .taone
elif datatype == "SR":
putanga = whaiaro.current_conditions [0] .mataara
elif datatype == "SS":
putanga = whaiaro.current_conditions [0] .mutu
elif datatype == "MP":
putanga = whaiaro.current_conditions [0] .mona_phase
elif datatype == "MF":
putanga = WeatherText.conditions_moon_font [self.current_conditions [0] .moon_icon]
elif datatype == "BR":
aho = whaiaro.current_conditions [0] .bar_read
mena he nama.is Nama (aho) == Pono:
ki te emepaea == Pono:
aho = whaiaro.convertMillibarsToInches (aho)
aho = aho + press mutuit
putanga = aho
elif datatype == "BD":
putanga = whaiaro.current_conditions [0] .bar_desc
atu:
putanga = "\ nERROR: He momo raraunga unknown e tonohia ana"atu: # raraunga matapae
mena he mutunga == Kore: # mena kaore i tautuhia te ra mutunga whakamahi te ra tiimatanga
mutunga = awateamena he po == Pono: # matapae po e hiahiatia ana
mo te ra_mutu i te whānuitanga (te rā tīmatanga, te rā mutunga + 1):
mena he momo datatype == "DW":
mena he whaiaro.locale == "kei":
mena he wiki poto == Pono:
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherTxt.day_of_week_short_es [self.night_forecast [day_number] .day_of_week]
atu:
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherTxt.day_of_week_es [self.night_forecast [day_number] .day_of_week]
elif whaiaro.locale == "fr":
mena he wiki poto == Pono:
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherTxt.day_of_week_short_fr [self.night_forecast [day_number] .day_of_week]
atu:
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherTxt.day_of_week_fr [self.night_forecast [day_number] .day_of_week]
atu:
mena he wiki poto == Pono:
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherText.day_of_week_short [self.night_forecast [day_number] .day_of_week]
atu:
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherTxt.day_of_week [self.night_forecast [day_number] .day_of_week]
elif datatype == "WF": # huarere huarere
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherText.conditions_weather_font [self.night_forecast [day_number] .condition_code]
elif datatype == "LT":
aho = self.night_forecast [day_number]. iti
mena he nama.is Nama (aho) == Pono:
ki te emepaea == Pono:
aho = whaiaro.convertCelsiusToFahrenheit (aho)
aho = aho + tempunit
putanga = putanga + whaiaro.getSpaces (waahi) + ahoelif datatype == "HT":
aho = self.night_forecast [day_number]. teitei
mena he nama.is Nama (aho) == Pono:
ki te emepaea == Pono:
aho = whaiaro.convertCelsiusToFahrenheit (aho)
aho = aho + tempunit
putanga = putanga + whaiaro.getSpaces (waahi) + aho
elif datatype == "CC":
mena he whaiaro.locale == "kei":
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherText.conditions_text_es [self.night_forecast [day_number] .condition_code]
elif whaiaro.locale == "fr":
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherText.conditions_text_fr [self.night_forecast [day_number] .condition_code]
atu:
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherText.conditions_text [self.night_forecast [day_number] .condition_code]
elif datatype == "CT":
putanga = putanga + whaiaro.getSpaces (waahi) + self.night_forecast [day_number] .condition_text
elif datatype == "PC":
aho = self.night_forecast [day_number] .precip
mena he nama.is Nama (aho) == Pono:
aho = aho + u »%»
putanga = putanga + whaiaro.getSpaces (waahi) + aho
elif datatype == "HM":
aho = self.night_forecast [day_number] .humidity
mena he nama.is Nama (aho) == Pono:
aho = aho + u »%»
putanga = putanga + whaiaro.getSpaces (waahi) + aho
elif datatype == "WD":
aho = self.night_forecast [day_number] .wind_dir
mena he whaiaro.locale == "kei":
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherTxt.bearing_text_es [aho]
elif whaiaro.locale == "fr":
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherTxt.bearing_text_fr [aho]
atu:
putanga = putanga + whaiaro.getSpaces (waahi) + ahoelif datatype == "BF":
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherText.bearing_arrow_font [self.night_forecast [day_number] .wind_dir]
elif datatype == "WS":
aho = self.night_forecast [day_number] .wind_speed
mena he nama.is Nama (aho) == Pono:
ki te emepaea == Pono:
aho = whaiaro.convertKilometresToMiles (aho)
aho = aho + tere
putanga = putanga + whaiaro.getSpaces (waahi) + aho
elif datatype == "WG":
aho = self.night_forecast [day_number] .wind_gust
mena he nama.is Nama (aho) == Pono:
ki te emepaea == Pono:
aho = whaiaro.convertKilometresToMiles (aho)
aho = aho + tere
putanga = putanga + whaiaro.getSpaces (waahi) + aho
elif datatype == "CN":
putanga = putanga + whaiaro.getSpaces (waahi) + self.night_forecast [day_number] .city
elif datatype == "SR":
putanga = putanga + whaiaro.getSpaces (waahi) + whaiaro.night_forecast [day_number] .sunrise
elif datatype == "SS":
putanga = putanga + whaiaro.getSpaces (waahi) + whaiaro.night_forecast [day_number] .sunset
elif datatype == "MP":
putanga = putanga + whaiaro.getSpaces (waahi) + whaiaro.night_forecast [day_number] .moon_phase
elif datatype == "MF":
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherText.conditions_moon_font [self.night_forecast [day_number] .moon_icon]
elif datatype == "BR":
putanga = putanga + whaiaro.getSpaces (waahi) + self.night_forecast [day_number] .bar_read
elif datatype == "BD":
putanga = putanga + whaiaro.getSpaces (waahi) + self.night_forecast [day_number] .bar_desc
atu:
putanga = "\ nERROR: He momo raraunga unknown e tonohia ana"
whatiatu: E hiahiatia ana te matapae # ra
mo te ra_mutu i te whānuitanga (te rā tīmatanga, te rā mutunga + 1):
mena he momo datatype == "DW":
mena he whaiaro.locale == "kei":
mena he wiki poto == Pono:
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherTxt.day_of_week_short_es [self.day_forecast [day_number] .day_of_week]
atu:
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherText.day_of_week_es [self.day_forecast [day_number] .day_of_week]
elif whaiaro.locale == "fr":
mena he wiki poto == Pono:
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherTxt.day_of_week_short_fr [self.day_forecast [day_number] .day_of_week]
atu:
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherTxt.day_of_week_fr [self.day_forecast [day_number] .day_of_week]
atu:
mena he wiki poto == Pono:
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherText.day_of_week_short [self.day_forecast [day_number] .day_of_week]
atu:
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherTxt.day_of_week [self.day_forecast [day_number] .day_of_week]
elif datatype == "WF": # huarere huarere
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherText.conditions_weather_font [self.day_forecast [day_number] .condition_code]
elif datatype == "LT":
aho = self.day_forecast [day_number]. iti
mena he nama.is Nama (aho) == Pono:
ki te emepaea == Pono:
aho = whaiaro.convertCelsiusToFahrenheit (aho)
aho = aho + tempunit
putanga = putanga + whaiaro.getSpaces (waahi) + aho
elif datatype == "HT":
aho = self.day_forecast [day_number]. teitei
mena he nama.is Nama (aho) == Pono:
ki te emepaea == Pono:
aho = whaiaro.convertCelsiusToFahrenheit (aho)
aho = aho + tempunit
putanga = putanga + whaiaro.getSpaces (waahi) + aho
elif datatype == "CC":
mena he whaiaro.locale == "kei":
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherText.conditions_text_es [self.day_forecast [day_number] .condition_code]
elif whaiaro.locale == "fr":
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherText.conditions_text_fr [self.day_forecast [day_number] .condition_code]
atu:
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherText.conditions_text [self.day_forecast [day_number] .condition_code]
elif datatype == "CT":
putanga = putanga + whaiaro.getSpaces (waahi) + self.day_forecast [day_number] .condition_text
elif datatype == "PC":
aho = whaiaro.day_forecast [day_number] .precip
mena he nama.is Nama (aho) == Pono:
aho = aho + u »%»
putanga = putanga + whaiaro.getSpaces (waahi) + aho
elif datatype == "HM":
aho = self.day_forecast [day_number] .humidity
mena he nama.is Nama (aho) == Pono:
aho = aho + u »%»
putanga = putanga + whaiaro.getSpaces (waahi) + aho
elif datatype == "WD":
aho = self.day_forecast [day_number] .wind_dirmena he whaiaro.locale == "kei":
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherTxt.bearing_text_es [aho]
elif whaiaro.locale == "fr":
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherTxt.bearing_text_fr [aho]
atu:
putanga = putanga + whaiaro.getSpaces (waahi) + ahoelif datatype == "BF":
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherText.bearing_arrow_best [self.day_forecast [day_number] .wind_dir]
elif datatype == "WS":
aho = whaiaro.day_forecast [day_number] .wind_speed
mena he nama.is Nama (aho) == Pono:
ki te emepaea == Pono:
aho = whaiaro.convertKilometresToMiles (aho)
aho = aho + tere
putanga = putanga + whaiaro.getSpaces (waahi) + aho
elif datatype == "WG":
aho = self.day_forecast [day_number] .wind_gust
mena he nama.is Nama (aho) == Pono:
ki te emepaea == Pono:
aho = whaiaro.convertKilometresToMiles (aho)
aho = aho + tere
putanga = putanga + whaiaro.getSpaces (waahi) + aho
elif datatype == "CN":
putanga = putanga + whaiaro.getSpaces (waahi) + whaiaro.day_forecast [day_number] .city
elif datatype == "SR":
putanga = putanga + whaiaro.getSpaces (waahi) + whaiaro.day_forecast [day_number] .sunrise
elif datatype == "SS":
putanga = putanga + whaiaro.getSpaces (waahi) + whaiaro.day_forecast [day_number] .sunset
elif datatype == "MP":
putanga = putanga + whaiaro.getSpaces (waahi) + whaiaro.day_forecast [day_number] .moon_phase
elif datatype == "MF":
putanga = putanga + whaiaro.getSpaces (waahi) + WeatherText.conditions_moon_font [self.day_forecast [day_number] .moon_icon]
elif datatype == "BR":
putanga = putanga + whaiaro.getSpaces (waahi) + self.day_forecast [day_number] .bar_read
elif datatype == "BD":
putanga = putanga + whaiaro.getSpaces (waahi) + self.day_forecast [day_number] .bar_desc
atu:
putanga = u »\ nERROR: He momo raraunga kaore e mohiotia»
whatiputanga = u »» + putanga.strip (u »«) # ngaro wāhi ārahi / autō
putanga whakahoki#otahi:
#print "getOutputTxt: Hapa ohorere:", sys.exc_info () [0]def getOutputTextFromTemplate (whaiaro, tauira):
#whakamatau:# mau taviri ki te tauira tauira
DATATYPE_KEY = "–datatype ="
Tīmata_KEY = "–startday ="
ENDDAY_KEY = "–endday ="
NIGHT_KEY = "-po"
SHORTWEEKDAY_KEY = "–shortweekday"
IMPERIAL_KEY = "–imperial"
HIDEUNITS_KEY = "–hideunits"
SPACES_KEY = "–spaces ="putanga = u »»
optionsfound = Hape
# uta i te konae
whakamatau:
fileinput = tuwhera (self.options.template)
tauira = fileinput.read ()
fileinput.close ()
ki te:
putanga = u »Kare e kitea te konae Tauira!»templatelist = whaiaro.getTemplateList (tauira)
# ka haere ma te raarangi tauira ka whakatau i te putanga mo ia mea kua kitea
mo au i te awhe (0, len (templatelist) -1):pos = templatelist [i]. Rapua (DATATYPE_KEY)
mena he pos! = -1:
optionsfound = Pono
pos = pos + len (DATATYPE_KEY)
datatype = templatelist [i] [pos: pos + 4] .strip («}»). Unuhia («{«). Unuhia («-«). Unuhia (»«)
atu:
datatype = Korepos = templatelist [i]. Rapua (TIAKI_KI)
mena he pos! = -1:
optionsfound = Pono
pos = pos + len (TIAKI_KEY)
startday = int (templatelist [i] [pos: pos + 4] .strip ("}"). Unuhia ("{"). Unuhia ("-"). Unuhia (""))
atu:
timatanga = Korepos = templatelist [i]. Rapua (ENDDAY_KEY)
mena he pos! = -1:
optionsfound = Pono
pos = pos + len (ENDDAY_KEY)
endday = int (templatelist [i] [pos: pos + 4] .strip ("}"). Unuhia ("{"). Unuhia ("-"). Unuhia (""))
atu:
rā mutunga = Korepos = templatelist [i]. Rapua (NIGHT_KEY)
mena he pos! = -1:
optionsfound = Pono
po = Pono
atu:
po = Hapepos = templatelist [i]. Rapua (SHORTWEEKDAY_KEY)
mena he pos! = -1:
optionsfound = Pono
potowehe = Pono
atu:
potowehe = Hapepos = templatelist [i]. Rapua (IMPERIAL_KEY)
mena he pos! = -1:
optionsfound = Pono
emepaea = Pono
atu:
emepaea = Hapepos = templatelist [i]. Rapua (HIDEUNITS_KEY)
mena he pos! = -1:
optionsfound = Pono
hideunits = Pono
atu:
hideunits = Hapepos = templatelist [i]. Rapua (SPACES_KEY)
mena he pos! = -1:
optionsfound = Pono
pos = pos + len (SPACES_KEY)
mokowā = int (templatelist [i] [pos: pos + 4] .strip («}»). Unuhia («{«). Unuhia («-«). Unuhia (»«))
atu:
mokowā = 1ki te kowhiria te whiringa == Pono:
templatelist [i] = self.getOutputTxt (momo raraunga, tiimatanga, awatea, po, poatea, te emepaea, nga hunanga, nga waahi)
optionsfound = Hape# tirohia te raarangi e whakakotahi ana i nga putanga inaianei kua taupokinaina
mo te taonga kei te templatelist:
putanga = putanga + taongaputanga whakahoki
#otahi:
#print "getOutputTextFromTemplate: Hapa ohorere:", sys.exc_info () [0]def fetchData (whaiaro):
# tiki tonu i nga korero taapiri, whakamahia nga mahi korero i runga i enei korero
file_path_current = whaiaro.TEMP_FILEPATH_CURRENT.replace ("LOCATION", self.options.location)
file_path_dayforecast = whaiaro.TEMP_FILEPATH_DAYFORECAST.replace ("LOCATION", self.options.location)
file_path_nightforecast = whaiaro.TEMP_FILEPATH_NIGHTFORECAST.replace ("LOCATION", self.options.location)mena he.isConnectionAe waatea () == Hapa:
ki te os.path.exists (file_path_current):
RetaataWhakaahua = Hape
atu: # kaore he hononga, kaore he keteroki, pupuhi!
tā "Kaore he hononga ipurangi e waatea ana, kaore hoki he rangi huarere keteroki."
elif whaiaro.options.refetch == Pono:
WhakahoutangaTata = Pono
atu:
# me tiki ano e nga raraunga?
ki te os.path.exists (file_path_current):
lastmodDate = time.localtime (os.stat (file_path_current) [ST_MTIME])
expiryDate = (datetime.datetime.today () - datetime.timedelta (meneti = whaiaro.EXPIRY_MINUTES)). wātaka ()ki te expiryDate> lastmodDate:
WhakahoutangaTata = Pono
atu:
RetaataWhakaahua = Hape
atu:
WhakahoutangaTata = Pono# tikina nga korero mo nga ahuatanga o naianei, ma te paetukutuku raanei ma te 'tango kore'
ki te RefetchData == Pono:# whiwhi raraunga tikanga onaianei mai i te ratonga xoap
whakamatau:# http://xoap.weather.com/weather/local/UKXX0103?cc=*&dayf=5&link=xoap∏=xoap&par=1061785028&key=e374effbfd74930b
url = 'http://xoap.weather.com/weather/local/' + self.options.location + '? cc = * & dayf = 8 & hono = xoap∏ = xoap & par = 1061785028 & matua = e374effbfd74930b & waeine = m '
mena he whakaaro.options.verbose == Pono:
tā >> sys.stdout, «te tiki i nga raraunga huarere mai i«, urlUsock = urllib2.urlopen (url)
xml = usock.read ()
Usock. kati ()
whaiaro.weatherxmldoc = minidom.parseString (xml)
ki te:
tā "fetchData: Hapa ohorere:", sys.exc_info () [0]
tā "Kaore e taea te whakapiri atu ki te puna huarere mo nga ahuatanga o naianei"# korero ki te kaiwhakamahi mena he kino te waahi…
kitea = xml.find ("He waahi muhu kua hoatu")
ki te kitea! = -1:
tā "Wāhi muhu kua whakaritea"# te uiui i nga korero huarere, utaina ki te hanganga akomanga me te kohi
whakamatau:# whakarite i nga raarangi raraunga huarere
self.current_conditions = []
self.day_forecast = []
self.night_forecast = []# kohikohi raraunga whanui
huarere_n = whaiaro.weatherxmldoc.documentElement
location_n = huarere_n.getElementsByTagName ('loc') [0]
city_n = location_n.getElementsByTagName ('dnam') [0]
taone = whaiaro.getTxt (taone_n.childNodes)# kohikohi raraunga tikanga o naianei
day_of_week = u »I tenei ra»
piko = u »N / A»
sunrise_n = location_n.getElementsByTagName ('sunr') [0]
sunrise = whaiaro.getTxt (sunrise_n.childNodes)
sunset_n = location_n.getElementsByTagName ('suns') [0]
toenga o te ra = whaiaro.getKupu (tohaina te ra_n.childNodes)
current_condition_n = huarere_n.getElementsByTagName ('cc') [0]
current_desc_n = current_condition_n.getElementsByTagName ('t') [0]
current_desc = self.getTxt (current_desc_n.childNodes)
current_code_n = current_condition_n.getElementsByTagName ('ata') [0]
current_code = self.getTxt (current_code_n.childNodes)
current_temp_n = current_condition_n.getElementsByTagName ('tmp') [0]
current_temp = self.getTxt (current_temp_n.childNodes)
current_temp_feels_n = current_condition_n.getElementsByTagName ('flik') [0]
current_temp_feels = self.getTxt (o nāianei_temp_feels_n.childNodes)
bar_n = current_condition_n.getElementsByTagName ('pae') [0]
bar_read_n = bar_n.getElementsByTagName ('r') [0]
bar_read = self.getTxt (bar_read_n.childNodes)
bar_desc_n = bar_n.getElementsByTagName ('d') [0]
bar_desc = self.getTxt (bar_desc_n.childNodes)
wind_n = current_condition_n.getElementsByTagName ('hau') [0]
wind_speed_n = wind_n.getElementsByTagName ('s') [0]
wind_speed = self.getTxt (wind_speed_n.childNodes)
wind_gust_n = wind_n.getElementsByTagName ('gust') [0]
wind_gust = self.getTxt (wind_gust_n.childNodes)
wind_dir_n = wind_n.getElementsByTagName ('d') [0]
wind_direction = self.getTxt (wind_dir_n.childNodes)
haumākū_n = current_condition_n.getElementsByTagName ('hmid') [0]
haumākū = whaiaro.getTxt (haumākū_n.childNodes)
moon_n = current_condition_n.getElementsByTagName ('marama') [0]
moon_icon_n = moon_n.getElementsByTagName ('ata') [0]
moon_icon = whaiaro.getTxt (moon_icon_n.childNodes)
moon_phase_n = moon_n.getElementsByTagName ('t') [0]
moon_phase = whaiaro.getTxt (moon_phase_n.childNodes)
current_conditions_data = WeatherData (day_of_week, current_temp_feels, current_temp, current_code, current_desc, pikitanga, haumākū, hau
whaiaro.current_conditions.append (o nāianei_conditions_data)# kohikohi raraunga matapae
bar_read = u »N / A»
bar_desc = u »N / A»
marama_phase = u »N / A»
moon_icon = u »na»
forecast_n = huarere_n.getElementsByTagName ('dayf') [0]
day_nodes = matapae_n.getElementsByTagName ('ra')mo te ra i roto i nga ra_ ingoa:
day_of_week = day.getAttribut ('t')
day_of_year = day.getAttribut ('dt')
high_temp_n = day.getElementsByTagName ('hi') [0]
high_temp = self.getTxt (teitei_temp_n.childNodes)
low_temp_n = day.getElementsByTagName ('iti') [0]
low_temp = self.getTxt (low_temp_n.childNodes)sunrise_n = day.getElementsByTagName ('sunr') [0]
sunrise = whaiaro.getTxt (sunrise_n.childNodes)
sunset_n = day.getElementsByTagName ('suns') [0]
toenga o te ra = whaiaro.getKupu (tohaina te ra_n.childNodes)# ra matapae i nga korero motuhake
daytime_n = day.getElementsByTagName ('waahanga') [0] # ra
condition_code_n = awatea_n.getElementsByTagName ('ata') [0]
condition_code = self.getTxt (condition_code_n.childNodes)
condition_n = awatea_n.getElementsByTagName ('t') [0]
huru = whaiaro.getTupu (condition_n.childNodes)
precip_n = awatea_n.getElementsByTagName ('ppcp') [0]
piko = whaiaro.getTupu (punga_n.childNodes)
haumākū_n = awatea_n.getElementsByTagName ('hmid') [0]
haumākū = whaiaro.getTxt (haumākū_n.childNodes)
wind_n = awatea_n.getElementsByTagName ('hau') [0]
wind_speed_n = wind_n.getElementsByTagName ('s') [0]
wind_speed = self.getTxt (wind_speed_n.childNodes)
wind_direction_n = wind_n.getElementsByTagName ('t') [0]
wind_direction = self.getTxt (wind_direction_n.childNodes)
wind_gust_n = wind_n.getElementsByTagName ('gust') [0]
wind_gust = self.getTxt (wind_gust_n.childNodes)
day_forecast_data = WeatherData (day_of_week, low_temp, high_temp, condition_code, huru, pato, haumākū, hau_rironga, hau
self.day_forecast.append (day_forecast_data)# matapae po whakaaturanga motuhake
daytime_n = day.getElementsByTagName ('waahanga') [1] # po
condition_code_n = awatea_n.getElementsByTagName ('ata') [0]
condition_code = self.getTxt (condition_code_n.childNodes)
condition_n = awatea_n.getElementsByTagName ('t') [0]
huru = whaiaro.getTupu (condition_n.childNodes)
precip_n = awatea_n.getElementsByTagName ('ppcp') [0]
piko = whaiaro.getTupu (punga_n.childNodes)
haumākū_n = awatea_n.getElementsByTagName ('hmid') [0]
haumākū = whaiaro.getTxt (haumākū_n.childNodes)
wind_n = awatea_n.getElementsByTagName ('hau') [0]
wind_speed_n = wind_n.getElementsByTagName ('s') [0]
wind_speed = self.getTxt (wind_speed_n.childNodes)
wind_direction_n = wind_n.getElementsByTagName ('t') [0]
wind_direction = self.getTxt (wind_direction_n.childNodes)
wind_gust_n = wind_n.getElementsByTagName ('gust') [0]
wind_gust = self.getTxt (wind_gust_n.childNodes)
night_forecast_data = WeatherData (day_of_week, low_temp, high_temp, condition_code, huru, pato, haumākū, hau_rironga, hau
self.night_forecast.append (night_forecast_data)# piko i nga raraunga mo te wa o muri mai!
fileoutput = tuwhera (file_path_current, 'w')
pickle.dump (self.current_conditions, whakaunga)
fileoutput.close ()fileoutput = tuwhera (file_path_dayforecast, 'w')
pickle.dump (self.day_forecast, fileoutput)
fileoutput.close ()fileoutput = tuwhera (file_path_nightforecast, 'w')
pickle.dump (self.night_forecast, fileoutput)
fileoutput.close ()ki te:
tā "fetchData: Hapa ohorere:", sys.exc_info () [0]
tā "Kaore e taea te uiui i nga korero huarere"atu: # tango i nga rangi huarere mai i nga konae aara
mena he whakaaro.options.verbose == Pono:
tā >> sys.stdout, «te tiki raraunga huarere mai i te konae:«, file_path_currentfileinput = tuwhera (file_path_current, 'r')
self.current_conditions = pickle.load (fileinput)
fileinput.close ()mena he whakaaro.options.verbose == Pono:
tā >> sys.stdout, "te tiki raraunga matapae rā mai i ngā konae:", file_path_dayforecast, file_path_nightforecastfileinput = tuwhera (file_path_dayforecast, 'r')
self.day_forecast = pickle.load (fileinput)
fileinput.close ()mena he whakaaro.options.verbose == Pono:
tā >> sys.stdout, «te tiki raraunga matapae ra mai i nga konae:«, file_path_nightforecast, file_path_nightforecastfileinput = tuwhera (file_path_nightforecast, 'r')
self.night_forecast = pickle.load (fileinput)
fileinput.close ()def putangaTau (whaiaro):
#whakamatau:mena ko koe. He tirohanga. Tauira! = Kore:
putanga = whaiaro.getOutputTextFromTemplate (whaiaro.options.template)
atu:
putanga = whaiaro.getOutputText (whaiaro.options.datatype, self.options.startday, self.options.endday, self .options kōwhiringa. mokowā)
tā putanga.encode ("utf-8")
#otahi:
#print «outputData: Hapa ohorere:«, sys.exc_info () [0]mena ka __ Ingoa__ == "__main__":
parser = CommandLineParser ()
(kōwhiringa, tohenga) = parser.parse_args ()mena he kowhiringa.verbose == Pono:
tā >> sys.stdout, "wāhi:", options.location
tā >> sys.stdout, "emepaea:", options.imperial
tā >> sys.stdout, "datatype:", options.datatype
tā >> sys.stdout, "po:", options.night
taarua >> sys.stdout, "ra tiimata:", options.startday
taarua >> sys.stdout, "ra mutunga:", options.endday
tā >> sys.stdout, "mokowā:", options.spaces
taarua >> sys.stdout, "verbose:", options.verbose
tā >> sys.stdout, "whakahoutanga:", kōwhiringa.hauru# hanga ahanoa huarere hou mo te ao
huarere = AoWeather (whiringa)
huarere.fetchData ()
huarere.outputData ()
Ka hangaia e matou te konae ~ / Conky / tuhinga / myweather.template
gedit ~ / Conky / scripts / myweather.template
whakapiri matou i te whai ake i roto:
{–Datatype = DW –startday = 1}: {–datatype = CC –startday = 1}
{–Datatype = HT –startday = 1} / {–datatype = LT –startday = 1} Hau mai i {–datatype = WD –startday = 1} ki te {–datatype = WS –startday = 1}
Haumaru: {–datatype = HM –startday = 1} Takotoranga: {–datatype = PC –startday = 1}
Sunrise: {–datatype = SR –startday = 1} Sunset: {–datatype = SS –startday = 1}
——————————————
{–Datatype = DW –startday = 2}: {–datatype = CC –startday = 2}
{–Datatype = HT –startday = 2} / {–datatype = LT –startday = 2} Hau mai i {–datatype = WD –startday = 2} ki te {–datatype = WS –startday = 2}
Haumaru: {–datatype = HM –startday = 2} Takotoranga: {–datatype = PC –startday = 2}
Sunrise: {–datatype = SR –startday = 2} Sunset: {–datatype = SS –startday = 2}
——————————————
{–Datatype = DW –startday = 3}: {–datatype = CC –startday = 3}
{–Datatype = HT –startday = 3} / {–datatype = LT –startday = 3} Hau mai i {–datatype = WD –startday = 3} ki te {–datatype = WS –startday = 3}
Haumaru: {–datatype = HM –startday = 3} Takotoranga: {–datatype = PC –startday = 3}
Sunrise: {–datatype = SR –startday = 3} Sunset: {–datatype = SS –startday = 3}
——————————————
{–Datatype = DW –startday = 4}: {–datatype = CC –startday = 4}
{–Datatype = HT –startday = 4} / {–datatype = LT –startday = 4} Hau mai i {–datatype = WD –startday = 4} ki te {–datatype = WS –startday = 4}
Haumaru: {–datatype = HM –startday = 4} Takotoranga: {–datatype = PC –startday = 4}
Sunrise: {–datatype = SR –startday = 4} Sunset: {–datatype = SS –startday = 4}
Ka hangaia e matou te konae ~ / Conky / scripts / mail / conkyEmail.py (me hanga e matou te kōpaki mēra)
gedit ~ / Conky / scripts / mail / conkyEmail.py
a ka whakapirihia e matou nga mea e whai ake nei:
kawemai koe
kawemai aho# Whakauruhia to ingoa kaiwhakamahi me to kupuhipa i raro ake nei i roto i nga korero takirua
# hei tauira ingoa kaiwhakamahi = »ingoa kaiwhakamahi» me te kupuhipa = »kupuhipa»
ingoa kaiwhakamahi = »TO_USUARIO_SINARROBA«
kupuhipa = »TO_KEY«com = »wget -O - https: //» + ingoa kaiwhakamahi + »:» + kupuhipa + »@ mail.google.com / mēra / whangai / ngota –no-tirohia-tiwhikete»
temp = os.popen (com)
msg = temp.read ()
index = aho.find (msg, » »)
index2 = string.find (msg, » »)
fc = int (msg [taupū + 11: tau2]]mena fc == 0:
tā "0 hou"
atu:
tā str (fc) + »hou»
Na inaianei kei a koe nga konae 7:
I roto i te kōpaki: ~
-> .startconky << - mahia
I roto i te kōpaki: ~ / Conky
-> conkymain
-> Tuhinga
-> conkymail
a kei roto i te kōpaki: ~ / Conky / tuhinga
-> conkyForecast.py << - mahia
-> myweather.template
ā, kei te kōpaki: ~ / Conky / hōtuhi / mēra
conkyEmail.py << - mahia
Ana koira, he whakamarama, kei hea te korero / kaainga / kaiwhakamahi / ... ka haere to ingoa kaiwhakamahi me te waahanga e haere ana nga korero a Gmail, i tohua e au nga tae me waiho e koe o raraunga.
ki te patu i te huringa huringa ka tuhi ki te papatohu
killall conky
ki te whakahaere conky tuhi ki te papatohu
./.startconky
ka oti ana i a koe nga mea katoa kia whakatikatikahia, ki te hiahia koe ki te tiimata i a ia huihuinga
Pūnaha—> Manakohanga—> Wāhanga me ngā kaupapa whakaoho ka tāpiri atu
I te Ingoa ka taea e taatau te tuhi Conky, i te Ota ./.startconky me tera ka tiimata i nga wa katoa ka huri koe i te pc.
Koira, ko te tumanako ka awhinahia koe.
Hei tuatahi ki te korero