def eintragen_multi(self, s): z = s.split(";") n = z[0] c = z[1] cl = wnf_tools.pascalToRGB(c, wnf_tools.clWhite) art = z[2] i = 0 for dt in z: if (i > 2) and (dt <> ""): if dt.find("-") >= 0: #Multitermin als Zeitraum von bis t = dt.split("-") dv = wnf_tools.strToDate(t[0]) db = wnf_tools.strToDate(t[1]) if wnf_tools.zeitraum_ueberlappt(dv, db, self.von, self.bis): difference1 = datetime.timedelta(days=1) d = self.von for i in range(28): if (d >= dv) and (d <= db): self.eintragen(d, n, cl) print n, dv, db d = d + difference1 else: #einzelner Multitermin d = wnf_tools.strToDate(dt) if (d >= self.von) and (d <= self.bis): self.eintragen(d, n, cl) print n, d i = i + 1
def eintragen_zeitraum(self, s): z = s.split(";") dv = wnf_tools.strToDate(z[0]) db = wnf_tools.strToDate(z[1]) n = z[2] c = z[3] cl = wnf_tools.pascalToRGB(c, wnf_tools.clWhite) if wnf_tools.zeitraum_ueberlappt(dv, db, self.von, self.bis): difference1 = datetime.timedelta(days=1) d = self.von for i in range(28): if (d >= dv) and (d <= db): self.eintragen(d, n, cl) d = d + difference1
def lese_date(self, ini, aSection, aName, aDefault): s = self.lese_str(ini, aSection, aName) try: d = wnf_tools.strToDate(s) except: d = aDefault return d
def eintragen_termin(self, s): z = s.split(";") d = wnf_tools.strToDate(z[0]) n = z[1] c = z[2] cl = wnf_tools.pascalToRGB(c, wnf_tools.clWhite) if (d >= self.von) and (d <= self.bis): self.eintragen(d, n, cl)
def ausgabe_ics(self, dn): print "Ausgabe von ", dn cal = Calendar() cal.add("prodid", "-//wnfDesktopKalender//wlsoft.de//") cal.add("version", "2.0") event = Event() event.add("summary", "Python meeting about calendaring") event.add("dtstart", wnf_tools.strToDate("03.04.2009")) event.add("dtend", wnf_tools.strToDate("03.04.2009")) event.add("dtstamp", wnf_tools.strToDate("03.04.2009")) event["uid"] = "20050115T101010/[email protected]" event.add("priority", 5) cal.add_component(event) f = open(dn, "wb") f.write(cal.as_string()) f.close()
def eintragen_zyklisch(self, s): z = s.split(";") g = wnf_tools.strToDate(z[0]) #Anfangstermin t = wnf_tools.strToInt(z[1]) #Wiederhalung alle t Tage n = z[2] #Name c = z[3] #Farbe cl = wnf_tools.pascalToRGB(c, wnf_tools.clYellow) while g < self.bis: if g>self.von: self.eintragen(g, n, cl) g = g + datetime.timedelta(t)
def eintragen_geburtstag(self, s): z = s.split(";") g = wnf_tools.strToDate(z[0]) n = z[1] c = z[2] cl = wnf_tools.pascalToRGB(c, wnf_tools.clYellow) dv = wnf_tools.diesesJahr(g, self.von) db = wnf_tools.diesesJahr(g, self.bis) if (dv >= self.von) and (dv <= self.bis): i = wnf_tools.alterInJahren(g, self.von) n = "%i %s" % (i, n) self.eintragen(dv, n, cl) elif (db >= self.von) and (db <= self.bis): i = wnf_tools.alterInJahren(g, self.bis) n = "%i %s" % (i, n) self.eintragen(db, n, cl)
def __init__(self,aStichtag): self.modus = 0 self.heute = aStichtag self.jetzt = datetime.datetime.now() self.wochentag_i = wnf_tools.wochentag_i(self.heute) self.von = wnf_tools.ersterDieserWoche(self.heute) self.bis = self.von + datetime.timedelta(days=28) #print self.von,self.bis self.termine = {} self.caption = "wnfDesktopKalender 0.16" self.Breite = 800 self.Hoehe = 600 self.TagBreite = 90 self.TagHoehe = 70 self.TagRand = 2 self.IniDateiname = '' self.XOffset = 20 self.YOffset = 20 self.HGColor = wnf_tools.clWhite; self.TextColor = wnf_tools.clBlack; self.LineColor = wnf_tools.clBlack; self.FarbeFT = wnf_tools.clGray; self.FarbeHeute = wnf_tools.clGray; self.FarbeTransparent = wnf_tools.clWhite; self.FarbeSA = wnf_tools.clGray; self.FarbeSO = wnf_tools.clGray; self.FarbeNormal = wnf_tools.clWhite; self.GrafikD = "" #Grafikdateiname self.GrafikV = "" #Grafikverzeichnis #self.TextFont = wnf_tools.cFontDejaVuSans #self.TextFontSize = 9 self.TextFont = wnf_tools.cFontDejaVuSans self.TextFontSize = 11 self.Bundesland = wnf_tools.cSN self.CountDown = wnf_tools.strToDate('03.04.2009') self.CountDownATM = 0 self.CountDownFont = wnf_tools.cFontDejaVuSans self.CountDownFontSize = 18 self.FarbeCountDown = wnf_tools.clWhite;
except ConfigParser.NoSectionError: print 'Keine Multitermine' return True else: return False def setWallpaper(self, dn): s = 'dcop kdesktop KBackgroundIface setWallpaper %s 2' % (dn) os.system(s) # print s if __name__ == "__main__": #ini = os.environ["HOME"] #ini = "%s/.wnfdesktopkalender/wnfDesktopKalender.ini" % (ini) ini = "/wnfdaten/wine/Eigene_Dateien/wnfDesktopKalender/wnfDesktopKalender.ini" #ini = "/wnfdaten/Downloads/wnfDesktopKalender.ini" dn = '/tmp/wnfDesktopkalender.png' d = datetime.date.today() d = wnf_tools.strToDate('31.03.2009') t = TwnfDesktopKalender(d) print t.caption print "Auswerten von ", ini if t.lesen(ini): #t.ausgabe_jpg_ohne_hintergrund(dn) #t.ausgabe_jpg_ohne_hintergrund(dn) t.ausgabe_jpg(dn) #t.show_jpg() #print t.ausgabe_html(False) print "Ausgabe von ", dn print "ende"