示例#1
0
    def pasteWidgets(self, pos=(0, 0), logicals=False):
        """Pastes widgets from the clipboard."""
        clipFormat = wx.DataFormat(StoryPanel.CLIPBOARD_FORMAT)
        clipData = wx.CustomDataObject(clipFormat)

        if wx.TheClipboard.Open():
            gotData = wx.TheClipboard.IsSupported(
                clipFormat) and wx.TheClipboard.GetData(clipData)
            wx.TheClipboard.Close()

            if gotData:
                data = pickle.loads(clipData.GetData())

                self.eachWidget(lambda w: w.setSelected(False, False))

                if not pos: pos = StoryPanel.INSET
                if not logicals: pos = self.toLogical(pos)

                for widget in data:
                    newPassage = PassageWidget(self,
                                               self.app,
                                               state=widget,
                                               pos=pos,
                                               title=self.untitledName(
                                                   widget['passage'].title))
                    newPassage.findSpace()
                    newPassage.setSelected(True, False)
                    self.widgetDict[newPassage.passage.title] = newPassage
                    self.snapWidget(newPassage, False)

                self.parent.setDirty(True, action='Paste')
                self.resize()
                self.Refresh()
示例#2
0
    def pasteWidgets(self, pos = (0,0), logicals = False):
        """Pastes widgets from the clipboard."""
        clipFormat = wx.CustomDataFormat(StoryPanel.CLIPBOARD_FORMAT)
        clipData = wx.CustomDataObject(clipFormat)

        if wx.TheClipboard.Open():
            gotData = wx.TheClipboard.IsSupported(clipFormat) and wx.TheClipboard.GetData(clipData)
            wx.TheClipboard.Close()

            if gotData:
                data = pickle.loads(clipData.GetData())

                self.eachWidget(lambda w: w.setSelected(False, False))

                if not pos: pos = StoryPanel.INSET
                if not logicals: pos = self.toLogical(pos)

                for widget in data:
                    newPassage = PassageWidget(self, self.app, state = widget, pos = pos, title = self.untitledName(widget['passage'].title))
                    newPassage.findSpace()
                    newPassage.setSelected(True, False)
                    self.widgetDict[newPassage.passage.title] = newPassage
                    self.snapWidget(newPassage, False)

                self.parent.setDirty(True, action = 'Paste')
                self.resize()
                self.Refresh()
示例#3
0
    def pasteWidgets(self):
        """Pastes widgets into the clipboard."""
        format = wx.CustomDataFormat(StoryPanel.CLIPBOARD_FORMAT)

        if wx.TheClipboard.Open() and wx.TheClipboard.IsSupported(format):
            clipData = wx.CustomDataObject(format)
            wx.TheClipboard.GetData(clipData)
            wx.TheClipboard.Close()
            data = pickle.loads(clipData.GetData())

            self.eachWidget(lambda w: w.setSelected(False, False))

            for widget in data:
                newPassage = PassageWidget(self, self.app, state=widget)
                newPassage.findSpace()
                newPassage.setSelected(True, False)
                self.widgets.append(newPassage)

            self.parent.setDirty(True, action='Paste')
            self.Refresh()
示例#4
0
 def pasteWidgets (self):
     """Pastes widgets into the clipboard."""
     format = wx.CustomDataFormat(StoryPanel.CLIPBOARD_FORMAT)
     
     if wx.TheClipboard.Open() and wx.TheClipboard.IsSupported(format):
         clipData = wx.CustomDataObject(format)
         wx.TheClipboard.GetData(clipData)
         wx.TheClipboard.Close()
         data = pickle.loads(clipData.GetData())
                     
         self.eachWidget(lambda w: w.setSelected(False, False))
         
         for widget in data:
             newPassage = PassageWidget(self, self.app, state = widget)
             newPassage.findSpace()
             newPassage.setSelected(True, False)
             self.widgets.append(newPassage)
             
         self.parent.setDirty(True, action = 'Paste')
         self.Refresh()
示例#5
0
    def pasteWidgets(self):
        """Pastes widgets from the clipboard."""
        clipFormat = wx.CustomDataFormat(StoryPanel.CLIPBOARD_FORMAT)
        clipData = wx.CustomDataObject(clipFormat)

        if wx.TheClipboard.Open():
            gotData = wx.TheClipboard.IsSupported(clipFormat) and wx.TheClipboard.GetData(clipData)
            wx.TheClipboard.Close()

            if gotData:
                data = pickle.loads(clipData.GetData())

                self.eachWidget(lambda w: w.setSelected(False, False))

                for widget in data:
                    newPassage = PassageWidget(self, self.app, state = widget, title = self.untitledName(widget['passage'].title))
                    newPassage.findSpace()
                    newPassage.setSelected(True, False)
                    self.widgets.append(newPassage)

                self.parent.setDirty(True, action = 'Paste')
                self.Refresh()