If you want something more interactive, look into using a QValidator or an 
input mask on a Qt text field. Otherwise, sanitizing with regular expressions 
after the fact is a pretty solid solution.

-Nathan



From: Richard Bobo 
Sent: Friday, October 04, 2013 2:04 PM
To: Nuke Python discussion 
Subject: Re: [Nuke-python] Question about user input...

Magno,

Ha! Clever workaround. I have invested some time already, however, going down 
the path of rolling my own sanitizer… So, I think I'll keep going - since I'll 
be able to re-use it after I'm done for other user inputs, later. I'll give 
your suggestion a try later, after I'm done and see how well it works - maybe 
I'll change my mind!  ;^)

Thanks,
Rich




On Oct 4, 2013, at 4:22 PM, Magno Borgo <li...@borgo.tv> wrote:


  Correcting... "Create a dummy node"

    Here's an idea, looking quickly at docs, I couldn't find the function you 
need:

    Create a dummy name, set node name =  user text input and get it back 
sanitized.



      I don't htin kyou can do this, but will this help?


      import re
      string = '123 abc$&^'
      pattern = re.compile(r'[^\w]')
      newString = pattern.sub('_', string)
      print newString



      On 4/10/13 3:02 PM, Richard Bobo wrote:

        Hi, 

        I am writing a script that needs some user input name strings. I want 
to keep the names free of spaces and illegal characters. I know that the node 
"name" knob automatically cleans up spaces and unsupported characters as you 
type. If that user input method is accessible, I'd like to be able to use it 
instead of writing my own. Anyone know if it is accessible and how to call it, 
outside the knob name…?

        Thanks for any help,
        Rich


        Rich Bobo 
        Senior VFX Compositor
        Armstrong-White
        http://armstrong-white.com/

        Email:  richb...@mac.com
        Mobile:  (248) 840-2665
        Web:  http://richbobo.com/


        "Truth in our ideas means their power to work."
        - William James











_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python






    --
    Magno Borgo
    Certified Nuke Trainer
    www.boundaryvfx.com
    www.borgo.tv
    Brasil:Curitiba:GMT= -3




  --
  Magno Borgo
  Certified Nuke Trainer
  www.boundaryvfx.com
  www.borgo.tv
  Brasil:Curitiba:GMT= -3
  _______________________________________________
  Nuke-python mailing list
  Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
  http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python




--------------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to