本文整理匯總了Python中rapuma.core.tools.Tools.fullFileTimeStamp方法的典型用法代碼示例。如果您正苦於以下問題:Python Tools.fullFileTimeStamp方法的具體用法?Python Tools.fullFileTimeStamp怎麽用?Python Tools.fullFileTimeStamp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rapuma.core.tools.Tools
的用法示例。
在下文中一共展示了Tools.fullFileTimeStamp方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Xetex
# 需要導入模塊: from rapuma.core.tools import Tools [as 別名]
# 或者: from rapuma.core.tools.Tools import fullFileTimeStamp [as 別名]
#.........這裏部分代碼省略.........
gidTexObject.write('\\input \"' + cidTexFileOff + '\"\n')
else :
self.log.writeToLog(self.errorCodes['0650'], [self.cType])
# This can only hapen once in the whole process, this marks the end
gidTexObject.write('\\bye\n')
return True
def makeXoneACompliant (self) :
'''Insert the necessary TeX code into the header to give the
appearance of being PDF x1-a compliant. If the feature is turned
off then it will only inject relevant document properties that
are good to have included no mater what. XeTeX output is x1-a
for the most part, it just doesn't brag about it. The output
here mostly works. :-) '''
# import pdb; pdb.set_trace()
allLines = ''
# Set some of the vars for the output
title = self.projectConfig['ProjectInfo']['projectTitle']
subject = self.projectConfig['ProjectInfo']['projectDescription']
author = ''.join(self.projectConfig['ProjectInfo']['translators'])
creator = ''.join(self.projectConfig['ProjectInfo']['typesetters'])
# I don't think this next bit is not right, what does +7 mean anyway?
# It works for CDT time anyway, which I thought was -6
offSet = "+07\'00\'"
# To get the date stamp right, we strip out all the non-number
# characters so we are left with: yyyymmddhhmmss
comp = self.projectConfig['ProjectInfo']['projectCreateDate'].replace('-', '').replace(':', '').replace(' ', '')
cDate = 'D:' + comp + offSet
mDate = 'D:' + self.tools.fullFileTimeStamp() + offSet
lines = [
'\special{pdf:docinfo<<',
'/Title(' + title + ')%',
'/Subject(' + subject + ')%',
'/Author(' + author + ')%',
'/Creator(' + creator + ')%',
'/CreationDate(' + cDate + ')%',
'/ModDate(' + mDate + ')%',
'/Producer(XeTeX with Rapuma)%',
'/Trapped /False',
'/GTS_PDFXVersion(PDF/X-1:2003)%',
'/GTS_PDFXConformance(PDF/X-1a:2003)%',
'>> }'
]
# Add PDF header declairations for PDF X1-A:2003 compliance (default is True)
if self.tools.str2bool(self.layoutConfig['DocumentFeatures']['pdfX1a']) :
icc = os.path.join(self.local.rapumaConfigFolder, 'ps_cmyk.icc')
# Now create the insert line list
xtralines = [ '\special{pdf:fstream @OBJCVR (' + icc + ')}',
'\special{pdf:put @OBJCVR <</N 4>>}',
'%\special{pdf:close @OBJCVR}',
'\special{pdf:docview <<',
'/OutputIntents [ <<',
'/Type/OutputIndent',
'/S/GTS_PDFX',
'/OutputCondition (An Unknown print device)',
'/OutputConditionIdentifier (Custom)',
'/DestOutputProfile @OBJCVR',
'/RegistryName (http://www.color.og)',
'>> ] >>}'
]
lines = lines + xtralines
示例2: ProjData
# 需要導入模塊: from rapuma.core.tools import Tools [as 別名]
# 或者: from rapuma.core.tools.Tools import fullFileTimeStamp [as 別名]
#.........這裏部分代碼省略.........
# Build the cullList
cullList = []
files = os.listdir(bakDir)
for f in files :
try :
cullList.append(int(f.split('.')[0]))
except :
self.log.writeToLog(self.errorCodes['3410'], [f])
# Remove oldest file(s)
while len(cullList) > maxStoreBackups :
fn = min(cullList)
cullList.remove(min(cullList))
os.remove(os.path.join(bakDir, str(fn) + '.zip'))
def backupProject (self, targetPath=None) :
'''Backup a project. Send the compressed backup file with a date-stamp
file name to the user-specified backup folder. If a target path is
specified, put the archive there but use the PID in the name. If other
backups with the same name exist there, increment with a number.'''
# First see if this is even a valid project
if self.pid not in self.projList :
self.log.writeToLog(self.errorCodes['3610'], [self.pid])
# Set some paths and file names
if not targetPath :
# Now check for a valid location to backup to
if self.local.userLibBackup == '' :
self.log.writeToLog(self.errorCodes['3622'])
elif not os.path.exists(self.local.userLibBackup) :
self.log.writeToLog(self.errorCodes['3620'], [self.local.userLibBackup])
projBackupFolder = os.path.join(self.local.userLibBackup, self.pid)
backupTarget = os.path.join(projBackupFolder, self.tools.fullFileTimeStamp() + '.zip')
else :
projBackupFolder = self.tools.resolvePath(targetPath)
# Now check for a valid target path
if not os.path.exists(projBackupFolder) :
self.log.writeToLog(self.errorCodes['3625'], [targetPath])
backupTarget = self.tools.incrementFileName(os.path.join(projBackupFolder, self.pid + '.zip'))
# Make sure the dir is there
if not os.path.exists(projBackupFolder) :
os.makedirs(projBackupFolder)
# import pdb; pdb.set_trace()
# Zip up but use a list of files we don't want
self.zipUpProject(backupTarget, self.makeExcludeFileList(source))
# Cull out any excess backups
if not targetPath :
self.cullBackups(self.userConfig['System']['maxStoreBackups'], projBackupFolder)
# Finish here
pc = Config(self.pid)
pc.getProjectConfig()
pc.projectConfig['Backup']['lastBackup'] = self.tools.fullFileTimeStamp()
self.tools.writeConfFile(pc.projectConfig)
self.log.writeToLog(self.errorCodes['3630'], [self.pid,backupTarget])
return True
def backupRestore (self, backup, target = None) :
'''Restore a backup to the current or specified project.'''
示例3: Config
# 需要導入模塊: from rapuma.core.tools import Tools [as 別名]
# 或者: from rapuma.core.tools.Tools import fullFileTimeStamp [as 別名]
#.........這裏部分代碼省略.........
def getFontConfig (self) :
'''Load/return the font configuation object.'''
self.fontConfig = self.tools.loadConfig(self.local.fontConfFile, self.local.fontConfXmlFile)
def getMacroConfig (self) :
'''Load/return the macro configuration object.'''
self.macroConfig = self.tools.loadConfig(self.local.macroConfFile, self.local.macroConfXmlFile)
###############################################################################
############################ Manager Level Functions ##########################
###############################################################################
####################### Error Code Block Series = 1000 ########################
###############################################################################
def makeNewprojectConf (self, local, pid, cVersion, pmid='book') :
'''Create a new project configuration file for a new project.'''
self.projectConfig = ConfigObj(self.tools.getXMLSettings(os.path.join(local.rapumaConfigFolder, pmid + '.xml')), encoding='utf-8')
# Insert intitial project settings
self.projectConfig['ProjectInfo']['projectMediaIDCode'] = pmid
self.projectConfig['ProjectInfo']['creatorID'] = self.userConfig['System']['userID']
self.projectConfig['ProjectInfo']['projectCreatorVersion'] = cVersion
self.projectConfig['ProjectInfo']['projectCreateDate'] = self.tools.tStamp()
self.projectConfig['ProjectInfo']['projectIDCode'] = pid
self.projectConfig['Backup']['ownerID'] = self.userConfig['System']['userID']
self.projectConfig['Groups'] = {}
# Even though there was no push, we need a time stamp to avoid confusion
self.projectConfig['Backup']['lastCloudPush'] = self.tools.fullFileTimeStamp()
self.projectConfig.filename = local.projectConfFile
self.projectConfig.write()
###############################################################################
######################## Basic Config Handling Functions ######################
###############################################################################
####################### Error Code Block Series = 2000 ########################
###############################################################################
def processSinglePlaceholder (self, ph, value) :
'''Once we are sure we have a single placeholder (noting embedded) this
will process it and replace it with the correct value.'''
holderType = ph.split(':')[0]
try :
holderKey = ph.split(':')[1]
except :
holderKey = ''
if self.hasPlaceHolder(value):
value = self.processNestedPlaceholders(value, '')
result = ph # If nothing matches below, default to returning placeholder unchanged
if holderType == 'val' :
result = value
# A value that needs a measurement unit attached
elif holderType == 'mu' :
result = self.getMeasureUnit()
# A value that is from a configObj
elif holderKey and holderType == 'config' :