1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.docview
.. highlight:: python
.. _wx.lib.docview.DocTemplate:
==========================================================================================================================================
|phoenix_title| **wx.lib.docview.DocTemplate**
==========================================================================================================================================
The :class:`DocTemplate` class is used to model the relationship between a
document class and a view class.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>DocTemplate</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.lib.docview.DocTemplate_inheritance.png" alt="Inheritance diagram of DocTemplate" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.docview.DocTemplate.html" title="wx.lib.docview.DocTemplate" alt="" coords="5,83,200,112"/> <area shape="rect" id="node2" href="wx.Object.html" title="wx.Object" alt="" coords="61,5,143,35"/> </map>
</p>
|
|super_classes| Known Superclasses
==================================
:class:`wx.Object`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.docview.DocTemplate.__init__` Constructor. Create instances dynamically near the start of your
:meth:`~wx.lib.docview.DocTemplate.CreateDocument` Creates a new instance of the associated document class. If you have
:meth:`~wx.lib.docview.DocTemplate.CreateView` Creates a new instance of the associated document view. If you have
:meth:`~wx.lib.docview.DocTemplate.FileMatchesTemplate` Returns ``True`` if the path's extension matches one of this template's
:meth:`~wx.lib.docview.DocTemplate.GetDefaultExtension` Returns the default file extension for the document data, as passed to
:meth:`~wx.lib.docview.DocTemplate.GetDescription` Returns the text description of this template, as passed to the
:meth:`~wx.lib.docview.DocTemplate.GetDirectory` Returns the default directory, as passed to the document template
:meth:`~wx.lib.docview.DocTemplate.GetDocumentManager` Returns the document manager instance for which this template was
:meth:`~wx.lib.docview.DocTemplate.GetDocumentName` Returns the document type name, as passed to the document template
:meth:`~wx.lib.docview.DocTemplate.GetDocumentType` Returns the Python document class, as passed to the document template
:meth:`~wx.lib.docview.DocTemplate.GetFileFilter` Returns the file filter, as passed to the document template
:meth:`~wx.lib.docview.DocTemplate.GetFlags` Returns the flags, as passed to the document template constructor.
:meth:`~wx.lib.docview.DocTemplate.GetIcon` Returns the icon, as passed to the document template
:meth:`~wx.lib.docview.DocTemplate.GetViewName` Returns the view type name, as passed to the document template
:meth:`~wx.lib.docview.DocTemplate.GetViewType` Returns the Python view class, as passed to the document template
:meth:`~wx.lib.docview.DocTemplate.IsNewable` Returns true if the document template can be shown in "New" dialogs,
:meth:`~wx.lib.docview.DocTemplate.IsVisible` Returns true if the document template can be shown in user dialogs,
:meth:`~wx.lib.docview.DocTemplate.SetDefaultExtension` Sets the default file extension.
:meth:`~wx.lib.docview.DocTemplate.SetDescription` Sets the template description.
:meth:`~wx.lib.docview.DocTemplate.SetDirectory` Sets the default directory.
:meth:`~wx.lib.docview.DocTemplate.SetDocumentManager` Sets the document manager instance for which this template was
:meth:`~wx.lib.docview.DocTemplate.SetFileFilter` Sets the file filter.
:meth:`~wx.lib.docview.DocTemplate.SetFlags` Sets the internal document template flags (see the constructor
:meth:`~wx.lib.docview.DocTemplate.SetIcon` Sets the icon.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: DocTemplate(wx.Object)
The :class:`DocTemplate` class is used to model the relationship between a
document class and a view class.
.. method:: __init__(self, manager, description, filter, dir, ext, docTypeName, viewTypeName, docType, viewType, flags=DEFAULT_TEMPLATE_FLAGS, icon=None)
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:
``TEMPLATE_VISIBLE``: The template may be displayed to the user in
dialogs.
``TEMPLATE_INVISIBLE``: The template may not be displayed to the user in
dialogs.
``DEFAULT_TEMPLATE_FLAGS``: Defined as ``TEMPLATE_VISIBLE``.
.. method:: 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.
.. method:: 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.
.. method:: FileMatchesTemplate(self, path)
Returns ``True`` if the path's extension matches one of this template's
file filter extensions.
.. method:: GetDefaultExtension(self)
Returns the default file extension for the document data, as passed to
the document template constructor.
.. method:: GetDescription(self)
Returns the text description of this template, as passed to the
document template constructor.
.. method:: GetDirectory(self)
Returns the default directory, as passed to the document template
constructor.
.. method:: GetDocumentManager(self)
Returns the document manager instance for which this template was
created.
.. method:: GetDocumentName(self)
Returns the document type name, as passed to the document template
constructor.
.. method:: GetDocumentType(self)
Returns the Python document class, as passed to the document template
constructor.
.. method:: GetFileFilter(self)
Returns the file filter, as passed to the document template
constructor.
.. method:: GetFlags(self)
Returns the flags, as passed to the document template constructor.
(see the constructor description for more details).
.. method:: GetIcon(self)
Returns the icon, as passed to the document template
constructor.
.. method:: GetViewName(self)
Returns the view type name, as passed to the document template
constructor.
.. method:: GetViewType(self)
Returns the Python view class, as passed to the document template
constructor.
.. method:: IsNewable(self)
Returns true if the document template can be shown in "New" dialogs,
false otherwise.
.. method:: IsVisible(self)
Returns true if the document template can be shown in user dialogs,
false otherwise.
.. method:: SetDefaultExtension(self, defaultExt)
Sets the default file extension.
.. method:: SetDescription(self, description)
Sets the template description.
.. method:: SetDirectory(self, dir)
Sets the default directory.
.. method:: SetDocumentManager(self, manager)
Sets the document manager instance for which this template was
created. Should not be called by the application.
.. method:: SetFileFilter(self, filter)
Sets the file filter.
.. method:: SetFlags(self, flags)
Sets the internal document template flags (see the constructor
description for more details).
.. method:: SetIcon(self, flags)
Sets the icon.
|