Coverage for src/robotide/ui/searchdots.py: 43%
14 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-05-06 10:40 +0100
« prev ^ index » next coverage.py v7.8.0, created at 2025-05-06 10:40 +0100
1# Copyright 2008-2015 Nokia Networks
2# Copyright 2016- Robot Framework Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
16import wx 1ab
19class DottedSearch(object): 1ab
20 """Class that can be used to make Search dots...
22 parent - the UI component that the timer should be bound to
24 callback - function that will receive timer events in UI thread
25 argument to callback is string containing dots '.', '..'. '...' etc.
27 """
29 def __init__(self, parent, callback): 1ab
30 self._timer = wx.Timer(parent)
31 self._dots = 0
32 self._callback = callback
33 parent.Bind(wx.EVT_TIMER, self._timer_event)
35 def _timer_event(self, event): 1ab
36 self._dots = (self._dots + 1) % 5
37 self._callback('.'*self._dots)
39 def start(self): 1ab
40 self._timer.Start(500)
42 def stop(self): 1ab
43 self._timer.Stop()