| |
---|
| | |
---|
| | PROGNAME = "tren.py" |
---|
| | BASENAME = PROGNAME.split(".py")[0] |
---|
| | PROGENV = BASENAME.upper() |
---|
| | RCSID = "$Id: tren.py,v 1.181 2010/03/10 01:02:07 tundra Exp $" |
---|
| | RCSID = "$Id: tren.py,v 1.182 2010/03/10 18:29:25 tundra Exp $" |
---|
| | VERSION = RCSID.split()[2] |
---|
| | |
---|
| | # Copyright Information |
---|
| | |
---|
| |
---|
| | eNAMESHORT = "Renaming '%s' to new name '%s' too short! (Minimum length is %s.)" |
---|
| | eNOROOTRENAME = "Cannot rename root of file tree!" |
---|
| | eNULLARG = "%s cannot be empty!" |
---|
| | eRENAMEFAIL = "Attempt to rename '%s' to '%s' failed : %s!" |
---|
| | eTOKBADSEQ = "Unknown sequence renaming token, '%s'!" |
---|
| | eTOKDELIM = "Renaming token '%s' missing delimiter!" |
---|
| | eTOKUNKNOWN = "Renaming Token '%s' is unknown type!" |
---|
| | eTOKUNKNOWN = "Renaming token '%s' is unknown type!" |
---|
| | eTOOMANYINC = "Too many includes! (Max is %d) Possible circular reference?" % MAXINCLUDES |
---|
| | |
---|
| | |
---|
| | ##### |
---|
| |
---|
| | ### |
---|
| | |
---|
| | elif r[2] != "" and (r[2][0] == TOKASCEND or r[2][0] == TOKDESCEND): |
---|
| | |
---|
| | for token in self.SortViews: |
---|
| | print token |
---|
| | # Parse the Sequence Renaming Token into the token itself |
---|
| | # and its corresponding formatting field. |
---|
| | |
---|
| | token = r[2][1:] |
---|
| | |
---|
| | found = False |
---|
| | for seqtoken in self.SortViews: |
---|
| | |
---|
| | if token.startswith(seqtoken): |
---|
| | |
---|
| | token, field = token[:len(seqtoken)], token[len(seqtoken):] |
---|
| | found = True |
---|
| | break |
---|
| | |
---|
| | if not found: |
---|
| | ErrorMsg(eTOKBADSEQ % r[2]) |
---|
| | |
---|
| | # Retrieve the ordered list of the requested type, |
---|
| | # adjust for descending order, and plug in the |
---|
| | # sequence number for the current renaming target |
---|
| | # (which is just the index of that filename in the |
---|
| | # list). |
---|
| | |
---|
| | orderedlist = self.SortViews[token][:] |
---|
| | |
---|
| | if r[2][0] == TOKDESCEND: |
---|
| | orderedlist.reverse() |
---|
| | |
---|
| | r[2] = str(orderedlist.index(target)) |
---|
| | |
---|
| | ### |
---|
| | # Unrecognized Renaming Token |
---|
| | ### |
---|
| |
---|
| | |