def delete(self, pos=None, rows=None, add_undo=True): if self.is_editing_objects() and add_undo: if pos is None or rows is None: # selection block block = self._get_selection_block() if not block: wx.MessageBox("Invalid selection area", "Error") return top, left, bottom, right = block pos = top rows = bottom - top + 1 if wx.NO == wx.MessageBox( "%s %s will be deleted, and can NOT undo!!!\nContinue?" % (rows, self.editor_context.clazz.name), style=wx.YES_NO | wx.ICON_WARNING): return ListGrid.delete(self, pos, rows) # todo: it'd be better to support undo if self.is_editing_objects() and add_undo: self.editor_context.undo_manager.clear()
def insert(self, pos=-1, rows=1, add_undo=False): if self.is_editing_objects() and add_undo: # if wx.NO == wx.MessageBox("%s %s(s) will be created, continue?" % # (rows, self.editor_context.clazz.name), style=wx.YES_NO | wx.ICON_WARNING): # return pass ListGrid.insert(self, pos, rows, add_undo)
def insert_copied(self, pos=-1): if self.is_editing_objects(): attr_type_names, data = self._get_clipboard() if attr_type_names and data: if wx.NO == wx.MessageBox("%s %s(s) will be created, continue?" % (len(data), self.editor_context.clazz.name), style=wx.YES_NO | wx.ICON_WARNING): return ListGrid.insert_copied(self, pos)
def insert_copied(self, pos=-1): if self.is_editing_objects(): attr_type_names, data = self._get_clipboard() if attr_type_names and data: if wx.NO == wx.MessageBox( "%s %s(s) will be created, continue?" % (len(data), self.editor_context.clazz.name), style=wx.YES_NO | wx.ICON_WARNING): return ListGrid.insert_copied(self, pos)
def delete(self, pos=None, rows=None, add_undo=True): if self.is_editing_objects() and add_undo: if pos is None or rows is None: # selection block block = self._get_selection_block() if not block: wx.MessageBox("Invalid selection area", "Error") return top, left, bottom, right = block pos = top rows = bottom - top + 1 if wx.NO == wx.MessageBox("%s %s will be deleted, and can NOT undo!!!\nContinue?" % (rows, self.editor_context.clazz.name), style=wx.YES_NO | wx.ICON_WARNING): return ListGrid.delete(self, pos, rows) # todo: it'd be better to support undo if self.is_editing_objects() and add_undo: self.editor_context.undo_manager.clear()
def _cut(self): if self.is_editing_objects(): wx.MessageBox("Operation not supported!") return ListGrid._cut(self)
def __init__(self, parent, editor_context): ListGrid.__init__(self, parent, editor_context, StructListTable(editor_context))