.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. currentmodule:: wx.lib.agw.shortcuteditor .. highlight:: python .. _wx.lib.agw.shortcuteditor.ListShortcut: ========================================================================================================================================== |phoenix_title| **wx.lib.agw.shortcuteditor.ListShortcut** ========================================================================================================================================== :class:`ListShortcut` is a subclass of :class:`~wx.lib.agw.hypertreelist.HyperTreeList`, customized to look like the GIMP main shortcut list. This class is used to display the shortcut label (with an optional bitmap next to it), its accelerator and the help string associated with it (if present). This information is displayed in 3 columns inside :class:`ListShortcut`. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class ListShortcut:
| |super_classes| Known Superclasses ================================== :class:`wx.lib.agw.hypertreelist.HyperTreeList`, :class:`wx.lib.mixins.treemixin.ExpansionState` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.__init__` Default class constructor. :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.AcceptShortcut` Returns ``True`` if the input `accelerator` is a valid shortcut, ``False`` otherwise. :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.BuildImageList` Recursively builds the :class:`ListShortcut` image list based on the bitmaps in the :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.CalculateOffset` Calculates an offset (in pixels) so that the :class:`Shortcut` items without :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.DisableShortcut` If the user decides to reassign a shortcut to another item, this method will disable :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.FireShortcutChanged` Fires the ``EVT_SHORTCUT_CHANGED`` event for :class:`ListShortcut`. :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.FireShortcutChanging` Fires the ``EVT_SHORTCUT_CHANGING`` event for :class:`ListShortcut`. :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.GetItemIdentity` Return a hashable object that represents the identity of a :class:`ListShortcut` item. :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.HasFlag` Overridden from :class:`wx.Window` as a workaround on the conflicts between `treemixin` and :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.MakeImageList` Builds the :class:`ListShortcut` image list based on the bitmaps in the :class:`Shortcut` hierarchy. :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.OnExpandCollapse` Handles the ``wx.EVT_TREE_ITEM_COLLAPSED`` / ``wx.EVT_TREE_ITEM_EXPANDED`` events for :class:`ListShortcut`. :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.OnKillFocus` Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`ListShortcut`. :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.OnLeftDown` Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`ListShortcut`. :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.OnSelChanged` Handles the ``wx.EVT_TREE_SEL_CHANGED`` event for :class:`ListShortcut`. :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.OnShortcut` Handles the ``wx.EVT_CHAR_HOOK`` event for :class:`ShortcutEditor`, implemented in :class:`ListShortcut` :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.Populate` Recursively populates the :class:`ListShortcut` with information from the :class:`Shortcut` tree. :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.RecreateTree` Recreates the entire :class:`ListShortcut` (columns excluded). :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.SetFilter` Sets the `filter` string against all the shortcuts in the :class:`ListShortcut` are matched. :meth:`~wx.lib.agw.shortcuteditor.ListShortcut.ShowShortcutText` Shows/Hides a :class:`TextCtrl` used to display the combination of keystrokes the user ================================================================================ ================================================================================ | |api| Class API =============== .. class:: ListShortcut(HTL.HyperTreeList, treemixin.ExpansionState) :class:`ListShortcut` is a subclass of :class:`~wx.lib.agw.hypertreelist.HyperTreeList`, customized to look like the GIMP main shortcut list. This class is used to display the shortcut label (with an optional bitmap next to it), its accelerator and the help string associated with it (if present). This information is displayed in 3 columns inside :class:`ListShortcut`. .. method:: __init__(self, parent) Default class constructor. :param `parent`: an instance of :class:`ShortcutEditor`. .. method:: AcceptShortcut(self, shortcut, accelerator) Returns ``True`` if the input `accelerator` is a valid shortcut, ``False`` otherwise. :param `shortcut`: an instance of :class:`Shortcut`; :param string `accelerator`: the new accelerator to check. .. note:: Conflicting shortcuts are handled inside this method by presenting the user with a conflict dialog. At this point the user can decide to reassign an existing shortcut or to back away, in which case this method will return ``False``. .. method:: BuildImageList(self, shortcut=None, index=None) Recursively builds the :class:`ListShortcut` image list based on the bitmaps in the :class:`Shortcut` hierarchy. :param `shortcut`: an instance of :class:`Shortcut`. If ``None``, it is defaulted to `self.manager` to make this function reentrant (i.e. allow more than one enumeration on one and the same object simultaneously); :param integer `index`: the current image index inside the :class:`ListShortcut` own :class:`wx.ImageList`. .. method:: CalculateOffset(self) Calculates an offset (in pixels) so that the :class:`Shortcut` items without a bitmap look parallel to the ones with a bitmap. .. method:: DisableShortcut(self, conflict, item=None) If the user decides to reassign a shortcut to another item, this method will disable the conflicting shortcut (by putting a "Disabled" string as its accelerator). :param `conflict`: an instance of :class:`Shortcut` to reset; :param `item`: an instance of :class:`~wx.lib.agw.customtreectrl.GenericTreeItem`. If defaulted to ``None``, it is set to the :class:`ListShortcut` root item and used only to make this function reentrant (i.e. allow more than one enumeration on one and the same object simultaneously). .. method:: FireShortcutChanged(self, shortcut, newAccel) Fires the ``EVT_SHORTCUT_CHANGED`` event for :class:`ListShortcut`. :param `shortcut`: an instance of :class:`Shortcut` that has been renamed; :param string `newAccel`: the new accelerator just entered by the user. .. method:: FireShortcutChanging(self, shortcut, newAccel) Fires the ``EVT_SHORTCUT_CHANGING`` event for :class:`ListShortcut`. The event propagation (and thus the shortcut renaming by the user) can be interrupted by *not* calling `event.Skip()` in your handler for this event. :param `shortcut`: an instance of :class:`Shortcut` that is about to be renamed; :param string `newAccel`: the new accelerator just entered by the user. .. method:: GetItemIdentity(self, item) Return a hashable object that represents the identity of a :class:`ListShortcut` item. In this implementation this returns the item label. :param `item`: an instance of :class:`~wx.lib.agw.customtreectrl.GenericTreeItem`. .. method:: HasFlag(self, flag) Overridden from :class:`wx.Window` as a workaround on the conflicts between `treemixin` and :class:`~wx.lib.agw.hypertreelist.HyperTreeList` with the ``wx.TR_HIDE_ROOT`` `agwStyle` set. :param integer `flag`: an integer bit flag specifying the `agwStyle` style. :return: ``True`` if the :class:`ListShortcut` has the input `flag` set, ``False`` otherwise. .. note:: Overridden from :class:`wx.Window`. .. method:: MakeImageList(self) Builds the :class:`ListShortcut` image list based on the bitmaps in the :class:`Shortcut` hierarchy. .. method:: OnExpandCollapse(self, event) Handles the ``wx.EVT_TREE_ITEM_COLLAPSED`` / ``wx.EVT_TREE_ITEM_EXPANDED`` events for :class:`ListShortcut`. :param `event`: an instance of :class:`TreeEvent`. .. method:: OnKillFocus(self, event) Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`ListShortcut`. :param `event`: an instance of :class:`FocusEvent`. .. method:: OnLeftDown(self, event) Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`ListShortcut`. :param `event`: an instance of :class:`MouseEvent`. .. method:: OnSelChanged(self, event) Handles the ``wx.EVT_TREE_SEL_CHANGED`` event for :class:`ListShortcut`. :param `event`: an instance of :class:`TreeEvent`. .. method:: OnShortcut(self, event) Handles the ``wx.EVT_CHAR_HOOK`` event for :class:`ShortcutEditor`, implemented in :class:`ListShortcut` as it is easier to deal with in this class. :param `event`: an instance of :class:`KeyEvent`. .. method:: Populate(self, item=None, shortcut=None) Recursively populates the :class:`ListShortcut` with information from the :class:`Shortcut` tree. :param `item`: an instance of :class:`~wx.lib.agw.customtreectrl.GenericTreeItem`. If ``None``, it is defaulted to the :class:`ListShortcut` root item to make this function reentrant (i.e. allow more than one enumeration on one and the same object simultaneously); :param `shortcut`: an instance of :class:`Shortcut`. If ``None``, it is defaulted to `self.manager` to make this function reentrant (i.e. allow more than one enumeration on one and the same object simultaneously). .. method:: RecreateTree(self) Recreates the entire :class:`ListShortcut` (columns excluded). .. method:: SetFilter(self, filter='') Sets the `filter` string against all the shortcuts in the :class:`ListShortcut` are matched. :param string `filter`: a string to match. .. method:: ShowShortcutText(self, show) Shows/Hides a :class:`TextCtrl` used to display the combination of keystrokes the user has entered. This :class:`TextCtrl` remains visible only for a short amount of time and only when some keys are down. :param bool `show`: ``True`` to show the :class:`TextCtrl`, ``False`` to hide it.