Package wx :: Package lib :: Module docview :: Class DocManager
[frames | no frames]

Type DocManager

object --+        
         |        
    Object --+    
             |    
    EvtHandler --+
                 |
                DocManager


The wxDocManager class is part of the document/view framework supported by wxWindows, and cooperates with the wxView, wxDocument and wxDocTemplate classes.


Method Summary
  __init__(self, flags, initialize)
Constructor.
  ActivateView(self, view, activate, deleting)
Sets the current view.
  AddDocument(self, document)
Adds the document to the list of documents.
  AddFileToHistory(self, fileName)
Adds a file to the file history list, if we have a pointer to an appropriate file menu.
  AssociateTemplate(self, docTemplate)
Adds the template to the document manager's template list.
  Clear(self, force)
Closes all currently opened document by callling CloseDocuments and clears the document manager's templates.
  CloseDocument(self, doc, force)
Closes the specified document.
  CloseDocuments(self, force)
Closes all currently opened documents.
  CreateDocument(self, path, flags)
Creates a new document in a manner determined by the flags parameter, which can be:
  CreateView(self, doc, flags)
Creates a new view for the given document.
  DeleteTemplate(self, template, flags)
Placeholder, not yet implemented in wxWindows.
  Destroy(self)
Destructor.
  DisassociateTemplate(self, docTemplate)
Removes the template from the list of templates.
  FileHistoryAddFilesToMenu(self, menu)
Appends the files in the history list, to all menus managed by the file history object.
  FileHistoryLoad(self, config)
Loads the file history from a config object.
  FileHistoryRemoveMenu(self, menu)
Removes the given menu from the list of menus managed by the file history object.
  FileHistorySave(self, config)
Saves the file history into a config object.
  FileHistoryUseMenu(self, menu)
Use this menu for appending recently-visited document filenames, for convenient access.
  FindSuitableParent(self)
Returns a parent frame or dialog, either the frame with the current focus or if there is no current focus the application's top frame.
  FindTemplateForPath(self, path)
Given a path, try to find template that matches the extension.
  FlushDoc(self, doc)
Placeholder, not yet implemented in wxWindows.
  GetCurrentDocument(self)
Returns the document associated with the currently active view (if any).
  GetCurrentView(self)
Returns the currently active view.
  GetDocuments(self)
Returns the list of documents.
  GetFileHistory(self)
Returns the file history.
  GetFlags(self)
Returns the document manager's flags.
  GetHistoryFile(self, i)
Returns the file at index i from the file history.
  GetHistoryFilesCount(self)
Returns the number of files currently stored in the file history.
  GetLastActiveView(self)
Returns the last active view.
  GetMaxDocsOpen(self)
Returns the number of documents that can be open simultaneously.
  GetTemplates(self)
Returns the document manager's template list.
  Initialize(self)
Initializes data; currently just calls OnCreateFileHistory.
  MakeDefaultName(self)
Returns a suitable default name.
  MakeFrameTitle(self)
Returns a suitable title for a document frame.
  MatchTemplate(self, path)
Placeholder, not yet implemented in wxWindows.
  OnCreateFileHistory(self)
A hook to allow a derived class to create a different type of file history.
  OnFileClose(self, event)
Closes and deletes the currently active document.
  OnFileCloseAll(self, event)
Closes and deletes all the currently opened documents.
  OnFileNew(self, event)
Creates a new document and reads in the selected file.
  OnFileOpen(self, event)
Creates a new document and reads in the selected file.
  OnFileRevert(self, event)
Reverts the current document by calling wxDocument.Save for the current document.
  OnFileSave(self, event)
Saves the current document by calling wxDocument.Save for the current document.
  OnFileSaveAs(self, event)
Calls wxDocument.SaveAs for the current document.
  OnOpenFileFailure(self)
Called when there is an error opening a file.
  OnPreview(self, event)
Previews the current document by calling its View's OnCreatePrintout method.
  OnPrint(self, event)
