File: wx.lib.masked.timectrl.TimeCtrl.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 (332 lines) | stat: -rw-r--r-- 15,736 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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
.. 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.masked.timectrl

.. highlight:: python



.. _wx.lib.masked.timectrl.TimeCtrl:

==========================================================================================================================================
|phoenix_title|  **wx.lib.masked.timectrl.TimeCtrl**
==========================================================================================================================================

Masked control providing several time formats and manipulation of time values.



|

|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>TimeCtrl</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.masked.timectrl.TimeCtrl_inheritance.png" alt="Inheritance diagram of TimeCtrl" 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.TextCtrl.html" title="wx.TextCtrl" alt="" coords="327,392,416,421"/> <area shape="rect" id="node9" href="wx.lib.masked.textctrl.BaseMaskedTextCtrl.html" title="wx.lib.masked.textctrl.BaseMaskedTextCtrl" alt="" coords="117,469,408,499"/> <area shape="rect" id="node2" href="wx.Control.html" title="wx.Control" alt="" coords="268,315,356,344"/> <area shape="rect" id="node3" href="wx.TextEntry.html" title="wx.TextEntry" alt="" coords="381,315,480,344"/> <area shape="rect" id="node4" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="204,5,305,35"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="256,83,367,112"/> <area shape="rect" id="node8" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="251,160,372,189"/> <area shape="rect" id="node6" href="wx.Object.html" title="wx.Object" alt="" coords="329,5,411,35"/> <area shape="rect" id="node7" href="wx.lib.masked.maskededit.MaskedEditMixin.html" title="wx.lib.masked.maskededit.MaskedEditMixin" alt="" coords="4,392,301,421"/> <area shape="rect" id="node10" href="wx.Window.html" title="wx.Window" alt="" coords="267,237,356,267"/> <area shape="rect" id="node11" href="wx.lib.masked.timectrl.TimeCtrl.html" title="wx.lib.masked.timectrl.TimeCtrl" alt="" coords="152,547,373,576"/> </map> 
   </p>

|


|super_classes| Known Superclasses
==================================

