Exemple #1
0
	def startButtonPressed(self, e):
		try:
			if (self.cleanPDFNamedCheckButtonStatus == True):
				os.chdir(self.folderPath)
				tempPDFList = estel.pathListPDF(self.folderPath)
				for items in tempPDFList:
					i = 0
					if items[i:i+3] == 'EL.':
						if items [i+13:i+15] == '-0' or items [i+13:i+15] == '-1':
							os.rename(items, items[:i+16] + '.pdf')
						else:
							os.rename(items, items[:i+13] + '.pdf')
				wx.MessageBox('All Pdf name was clean', 'Info', wx.OK | wx.ICON_INFORMATION)
			if (self.revisionCheckButtonStatus == True):
				os.chdir(self.folderPath)
				errorLogList = estel.renamePDF(self.folderPath)
				if errorLogList != []:
					errorFile = open('errorLog.txt', 'w+')
					errorFile.writelines("%s\n" % i for i in errorLogList)
					errorFile.close()
					wx.MessageBox('=( Something gone wrong. Look errorLog file.', 'Info', wx.OK | wx.ICON_INFORMATION)
				else:
					wx.MessageBox('Revision Number will be change', 'Info', wx.OK | wx.ICON_INFORMATION)
			if (self.creatListCheckButtonStatus == True):
				os.chdir(self.folderPath)
				PDFList = estel.pathListPDF(self.folderPath)
				listPDF = open('PDFList.txt', 'w+')
				listPDF.writelines("%s\n" % i for i in PDFList)
				listPDF.close()
				wx.MessageBox('List was created', 'Info', wx.OK | wx.ICON_INFORMATION)
			if (self.cleanPDFNamedCheckButtonStatus == False & self.revisionCheckButtonStatus == False\
			 & self.creatListCheckButtonStatus == False):
				pass
		except OSError:
			wx.MessageBox('No such directory', 'Info', wx.OK | wx.ICON_INFORMATION)
Exemple #2
0
def main(argv):
    def usage():
        print(
            'usage estel.py [-r folder location] [-l folder location] [-c folder location]'
        )

    try:
        (opts, args) = getopt.getopt(argv[1:], 'r:l:c:')
    except getopt.GetoptError:
        return usage()
    if not opts:
        return usage()
    for (k, v) in opts:
        if k == '-r':  #Переименовываем документы (добавляем номер ревизии)
            os.chdir(v)
            errorLogList = estel.renamePDF(v)
            if errorLogList != []:
                errorFile = open('errorLog.txt', 'w+')
                errorFile.writelines("%s\n" % i for i in errorLogList)
                errorFile.close()
                print('=( Something gone wrong. Look errorLog file.')
            else:
                print('=) OK!')
        elif k == '-l':  #выводим список PDF файлов в директории
            os.chdir(v)
            PDFList = estel.pathListPDF(v)
            listPDF = open('PDFList.txt', 'w+')
            listPDF.writelines("%s\n" % i for i in PDFList)
            listPDF.close()
            print('OK!')
        elif k == '-c':  #чистим название PDF файлов чертежей (оставляем только EL. номер)
            os.chdir(v)
            tempPDFList = estel.pathListPDF(v)
            for items in tempPDFList:
                i = 0
                if items[i:i + 3] == 'EL.':
                    if items[i + 13:i + 15] == '-0' or items[i + 13:i +
                                                             15] == '-1':
                        os.rename(items, items[:i + 16] + '.pdf')
                    else:
                        os.rename(items, items[:i + 13] + '.pdf')
Exemple #3
0
 def startButtonPressed(self, e):
     try:
         if self.cleanPDFNamedCheckButtonStatus == True:
             os.chdir(self.folderPath)
             tempPDFList = estel.pathListPDF(self.folderPath)
             for items in tempPDFList:
                 i = 0
                 if items[i : i + 3] == "EL.":
                     if items[i + 13 : i + 15] == "-0" or items[i + 13 : i + 15] == "-1":
                         os.rename(items, items[: i + 16] + ".pdf")
                     else:
                         os.rename(items, items[: i + 13] + ".pdf")
             wx.MessageBox("All Pdf name was clean", "Info", wx.OK | wx.ICON_INFORMATION)
         if self.revisionCheckButtonStatus == True:
             os.chdir(self.folderPath)
             errorLogList = estel.renamePDF(self.folderPath)
             if errorLogList != []:
                 errorFile = open("errorLog.txt", "w+")
                 errorFile.writelines("%s\n" % i for i in errorLogList)
                 errorFile.close()
                 wx.MessageBox("=( Something gone wrong. Look errorLog file.", "Info", wx.OK | wx.ICON_INFORMATION)
             else:
                 wx.MessageBox("Revision Number will be change", "Info", wx.OK | wx.ICON_INFORMATION)
         if self.creatListCheckButtonStatus == True:
             os.chdir(self.folderPath)
             PDFList = estel.pathListPDF(self.folderPath)
             listPDF = open("PDFList.txt", "w+")
             listPDF.writelines("%s\n" % i for i in PDFList)
             listPDF.close()
             wx.MessageBox("List was created", "Info", wx.OK | wx.ICON_INFORMATION)
         if (
             self.cleanPDFNamedCheckButtonStatus
             == False & self.revisionCheckButtonStatus
             == False & self.creatListCheckButtonStatus
             == False
         ):
             pass
     except OSError:
         wx.MessageBox("No such directory", "Info", wx.OK | wx.ICON_INFORMATION)
Exemple #4
0
def main(argv):
    def usage():
        print ('usage estel.py [-r folder location] [-l folder location] [-c folder location]')
    try:
        (opts, args) = getopt.getopt(argv[1:], 'r:l:c:')
    except getopt.GetoptError:
        return usage()
    if not opts:
        return usage()
    for (k, v) in opts:
        if k == '-r': #Переименовываем документы (добавляем номер ревизии)
            os.chdir(v)
            errorLogList = estel.renamePDF(v)
            if errorLogList != []:
                errorFile = open('errorLog.txt', 'w+')
                errorFile.writelines("%s\n" % i for i in errorLogList)
                errorFile.close()
                print ('=( Something gone wrong. Look errorLog file.')
            else:
                print ('=) OK!')
        elif k == '-l': #выводим список PDF файлов в директории
            os.chdir(v)
            PDFList = estel.pathListPDF(v)
            listPDF = open('PDFList.txt', 'w+')
            listPDF.writelines("%s\n" % i for i in PDFList)
            listPDF.close()
            print('OK!')
        elif k == '-c': #чистим название PDF файлов чертежей (оставляем только EL. номер)
            os.chdir(v)
            tempPDFList = estel.pathListPDF(v)
            for items in tempPDFList:
                i = 0
                if items[i:i+3] == 'EL.':
                    if items [i+13:i+15] == '-0' or items [i+13:i+15] == '-1':
                        os.rename(items, items[:i+16] + '.pdf')
                    else:
                        os.rename(items, items[:i+13] + '.pdf')