Prints the current document by calling its View's OnCreatePrintout method.
  OnPrintSetup(self, event)
Presents the print setup dialog.
  OnRedo(self, event)
Issues a Redo command to the current document's command processor.
  OnUndo(self, event)
Issues an Undo command to the current document's command processor.
  OnUpdateFileClose(self, event)
Updates the user interface for the File Close command.
  OnUpdateFileCloseAll(self, event)
Updates the user interface for the File Close All command.
  OnUpdateFileNew(self, event)
Updates the user interface for the File New command.
  OnUpdateFileOpen(self, event)
Updates the user interface for the File Open command.
  OnUpdateFileRevert(self, event)
Updates the user interface for the File Revert command.
  OnUpdateFileSave(self, event)
Updates the user interface for the File Save command.
  OnUpdateFileSaveAs(self, event)
Updates the user interface for the File Save As command.
  OnUpdatePreview(self, event)
Updates the user interface for the Print Preview command.
  OnUpdatePrint(self, event)
Updates the user interface for the Print command.
  OnUpdatePrintSetup(self, event)
Updates the user interface for the Print Setup command.
  OnUpdateRedo(self, event)
Updates the user interface for the Redo command.
  OnUpdateUndo(self, event)
Updates the user interface for the Undo command.
  ProcessEvent(self, event)
Processes an event, searching event tables and calling zero or more suitable event handler function(s).
  ProcessUpdateUIEvent(self, event)
Processes a UI event, searching event tables and calling zero or more suitable event handler function(s).
  RemoveDocument(self, doc)
Removes the document from the list of documents.
  RemoveFileFromHistory(self, i)
Removes a file from the file history list, if we have a pointer to an appropriate file menu.
  SelectDocumentPath(self, templates, flags, save)
Under Windows, pops up a file selector with a list of filters corresponding to document templates.
  SelectDocumentType(self, temps, sort)
Returns a document template by asking the user (if there is more than one template).
  SelectViewType(self, temps, sort)
Returns a document template by asking the user (if there is more than one template), displaying a list of valid views.
  SetMaxDocsOpen(self, maxDocsOpen)
Sets the maximum number of documents that can be open at a time.

Property Summary

Method Details

__init__(self, flags=0, initialize=True)
(Constructor)

Constructor. Create a document manager instance dynamically near the start of your application before doing any document or view operations.

flags is used in the Python version to indicate whether the document manager is in DOC_SDI or DOC_MDI mode.

If initialize is true, the Initialize function will be called to create a default history list object. If you derive from wxDocManager, you may wish to call the base constructor with false, and then call Initialize in your own constructor, to allow your own Initialize or OnCreateFileHistory functions to be called.

Overrides:
wx.EvtHandler.__init__

ActivateView(self, view, activate=True, deleting=False)

Sets the current view.

AddDocument(self, document)

Adds the document to the list of documents.

AddFileToHistory(self, fileName)

Adds a file to the file history list, if we have a pointer to an appropriate file menu.

AssociateTemplate(self, docTemplate)

Adds the template to the document manager's template list.

Clear(self, force=True)

Closes all currently opened document by callling CloseDocuments and clears the document manager's templates.

CloseDocument(self, doc, force=True)

Closes the specified document.

CloseDocuments(self, force=True)

Closes all currently opened documents.

CreateDocument(self, path, flags=0)

Creates a new document in a manner determined by the flags parameter, which can be:

wx.lib.docview.DOC_NEW Creates a fresh document. wx.lib.docview.DOC_SILENT Silently loads the given document file.

If wx.lib.docview.DOC_NEW is present, a new document will be created and returned, possibly after asking the user for a template to use if there is more than one document template. If wx.lib.docview.DOC_SILENT is present, a new document will be created and the given file loaded into it. If neither of these flags is present, the user will be presented with a file selector for the file to load, and the template to use will be determined by the extension (Windows) or by popping up a template choice list (other platforms).

