phoenix_title wx.lib.agw.flatmenu.FileHistory

The FileHistory encapsulates a user interface convenience, the list of most recently visited files as shown on a menu (usually the File menu).

FileHistory can manage one or more file menus. More than one menu may be required in an MDI application, where the file history should appear on each MDI child menu as well as the MDI parent frame.


class_hierarchy Class Hierarchy

Inheritance diagram for class FileHistory:

method_summary Methods Summary

__init__

Default class constructor.

AddFilesToMenu

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

AddFilesToMenu2

Appends the files in the history list, to the given menu only.

AddFileToHistory

Adds a file to the file history list, if the object has a pointer to an

GetBaseId

Returns the base identifier for the range used for appending items.

GetCount

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

GetHistoryFile

Returns the file at this index (zero-based).

GetMaxFiles

Returns the maximum number of files that can be stored.

GetMenus

Returns the list of menus that are managed by this file history object.

GetNoHistoryFiles

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

Load

Loads the file history from the given config object.

RemoveFileFromHistory

Removes the specified file from the history.

RemoveMenu

Removes this menu from the list of those managed by this object.

Save

Saves the file history to the given config object.

SetBaseId

Sets the base identifier for the range used for appending items.

UseMenu

Adds this menu to the list of those menus that are managed by this file history


api Class API

class FileHistory(object)

The FileHistory encapsulates a user interface convenience, the list of most recently visited files as shown on a menu (usually the File menu).

FileHistory can manage one or more file menus. More than one menu may be required in an MDI application, where the file history should appear on each MDI child menu as well as the MDI parent frame.


Methods

__init__(self, maxFiles=9, idBase=wx.ID_FILE1)

Default class constructor.

Parameters:
  • maxFiles (integer) – the maximum number of files that should be stored and displayed;

  • idBase (integer) – defaults to wx.ID_FILE1 and represents the id given to the first history menu item.

Note

Since menu items can’t share the same ID you should change idBase to one of your own defined IDs when using more than one FileHistory in your application.



AddFilesToMenu(self, menu=None)

Appends the files in the history list, to all menus managed by the file history object if menu is None. Otherwise it calls the auxiliary method AddFilesToMenu2.

Parameters:

menu – if not None, an instance of FlatMenu.



AddFilesToMenu2(self, menu)

Appends the files in the history list, to the given menu only.

Parameters:

menu – an instance of FlatMenu.



AddFileToHistory(self, fnNew)

Adds a file to the file history list, if the object has a pointer to an appropriate file menu.

Parameters:

fnNew (string) – the file name to add to the history list.



GetBaseId(self)

Returns the base identifier for the range used for appending items.



GetCount(self)

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



GetHistoryFile(self, index)

Returns the file at this index (zero-based).

Parameters:

index (integer) – the index at which the file is stored in the file list (zero-based).



GetMaxFiles(self)

Returns the maximum number of files that can be stored.



GetMenus(self)

Returns the list of menus that are managed by this file history object.

See also

UseMenu.



GetNoHistoryFiles(self)

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



Load(self, config)

Loads the file history from the given config object.

Parameters:

config – an instance of Config.

Note

This function should be called explicitly by the application.

See also

Save.



RemoveFileFromHistory(self, index)

Removes the specified file from the history.

Parameters:

index (integer) – the zero-based index indicating the file name position in the file list.



RemoveMenu(self, menu)

Removes this menu from the list of those managed by this object.

Parameters:

menu – an instance of FlatMenu.



Save(self, config)

Saves the file history to the given config object.

Parameters:

config – an instance of Config.

Note

This function should be called explicitly by the application.

See also

Load.



SetBaseId(self, baseId)

Sets the base identifier for the range used for appending items.

Parameters:

baseId (integer) – the base identifier for the range used for appending items.



UseMenu(self, menu)

Adds this menu to the list of those menus that are managed by this file history object.

Parameters:

menu – an instance of FlatMenu.

See also

AddFilesToMenu for initializing the menu with filenames that are already in the history when this function is called, as this is not done automatically.