def ReadRef(self, key): tempstruct = [] for root, dirs, files in os.walk(self.dm.Refdir): for name in files: # print (' Read Reference File: ' + name) fullname, ext = os.path.splitext(name.strip()) # print str("fullname is " + fullname) if ext == ".txt": filename = self.dm.getfilename(fullname) # print str("filename is " + filename) dirname = self.dm.getdirectorystring(fullname) # print dirname corename = self.dm.getcorename(fullname) # print corename key = self.dm.getkey(fullname) # print key if not fullname is "": os.chdir(root) cpfile = open(name, "r") temp = singlefilestructure(self.tm, name, dirname, filename, corename, key, cpfile.readlines()) tempstruct.append(temp) # tempstruct.add(name, dirname, corename, cpfile.readlines()) cpfile.close() # print "End of loop..." # print str("Length of structure: " + str(len(tempstruct))) for actfile in tempstruct: if actfile.iskey(""): temp = translatefilestructure(self.tm, actfile.corename, actfile) self.refdata.append(temp) # print str("Creating Group " + actfile.corename + "...") for group in self.refdata: for actfile in tempstruct: # print str("Comparing " + group.corename + " with " + actfile.corename + " ...") if not actfile.iskey("") and actfile.isname(group.corename): group.add(actfile)
def ReadCurr(self, key): tempstruct = [] for root, dirs, files in os.walk(self.dm.Currdir): for name in files: # print ('Read Current File: ' + name) fullname, ext = os.path.splitext(name.strip()) # print str("fullname is " + fullname) # print ("fullpath is " + os.path.normpath(os.path.join(self.dm.getdirectorystring(fullname),self.dm.getfilename(fullname)))) if ext == ".txt": filename = self.dm.getfilename(fullname) # print str("filename is " + filename) dirname = self.dm.getdirectorystring(fullname) # print dirname corename = self.dm.getcorename(fullname) # print corename key = self.dm.getkey(fullname) # print key if not fullname is "": os.chdir(root) cpfile = open(name, "r") temp = singlefilestructure(self.tm, name, dirname, filename, corename, key, cpfile.readlines()) tempstruct.append(temp) # tempstruct.add(name, dirname, corename, cpfile.readlines()) cpfile.close() # print "End of loop..." for actfile in tempstruct: if actfile.iskey(""): temp = translatefilestructure(self.tm, actfile.corename, actfile) self.currdata.append(temp) for group in self.currdata: for actfile in tempstruct: if not actfile.iskey("") and actfile.isname(group.corename): group.add(actfile)
def ReadRef(self, key): tempstruct = [] for root, dirs, files in os.walk(self.dm.Refdir): for name in files: #print (' Read Reference File: ' + name) fullname, ext = os.path.splitext(name.strip()) #print str("fullname is " + fullname) if ext == ".txt": filename = self.dm.getfilename(fullname) #print str("filename is " + filename) dirname = self.dm.getdirectorystring(fullname) #print dirname corename = self.dm.getcorename(fullname) #print corename key = self.dm.getkey(fullname) #print key if not fullname is "": os.chdir(root) cpfile = open(name,"r") temp = singlefilestructure(self.tm, name, dirname, filename, corename, key, cpfile.readlines()) tempstruct.append(temp) #tempstruct.add(name, dirname, corename, cpfile.readlines()) cpfile.close() #print "End of loop..." #print str("Length of structure: " + str(len(tempstruct))) for actfile in tempstruct: if actfile.iskey(""): temp = translatefilestructure(self.tm, actfile.corename, actfile) self.refdata.append(temp) #print str("Creating Group " + actfile.corename + "...") for group in self.refdata: for actfile in tempstruct: #print str("Comparing " + group.corename + " with " + actfile.corename + " ...") if not actfile.iskey("") and actfile.isname(group.corename): group.add(actfile)
def ReadCurr(self, key): tempstruct = [] for root, dirs, files in os.walk(self.dm.Currdir): for name in files: #print ('Read Current File: ' + name) fullname, ext = os.path.splitext(name.strip()) #print str("fullname is " + fullname) #print ("fullpath is " + os.path.normpath(os.path.join(self.dm.getdirectorystring(fullname),self.dm.getfilename(fullname)))) if ext == ".txt": filename = self.dm.getfilename(fullname) #print str("filename is " + filename) dirname = self.dm.getdirectorystring(fullname) #print dirname corename = self.dm.getcorename(fullname) #print corename key = self.dm.getkey(fullname) #print key if not fullname is "": os.chdir(root) cpfile = open(name,"r") temp = singlefilestructure(self.tm, name, dirname, filename, corename, key, cpfile.readlines()) tempstruct.append(temp) #tempstruct.add(name, dirname, corename, cpfile.readlines()) cpfile.close() #print "End of loop..." for actfile in tempstruct: if actfile.iskey(""): temp = translatefilestructure(self.tm, actfile.corename, actfile) self.currdata.append(temp) for group in self.currdata: for actfile in tempstruct: if not actfile.iskey("") and actfile.isname(group.corename): group.add(actfile)
def CopyRef(self, key): for actfile in self.files: if actfile.iskey(""): temp = translatefilestructure(self.tm, actfile.corename, actfile.copy()) # print ('Copy Reference File: ' + actfile.corename) self.refdata.append(temp) for group in self.refdata: for actfile in self.files: if not actfile.iskey("") and actfile.isname(group.corename): group.add(actfile.copy())
def CopyRef(self, key): for actfile in self.files: if actfile.iskey(""): temp = translatefilestructure(self.tm, actfile.corename, actfile.copy()) #print ('Copy Reference File: ' + actfile.corename) self.refdata.append(temp) for group in self.refdata: for actfile in self.files: if not actfile.iskey("") and actfile.isname(group.corename): group.add(actfile.copy())