Пример #1
0
def ParseCommandArg():
    classname = ""
    author = ""
    email = ""
    lic = ""
    opts, args = getopt.getopt(sys.argv[1:], 'c:a:e:l:h?',
        ["classname=", "author=", "email=", "license=", "help"])
    for o, a in opts:
        if o == '-c' or o == "--classname":
            classname = a
        if o in ("-a", "--author"):
            author = a
        if o in ("-e", "--email"):
            email = a
        if o in ("-l", "--license"):
            lic = a
        if o in ("-h", "-?", "--help"):
            Usage();
            sys.exit()
    if (classname == ""):
        classname = raw_input("input class name:")
    if (author == ""):
        author = raw_input("input author name:")
    if (email == ""):
        email = raw_input("input email:")
    licPath = os.path.join(common.get_license_dir(), lic)
    while ((not os.path.exists(licPath)) or (lic == "")):
        lic = raw_input("input license file name:")
        licPath = os.path.join(common.get_license_dir(), lic)
    cr = open(licPath).read()
    return (classname, author, email, cr)
Пример #2
0
 def select_license(self, lic):
     licPath = os.path.join(common.get_license_dir(), lic)
     if os.path.isfile(licPath) and os.path.exists(licPath):
         self.copyrightCtrl.SetValue(open(licPath).read())
Пример #3
0
 def select_license(self, lic):
     licPath = os.path.join(common.get_license_dir(), lic)
     if (os.path.isfile(licPath) and os.path.exists(licPath)):
         self.copyrightCtrl.delete(1.0, Tkinter.END)
         self.copyrightCtrl.insert(1.0, open(licPath).read())