If the maximum number of documents has been reached, this function will delete the oldest currently loaded document before creating a new one.

wxPython version supports the document manager's wx.lib.docview.DOC_OPEN_ONCE and wx.lib.docview.DOC_NO_VIEW flag.

if wx.lib.docview.DOC_OPEN_ONCE is present, trying to open the same file multiple times will just return the same document. if wx.lib.docview.DOC_NO_VIEW is present, opening a file will generate the document, but not generate a corresponding view.

CreateView(self, doc, flags=0)

Creates a new view for the given document. If more than one view is allowed for the document (by virtue of multiple templates mentioning the same document type), a choice of view is presented to the user.

DeleteTemplate(self, template, flags)

Placeholder, not yet implemented in wxWindows.

Destroy(self)

Destructor.

Overrides:
wx.Object.Destroy

DisassociateTemplate(self, docTemplate)

Removes the template from the list of templates.

FileHistoryAddFilesToMenu(self, menu=None)

Appends the files in the history list, to all menus managed by the file history object.

If menu is specified, appends the files in the history list to the given menu only.

FileHistoryLoad(self, config)

Loads the file history from a config object.

FileHistoryRemoveMenu(self, menu)

Removes the given menu from the list of menus managed by the file history object.

FileHistorySave(self, config)

Saves the file history into a config object. This must be called explicitly by the application.

FileHistoryUseMenu(self, menu)

Use this menu for appending recently-visited document filenames, for convenient access. Calling this function with a valid menu enables the history list functionality.

Note that you can add multiple menus using this function, to be managed by the file history object.

FindSuitableParent(self)

Returns a parent frame or dialog, either the frame with the current focus or if there is no current focus the application's top frame.

FindTemplateForPath(self, path)

Given a path, try to find template that matches the extension. This is only an approximate method of finding a template for creating a document.

Note this wxPython verson looks for and returns a default template if no specific template is found.

FlushDoc(self, doc)

Placeholder, not yet implemented in wxWindows.

GetCurrentDocument(self)

Returns the document associated with the currently active view (if any).

GetCurrentView(self)

Returns the currently active view.

GetDocuments(self)

Returns the list of documents.

GetFileHistory(self)

Returns the file history.

GetFlags(self)

Returns the document manager's flags. This method has been added to wxPython and is not in wxWindows.

GetHistoryFile(self, i)

Returns the file at index i from the file history.

GetHistoryFilesCount(self)

Returns the number of files currently stored in the file history.

GetLastActiveView(self)

Returns the last active view. This is used in the SDI framework where dialogs can be mistaken for a view and causes the framework to deactivete the current view. This happens when something like a custom dialog box used to operate on the current view is shown.

GetMaxDocsOpen(self)

Returns the number of documents that can be open simultaneously.

GetTemplates(self)

Returns the document manager's template list. This method has been added to wxPython and is not in wxWindows.

Initialize(self)

Initializes data; currently just calls OnCreateFileHistory. Some data cannot always be initialized in the constructor because the programmer must be given the opportunity to override functionality. In fact Initialize is called from the wxDocManager constructor, but this can be vetoed by passing false to the second argument, allowing the derived class's constructor to call Initialize, possibly calling a different OnCreateFileHistory from the default.

The bottom line: if you're not deriving from Initialize, forget it and construct wxDocManager with no arguments.

MakeDefaultName(self)

Returns a suitable default name. This is implemented by appending an integer counter to the string "Untitled" and incrementing the counter.

MakeFrameTitle(self)

Returns a suitable title for a document frame. This is implemented by appending the document name to the application name.

MatchTemplate(self, path)

Placeholder, not yet implemented in wxWindows.

OnCreateFileHistory(self)

A hook to allow a derived class to create a different type of file history. Called from Initialize.

OnFileClose(self, event)

Closes and deletes the currently active document.

OnFileCloseAll(self, event)

