Home | Trees | Indices | Help |
|
---|
|
1 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Rickard Lindberg, Roger Lindberg 2 # 3 # This file is part of Timeline. 4 # 5 # Timeline is free software: you can redistribute it and/or modify 6 # it under the terms of the GNU General Public License as published by 7 # the Free Software Foundation, either version 3 of the License, or 8 # (at your option) any later version. 9 # 10 # Timeline is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with Timeline. If not, see <http://www.gnu.org/licenses/>. 17 18 19 import wx 20 21 from timelinelib.wxgui.dialogs.eventlist.view import EventListDialog 22 232511227 self._view = view 28 self._result = [] 29 self._result_index = 0 30 self._last_search = None 31 self._last_period = None3234 self._timeline_canvas = timeline_canvas 35 self._view.Enable(timeline_canvas is not None) 36 if timeline_canvas is not None: 37 self._view.SetPeriodChoices(self._timeline_canvas.GetPeriodChoices())3840 new_search = self._view.GetValue() 41 new_period = self._view.GetPeriod() 42 if ( 43 (self._last_search is not None and self._last_search == new_search) and 44 (self._last_period is not None and self._last_period == new_period)): 45 self.next() 46 else: 47 self._last_search = new_search 48 self._last_period = new_period 49 self._search_for_events(new_search, new_period) 50 self._result_index = 0 51 self.navigate_to_match() 52 self._set_result_label() 53 self._view.UpdateButtons()5456 if self._timeline_canvas is not None: 57 self._result = self._timeline_canvas.GetFilteredEvents(new_search, new_period) 58 else: 59 self._result = []6062 nbr_of_matches = len(self._result) 63 if nbr_of_matches == 0: 64 self._view.UpdateNbrOfMatchesLabel(' ' * 4 + _('No matches found')) 65 elif nbr_of_matches == 1: 66 self._view.UpdateNbrOfMatchesLabel(' ' * 4 + _('Only one match found')) 67 else: 68 self._view.UpdateNbrOfMatchesLabel(' ' * 4 + '%d ' % nbr_of_matches + _('matches found'))6971 if self._on_last_match(): 72 self._result_index = 0 73 else: 74 self._result_index += 1 75 self.navigate_to_match() 76 self._view.UpdateButtons()7779 if not self._on_first_match(): 80 self._result_index -= 1 81 self.navigate_to_match() 82 self._view.UpdateButtons()8385 event_list = [event.get_label(self._timeline_canvas.GetTimeType()) for event in self._result] 86 dlg = EventListDialog(self._view, event_list) 87 if dlg.ShowModal() == wx.ID_OK: 88 self._result_index = dlg.GetSelectedIndex() 89 self.navigate_to_match() 90 dlg.Destroy()91 97 100 103 106 109
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Jul 23 01:55:31 2020 | http://epydoc.sourceforge.net |