本文整理匯總了Python中rapuma.core.tools.Tools類的典型用法代碼示例。如果您正苦於以下問題:Python Tools類的具體用法?Python Tools怎麽用?Python Tools使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Tools類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
def __init__(self, pid) :
'''Intitate the whole class and create the object.'''
self.pid = pid
self.tools = Tools()
self.rapumaHome = os.environ.get('RAPUMA_BASE')
self.userHome = os.environ.get('RAPUMA_USER')
self.user = UserConfig(self.rapumaHome, self.userHome)
self.userConfig = self.user.userConfig
self.projectConfig = Config(pid).projectConfig
self.projHome = None
self.local = None
self.finishInit()
# Log messages for this module
self.errorCodes = {
'EDIT-000' : ['MSG', 'Messages for editing project and setting files.'],
'EDIT-005' : ['MSG', 'Unassigned error message ID.'],
'EDIT-010' : ['ERR', 'The component [<<1>>] has multiple subcomponents and cannot be opened for editing. Please work with the individual subcomponents.'],
'EDIT-020' : ['ERR', 'Working text file [<<1>>] not found.'],
'EDIT-030' : ['ERR', 'No files found to edit with the commands supplied.'],
'EDIT-040' : ['MSG', 'Component files for [<<1>>] have been opened in your file editor.'],
'0000' : ['MSG', 'Placeholder message'],
}
示例2: __init__
def __init__(self, pid, gid = None, projectConfig = None) :
'''Intitate the whole class and create the object.'''
self.pid = pid
self.tools = Tools()
self.user = UserConfig()
self.userConfig = self.user.userConfig
if projectConfig :
self.projectConfig = projectConfig
else :
self.proj_config = Config(self.pid)
self.proj_config.getProjectConfig()
self.projectConfig = self.proj_config.projectConfig
self.local = ProjLocal(pid, gid, self.projectConfig)
self.log = ProjLog(pid)
# Log messages for this module
self.errorCodes = {
'0000' : ['MSG', 'Placeholder message'],
'XPRT-000' : ['MSG', 'Messages for export issues (probably only in project.py)'],
'XPRT-005' : ['MSG', 'Unassigned error message ID.'],
'XPRT-010' : ['ERR', 'Export file name could not be formed with available configuration information.'],
'XPRT-020' : ['ERR', 'Unable to export: [<<1>>].'],
'XPRT-030' : ['MSG', 'Files exported to [<<1>>].'],
'XPRT-040' : ['MSG', 'Beginning export, please wait...'],
'XPRT-050' : ['MSG', 'Unassigned error message ID.'],
'1210' : ['MSG', 'Processes completed successfully on: [<<1>>] by [<<2>>]'],
'1220' : ['ERR', 'Processes for [<<1>>] failed. Script [<<2>>] returned this error: [<<3>>]'],
'1240' : ['MSG', 'Component group preprocessing [<<1>>] for group [<<2>>].'],
'1260' : ['ERR', 'Installed the default component preprocessing script. Editing will be required for it to work with your project.'],
'1265' : ['LOG', 'Component preprocessing script is already installed.'],
}
示例3: __init__
def __init__(self) :
'''Intitate the whole class and create the object.'''
# import pdb; pdb.set_trace()
self.rapumaHome = os.environ.get('RAPUMA_BASE')
self.defaultUserHome = os.environ.get('RAPUMA_USER')
self.userConfFileName = 'rapuma.conf'
self.tools = Tools()
# Point to the right user config either server or desktop
# The RAPUMA_USER setting should have the right path from
# the mother script (rapuma)
self.userConfFile = os.path.join(self.defaultUserHome, self.userConfFileName)
# Check to see if the file is there, then read it in and break it into
# sections. If it fails, scream really loud!
rapumaXMLDefaults = os.path.join(self.rapumaHome, 'config', 'rapuma.xml')
if os.path.exists(rapumaXMLDefaults) :
self.tools.sysXmlConfig = self.tools.xml_to_section(rapumaXMLDefaults)
else :
raise IOError, "Can't open " + rapumaXMLDefaults
# Now make the users local rapuma.conf file if it isn't there
if not os.path.isfile(self.userConfFile) :
self.initUserHome()
# Load the system.conf file into an object
self.userConfig = ConfigObj(self.userConfFile, encoding='utf-8')
# Log messages for this module
self.errorCodes = {
'0000' : ['MSG', 'Placeholder message'],
}
示例4: __init__
def __init__(self, pid, gid = None) :
'''Intitate the whole class and create the object.'''
# import pdb; pdb.set_trace()
self.pid = pid
self.gid = gid
self.local = ProjLocal(pid, gid)
self.tools = Tools()
self.proj_config = Config(pid, gid)
self.proj_config.getProjectConfig()
self.proj_config.getLayoutConfig()
self.layoutConfig = self.proj_config.layoutConfig
self.user = UserConfig()
self.userConfig = self.user.userConfig
self.log = ProjLog(pid)
# to [px] is 72/25.4
self.mmToPx = 72 / 25.4
# page width [px]
self.paperPxWidth = round(self.mmToPx * float(self.layoutConfig['PageLayout']['pageWidth']),1)
# page height [px]
self.paperPxHeight = round(self.mmToPx * float(self.layoutConfig['PageLayout']['pageHeight']),1)
# Log messages for this module
self.errorCodes = {
'0000' : ['MSG', 'Placeholder message'],
'1310' : ['WRN', 'Failed to add diagnostic component: [<<1>>] with error: [<<2>>]']
}
示例5: __init__
def __init__(self, pid) :
'''Intitate the whole class and create the object.'''
self.pid = pid
self.log = ProjLog(self.pid)
self.tools = Tools()
self.user = UserConfig()
self.config = Config(pid)
self.local = ProjLocal(self.pid)
self.userConfig = self.user.userConfig
self.config.getProjectConfig()
self.projectConfig = self.config.projectConfig
if self.userConfig['System']['textDifferentialViewerCommand'] == '' :
self.diffViewCmd = None
else :
self.diffViewCmd = self.userConfig['System']['textDifferentialViewerCommand']
# Make sure the diff view command is a list
if type(self.diffViewCmd) != list :
self.diffViewCmd = [self.userConfig['System']['textDifferentialViewerCommand']]
# Log messages for this module
self.errorCodes = {
'0210' : ['WRN', 'File does not exist: [<<1>>] compare cannot be done.'],
'0280' : ['ERR', 'Failed to compare files with error: [<<1>>]'],
'0285' : ['ERR', 'Cannot compare component [<<1>>] because a coresponding subcomponent could not be found.'],
'0290' : ['ERR', 'Compare test type: [<<1>>] is not valid.'],
'0295' : ['MSG', 'Comparing: [<<1>>] with parent: [<<2>>] Close the viewer to return to the terminal prompt.'],
'0220' : ['MSG', 'Comparison not needed, files seem to be the same.'],
'0300' : ['WRN', 'Files are different but visual compare is not enabled.']
}
示例6: __init__
def __init__(self, project, cfg, parent = None) :
'''Initialize this class.'''
self.project = project
self.cfg = cfg
self.parent = parent or project
self.managers = {}
self.tools = Tools()
示例7: __init__
def __init__(self, project, cfg) :
super(Pdf, self).__init__(project, cfg)
# import pdb; pdb.set_trace()
# Set values for this manager
self.pid = project.projectIDCode
self.gid = project.gid
self.cType = 'pdf'
self.Ctype = self.cType.capitalize()
self.project = project
self.local = project.local
self.tools = Tools()
self.proj_config = Config(self.pid, self.gid)
self.proj_config.getProjectConfig()
self.proj_config.getAdjustmentConfig()
self.projectConfig = self.proj_config.projectConfig
self.log = project.log
self.cfg = cfg
self.mType = project.projectMediaIDCode
self.renderer = project.projectConfig['CompTypes'][self.Ctype]['renderer']
self.compSource = project.projectConfig['CompTypes'][self.Ctype]['compSource']
# Get the comp settings
self.compSettings = project.projectConfig['CompTypes'][self.Ctype]
# Build a tuple of managers this component type needs to use
self.pdfManagers = ('fixed', self.renderer)
# Init the general managers
for self.mType in self.pdfManagers :
self.project.createManager(self.mType)
# Create the internal ref names we use in this module
self.text = self.project.managers[self.cType + '_Fixed']
# File names
# Folder paths
self.projScriptFolder = self.local.projScriptFolder
self.projComponentFolder = self.local.projComponentFolder
self.gidFolder = os.path.join(self.projComponentFolder, self.gid)
# File names with folder paths
self.rapumaXmlCompConfig = os.path.join(self.project.local.rapumaConfigFolder, self.xmlConfFile)
# Get persistant values from the config if there are any
newSectionSettings = self.tools.getPersistantSettings(self.projectConfig['CompTypes'][self.Ctype], self.rapumaXmlCompConfig)
if newSectionSettings != self.projectConfig['CompTypes'][self.Ctype] :
self.projectConfig['CompTypes'][self.Ctype] = newSectionSettings
# Set them here
for k, v in self.compSettings.iteritems() :
setattr(self, k, v)
# Module Error Codes
self.errorCodes = {
'0000' : ['MSG', 'Messages for the PDF module.'],
}
示例8: __init__
def __init__(self, pid) :
'''Intitate the whole class and create the object.'''
self.pid = pid
self.tools = Tools()
self.user = UserConfig()
self.userConfig = self.user.userConfig
self.local = ProjLocal(pid)
self.log = ProjLog(pid)
self.projData = ProjData(pid)
示例9: Group
class Group (object) :
# Shared values
xmlConfFile = 'group.xml'
def __init__(self, project, cfg, parent = None) :
'''Initialize this class.'''
self.project = project
self.cfg = cfg
self.parent = parent or project
self.managers = {}
self.tools = Tools()
def render(self) :
'''Render a group.'''
self.tools.terminal("Warning: Calling dummy rendering in the group class.")
示例10: __init__
def __init__(self, pid) :
'''Do the primary initialization for this manager.'''
self.tools = Tools()
self.pid = pid
self.rapumaHome = os.environ.get('RAPUMA_BASE')
self.userHome = os.environ.get('RAPUMA_USER')
self.user = UserConfig()
self.userConfig = self.user.userConfig
self.local = ProjLocal(pid)
示例11: Fixed
class Fixed (Manager) :
# Shared values
xmlConfFile = 'fixed.xml'
def __init__(self, project, cfg, cType) :
'''Do the primary initialization for this manager.'''
super(Fixed, self).__init__(project, cfg)
# Set values for this manager
self.gid = project.gid
self.pid = project.projectIDCode
self.tools = Tools()
self.project = project
self.projectConfig = project.projectConfig
self.cfg = cfg
self.cType = cType
self.Ctype = cType.capitalize()
self.log = project.log
self.manager = self.cType + '_Fixed'
self.managers = project.managers
self.rapumaXmlTextConfig = os.path.join(self.project.local.rapumaConfigFolder, self.xmlConfFile)
# import pdb; pdb.set_trace()
# Get persistant values from the config if there are any
newSectionSettings = self.tools.getPersistantSettings(self.project.projectConfig['Managers'][self.manager], self.rapumaXmlTextConfig)
if newSectionSettings != self.project.projectConfig['Managers'][self.manager] :
self.project.projectConfig['Managers'][self.manager] = newSectionSettings
self.tools.writeConfFile(self.project.projectConfig)
self.compSettings = self.project.projectConfig['Managers'][self.manager]
for k, v in self.compSettings.iteritems() :
setattr(self, k, v)
# Log messages for this module
self.errorCodes = {
'0000' : ['MSG', 'Placeholder message'],
}
示例12: __init__
def __init__(self, layoutConfig) :
'''Do the primary initialization for this class.'''
self.tools = Tools()
self.layoutConfig = layoutConfig
# Log messages for this module
self.errorCodes = {
'0000' : ['MSG', 'Placeholder message'],
}
示例13: __init__
def __init__(self, pid) :
'''Do the primary initialization for this class.'''
self.pid = pid
self.tools = Tools()
self.user = UserConfig()
self.log = ProjLog(pid)
self.userConfig = self.user.userConfig
self.proj_config = Config(pid)
self.proj_config.getProjectConfig()
self.projectConfig = self.proj_config.projectConfig
self.proj_config.getFontConfig()
self.fontConfig = self.proj_config.fontConfig
self.local = ProjLocal(pid, self.projectConfig)
# Load all font settings for use in this module
if self.fontConfig :
for k, v in self.fontConfig['GeneralSettings'].iteritems() :
setattr(self, k, v)
# Log messages for this module
self.errorCodes = {
'FONT-000' : ['MSG', 'Font module messages'],
'FONT-005' : ['MSG', 'FONT-005 - Unassigned error message ID.'],
'FONT-015' : ['MSG', 'FONT-015 - Unassigned error message ID.'],
'FONT-020' : ['ERR', 'Failed to find font setting in ParaTExt project (.ssf file). A primary font must be set before this component can be successfully rendered.'],
'FONT-025' : ['ERR', 'No source editor was found for this project. Please enter this setting before continuing.'],
'FONT-042' : ['MSG', 'The [<<1>>] font setup information was added to project config'],
'FONT-050' : ['ERR', 'Halt! [<<1>>] not found. - font.copyInFont()'],
'FONT-070' : ['LOG', 'Copied the [<<1>>] font file into the project. - proj_font.copyInFont()'],
'FONT-100' : ['ERR', 'This function has not been implemented yet!. - proj_font.setGlyphMap()'],
'0010' : ['LOG', 'Wrote out new font configuration (font.__init__())'],
'1220' : ['ERR', 'The Font bundle file [<<1>>] could not be found. Process halted.'],
'1235' : ['MSG', 'Font [<<1>>] has been installed into the project.'],
'1237' : ['MSG', 'Font [<<1>>] has been updated.'],
'1240' : ['ERR', 'Font bundle file [<<1>>] not found.'],
'1241' : ['ERR', 'Font bundle [<<1>>] not found.'],
'1245' : ['LOG', '<<1>> font setup information added to project config'],
'1250' : ['ERR', 'The [<<1>>] font is apparently part of this project. Please remove before trying to re-add this font.'],
'1260' : ['MSG', 'The <<1>> font bundle has been copied into the project font folder.'],
'1262' : ['LOG', 'The <<1>> font bundle already exsits in the font folder.'],
'1265' : ['ERR', 'Failed to extract the [<<1>>] font bundle into the project. Font install process failed.'],
'1267' : ['LOG', 'The <<1>> font bundle has been copied into the project font folder.'],
'1280' : ['MSG', 'Failed to install the font: [<<1>>] into the project.'],
'1370' : ['LOG', 'Removed [<<1>>] font name from project component type: [<<2>>].'],
'1380' : ['MSG', 'Removed the [<<1>>] font from the project.'],
'1382' : ['MSG', 'Force switch was set (-f). This process has completely removed the [<<1>>] font and settings from the project. - proj_font.removeFont()'],
'1390' : ['LOG', 'Removed the [<<1>>] font package.'],
'1395' : ['MSG', 'Could not remove the [<<1>>] font package. It may be used by another group. Use force (-f) to remove the package from the font folder.']
}
示例14: __init__
def __init__(self, pid, gid=None) :
'''Do the primary initialization for this class.'''
self.pid = pid
self.gid = gid
self.user = UserConfig()
self.userConfig = self.user.userConfig
self.projHome = os.path.join(os.path.expanduser(self.userConfig['Resources']['projects']), self.pid)
self.local = ProjLocal(pid, gid)
self.tools = Tools()
self.log = ProjLog(pid)
# Create config placeholders
self.projectConfig = None
self.adjustmentConfig = None
self.layoutConfig = None
self.illustrationConfig = None
self.fontConfig = None
self.macroConfig = None
# Log messages for this module
self.errorCodes = {
'3100' : ['ERR', 'Macro package: [<<1>>] already exists in the project. Use force (-f) to reinstall.'],
'3200' : ['ERR', 'Failed to install macro package: [<<1>>]'],
'3300' : ['MSG', 'Install macro package: [<<1>>], Reinitialized [<<2>>]'],
'3310' : ['ERR', 'Failed to copy [<<1>>] to folder [<<2>>].'],
'3400' : ['MSG', 'Force set to True. Removed macro package configuration file: [<<1>>]'],
'3500' : ['MSG', 'Removed macro package [<<1>>] folder and all files contained.'],
'3600' : ['MSG', 'Updated macro package [<<1>>]'],
'3650' : ['ERR', 'Failed to updated macro package [<<1>>]']
}
# Test for gid before trying to finish the init
# import pdb; pdb.set_trace()
if gid :
if not self.projectConfig :
self.getProjectConfig()
# We need to skip over this if the group doesn't exist
try :
# Reinitialize local
self.cType = self.projectConfig['Groups'][gid]['cType']
self.Ctype = self.cType.capitalize()
self.local = ProjLocal(pid, gid, self.cType)
except :
self.cType = None
self.Ctype = None
else :
self.cType = None
self.Ctype = None
示例15: __init__
def __init__(self, pid, gid) :
'''Do the primary initialization for this class.'''
self.pid = pid
self.gid = gid
self.tools = Tools()
self.local = ProjLocal(pid)
self.user = UserConfig()
self.userConfig = self.user.userConfig
self.proj_config = Config(pid, gid)
self.proj_config.getProjectConfig()
self.proj_config.getLayoutConfig()
self.proj_config.getIllustrationConfig()
self.projectConfig = self.proj_config.projectConfig
self.layoutConfig = self.proj_config.layoutConfig
self.illustrationConfig = self.proj_config.illustrationConfig
self.cType = self.projectConfig['Groups'][gid]['cType']
self.Ctype = self.cType.capitalize()
self.log = ProjLog(pid)
self.backgroundTypes = ['watermark', 'lines']
# Folder paths
self.projComponentFolder = self.local.projComponentFolder
self.projIllustrationFolder = self.local.projIllustrationFolder
self.projConfFolder = self.local.projConfFolder
# Log messages for this module
self.errorCodes = {
'0000' : ['MSG', 'Placeholder message'],
'0010' : ['ERR', 'Component type [<<1>>] not recognized!'],
'0210' : ['WRN', 'Cannot copy [<<1>>] into the project Illustration folder. File already exists. Please use remove or update commands if the file needs to be replaced.'],
'0220' : ['MSG', 'Copied [<<1>>] into the project Illustration folder.'],
'0230' : ['ERR', 'Failed to Copy [<<1>>] into the project Illustration folder.'],
'0240' : ['MSG', 'Illustration add operation complete!'],
'0265' : ['LOG', 'Piclist file for [<<1>>] has been created.'],
'0270' : ['WRN', 'Illustration file [<<1>>] not found in Illustration folder.'],
'0280' : ['ERR', 'There was a problem trying to import the illustration file(s). A possible cause could be that there was no \\fig markers in the source imported into the project. I\'m just say\'n.'],
'1010' : ['MSG', 'Removed illustration file [<<1>>] from project Illustration folder.'],
'1020' : ['LOG', 'Request to removed illustration file [<<1>>] from project Illustration folder. File not found. Operation not complete'],
'1030' : ['MSG', 'Illustration remove operation complete!'],
'2010' : ['MSG', 'Updated illustration file [<<1>>] in project Illustration folder.'],
'2020' : ['ERR', 'Update failed, file [<<1>>] not found in project Illustration folder. Use add illustration command to install the illustration.'],
'2030' : ['ERR', 'Update failed on file [<<1>>]. Copy proceedure failed.'],
'2040' : ['MSG', 'Illustration update operation complete!']
}