[GRASS-dev] wxGUI customized toolboxes: handler for non-GRASS commands
Yann Chemin
ychemin at gmail.com
Sat May 17 20:46:53 PDT 2014
Hi Anna,
Patch works great ! Needs RunMenuCmd and all goes to perfection. Any
chance to have it included in the SVN tree?
Thank you
Yann
On 18/05/2014, Anna Petrášová <kratochanna at gmail.com> wrote:
> Hi Yann,
>
> it's grayed out because it tests if it's a working grass command (for
> example r.in.lidar is grayed when you don't compile grass with liblas). You
> can try to apply this patch which tests if the command looks like grass
> command (regular expression) and if it is not, it doesn't disable it in
> menu.
>
> Index: gui_core/menu.py
> ===================================================================
> --- gui_core/menu.py (revision 60284)
> +++ gui_core/menu.py (working copy)
> @@ -18,7 +18,7 @@
> @author Robert Szczepanek (menu customization)
> @author Vaclav Petras <wenzeslaus gmail.com> (menu customization)
> """
> -
> +import re
> import wx
>
> from core import globalvar
> @@ -91,7 +91,8 @@
> cmd = utils.split(str(command))
> except UnicodeError:
> cmd = utils.split(EncodeString((command)))
> - if cmd and cmd[0] not in globalvar.grassCmd:
> + if cmd and cmd[0] not in globalvar.grassCmd and \
> + re.match('[rvdipmgt][3bs]?\.([a-z0-9\.])+', cmd[0]):
> menuItem.Enable(False)
>
> rhandler = eval('self.parent.' + handler)
>
>
>
> On Fri, May 16, 2014 at 12:30 AM, Yann Chemin <ychemin at gmail.com> wrote:
>
>> in svn/gui/wxpython/lmgr/frame.py
>> line 758
>> by adding:
>>
>> def RunCmd(self, event = None, cmd = []):
>> """!Run command to system from menu"""
>> if event:
>> cmd = self.GetMenuCmd(event)
>> os.system(cmd)
>>
>>
> I am not sure if this is needed. I would say it might work without this
> change but you have to try it out.
>
>
> Best,
>
> Anna
>
>
>> it should handle it, however, it seems that a flag is needed to enable
>> the possibility to click the command from the created menu. It is
>> still grey/shadowed.
>>
>>
>>
>> On 16/05/2014, Yann Chemin <ychemin at gmail.com> wrote:
>> > To be precise, the non-GRASS programs have their own GUI already, and
>> > the calls need only one word.
>> >
>> > On 16/05/2014, Yann Chemin <ychemin at gmail.com> wrote:
>> >> Hi,
>> >>
>> >> I would like to make a customized toolbox to call some non-GRASS CLI
>> >> programs.
>> >>
>> >> Handlers OnMenuCmd and RunMenuCmd seem not to work. The menu items are
>> >> grey/shadowed so that no mouse click is allowed on them.
>> >>
>> >> thanks
>> >> Yann
>> >> --
>> >> ----
>> >>
>> >
>> >
>> > --
>> > ----
>> >
>>
>>
>> --
>> ----
>> _______________________________________________
>> grass-dev mailing list
>> grass-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-dev
>>
>
--
----
More information about the grass-dev
mailing list