translate.storage.projstore.ProjectStore

Package translate :: Package storage :: Module projstore :: Class ProjectStore |
[hide private]
[frames] | no frames]

# Class ProjectStore

source code

Basic project file container.

Instance Methods | [hide private]
__init__(self) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code
__del__(self) | source code
_get_sourcefiles(self) Read-only access to `self._sourcefiles`. | source code
_get_targetfiles(self) Read-only access to `self._targetfiles`. | source code
_get_transfiles(self) Read-only access to `self._transfiles`. | source code
__in__(self, lhs) @returns `True` if `lhs` is a file name or file object in the project store. | 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 `ftype` ('src', 'trans', 'tgt'). | source code
append_sourcefile(self, afile, fname=None) | source code
append_targetfile(self, afile, fname=None) | source code
append_transfile(self, afile, fname=None) | source code
remove_file(self, fname, ftype=None) Remove the file with the given project name from the project. | source code
remove_sourcefile(self, fname) | source code
remove_targetfile(self, fname) | source code
remove_transfile(self, fname) | source code
close(self) | source code
get_file(self, fname, mode=`'``rb``'`) Retrieve the file with the given name from the project store. | source code
get_filename_type(self, fname) Get the type of file ('src', 'trans', 'tgt') with the given name. | source code
get_proj_filename(self, realfname) Try and find a project file name for the given real file name. | source code
load(self, *args, **kwargs) Load the project in some way. | source code
save(self, filename=None, *args, **kwargs) Save the project in some way. | source code
update_file(self, pfname, infile) Remove the project file with name `pfname` and add the contents from `infile` to the project under the same file name. | source code
_fix_type_filename(self, ftype, fname) Strip the path from the filename and prepend the correct prefix. | source code
_generate_settings(self) @returns A XML string that represents the current settings. | source code
_load_settings(self, settingsxml) Load project settings from the given XML string. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]
| sourcefiles Read-only access to `self._sourcefiles`.
| targetfiles Read-only access to `self._targetfiles`.
| transfiles Read-only access to `self._transfiles`.
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self) (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 `ftype` ('src', 'trans', 'tgt'). Parameters: `delete_orig` (bool) - 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.

### remove_file(self, fname, ftype=None) | source code
Remove the file with the given project name from the project. If the file type ('src', 'trans' or 'tgt') is not given, it is guessed.

### get_file(self, fname, mode=`'``rb``'`) | source code
Retrieve the file with the given name from the project store. The file is looked up in the `self._files` dictionary. The values in this dictionary may be `None`, to indicate that the file is not cacheable and needs to be retrieved in a special way. This special way must be defined in this method of sub-classes. The value may also be a string, which indicates that it is a real file accessible via `open()`. Parameters: `mode` (str) - The mode in which to re-open the file (if it is closed) @see BundleProjectStore.get_file

### load(self, *args, **kwargs) | source code
Load the project in some way. Undefined for this (base) class.

### save(self, filename=None, *args, **kwargs) | source code
Save the project in some way. Undefined for this (base) class.

### update_file(self, pfname, infile) | source code
Remove the project file with name `pfname` and add the contents from `infile` to the project under the same file name. Returns: the results from self.append_file.

### _load_settings(self, settingsxml) | source code
Load project settings from the given XML string. `settingsxml` is parsed into a DOM tree (`lxml.etree.fromstring`) which is then inspected.

Property Details | [hide private]

### sourcefiles Read-only access to `self._sourcefiles`. Get Method: _get_sourcefiles(self) - Read-only access to `self._sourcefiles`.

### targetfiles Read-only access to `self._targetfiles`. Get Method: _get_targetfiles(self) - Read-only access to `self._targetfiles`.

### transfiles Read-only access to `self._transfiles`. Get Method: _get_transfiles(self) - Read-only access to `self._transfiles`.