[GRASS-dev] wxGUI command line: " changed into @ while typing

Anna Petrášová kratochanna at gmail.com
Mon Feb 10 12:25:55 PST 2014


On Mon, Feb 10, 2014 at 2:28 PM, Markus Metz
<markus.metz.giswork at gmail.com>wrote:

> On Mon, Feb 10, 2014 at 7:53 PM, Vaclav Petras <wenzeslaus at gmail.com>
> wrote:
> >
> >
> >
> > On Mon, Feb 10, 2014 at 1:19 PM, Markus Neteler <neteler at osgeo.org>
> wrote:
> >>
> >> Hi,
> >>
> >> I noticed on Linux that while type
> >>
> >> v.extract input=lakes out=anything where=@
> >>
> >> and a map name list pops up...
> >>
> >> Is this happening to anyone else?
> >>
> > If I understand correctly, you type " character but it is changed to @
> > character. This does not happen to me with EN and CS keyboard layouts.
>
> The " character is changed to @ for me too on a DE keyboard layout.
>

Could someone test the attached diff please?

Anna


>
> >
> > GRASS version: 7.0.svn
> > GRASS SVN Revision: 58850M
> > Build Date: 2014-01-03
> > GDAL/OGR: 1.10.0
> > PROJ.4: 4.8.0
> > GEOS: 3.3.8
> > SQLite: 3.7.9
> > Python: 2.7.3
> > wxPython: 2.8.12.1
> > Platform: Linux-3.2.0-58-generic-pae-i686-with-Ubuntu-12.04-precise
> >
> >>
> >> I use
> >> GRASS version: 7.0.svn
> >> GRASS SVN Revision: 58873M
> >> Build Date: 2014-01-04
> >> GDAL/OGR: 1.10.1
> >> PROJ.4: 4.8.0
> >> GEOS:
> >> SQLite: 3.8.2
> >> Python: 2.7.5
> >> wxPython: 2.8.12.0
> >> Platform: Linux-3.12.9-301.fc20.x86_64-x86_64-with-fedora-20-Heisenbug
> >>
> >> (Un)related: on Windows this seems to work but retrieving the command
> >> from the wxGUI history by scrolling "eats" the quotes.
> >>
> >> thanks
> >> Markus
> >> _______________________________________________
> >> grass-dev mailing list
> >> grass-dev at lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/grass-dev
> >
> >
> >
> > _______________________________________________
> > grass-dev mailing list
> > grass-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/grass-dev
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20140210/2a953941/attachment.html>
-------------- next part --------------
Index: gui/wxpython/gui_core/prompt.py
===================================================================
--- gui/wxpython/gui_core/prompt.py	(revision 58980)
+++ gui/wxpython/gui_core/prompt.py	(working copy)
@@ -175,6 +175,7 @@
         # bindings
         #
         self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
+        self.Bind(wx.EVT_CHAR, self.OnChar)
         self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPressed)
         self.Bind(wx.stc.EVT_STC_AUTOCOMP_SELECTION, self.OnItemSelected)
         self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemChanged)
@@ -375,16 +376,38 @@
         if len(self.autoCompList) > 0:
             self.autoCompList.sort()
             self.AutoCompShow(lenEntered = 0, itemList = ' '.join(self.autoCompList))    
-        
+
     def OnKeyPressed(self, event):
-        """!Key press capture for autocompletion, calltips, and command history
+        """!Key pressed capture special treatment for tabulator to show help"""
+        pos = self.GetCurrentPos()
+        if event.GetKeyCode() == wx.WXK_TAB:
+            # show GRASS command calltips (to hide press 'ESC')
+            entry = self.GetTextLeft()
+            try:
+                cmd = entry.split()[0].strip()
+            except IndexError:
+                cmd = ''
 
+            if cmd not in globalvar.grassCmd:
+                return
+
+            info = gtask.command_info(GetRealCmd(cmd))
+
+            self.CallTipSetBackground("#f4f4d1")
+            self.CallTipSetForeground("BLACK")
+            self.CallTipShow(pos, info['usage'] + '\n\n' + info['description'])
+        else:
+            event.Skip()
+
+    def OnChar(self, event):
+        """!Key char capture for autocompletion, calltips, and command history
+
         @todo event.ControlDown() for manual autocomplete
         """
         # keycodes used: "." = 46, "=" = 61, "-" = 45 
         pos = self.GetCurrentPos()
         # complete command after pressing '.'
-        if event.GetKeyCode() == 46 and not event.ShiftDown():
+        if event.GetKeyCode() == 46:
             self.autoCompList = list()
             entry = self.GetTextLeft()
             self.InsertText(pos, '.')
@@ -405,7 +428,7 @@
             self.ShowList()
 
         # complete flags after pressing '-'
-        elif (event.GetKeyCode() == 45 and not event.ShiftDown()) \
+        elif (event.GetKeyCode() == 45) \
                 or event.GetKeyCode() == wx.WXK_NUMPAD_SUBTRACT \
                 or event.GetKeyCode() == wx.WXK_SUBTRACT:
             self.autoCompList = list()
@@ -425,7 +448,7 @@
             self.ShowList()
             
         # complete map or values after parameter
-        elif event.GetKeyCode() == 61 and not event.ShiftDown():
+        elif event.GetKeyCode() == 61:
             self.autoCompList = list()
             self.InsertText(pos, '=')
             self.CharRight()
@@ -440,7 +463,7 @@
             self.ShowList()
         
         # complete mapset ('@')
-        elif event.GetKeyCode() == 50 and event.ShiftDown():
+        elif event.GetKeyCode() == 64:
             self.autoCompList = list()
             self.InsertText(pos, '@')
             self.CharRight()
@@ -511,24 +534,6 @@
                 
             self.ShowList()
 
-        elif event.GetKeyCode() == wx.WXK_TAB:
-            # show GRASS command calltips (to hide press 'ESC')
-            entry = self.GetTextLeft()
-            try:
-                cmd = entry.split()[0].strip()
-            except IndexError:
-                cmd = ''
-            
-            if cmd not in globalvar.grassCmd:
-                return
-            
-            info = gtask.command_info(GetRealCmd(cmd))
-            
-            self.CallTipSetBackground("#f4f4d1")
-            self.CallTipSetForeground("BLACK")
-            self.CallTipShow(pos, info['usage'] + '\n\n' + info['description'])
-            
-            
         elif event.GetKeyCode() in [wx.WXK_UP, wx.WXK_DOWN] and \
                  not self.AutoCompActive():
             # Command history using up and down   


More information about the grass-dev mailing list