Luca Brasi wrote:I wanted to pass text variables to the plugin which didn't work.
He/She is a new plugin developer. I do not think they know about parsing variable names. this has to be set up in the code. you will usually see a check box in the action to disable the parsing if it is supported. if there is no way to disable it then there is a pretty good chance that there is no parsing available.
I will explain how to use this feature for the plugin developer.
there is a mechanism in place that if used in conjunction with a text entry control in the action configuration dialog will allow the user to enter {some_variable_name} in the control and when the action gets run it will locate that variable and return the contents of the variable instead of a literal string that was entered.
The largest use of it is if you want to take the data that is returned from one action and enter it into another action. any data that is returned from an action gets put into a variable called eg.result. so if your action was to follow the user would be able to enter {eg.result} in the field and have the checkbox to parse checked and the information will automatically get transferred.
how this is used is you will commonly add an extra control to the configuration dialog that is a check box to enable or disable the parsing of the text. The code below is pseudo code for an example of how to set it up.
Code: Select all
class SomeAction(eg.ActionBase):
def __call__(self, param1, parse_param1=False):
if parse_param1:
param1 = eg.ParseString(param1)
def Configure(self, param1='', parse_param1=False):
panel = eg.ConfigPanel()
param_st = panel.StaticText('Param 1')
param_ctrl = panel.TextCtrl(param1)
parse_st = panel.StaticText('Parse Param 1')
parse_ctrl = wx.CheckBox(panel, -1, '')
parse_ctrl.SetValue(parse_param1)
param_sizer = wx.BoxSizer(wx.HORIZONTAL)
param_sizer.Add(param_st, 0, wx.EXPAND | wx.ALL, 5)
param_sizer.Add(param_ctrl, 0, wx.EXPAND | wx.ALL, 5)
parse_sizer = wx.BoxSizer(wx.HORIZONTAL)
parse_sizer.Add(parse_st, 0, wx.EXPAND | wx.ALL, 5)
parse_sizer.Add(parse_ctrl, 0, wx.EXPAND | wx.ALL, 5)
panel.sizer.Add(param_sizer, 0, wx.EXPAND)
panel.sizer.Add(parse_sizer, 0, wx.EXPAND)
while panel.Affirmed():
panel.SetResult(
param_ctrl.GetValue(),
parse_ctrl.GetValue()
)