Advertisement
clockworkpc

Tiddly Case Tag Generator

Aug 3rd, 2012
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.93 KB | None | 0 0
  1. #!/usr/bin/python
  2. #/home/clockworkpc/bin/casetagcreator.py
  3.  
  4. # Released under a GPLv3 Licence by Clockwork PC 2012
  5. # www.clockworkpc.com.au
  6.  
  7. # You are entitled to the following four freedoms:
  8. # Freedom 0: To run this program for any purpose
  9. # Freedom 1: To study how this program works and change it to make it do what you wish
  10. # Freedom 2: To redistribute copies so you can help your neighbour
  11. # Freedom 3: To distribute copies of your modified version to others
  12.  
  13. import os
  14. masterCaseFile = (os.getenv("HOME")+"/Dropbox/Deakin/Tiddlywiki/TiddlyTags/MasterFiles/master_tiddlycases.txt")
  15. os.system("touch " + masterCaseFile)
  16.  
  17. def caseTagGenerator():
  18.     print ""
  19.     caseParty1 = raw_input("Enter the name of the first party: ")
  20.     print ""
  21.     caseParty2 = raw_input("Enter the name of the second party: ")
  22.     print ""
  23.     caseYear = raw_input("Enter the year only (no brackets): ")
  24.     print ""
  25.     caseYearQ = raw_input("""
  26.     Which brackets?
  27.  
  28.     1. Round brackets?
  29.     2. Square brackets?
  30.  
  31.     Enter your selection: """)
  32.     print ""
  33.     caseCitation = raw_input("Enter the case citation: ")
  34.     print ""
  35.     caseParagraph = raw_input("Enter the case paragraph, number only: ")
  36.     print ""
  37.     caseJudge = raw_input("Enter the name of the judge or justice, e.g. Kirby J or Kirby and Hughes JJ: ")
  38.  
  39.     if caseParagraph == "":
  40.         if caseYearQ == "1":
  41.             tiddlyCase = "[[" + caseParty1 + " v " + caseParty2 + " (" + caseYear + ") " + caseCitation + "]]"
  42.         elif caseYearQ == "2":
  43.             tiddlyCase = "[[" + caseParty1 + " v " + caseParty2 + " [" + caseYear + "] " + caseCitation + "]]"
  44.            
  45.     elif caseJudge == "":
  46.         if caseYearQ == "1":
  47.             tiddlyCase = "[[" + caseParty1 + " v " + caseParty2 + " (" + caseYear + ") " + caseCitation + "]] at " + caseParagraph
  48.         elif caseYearQ == "2":
  49.             tiddlyCase = "[[" + caseParty1 + " v " + caseParty2 + " [" + caseYear + "] " + caseCitation + "]] at " + caseParagraph
  50.  
  51.     else:
  52.         if caseYearQ == "1":
  53.             tiddlyCase = "[[" + caseParty1 + " v " + caseParty2 + " (" + caseYear + ") " + caseCitation + "]] at " + caseParagraph + " per " + caseJudge
  54.         elif caseYearQ == "2":
  55.             tiddlyCase = "[[" + caseParty1 + " v " + caseParty2 + " [" + caseYear + "] " + caseCitation + "]] at " + caseParagraph + " per " + caseJudge
  56.  
  57.     print tiddlyCase
  58.  
  59.     f = open(masterCaseFile, "a")
  60.     f.write(tiddlyCase+'\n')
  61.     f.close()
  62.    
  63.     xCowsayLine = "xcowsay --time=1 " + "'" + tiddlyCase + "'"
  64.     print xCowsayLine
  65.    
  66.     os.system(xCowsayLine)
  67.  
  68. def newCaseTest():
  69.     newCaseQ = raw_input("""
  70.     Do you want to add another case?
  71.    
  72.     1. Yes
  73.     2. No
  74.    
  75.     Enter your selection: """)
  76.  
  77. running = True
  78. while running:
  79.     caseTagGenerator()
  80.     newCaseQ = int(raw_input("""
  81.     Do you want to add another case?
  82.    
  83.     1. Yes
  84.     2. No
  85.    
  86.     Enter your selection: """))
  87.     if newCaseQ == 2:
  88.         running = False
  89.         os.system("xcowsay 'Alright then, goodbye'")
  90.     elif newCaseQ == 1:
  91.         os.system('clear')
  92.     else:
  93.         os.system('clear')
  94.         print """
  95.         I'm not sure what you want, but let's add another case!
  96.         """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement