[Thuban-commits] r2870 - in trunk/thuban: . Thuban/UI
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Mar 18 12:11:41 CET 2009
Author: dpinte
Date: 2009-03-18 12:11:31 +0100 (Wed, 18 Mar 2009)
New Revision: 2870
Modified:
trunk/thuban/ChangeLog
trunk/thuban/Thuban/UI/mainwindow.py
trunk/thuban/Thuban/UI/view.py
trunk/thuban/Thuban/UI/viewport.py
Log:
2009-03-18 Didrik Pinte <dpinte at dipole-consulting.com>
* Thuban/UI/view.py, viewport.py : support mouse double click events
* Thuban/UI/mainwindow.py : support tools providing a wx.Bitmap icon in
place of a path to Thuban resources
Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog 2009-02-19 18:17:37 UTC (rev 2869)
+++ trunk/thuban/ChangeLog 2009-03-18 11:11:31 UTC (rev 2870)
@@ -1,3 +1,9 @@
+2009-03-18 Didrik Pinte <dpinte at dipole-consulting.com>
+
+ * Thuban/UI/view.py, viewport.py : support mouse double click events
+ * Thuban/UI/mainwindow.py : support tools providing a wx.Bitmap icon in
+ place of a path to Thuban resources
+
2009-02-19 Didrik Pinte <dpinte at dipole-consulting.com>
* Thuban/UI/dock.py : bugfix for docking/undocking events
Modified: trunk/thuban/Thuban/UI/mainwindow.py
===================================================================
--- trunk/thuban/Thuban/UI/mainwindow.py 2009-02-19 18:17:37 UTC (rev 2869)
+++ trunk/thuban/Thuban/UI/mainwindow.py 2009-03-18 11:11:31 UTC (rev 2870)
@@ -279,7 +279,10 @@
command = registry.Command(name)
if command is not None:
ID = self.get_id(name)
- bitmap = resource.GetBitmapResource(command.Icon(),
+ if isinstance(command.Icon(), wx.Bitmap):
+ bitmap = command.Icon()
+ else:
+ bitmap = resource.GetBitmapResource(command.Icon(),
wx.BITMAP_TYPE_XPM)
toolbar.AddTool(ID, bitmap,
shortHelpString = command.HelpText(),
Modified: trunk/thuban/Thuban/UI/view.py
===================================================================
--- trunk/thuban/Thuban/UI/view.py 2009-02-19 18:17:37 UTC (rev 2869)
+++ trunk/thuban/Thuban/UI/view.py 2009-03-18 11:11:31 UTC (rev 2870)
@@ -122,6 +122,7 @@
# subscribe the WX events we're interested in
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
+ self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDoubleClick)
self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
self.Bind(wx.EVT_MIDDLE_DOWN, self.OnMiddleDown)
self.Bind(wx.EVT_MIDDLE_UP, self.OnMiddleUp)
@@ -131,7 +132,7 @@
self.Bind(wx.EVT_IDLE, self.OnIdle)
def __del__(self):
- wx.Window.__del__(self)
+ #wx.Window.__del__(self)
ViewPort.__del__(self)
def PreviewBitmap(self):
@@ -401,6 +402,11 @@
self.dragging = 0
self.MouseLeftUp(event)
+ def OnLeftDoubleClick(self, event):
+ """ Handle EVT_LEFT_DCLICK
+ """
+ self.MouseDoubleClick(event)
+
def OnMotion(self, event):
if self.dragging:
self.tool.Hide(self.drag_dc)
Modified: trunk/thuban/Thuban/UI/viewport.py
===================================================================
--- trunk/thuban/Thuban/UI/viewport.py 2009-02-19 18:17:37 UTC (rev 2869)
+++ trunk/thuban/Thuban/UI/viewport.py 2009-03-18 11:11:31 UTC (rev 2870)
@@ -95,6 +95,9 @@
def MouseUp(self, event):
if self.dragging:
self.drag_stop(event.m_x, event.m_y)
+
+ def MouseDoubleClick(self, event):
+ pass
def Cancel(self):
self.dragging = 0
@@ -399,7 +402,7 @@
if pheight:
scales.append(wheight / pheight)
if scales:
- min_scale = 0.5 * min(scales)
+ min_scale = 0.1 * min(scales)
else:
min_scale = scale
@@ -431,6 +434,8 @@
scale = min_scale
self.scale = scale
+ if self.scale == 0:
+ raise Exception("Scale exception : %s %s")
# determine new offset to preserve the center
self.offset = (wwidth/2 - scale * pcenterx,
@@ -642,6 +647,10 @@
self.set_current_position(event)
if self.tool is not None:
self.tool.MouseMove(event)
+
+ def MouseDoubleClick(self, event):
+ if self.tool is not None:
+ self.tool.MouseDoubleClick(event)
def shape_selected(self, layer, shape):
"""Receiver for the SHAPES_SELECTED messages. Redraw the map."""
More information about the Thuban-commits
mailing list