projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tweak line number size just a bit
[wxWidgets.git]
/
wxPython
/
demo
/
CustomDragAndDrop.py
diff --git
a/wxPython/demo/CustomDragAndDrop.py
b/wxPython/demo/CustomDragAndDrop.py
index 2ff049640eb3e8b52e458427350391c4d2507dbe..b1c1e5a890df6ed0d8f03631091ca00584cdf8a9 100644
(file)
--- a/
wxPython/demo/CustomDragAndDrop.py
+++ b/
wxPython/demo/CustomDragAndDrop.py
@@
-1,11
+1,3
@@
-# 11/5/2003 - Modified by grimmtooth@softhome.net (Jeff Grimmett)
-#
-# o Updated for wx namespace
-#
-# 11/24/2003 - Modified by grimmtooth@softhome.net (Jeff Grimmett)
-#
-# o Issues around line 167. I'm stuck.
-#
import cPickle
import wx
import cPickle
import wx
@@
-46,7
+38,7
@@
class DoodlePad(wx.Window):
dc.SetPen(wx.Pen(wx.BLUE, 3))
for line in self.lines:
for coords in line:
dc.SetPen(wx.Pen(wx.BLUE, 3))
for line in self.lines:
for coords in line:
- dc.DrawLine
XY
(*coords)
+ dc.DrawLine(*coords)
dc.EndDrawing()
dc.EndDrawing()
@@
-63,22
+55,23
@@
class DoodlePad(wx.Window):
def OnLeftUp(self, event):
def OnLeftUp(self, event):
- self.lines.append(self.curLine)
- self.curLine = []
- self.ReleaseMouse()
+ if self.HasCapture():
+ self.lines.append(self.curLine)
+ self.curLine = []
+ self.ReleaseMouse()
def OnRightUp(self, event):
self.lines = []
self.Refresh()
def OnMotion(self, event):
def OnRightUp(self, event):
self.lines = []
self.Refresh()
def OnMotion(self, event):
- if event.Dragging() and not self.mode == "Drag":
+ if
self.HasCapture() and
event.Dragging() and not self.mode == "Drag":
dc = wx.ClientDC(self)
dc.BeginDrawing()
dc.SetPen(wx.Pen(wx.BLUE, 3))
dc = wx.ClientDC(self)
dc.BeginDrawing()
dc.SetPen(wx.Pen(wx.BLUE, 3))
- coords = ((self.x, self.y), event.GetPosition())
+ coords = ((self.x, self.y), event.GetPosition
Tuple
())
self.curLine.append(coords)
self.curLine.append(coords)
- dc.DrawLine
XY
(*coords)
+ dc.DrawLine(*coords)
self.x, self.y = event.GetPositionTuple()
dc.EndDrawing()
self.x, self.y = event.GetPositionTuple()
dc.EndDrawing()
@@
-171,7
+164,7
@@
class DoodleDropTarget(wx.PyDropTarget):
if self.GetData():
# convert it back to a list of lines and give it to the viewer
linesdata = self.data.GetData()
if self.GetData():
# convert it back to a list of lines and give it to the viewer
linesdata = self.data.GetData()
- lines =
wx.InputStream(cPickle.loads(linesdata)
)
+ lines =
cPickle.loads(linesdata
)
self.dv.SetLines(lines)
# what is returned signals the source what to do
self.dv.SetLines(lines)
# what is returned signals the source what to do
@@
-207,7
+200,7
@@
class DoodleViewer(wx.Window):
for line in self.lines:
for coords in line:
for line in self.lines:
for coords in line:
- dc.DrawLine
XY
(*coords)
+ dc.DrawLine(*coords)
dc.EndDrawing()
#----------------------------------------------------------------------
dc.EndDrawing()
#----------------------------------------------------------------------
@@
-247,10
+240,10
@@
class CustomDnDPanel(wx.Panel):
rbox.Add(rb1)
rbox.Add(rb2)
rbox.Add(rb1)
rbox.Add(rb2)
- box.Add(text1, 0, wxALL, 10)
- box.Add(rbox, 0, wxALIGN_CENTER)
+ box.Add(text1, 0, wx
.
ALL, 10)
+ box.Add(rbox, 0, wx
.
ALIGN_CENTER)
box.Add((10,90))
box.Add((10,90))
- box.Add(text2, 0, wxALL, 10)
+ box.Add(text2, 0, wx
.
ALL, 10)
sizer.Add(box)
sizer.Add(box)