support for today

added today to plist
fixing due date name in plist
This commit is contained in:
Maciej Krok 2016-10-08 11:01:26 +02:00
parent cb1d43e82a
commit c009a3176a
4 changed files with 39 additions and 9 deletions

View File

@ -23,8 +23,15 @@ class Project(ToDo):
def makeAppleScript(self):
ans = "\n"
ans += "\n"
ans += "set " + self.getMD5() + " to make new project \n"
ans += "set " + self.getMD5() + " to make new project "
if self.isToDay():
ans += "at beginning of list \"Today\""
ans += "\n"
ans += "set name of " + self.getMD5() + " to \"" + self.getName() + "\"\n"
@ -35,7 +42,7 @@ class Project(ToDo):
ans += "set notes of " + self.getMD5() + " to \"" + self.getNotes() + "\"\n"
if self.getDueDate() > 0:
ans += "set due date of " + self.getMD5() + " to (current date) + " + self.getDueDate() + " * days\n"
ans += "set due date of " + self.getMD5() + " to (current date) + " + str(self.getDueDate()) + " * days\n"
tags = ""
for tag in self.getTags():

View File

@ -21,9 +21,14 @@ class ToDo:
return self.plist["tags"]
def getDueDate(self):
if "due date " not in self.plist:
if "due date" not in self.plist:
return 0
return self.plist["due date "]
return self.plist["due date"]
def isToDay(self):
if "today" not in self.plist:
return False
return self.plist["today"]
def getMD5(self):
return self.md5
@ -33,8 +38,14 @@ class ToDo:
def makeAppleScript(self):
ans = "\n"
ans += "\n"
ans += "set " + self.getMD5() +" to make new to do \n"
ans += "set " + self.getMD5() +" to make new to do "
if self.isToDay():
ans += "at beginning of list \"Today\""
ans += "\n"
ans += "set name of " + self.getMD5() + " to \""+ self.getName() +"\"\n"

View File

@ -7,8 +7,10 @@
<dict>
<key>name</key>
<string>sample todos0</string>
<key>due date </key>
<key>due date</key>
<integer>5</integer>
<key>today</key>
<true/>
<key>tags</key>
<array>
<string>sampleTag4</string>
@ -35,6 +37,8 @@ Phasellus fringilla est sed congue mollis. Nullam cursus aliquam arcu quis tinci
Duis at congue nisl. In pharetra vitae nibh at finibus. Aenean ullamcorper purus a ultrices consectetur. Duis sed ultricies sapien, pulvinar vestibulum libero. Donec id neque nec mi eleifend blandit at id libero. Nullam scelerisque massa quis ultrices tincidunt. Aenean condimentum rhoncus fringilla.</string>
<key>due date</key>
<integer>3</integer>
<key>today</key>
<true/>
<key>tags</key>
<array>
<string>sampleTag1</string>
@ -47,8 +51,10 @@ Duis at congue nisl. In pharetra vitae nibh at finibus. Aenean ullamcorper purus
<dict>
<key>name</key>
<string>sample todos1</string>
<key>due date </key>
<key>due date</key>
<integer>0</integer>
<key>today</key>
<true/>
<key>tags</key>
<array>
<string>sampleTag3</string>
@ -60,8 +66,10 @@ Duis at congue nisl. In pharetra vitae nibh at finibus. Aenean ullamcorper purus
<dict>
<key>name</key>
<string>sample todos2</string>
<key>due date </key>
<key>due date</key>
<integer>0</integer>
<key>today</key>
<false/>
<key>tags</key>
<array>
<string>sampleTag2</string>
@ -73,8 +81,10 @@ Duis at congue nisl. In pharetra vitae nibh at finibus. Aenean ullamcorper purus
<dict>
<key>name</key>
<string>sample todos3</string>
<key>due date </key>
<key>due date</key>
<integer>0</integer>
<key>today</key>
<false/>
<key>tags</key>
<array>
<string>sampleTag3</string>

View File

@ -63,6 +63,8 @@ class thingspy:
cmd.append("-e")
cmd.append(applescript)
# print applescript
process = Popen(cmd, stdout=PIPE)
out, err = process.communicate()
print("out:" + str(out))