def on_continueButton(self, event, grid, next_dia=None): """ pulls up next dialog, if there is one. gets any updated information from the current grid and runs ErMagicBuilder """ #wait = wx.BusyInfo("Please wait, working...") # unhighlight selected columns, etc. if self.drop_down_menu: self.drop_down_menu.clean_up() # remove '**' from col names #self.remove_starred_labels(grid) grid.remove_starred_labels() grid.SaveEditControlValue() # locks in value in cell currently edited grid_name = str(grid.GetName()) # check that all required data are present validation_errors = self.validate(grid) if validation_errors: result = pw.warning_with_override("You are missing required data in these columns: {}\nAre you sure you want to continue without these data?".format(', '.join(validation_errors))) if result == wx.ID_YES: pass else: return False if grid.changes: self.onSave(grid) self.deleteRowButton = None self.panel.Destroy() # make sure that specimens get propagated with # any default sample info if next_dia == self.InitLocCheck: if self.er_magic_data.specimens: for spec in self.er_magic_data.specimens: spec.propagate_data() if next_dia: wait = wx.BusyInfo("Please wait, working...") wx.Yield() next_dia() del wait else: wait = wx.BusyInfo("Please wait, writing data to files...") wx.Yield() # actually write data: self.er_magic_data.write_files() self.Destroy() del wait
def onContinue(self, event, grid, next_dia=None):#, age_data_type='site'): """ Save grid data in the data object """ # deselect column, including remove 'EDIT ALL' label if self.grid_frame.drop_down_menu: self.grid_frame.drop_down_menu.clean_up() # remove '**' and '^^' from col names #self.remove_starred_labels(grid) grid.remove_starred_labels() grid.SaveEditControlValue() # locks in value in cell currently edited grid_name = str(grid.GetName()) # save all changes to data object and write to file self.grid_frame.grid_builder.save_grid_data() # check that all required data are present validation_errors = self.validate(grid) if validation_errors: warn_string = "" for error_name, error_cols in list(validation_errors.items()): if error_cols: warn_string += "You have {}: {}.\n\n".format(error_name, ", ".join(error_cols)) warn_string += "Are you sure you want to continue?" result = pw.warning_with_override(warn_string) if result == wx.ID_YES: pass else: return False else: wx.MessageBox('Saved!', 'Info', style=wx.OK | wx.ICON_INFORMATION) self.panel.Destroy() if next_dia: next_dia() else: # propagate any type/lithology/class data from sites to samples table # will only overwrite if sample values are blank or "Not Specified" self.contribution.propagate_lithology_cols() wx.MessageBox('Done!', 'Info', style=wx.OK | wx.ICON_INFORMATION) # show main frame self.main_frame.Show()
def on_saveButton(self, event, grid): """saves any editing of the grid but does not continue to the next window""" wait = wx.BusyInfo("Please wait, working...") if self.drop_down_menu: # unhighlight selected columns, etc. self.drop_down_menu.clean_up() # remove '**' from col labels starred_cols = grid.remove_starred_labels() grid.SaveEditControlValue() # locks in value in cell currently edited grid.HideCellEditControl() # removes focus from cell that was being edited if grid.changes: self.onSave(grid) for col in starred_cols: label = grid.GetColLabelValue(col) grid.SetColLabelValue(col, label + '**') del wait
def on_saveButton(self, event, grid): """saves any editing of the grid but does not continue to the next window""" wait = wx.BusyInfo("Please wait, working...") wx.SafeYield() if self.grid_frame.drop_down_menu: # unhighlight selected columns, etc. self.grid_frame.drop_down_menu.clean_up() # remove '**' and '^^' from col labels starred_cols, hatted_cols = grid.remove_starred_labels() grid.SaveEditControlValue() # locks in value in cell currently edited grid.HideCellEditControl() # removes focus from cell that was being edited if grid.changes: self.onSave(grid) for col in starred_cols: label = grid.GetColLabelValue(col) grid.SetColLabelValue(col, label + '**') for col in hatted_cols: label = grid.GetColLabelValue(col) grid.SetColLabelValue(col, label + '^^') del wait