Пример #1
0
    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()
Пример #2
0
    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)
Пример #3
0
 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)
Пример #4
0
 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)
Пример #5
0
    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)
Пример #6
0
 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()        
Пример #7
0
    def _cut(self):
        if self.is_editing_objects():
            wx.MessageBox("Operation not supported!")
            return

        ListGrid._cut(self)
Пример #8
0
 def __init__(self, parent, editor_context):
     ListGrid.__init__(self, parent, editor_context,
                       StructListTable(editor_context))
Пример #9
0
 def _cut(self):
     if self.is_editing_objects():
         wx.MessageBox("Operation not supported!")
         return
     
     ListGrid._cut(self)
Пример #10
0
 def __init__(self, parent, editor_context):
     ListGrid.__init__(self, parent, editor_context, StructListTable(editor_context))