:class:`wx.lib.masked.textctrl.BaseMaskedTextCtrl`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.masked.timectrl.TimeCtrl.__init__`                                Default class constructor.
:meth:`~wx.lib.masked.timectrl.TimeCtrl.BindSpinButton`                          This function binds an externally created spin button to the control,
:meth:`~wx.lib.masked.timectrl.TimeCtrl.ChangeValue`                             Validating ChangeValue function for time values
:meth:`~wx.lib.masked.timectrl.TimeCtrl.GetBounds`                               This function returns a two-tuple (min,max), indicating the
:meth:`~wx.lib.masked.timectrl.TimeCtrl.GetFormat`                               
:meth:`~wx.lib.masked.timectrl.TimeCtrl.GetMax`                                  Gets the minimum value of the control.
:meth:`~wx.lib.masked.timectrl.TimeCtrl.GetMin`                                  Gets the minimum value of the control.
:meth:`~wx.lib.masked.timectrl.TimeCtrl.GetMxDateTime`                           Returns the value of the control as an mx.DateTime, with the date
:meth:`~wx.lib.masked.timectrl.TimeCtrl.GetValue`                                This function returns the value of the display as a string by default,
:meth:`~wx.lib.masked.timectrl.TimeCtrl.GetWxDateTime`                           This function is the conversion engine for TimeCtrl; it takes
:meth:`~wx.lib.masked.timectrl.TimeCtrl.IsInBounds`                              Returns ``True`` if no value is specified and the current value
:meth:`~wx.lib.masked.timectrl.TimeCtrl.IsLimited`                               Returns ``True`` if the control is currently limiting the
:meth:`~wx.lib.masked.timectrl.TimeCtrl.IsValid`                                 Can be used to determine if a given value would be a legal and
:meth:`~wx.lib.masked.timectrl.TimeCtrl.SetBounds`                               This function is a convenience function for setting the min and max
:meth:`~wx.lib.masked.timectrl.TimeCtrl.SetFormat`                               
:meth:`~wx.lib.masked.timectrl.TimeCtrl.SetInsertionPoint`                       This override records the specified position and associated cell before
:meth:`~wx.lib.masked.timectrl.TimeCtrl.SetLimited`                              If called with a value of True, this function will cause the control
:meth:`~wx.lib.masked.timectrl.TimeCtrl.SetMax`                                  Sets the maximum value of the control. If a value of None
:meth:`~wx.lib.masked.timectrl.TimeCtrl.SetMin`                                  Sets the minimum value of the control.  If a value of None
:meth:`~wx.lib.masked.timectrl.TimeCtrl.SetMxDateTime`                           Because SetValue can take an mx.DateTime, (if DateTime is importable),
:meth:`~wx.lib.masked.timectrl.TimeCtrl.SetParameters`                           Function providing access to the parameters governing TimeCtrl display
:meth:`~wx.lib.masked.timectrl.TimeCtrl.SetSelection`                            
:meth:`~wx.lib.masked.timectrl.TimeCtrl.SetValue`                                Validating SetValue function for time values
:meth:`~wx.lib.masked.timectrl.TimeCtrl.SetWxDateTime`                           Because SetValue can take a :class:`DateTime`, this is now just an alias.
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: TimeCtrl(BaseMaskedTextCtrl)

   Masked control providing several time formats and manipulation of time values.

   .. method:: __init__ ( self, parent, id=-1, value = '00:00:00', pos = wx.DefaultPosition, size = wx.DefaultSize, fmt24hr=False, spinButton = None, style = wx.TE_PROCESS_TAB, validator = wx.DefaultValidator, name = "time", \*\*kwargs )

      Default class constructor.
      
      :param wx.Window `parent`: the window parent. Must not be ``None``;
      :param integer `id`: window identifier. A value of -1 indicates a default value;
      :param string `value`: value to be shown;
      :param `pos`: the control position. A value of (-1, -1) indicates a default position,
       chosen by either the windowing system or wxPython, depending on platform;
      :type `pos`: tuple or :class:`wx.Point`
      :param `size`: the control size. A value of (-1, -1) indicates a default size,
       chosen by either the windowing system or wxPython, depending on platform;
      :param boolean `fmt24hr`: ``True`` to use 24 hour format (sometimes called military format;
      :param SpinButton `spinButton`: an instance of :class:`SpinButton` or
        None;
      :param integer `style`: the window style;
      :param wx.Validator `validator`: this is mainly provided for data-transfer, as control does
        its own validation;
      :param string `name`: the window name;


   .. method:: BindSpinButton(self, sb)

      This function binds an externally created spin button to the control,
      so that up/down events from the button automatically change the control.
      
      :param SpinButton `sb`: an instance of :class:`SpinButton`


   .. method:: ChangeValue(self, value)

      Validating ChangeValue function for time values:
      This function will do dynamic type checking on the value argument,
      and convert :class:`DateTime`, mxDateTime, or 12/24 format time string
      into the appropriate format string for the control.
      
      No change event is fired by this method.
      
      :param `value`: the time value


   .. method:: GetBounds(self, as_string = False)

      This function returns a two-tuple (min,max), indicating the
      current bounds of the control.  Each value can be None if
      that bound is not set.


   .. method:: GetFormat(self)


   .. method:: GetMax(self, as_string = False)

      Gets the minimum value of the control.
      If None, it will return None.  Otherwise it will return
      the current minimum bound on the control, as a :class:`DateTime`
      by default, or as a string if as_string argument is True.


   .. method:: GetMin(self, as_string = False)

      Gets the minimum value of the control.
      If None, it will return None.  Otherwise it will return
      the current minimum bound on the control, as a :class:`DateTime`
      by default, or as a string if as_string argument is True.


   .. method:: GetMxDateTime(self, value=None)

      Returns the value of the control as an mx.DateTime, with the date
      portion set to January 1, 1970.


   .. method:: GetValue(self, as_wxDateTime = False, as_mxDateTime = False, as_wxTimeSpan = False, as_mxDateTimeDelta = False)

      This function returns the value of the display as a string by default,
      but supports return as a :class:`DateTime`, mx.DateTime, :class:`TimeSpan`,
      or mx.DateTimeDelta, if requested.
      (Evaluated in the order above-- first one wins!)
      
      :param boolean `as_wxDateTime`: return value as :class:`DateTime`;
      :param boolean `as_mxDateTime`: return value as mxDateTime;
      :param boolean `as_wxTimeSpan`: return value as :class:`TimeSpan`;
      :param boolean `as_mxDateTimeDelta`: return value as mxDateTimeDelta;


   .. method:: GetWxDateTime(self, value=None)

      This function is the conversion engine for TimeCtrl; it takes
      one of the following types:
      
      * time string
      * :class:`DateTime`
      * :class:`TimeSpan`
      * mxDateTime
      * mxDateTimeDelta
      
      and converts it to a :class:`DateTime` that always has Jan 1, 1970 as
      its date portion, so that range comparisons around values can work using
      :class:`DateTime` built-in comparison function.  If a value is not
      provided to convert, the string value of the control will be used.
      If the value is not one of the accepted types, a ValueError will be
      raised.


   .. method:: IsInBounds(self, value=None)

      Returns ``True`` if no value is specified and the current value
      of the control falls within the current bounds.  As the clock
      is a "circle", both minimum and maximum bounds must be set for
      a value to ever be considered "out of bounds".  This function can
      also be called with a value to see if that value would fall within
      the current bounds of the given control.


   .. method:: IsLimited(self)

      Returns ``True`` if the control is currently limiting the
      value to fall within any current bounds.  *Note:* can
      be set even if there are no current bounds.


   .. method:: IsValid(self, value)

      Can be used to determine if a given value would be a legal and
      in-bounds value for the control.
      
      :param `value`: value to check


   .. method:: SetBounds(self, min=None, max=None)

      This function is a convenience function for setting the min and max
      values at the same time.  The function only applies the maximum bound
      if setting the minimum bound is successful, and returns ``True`` only if both operations succeed.
      
      .. note:: Leaving out an argument will remove the corresponding bound.
      
      :param `min`: Minium value for the control
      :type `min`: integer or None
      :param `max`: Minium value for the control
      :type `max`: integer or None


   .. method:: SetFormat(self, format)


   .. method:: SetInsertionPoint(self, pos)

      This override records the specified position and associated cell before
      calling base class' function.  This is necessary to handle the optional
      spin button, because the insertion point is lost when the focus shifts
      to the spin button.


   .. method:: SetLimited(self, limited)

      If called with a value of True, this function will cause the control
      to limit the value to fall within the bounds currently specified.
      If the control's value currently exceeds the bounds, it will then
      be limited accordingly.
      
      If called with a value of 0, this function will disable value
      limiting, but coloring of out-of-bounds values will still take
      place if bounds have been set for the control.
      
      :param boolean `limited`: define value limiting


   .. method:: SetMax(self, max=None)

      Sets the maximum value of the control. If a value of None
      is provided, then the control will have no explicit maximum value.
      If the value specified is less than the current minimum value, then
      the function returns ``False`` and the maximum will not change from its
      current setting. On success, the function returns True.
      
      If successful and the current value is greater than the new upper
      bound, if the control is limited the value will be automatically
      adjusted to this maximum value; if not limited, the value in the
      control will be colored as invalid.
      
      :param `max`: Minium value for the control
      :type `max`: integer or None


   .. method:: SetMin(self, min=None)

      Sets the minimum value of the control.  If a value of None
      is provided, then the control will have no explicit minimum value.
      If the value specified is greater than the current maximum value,
      then the function returns 0 and the minimum will not change from
      its current setting.  On success, the function returns 1.
      
      If successful and the current value is lower than the new lower
      bound, if the control is limited, the value will be automatically
      adjusted to the new minimum value; if not limited, the value in the
      control will be colored as invalid.
      
      :param `min`: Minium value for the control
      :type `min`: integer or None


   .. method:: SetMxDateTime(self, mxdt)

      Because SetValue can take an mx.DateTime, (if DateTime is importable),
      this is now just an alias.


   .. method:: SetParameters(self, \*\*kwargs)

      Function providing access to the parameters governing TimeCtrl display
      and bounds.


   .. method:: SetSelection(self, sel_start, sel_to)


   .. method:: SetValue(self, value)

      Validating SetValue function for time values:
      This function will do dynamic type checking on the value argument,
      and convert :class:`DateTime`, mxDateTime, or 12/24 format time string
      into the appropriate format string for the control.
      
      :param `value`: the time value


   .. method:: SetWxDateTime(self, wxdt)

      Because SetValue can take a :class:`DateTime`, this is now just an alias.