On Mon, Feb 10, 2014 at 3:25 PM, Anna Petrášová <kratocha...@gmail.com>wrote:
> > > > On Mon, Feb 10, 2014 at 2:28 PM, Markus Metz < > markus.metz.gisw...@gmail.com> wrote: > >> On Mon, Feb 10, 2014 at 7:53 PM, Vaclav Petras <wenzesl...@gmail.com> >> wrote: >> > >> > >> > >> > On Mon, Feb 10, 2014 at 1:19 PM, Markus Neteler <nete...@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? > Sorry, new better diff attached. > > 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@lists.osgeo.org >> >> http://lists.osgeo.org/mailman/listinfo/grass-dev >> > >> > >> > >> > _______________________________________________ >> > grass-dev mailing list >> > grass-dev@lists.osgeo.org >> > http://lists.osgeo.org/mailman/listinfo/grass-dev >> _______________________________________________ >> grass-dev mailing list >> grass-dev@lists.osgeo.org >> http://lists.osgeo.org/mailman/listinfo/grass-dev >> > >
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,73 @@ 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']) + elif event.GetKeyCode() in (wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER) and \ + not self.AutoCompActive(): + # run command on line when <return> is pressed + self._runCmd(self.GetCurLine()[0].strip()) + elif event.GetKeyCode() in [wx.WXK_UP, wx.WXK_DOWN] and \ + not self.AutoCompActive(): + # Command history using up and down + if len(self.cmdbuffer) < 1: + return + + self.DocumentEnd() + + # move through command history list index values + if event.GetKeyCode() == wx.WXK_UP: + self.cmdindex = self.cmdindex - 1 + if event.GetKeyCode() == wx.WXK_DOWN: + self.cmdindex = self.cmdindex + 1 + if self.cmdindex < 0: + self.cmdindex = 0 + if self.cmdindex > len(self.cmdbuffer) - 1: + self.cmdindex = len(self.cmdbuffer) - 1 + + try: + txt = self.cmdbuffer[self.cmdindex] + except KeyError: + txt = '' + + # clear current line and insert command history + self.DelLineLeft() + self.DelLineRight() + pos = self.GetCurrentPos() + self.InsertText(pos, txt) + self.LineEnd() + + self.ShowStatusText('') + 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 +463,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 +483,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 +498,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,61 +569,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 - if len(self.cmdbuffer) < 1: - return - - self.DocumentEnd() - - # move through command history list index values - if event.GetKeyCode() == wx.WXK_UP: - self.cmdindex = self.cmdindex - 1 - if event.GetKeyCode() == wx.WXK_DOWN: - self.cmdindex = self.cmdindex + 1 - if self.cmdindex < 0: - self.cmdindex = 0 - if self.cmdindex > len(self.cmdbuffer) - 1: - self.cmdindex = len(self.cmdbuffer) - 1 - - try: - txt = self.cmdbuffer[self.cmdindex] - except KeyError: - txt = '' - - # clear current line and insert command history - self.DelLineLeft() - self.DelLineRight() - pos = self.GetCurrentPos() - self.InsertText(pos,txt) - self.LineEnd() - - self.ShowStatusText('') - - elif event.GetKeyCode() in (wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER) and \ - self.AutoCompActive() == False: - # run command on line when <return> is pressed - self._runCmd(self.GetCurLine()[0].strip()) - elif event.GetKeyCode() == wx.WXK_SPACE: items = self.GetTextLeft().split() if len(items) == 1:
_______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev