Package wx :: Package lib :: Module docview :: Class DocTemplate

[frames | no frames]

## Type DocTemplate

    object --+
             |
        Object --+
                 |
                DocTemplate

Known Subclasses:
  `ChildDocTemplate`

The wxDocTemplate class is used to model the relationship between a document class and a view class.

Method Summary
| ``__init__`(self, manager, description, filter, dir, ext, docTypeName, viewTypeName, docType, viewType, flags, icon)` Constructor.
| ``CreateDocument`(self, path, flags)` Creates a new instance of the associated document class.
| ``CreateView`(self, doc, flags)` Creates a new instance of the associated document view.
| ``FileMatchesTemplate`(self, path)` Returns True if the path's extension matches one of this template's file filter extensions.
| ``GetDefaultExtension`(self)` Returns the default file extension for the document data, as passed to the document template constructor.
| ``GetDescription`(self)` Returns the text description of this template, as passed to the document template constructor.
| ``GetDirectory`(self)` Returns the default directory, as passed to the document template constructor.
| ``GetDocumentManager`(self)` Returns the document manager instance for which this template was created.
| ``GetDocumentName`(self)` Returns the document type name, as passed to the document template constructor.
| ``GetDocumentType`(self)` Returns the Python document class, as passed to the document template constructor.
| ``GetFileFilter`(self)` Returns the file filter, as passed to the document template constructor.
| ``GetFlags`(self)` Returns the flags, as passed to the document template constructor.
| ``GetIcon`(self)` Returns the icon, as passed to the document template constructor.
| ``GetViewName`(self)` Returns the view type name, as passed to the document template constructor.
| ``GetViewType`(self)` Returns the Python view class, as passed to the document template constructor.
| ``IsNewable`(self)` Returns true if the document template can be shown in "New" dialogs, false otherwise.
| ``IsVisible`(self)` Returns true if the document template can be shown in user dialogs, false otherwise.
| ``SetDefaultExtension`(self, defaultExt)` Sets the default file extension.
| ``SetDescription`(self, description)` Sets the template description.
| ``SetDirectory`(self, dir)` Sets the default directory.
| ``SetDocumentManager`(self, manager)` Sets the document manager instance for which this template was created.
| ``SetFileFilter`(self, filter)` Sets the file filter.
| ``SetFlags`(self, flags)` Sets the internal document template flags (see the constructor description for more details).
| ``SetIcon`(self, flags)` Sets the icon.

Property Summary

Method Details

### __init__(self, manager, description, filter, dir, ext, docTypeName, viewTypeName, docType, viewType, flags=1, icon=None)
(Constructor)

Constructor. Create instances dynamically near the start of your application after creating a wxDocManager instance, and before doing any document or view operations.

manager is the document manager object which manages this template.

description is a short description of what the template is for. This string will be displayed in the file filter list of Windows file selectors.

filter is an appropriate file filter such as *.txt.

dir is the default directory to use for file selectors.

ext is the default file extension (such as txt).

docTypeName is a name that should be unique for a given type of document, used for gathering a list of views relevant to a particular document.

viewTypeName is a name that should be unique for a given view.

docClass is a Python class. If this is not supplied, you will need to derive a new wxDocTemplate class and override the CreateDocument member to return a new document instance on demand.

viewClass is a Python class. If this is not supplied, you will need to derive a new wxDocTemplate class and override the CreateView member to return a new view instance on demand.

flags is a bit list of the following: wx.TEMPLATE_VISIBLE The template may be displayed to the user in dialogs.

wx.TEMPLATE_INVISIBLE The template may not be displayed to the user in dialogs.

wx.DEFAULT_TEMPLATE_FLAGS Defined as wxTEMPLATE_VISIBLE.

  Overrides:
    `wx.Object.__init__`

### CreateDocument(self, path, flags)

Creates a new instance of the associated document class. If you have not supplied a class to the template constructor, you will need to override this function to return an appropriate document instance.

### CreateView(self, doc, flags)

Creates a new instance of the associated document view. If you have not supplied a class to the template constructor, you will need to override this function to return an appropriate view instance.

### FileMatchesTemplate(self, path)

Returns True if the path's extension matches one of this template's file filter extensions.

### GetDefaultExtension(self)

Returns the default file extension for the document data, as passed to the document template constructor.

### GetDescription(self)

Returns the text description of this template, as passed to the document template constructor.

### GetDirectory(self)

Returns the default directory, as passed to the document template constructor.

### GetDocumentManager(self)

Returns the document manager instance for which this template was created.

### GetDocumentName(self)

Returns the document type name, as passed to the document template constructor.

### GetDocumentType(self)

Returns the Python document class, as passed to the document template constructor.

### GetFileFilter(self)

Returns the file filter, as passed to the document template constructor.

### GetFlags(self)

Returns the flags, as passed to the document template constructor. (see the constructor description for more details).

### GetIcon(self)

Returns the icon, as passed to the document template constructor. This method has been added to wxPython and is not in wxWindows.

### GetViewName(self)

Returns the view type name, as passed to the document template constructor.

### GetViewType(self)

Returns the Python view class, as passed to the document template constructor.

### IsNewable(self)

Returns true if the document template can be shown in "New" dialogs, false otherwise.

This method has been added to wxPython and is not in wxWindows.

### IsVisible(self)

Returns true if the document template can be shown in user dialogs, false otherwise.

### SetDefaultExtension(self, defaultExt)

Sets the default file extension.

### SetDescription(self, description)

Sets the template description.

### SetDirectory(self, dir)

Sets the default directory.

### SetDocumentManager(self, manager)

Sets the document manager instance for which this template was created. Should not be called by the application.

### SetFileFilter(self, filter)

Sets the file filter.

### SetFlags(self, flags)

Sets the internal document template flags (see the constructor description for more details).

### SetIcon(self, flags)

Sets the icon. This method has been added to wxPython and is not in wxWindows.

Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:10:02 2007 | http://epydoc.sf.net