Package translate :: Package storage :: Module bundleprojstore :: Class BundleProjectStore
[hide private]
[frames] | no frames]

Class BundleProjectStore

source code


Represents a translate project bundle (zip archive).

Instance Methods [hide private]
 
__init__(self, fname)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
append_file(self, afile, fname, ftype='trans', delete_orig=False)
Append the given file to the project with the given filename, marked to be of type C{ftype} ('src', 'trans', 'tgt').
source code
 
remove_file(self, fname, ftype=None)
Remove the file with the given project name from the project.
source code
 
close(self) source code
 
cleanup(self)
Clean up our mess: remove temporary files.
source code
 
get_file(self, fname)
Retrieve a project file (source, translation or target file) from the project archive.
source code
 
get_proj_filename(self, realfname)
Try and find a project file name for the given real file name.
source code
 
load(self, zipname)
Load the bundle project from the zip file of the given name.
source code
 
save(self, filename=None)
Save all project files to the bundle zip file.
source code
 
update_file(self, pfname, infile)
Updates the file with the given project file name with the contents of infile.
source code
 
_load_settings(self)
Grab the project.xtp file from the zip file and load it.
source code
 
_create_temp_zipfile(self)
Create a new zip file with a temporary file name (with mode 'w').
source code
 
_replace_project_zip(self, zfile)
Replace the currently used zip file (self.zip) with the given zip file.
source code
 
_update_from_tempfiles(self)
Update project files from temporary files.
source code
 
_zip_add(self, pfname, infile)
Add the contents of infile to the zip with file name pfname.
source code
 
_zip_delete(self, fnames)
Delete the files with the given names from the zip file (self.zip).
source code

Inherited from projstore.ProjectStore: __del__, __in__, append_sourcefile, append_targetfile, append_transfile, get_filename_type, remove_sourcefile, remove_targetfile, remove_transfile

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Methods [hide private]
 
from_project(cls, proj, fname=None) source code
Properties [hide private]

Inherited from projstore.ProjectStore: sourcefiles, targetfiles, transfiles

Inherited from object: __class__

Method Details [hide private]

__init__(self, fname)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

append_file(self, afile, fname, ftype='trans', delete_orig=False)

source code 
Append the given file to the project with the given filename, marked
to be of type C{ftype} ('src', 'trans', 'tgt').

@param delete_orig: If C{True}, as set by
                    L{project.convert_forward()}, C{afile} is
                    deleted after appending, if possible.
NOTE: For this implementation, the appended file will be deleted
      from disk if C{delete_orig} is C{True}.

Parameters:
  • delete_orig - Whether or not the original (given) file should be deleted after being appended. This is set to True by project.convert_forward(). Not used in this class.
Overrides: projstore.ProjectStore.append_file

remove_file(self, fname, ftype=None)

source code 

Remove the file with the given project name from the project.

Overrides: projstore.ProjectStore.remove_file

close(self)

source code 
Overrides: projstore.ProjectStore.close

get_file(self, fname)

source code 

Retrieve a project file (source, translation or target file) from the project archive.

Parameters:
  • mode - The mode in which to re-open the file (if it is closed) @see BundleProjectStore.get_file
Overrides: projstore.ProjectStore.get_file

get_proj_filename(self, realfname)

source code 

Try and find a project file name for the given real file name.

Overrides: projstore.ProjectStore.get_proj_filename

load(self, zipname)

source code 

Load the bundle project from the zip file of the given name.

Overrides: projstore.ProjectStore.load

save(self, filename=None)

source code 

Save all project files to the bundle zip file.

Overrides: projstore.ProjectStore.save

update_file(self, pfname, infile)

source code 

Updates the file with the given project file name with the contents of infile.

Returns:
the results from self.append_file.
Overrides: projstore.ProjectStore.update_file

_load_settings(self)

source code 

Grab the project.xtp file from the zip file and load it.

Overrides: projstore.ProjectStore._load_settings

_replace_project_zip(self, zfile)

source code 

Replace the currently used zip file (self.zip) with the given zip file. Basically, os.rename(zfile.filename, self.zip.filename).