Creating multi-line text fields
Forum rules
This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
-
Perry The Cynic
- Posts: 857
- Joined: Mon Apr 07, 2008 9:46 pm
Creating multi-line text fields
Is it possible to create a multi-line text field in a plugin's ConfigUI, and how?
I'm trying to make an action configuration field to enter Python code, and a single line really isn't terribly useful for that. Yes, the user can paste multi-line Python text into that field, but only the last line is displayed, and editing is impractical.
Cheers
-- perry
I'm trying to make an action configuration field to enter Python code, and a single line really isn't terribly useful for that. Yes, the user can paste multi-line Python text into that field, but only the last line is displayed, and editing is impractical.
Cheers
-- perry
- jay (support)
- Site Admin
- Posts: 19232
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
Re: Creating multi-line text fields
Not at the moment. We have a few field types we'd like to add to v2 of the API but that won't be until at least Indigo 6.
-
Perry The Cynic
- Posts: 857
- Joined: Mon Apr 07, 2008 9:46 pm
Re: Creating multi-line text fields
Any suggestions on how to make a viable put-your-script-here field until then?Not at the moment. We have a few field types we'd like to add to v2 of the API but that won't be until at least Indigo 6.
Cheers
-- Perry
- matt (support)
- Site Admin
- Posts: 21542
- Joined: Mon Jan 27, 2003 1:17 pm
- Location: Texas
- Contact:
Re: Creating multi-line text fields
A couple of thoughts: 1) have the enter a raw file path to a script file, 2) have an Action Group popup instead and have them create an Action Group with an embedded script.
If you need a return value though, those become less practical (or impossible).
If you need a return value though, those become less practical (or impossible).
-
Perry The Cynic
- Posts: 857
- Joined: Mon Apr 07, 2008 9:46 pm
Re: Creating multi-line text fields
(1) doesn't work for remote administration (which I use heavily and want to support). Does it?A couple of thoughts: 1) have them enter a raw file path to a script file, 2) have an Action Group popup instead and have them create an Action Group with an embedded script.
(2) is what I'd love to do (it's the "Indigo way"). But I'm implementing "run this script in my plugin's execution context" (not the one that Indigo provides by default), and there's no way to have Indigo send a script over to a plugin for execution, is there? (I guess that's the feature I actually want here - a plugin action that uses Indigo's "perform script" UI. Fat chance.
I may just dust off my old design to run my own plugin-embedded web server... is there some supported way to say "open this URL on the Indigo client that has this ConfigUI open"?
Thanks
-- perry
- matt (support)
- Site Admin
- Posts: 21542
- Joined: Mon Jan 27, 2003 1:17 pm
- Location: Texas
- Contact:
Re: Creating multi-line text fields
Regarding #2, you can use the main Indigo python context to send an action to a specific plugin. For example, this script chunk executes the setVolume action in the iTunes plugin:
So you could send the script you want executed as a string to an action in your plugin. You could also wrap up the glue code that gets the plugin from the ID, checks its isEnabled() flag and calls executeAction in to a shared python attachment class. See the specialLog() function definition here as an example. So ultimately from Indigo's embedded action UI the user would do something like:
I'm not sure if that is usable enough for what you are trying to do, and you have to manage installing or moving the cynicglue.py file into the /Library/Python/2.x/site-packages/ folder some how.
Code: Select all
itunesId = "com.perceptiveautomation.indigoplugin.itunes"
itunesPlugin = indigo.server.getPlugin(itunesId)
if itunesPlugin.isEnabled():
itunesPlugin.executeAction("setVolume", deviceId=135305663, props={'volume':50})Code: Select all
import cynicglue as cg
cg.executeCynically("some .py sode")-
Perry The Cynic
- Posts: 857
- Joined: Mon Apr 07, 2008 9:46 pm
Re: Creating multi-line text fields
Conceptually it's fine - that's what we have an Indigo "execute script" action for. I'll start another thread or two with ensuing details.I'm not sure if that is usable enough for what you are trying to do, and you have to manage installing or moving the cynicglue.py file into the /Library/Python/2.x/site-packages/ folder some how.
Of course it does occur to me that you could easily embrace this thought by extending the script type popup (that currently contains "Applescript" and "Python") to include the names of all enabled plugins that happen to define an action called (say) "do script", and simply turn execution of such a script action into an action invocation for that plugin. This would make script execution totally extensible; not just for Python injection as here, but for arbitrary scripting as defined by a plugin - anyone could invent a new Indigo scripting language just by writing a plugin and giving it a "do script" action. Wouldn't that be great, not to mention fairly simple for you to do, and totally backward compatible?
Cheers
-- perry
- jay (support)
- Site Admin
- Posts: 19232
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
Re: Creating multi-line text fields
Interesting idea. The "fairly simple for you to do" part is inaccurate however. Anything can be done of course but everything takes time for design, development, thorough testing, and documentation so it's got to be weighed for ROI.
-
Perry The Cynic
- Posts: 857
- Joined: Mon Apr 07, 2008 9:46 pm
Re: Creating multi-line text fields
Hey, man... I'm trying to sell you on the idea. You want realism here?Interesting idea. The "fairly simple for you to do" part is inaccurate however. Anything can be done of course but everything takes time for design, development, thorough testing, and documentation so it's got to be weighed for ROI.
Still... you've already got the scripting action and the dialog complete with a popup to extend, and the mechanics of calling an action in a plugin. For something as potentially big as third party script engine support, this one's pretty cheap. Just think how often you'd get to tell us "Implement it yourself, we gave you the tools."
Cheers
-- perry