Closes and deletes all the currently opened documents.

OnFileNew(self, event)

Creates a new document and reads in the selected file.

OnFileOpen(self, event)

Creates a new document and reads in the selected file.

OnFileRevert(self, event)

Reverts the current document by calling wxDocument.Save for the current document.

OnFileSave(self, event)

Saves the current document by calling wxDocument.Save for the current document.

OnFileSaveAs(self, event)

Calls wxDocument.SaveAs for the current document.

OnOpenFileFailure(self)

Called when there is an error opening a file.

OnPreview(self, event)

Previews the current document by calling its View's OnCreatePrintout method.

OnPrint(self, event)

Prints the current document by calling its View's OnCreatePrintout method.

OnPrintSetup(self, event)

Presents the print setup dialog.

OnRedo(self, event)

Issues a Redo command to the current document's command processor.

OnUndo(self, event)

Issues an Undo command to the current document's command processor.

OnUpdateFileClose(self, event)

Updates the user interface for the File Close command.

OnUpdateFileCloseAll(self, event)

Updates the user interface for the File Close All command.

OnUpdateFileNew(self, event)

Updates the user interface for the File New command.

OnUpdateFileOpen(self, event)

Updates the user interface for the File Open command.

OnUpdateFileRevert(self, event)

Updates the user interface for the File Revert command.

OnUpdateFileSave(self, event)

Updates the user interface for the File Save command.

OnUpdateFileSaveAs(self, event)

Updates the user interface for the File Save As command.

OnUpdatePreview(self, event)

Updates the user interface for the Print Preview command.

OnUpdatePrint(self, event)

Updates the user interface for the Print command.

OnUpdatePrintSetup(self, event)

Updates the user interface for the Print Setup command.

OnUpdateRedo(self, event)

Updates the user interface for the Redo command.

OnUpdateUndo(self, event)

Updates the user interface for the Undo command.

ProcessEvent(self, event)

Processes an event, searching event tables and calling zero or more suitable event handler function(s). Note that the ProcessEvent method is called from the wxPython docview framework directly since wxPython does not have a virtual ProcessEvent function.

Overrides:
wx.EvtHandler.ProcessEvent

ProcessUpdateUIEvent(self, event)

Processes a UI event, searching event tables and calling zero or more suitable event handler function(s). Note that the ProcessEvent method is called from the wxPython docview framework directly since wxPython does not have a virtual ProcessEvent function.

RemoveDocument(self, doc)

Removes the document from the list of documents.

RemoveFileFromHistory(self, i)

Removes a file from the file history list, if we have a pointer to an appropriate file menu.

SelectDocumentPath(self, templates, flags, save)

Under Windows, pops up a file selector with a list of filters corresponding to document templates. The wxDocTemplate corresponding to the selected file's extension is returned.

On other platforms, if there is more than one document template a choice list is popped up, followed by a file selector.

This function is used in wxDocManager.CreateDocument.

SelectDocumentType(self, temps, sort=False)

Returns a document template by asking the user (if there is more than one template). This function is used in wxDocManager.CreateDocument.

Parameters

templates - list of templates from which to choose a desired template.

sort - If more than one template is passed in in templates, then this parameter indicates whether the list of templates that the user will have to choose from is sorted or not when shown the choice box dialog. Default is false.

SelectViewType(self, temps, sort=False)

Returns a document template by asking the user (if there is more than one template), displaying a list of valid views. This function is used in wxDocManager::CreateView. The dialog normally will not appear because the array of templates only contains those relevant to the document in question, and often there will only be one such.

SetMaxDocsOpen(self, maxDocsOpen)

Sets the maximum number of documents that can be open at a time. By default, this is 10,000. If you set it to 1, existing documents will be saved and deleted when the user tries to open or create a new one (similar to the behaviour of Windows Write, for example). Allowing multiple documents gives behaviour more akin to MS Word and other Multiple Document Interface applications.


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