[GRASS-SVN] r35126 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 30 18:39:00 EST 2008


Author: cmbarton
Date: 2008-12-30 18:39:00 -0500 (Tue, 30 Dec 2008)
New Revision: 35126

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py
Log:
Fixed problems with dragging different overlay objects and with hidden overlay dialogs.

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py	2008-12-30 23:37:50 UTC (rev 35125)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py	2008-12-30 23:39:00 UTC (rev 35126)
@@ -1382,8 +1382,10 @@
                     begin = self.Pixel2Cell(self.mouse['begin'])
 
                     self.DrawLines(self.pdcTmp, begin, end)
-        else:
-            # get decoration id
+        elif self.mouse['use'] == 'pointer':
+            # get decoration or text id
+            self.idlist = []
+            self.dragid = ''
             self.lastpos = self.mouse['begin']
             idlist = self.pdc.FindObjects(x=self.lastpos[0], y=self.lastpos[1],
                                           radius=self.hitradius)
@@ -1391,6 +1393,8 @@
             if 99 in idlist: idlist.remove(99)                             
             if idlist != [] :
                 self.dragid = idlist[0] #drag whatever is on top
+        else:
+            pass
 
         event.Skip()
 
@@ -1689,10 +1693,13 @@
                 self.redrawAll = None
                 ### self.OnPaint(None)
                 
-        elif self.dragid != None:
+        elif self.mouse['use'] == 'pointer' and self.dragid != None:
             # end drag of overlay decoration
-            if self.overlays.has_key(self.dragid):
+            if self.dragid < 99 and self.overlays.has_key(self.dragid):
                 self.overlays[self.dragid]['coords'] = self.pdc.GetIdBounds(self.dragid)
+            elif self.dragid > 100:
+                self.textdict[self.dragid]['coords'] = self.pdc.GetIdBounds(self.dragid)
+                                
             self.dragid = None
             self.currtxtid = None
             self.UpdateMap(render=True)
@@ -3872,15 +3879,15 @@
             gdialogs.DecorationDialog(parent=self, title=_('Scale and North arrow'),
                                       size=(350, 200),
                                       style=wx.DEFAULT_DIALOG_STYLE | wx.CENTRE,
-                                      cmd=['d.barscale'],
+                                      cmd=['d.barscale', 'at=0,5'],
                                       ovlId=id,
                                       name='barscale',
                                       checktxt = _("Show/hide scale and North arrow"),
                                       ctrltxt = _("scale object"))
 
         self.dialogs['barscale'].CentreOnParent()
-        self.dialogs['barscale'].Show()
-        self.MapWindow.mouse['use'] = 'pointer'
+        self.dialogs['barscale'].ShowModal()
+        self.MapWindow.mouse['use'] = 'pointer'        
 
     def OnAddLegend(self, event):
         """
@@ -3908,7 +3915,7 @@
                                       ctrltxt = _("legend object")) 
 
         self.dialogs['legend'].CentreOnParent()
-        self.dialogs['legend'].Show()
+        self.dialogs['legend'].ShowModal()
         self.MapWindow.mouse['use'] = 'pointer'
 
     def OnAddText(self, event):
@@ -3927,7 +3934,6 @@
         self.dialogs['text'] = gdialogs.TextLayerDialog(parent=self, ovlId=id, 
                                                     title=_('Add text layer'),
                                                     size=(400, 200))
-
         self.dialogs['text'].CenterOnParent()
 
         # If OK button pressed in decoration control dialog



More information about the grass-commit mailing list