def __init__(self): self.DELAY = 1000 self.search_dialogs = {} self.activate_dialogs = {} wxgui_api.install_bundled_icon("wxoldalarms", '@oldalarmsdialog', ("oldalarms48.png", )) organism_alarms_api.install_unique_old_alarms_interface( self._choose_old_alarms_unique) wxgui_api.register_aborted_save_warning( organism_timer_api.get_old_occurrences_search_exception(), "The database cannot be saved while the old " "alarms are being searched and activated.") # Enabling and closing do not race, i.e. it's impossible that first a # dialog is started to be created, but it's tried to be closed *while* # it's creating, *before* it's shown; this is because these two events # run sequentially on the same thread, and they both trigger actions # on the GUI (creating the dialog and closing it) that run on the main # thread, so while the dialog is creating, the call for closing it, # even if triggered, has to wait for the dialog to be created organism_timer_api.bind_to_search_old_alarms(self._enable_search) organism_timer_api.bind_to_search_old_alarms_end(self._disable_search) organism_alarms_api.bind_to_activate_alarms_range( self._enable_activate) organism_alarms_api.bind_to_activate_alarms_range_end( self._disable_activate) core_api.bind_to_closing_database(self._handle_closing_database)