File: wx.lib.agw.shortcuteditor.ListShortcut.txt

package info (click to toggle)
wxpython4.0 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 211,112 kB
  • sloc: cpp: 888,355; python: 223,130; makefile: 52,087; ansic: 45,780; sh: 3,012; xml: 1,534; perl: 264
file content (265 lines) | stat: -rw-r--r-- 13,670 bytes parent folder | download
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
.. 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.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

   <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>ListShortcut</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.agw.shortcuteditor.ListShortcut_inheritance.png" alt="Inheritance diagram of ListShortcut" 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.mixins.treemixin.TreeAPIHarmonizer.html" title="wx.lib.mixins.treemixin.TreeAPIHarmonizer" alt="" coords="5,315,296,344"/> <area shape="rect" id="node7" href="wx.lib.mixins.treemixin.ExpansionState.html" title="wx.lib.mixins.treemixin.ExpansionState" alt="" coords="253,392,523,421"/> <area shape="rect" id="node2" href="wx.lib.mixins.treemixin.TreeHelper.html" title="wx.lib.mixins.treemixin.TreeHelper" alt="" coords="320,315,556,344"/> <area shape="rect" id="node3" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="568,5,669,35"/> <area shape="rect" id="node4" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="620,83,731,112"/> <area shape="rect" id="node6" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="615,160,736,189"/> <area shape="rect" id="node5" href="wx.Object.html" title="wx.Object" alt="" coords="693,5,775,35"/> <area shape="rect" id="node8" href="wx.Window.html" title="wx.Window" alt="" coords="631,237,720,267"/> <area shape="rect" id="node9" href="wx.lib.agw.shortcuteditor.ListShortcut.html" title="wx.lib.agw.shortcuteditor.ListShortcut" alt="" coords="403,469,660,499"/> <area shape="rect" id="node11" href="wx.Control.html" title="wx.Control" alt="" coords="632,315,720,344"/> <area shape="rect" id="node10" href="wx.lib.agw.hypertreelist.HyperTreeList.html" title="wx.lib.agw.hypertreelist.HyperTreeList" alt="" coords="547,392,804,421"/> </map> 
   </p>

|


|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.