Exemple #1
0
 def ClearDatabase(self, e):
     self.status.SetStatusText("Clearing database...")
     data.drop_tables()
     self.status.SetStatusText("Database cleared")
gs = wx.App()
gs.SetAppName(version.name)

files = []

if len(sys.argv) > 1:
    i = 1
    while i < len(sys.argv):
        if sys.argv[i] == "-h" or sys.argv[i] == "--help":
            usage()
        elif sys.argv[i] == "-v" or sys.argv[i] == "--version":
            print version.string
        elif sys.argv[i] == "--clear-db":
            if len(sys.argv) == 2:
                data.drop_tables()
            else:
                print "Error: The --clear-db option must not be used with other options, else operator error is assumed."
                exit(1)
        elif sys.argv[i] == "--tl" and len(sys.argv) > i + 1:
            if len(sys.argv) > i + 2:
                rows = data.find_resources(name=sys.argv[i + 2], mintl=sys.argv[i + 1])
                i += 2
            else:
                rows = data.find_resources(mintl=sys.argv[i + 1])
                i += 1
            data.display_rows(rows)
            exit(0)
        elif sys.argv[i] == "--name" and len(sys.argv) > i + 1:
            if len(sys.argv) > i + 2:
                rows = data.find_resources(name=sys.argv[i + 1], mintl=sys.argv[i + 2])