def on_load_cmap(self, evt): """Handles request to load a colormap""" file_dlg = wx.FileDialog(parent=self.view, message="Please specify a colormap file", defaultDir=pathfinder.colormaps_path(), style=wx.FD_OPEN) if file_dlg.ShowModal() == wx.ID_OK: try: self.colormap_dict = self.model.get_cmap_dict( file_dlg.GetPath()) self.set_colormap() finally: file_dlg.Destroy()
def on_save_cmap(self, evt): """Handles request to save current colormap""" file_dlg = wx.FileDialog(parent=self.view, message="Please specify a filename", defaultDir=pathfinder.colormaps_path(), style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) if file_dlg.ShowModal() == wx.ID_OK: try: self.model.save_cmap_dict(self.colormap_dict, file_dlg.GetPath()) self.colormap_dict = self.model.get_cmap_dict( file_dlg.GetPath()) self.set_colormap() finally: file_dlg.Destroy()