def on_load_properties(self, evt): # Show confirmation dialog. if self.properties.is_initialized(): dlg = wx.MessageDialog( None, "Loading a new file will close all windows and clear unsaved data. Proceed?", 'Load properties file', wx.OK | wx.CANCEL) response = dlg.ShowModal() if response != wx.ID_OK: return # Close all subwindows for window in self.GetChildren(): if isinstance(window, wx.Frame): window.Destroy() # Shut down existing connections and wipe properties. db = DBConnect() db.Disconnect() p = Properties() p.clear() self.console.Clear() if not p.is_initialized(): from cpa.guiutils import show_load_dialog if not show_load_dialog(): example_link_address = 'cellprofileranalyst.org' dlg = wx.MessageDialog( None, 'CellProfiler Analyst requires a properties file. Download an example at %s' % (example_link_address), 'Properties file required', wx.OK) response = dlg.ShowModal() logging.error( 'CellProfiler Analyst requires a properties file.') else: db.connect() db.register_gui_parent(self)