Exemple #1
0
    def restore_tabs(self, old_value, new_value, add_tabs,
                     remove_tabs):  # called for undo/redo
        # add_tabs: (index, xml_data) each, where the indices refer to the new_value
        # removed_tabs are (index, xml_data) each, where the indices refer to the old_value
        new_labels = [v[0] for v in new_value]
        tabs_p = self.properties["tabs"]

        # remove tabs: index is highest first
        for index, xml_data in remove_tabs:
            self.children[index].recursive_remove(level=0)

        # insert/add tabs: index is lowest first
        set_selected_page = None
        rebuild = []
        for index, xml_data in add_tabs:
            # actually add/insert
            tabs_p.value.insert(index,
                                [new_labels[index]])  # placeholder for pasting
            self.children.insert(index, None)
            import clipboard
            clipboard._paste(self, index, xml_data)

            if self.widget:
                set_selected_page = index  # remember last added index for selection

        # select the last added tab
        if set_selected_page is not None:
            self.widget.SetSelection(set_selected_page)

        for index in rebuild:
            common.app_tree.build(self.children[index], recursive=True)
        common.app_tree.build(self, recursive=False)
Exemple #2
0
 def simulate_paste(self, parent, pos, data):
     # accepts XML data; returns True on success
     import clipboard
     ret = clipboard._paste(parent, pos, data)
     wx.SafeYield()
     return ret
Exemple #3
0
 def clipboard_paste(self, clipboard_data):
     "Insert a widget from the clipboard to the current destination"
     if self.widget: size = self.widget.GetSize()
     ret = clipboard._paste(self, 0, clipboard_data)
     if self.widget: self.widget.SetSize(size)
     return ret
Exemple #4
0
 def clipboard_paste(self, clipboard_data):
     "Insert a widget from the clipboard to the current destination"
     return clipboard._paste(self.parent, self.pos, clipboard_data)
Exemple #5
0
 def clipboard_paste(self, clipboard_data):
     "Insert a widget from the clipboard to the current destination"
     if self.parent.CHILDREN == -1:
         # e.g. Panel has special treatment
         return self.parent.clipboard_paste(clipboard_data)
     return clipboard._paste(self.parent, self.index, clipboard_data)
Exemple #6
0
 def clipboard_paste(self, clipboard_data):
     "Insert a widget from the clipboard to the current destination"
     import clipboard
     return clipboard._paste(None, 0, clipboard_data)
Exemple #7
0
 def redo(self):
     slot = common.root.find_widget_from_path(self.slot_path)
     clipboard._paste(slot.parent,
                      slot.index,
                      self.xml_data,
                      rebuild_tree=True)