Sector11 Português, Brasileiro,
Sobre o problema, também penso que é esse o problema, tal como o xablins (post 457) e antes também o vancheese (post 453) com os ó, neste último caso a sugestão dada até por Sector11 aqui não resolve pois já está considerada, e a outra também refiro no meu post inicial, por isso aqui o problema mantêm-se e sem que eu perceba como o resolver.
Português>English
About the problem, I also think that this is the problem, such as xablins (post 457) and also before vancheese (post 453) with O in the latter case the suggestion given by Sector11 here does not solve it already considered, and the other also mean in my initial post, so here the question remains open and without my knowing how to solve it.
Hiding certain events can be misleading. Actually, I'd better like if the script would lose some single, problematic letters... And so I made this horrible, little fix.
How to use? Save the following as horribleFix.patch and check whether this fix apply:
$ patch --dry-run -p1 -i horribleFix.patch /usr/share/conkygooglecalendar/conkyGoogleCalendar.py
If this prints "patching file /usr/share/conkygooglecalendar/conkyGoogleCalendar.py" or similar, then everything is OK. Do real fixing by calling as root:
# patch -p1 -i horribleFix.patch /usr/share/conkygooglecalendar/conkyGoogleCalendar.py
As some say -- this works for me.
Code:*** /usr/share/conkygooglecalendar/conkyGoogleCalendar.py 2012-01-12 02:10:42.000000000 +0100 --- .conky/myConkyGCalMod.py 2012-01-12 02:29:10.038323060 +0100 *************** *** 432,438 **** starttime = self.getDatetimeString(starttime) endtime = self.getDatetimeString(endtime) ! return starttime, endtime, completetime, duration def getDatetimeString(self,whendatetime, format=None): --- 432,440 ---- starttime = self.getDatetimeString(starttime) endtime = self.getDatetimeString(endtime) ! def safeUnicode(x): ! return unicode(x is not None and str(x) or "", errors='ignore') ! return safeUnicode(starttime), safeUnicode(endtime), safeUnicode(completetime), safeUnicode(duration) def getDatetimeString(self,whendatetime, format=None): *************** *** 677,683 **** #who = self.getWrappedText(who, self.options.maxwidth, indent) # output event data using the template ! output = self.getOutputFromTemplate(template, title, starttime, endtime, location, description, who) output = self.getMadeSafeOutput(output) print output #.encode("utf-8") --- 678,686 ---- #who = self.getWrappedText(who, self.options.maxwidth, indent) # output event data using the template ! def safeUnicode(x): ! return unicode(x is not None and x or "", errors='ignore') ! output = self.getOutputFromTemplate(template, safeUnicode(title), starttime, endtime, location, safeUnicode(description), who) output = self.getMadeSafeOutput(output) print output #.encode("utf-8")
I have a question for anyone using Ubuntu 12.04.
Are you able to change colors in the conky templates that are used in a number of K's scripts?
orCode:${color2}
commands only give me text in the conky that is identical to the code I enter in the template. That is, I see ${color2} on the screen.Code:${color yellow}
Thank you,
GG -----------
Hi there,
I added a few lines to the getOutputFromTemplate method to avoid the utf8 problem. I didn't want to spend a lot of time in it, so the code is not perfect, but it solved the problem:
Regardsdef getOutputFromTemplate(self, template, title, starttime, endtime, location, description, who):
try:
output = template
if title == None or title.strip() == "":
output = self.removeLineByString(output,"[title]")
else:
title = title.decode('utf8')
output = output.replace("[title]",title)
if location == None or location.strip() == "":
output = self.removeLineByString(output,"[location]")
else:
location = location.decode('utf8')
output = output.replace("[location]",location)
if description == None or description.strip() == "":
output = self.removeLineByString(output,"[description]")
else:
description = description.decode('utf8')
output = output.replace("[description]",description)
if who == None or who.strip() == "":
output = self.removeLineByString(output,"[who]")
else:
#output = output.replace("[who]",";".join(who))
who = who.decode('utf8')
output = output.replace("[who]",who)
starttime, endtime, completetime, duration = self.getFormattedEventTimes(starttime, endtime)
starttime = starttime.decode('utf8')
output = output.replace("[starttime]",starttime)
endtime = endtime.decode('utf8')
output = output.replace("[endtime]",endtime)
if output.find("[completetime]") != -1:
completetime = completetime.decode('utf8')
output = output.replace("[completetime]",completetime)
if output.find("[duration]") != -1:
duration = duration.decode('utf8')
output = output.replace("[duration]",duration)
# get rid of any excess crlf's and add just one
#output = output.rstrip(" \n")
#output = output + "\n"
return output
except Exception,e:
self.logError("getOutputFromTemplate:Unexpected error:" + traceback.format_exc())
return ""
Bruce Schneier : "We need business models that respect the natural laws of the digital world instead of fighting them"
Thanks primolarry, this fixed the utf8 problem for me but I needed to make an additional modification on the line (#691 after your modifications):
print output #.encode("utf-8")
Simply remove the comment to get:
print output.encode("utf-8")
Bookmarks