Adding and accessing a Settable when a dynamic CommandSet is added. #1298
-
I'm trying to work through a bit of an issue. I have a command that checks a boolean variable to see if the user wants to capture some data or not, which I originally had a command to set, but then realized I didn't need to do this if the variable was a settable. The issue is that I would LIKE to have that variable squirrelled away with a set of commands the user can load dynamically instead of what I have now, which is the variable is part of the App all the time. The problem is, a main app command looks at this variable to see if it should actually call commands from the dynamically loaded command set. Is there a way to access a variable added when the CommandSet is loaded, and ignored if the CommandSet isn't loaded? Is there a way to see if there is a Settable in the Settables? I've seen the dynamic command example, but it doesn't show any access to Settables from a dynamic command, or if there is a way to access a Settable from the App if that CommandSet is loaded and registered. Even if there was some kind of "global" area that a CommandSet could add something to without being a direct part of the App might be useful? I would even settle for creating a command I could call with "onecmd_with_hooks" that would let me pass something back to the App... but it wasn't entirely clear how to do that. Also, there is a status that I would like to be able to display BASED on the variable, but the status command is just a normal command, not part of the CommandSet. If there weren't two commands that are normally available even when the CommandSet isn't loaded, this wouldn't be a problem. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Found out how to do this a different way. Though I wish there had been an example where you load a command set, and on load it hides commands it isn't ready for yet, then after an "init" command is run, unhides commands. But, eventually I got that worked out. Especially the fact that if you write your own on_register command, you really SHOULD call the super's on_register, otherwise commandset's self._cmd isn't set properly. |
Beta Was this translation helpful? Give feedback.
Found out how to do this a different way. Though I wish there had been an example where you load a command set, and on load it hides commands it isn't ready for yet, then after an "init" command is run, unhides commands. But, eventually I got that worked out. Especially the fact that if you write your own on_register command, you really SHOULD call the super's on_register, otherwise commandset's self._cmd isn't set properly.