951 data = None |
951 data = None |
952 if primary_selection and wx.Platform == '__WXMSW__': |
952 if primary_selection and wx.Platform == '__WXMSW__': |
953 return data |
953 return data |
954 else: |
954 else: |
955 wx.TheClipboard.UsePrimarySelection(primary_selection) |
955 wx.TheClipboard.UsePrimarySelection(primary_selection) |
956 if wx.TheClipboard.Open(): |
956 |
|
957 if not wx.TheClipboard.IsOpened(): |
957 dataobj = wx.TextDataObject() |
958 dataobj = wx.TextDataObject() |
958 if wx.TheClipboard.GetData(dataobj): |
959 if wx.TheClipboard.Open(): |
959 data = dataobj.GetText() |
960 success = wx.TheClipboard.GetData(dataobj) |
960 wx.TheClipboard.Close() |
961 wx.TheClipboard.Close() |
|
962 if success: |
|
963 data = dataobj.GetText() |
961 return data |
964 return data |
962 |
965 |
963 def SetCopyBuffer(self, text, primary_selection=False): |
966 def SetCopyBuffer(self, text, primary_selection=False): |
964 if primary_selection and wx.Platform == '__WXMSW__': |
967 if primary_selection and wx.Platform == '__WXMSW__': |
965 return |
968 return |
966 else: |
969 else: |
967 wx.TheClipboard.UsePrimarySelection(primary_selection) |
970 wx.TheClipboard.UsePrimarySelection(primary_selection) |
968 if wx.TheClipboard.Open(): |
971 if not wx.TheClipboard.IsOpened(): |
969 data = wx.TextDataObject() |
972 data = wx.TextDataObject() |
970 data.SetText(text) |
973 data.SetText(text) |
971 wx.TheClipboard.SetData(data) |
974 if wx.TheClipboard.Open(): |
972 wx.TheClipboard.Flush() |
975 wx.TheClipboard.SetData(data) |
973 wx.TheClipboard.Close() |
976 wx.TheClipboard.Flush() |
|
977 wx.TheClipboard.Close() |
974 self.RefreshEditMenu() |
978 self.RefreshEditMenu() |
975 |
979 |
976 def GetDrawingMode(self): |
980 def GetDrawingMode(self): |
977 return self.DrawingMode |
981 return self.DrawingMode |
978 |
982 |