Closed jfbourdon closed 2 years ago
I convinced myself, a search and replace approach is just better in every way.
The search and replace could also always be performed. That way, there isn't a new checkbox:
@jfbourdon I'm sorry, I missed all the notifications from this repo somehow! I like the third solution the most. The simpler, the better :) Could you please push it to the PR?
@jfbourdon Forget it, it's just two lines so I'm just doing it. I'm closing this MR, but the change will be done.
Here it is (with some extra love to the gui, eg. now the TextEdit availability is controlled by the checkbox): 8a83b74d6514b
Adds a checkbox to automatically append the plugin's name to the command. That way, I can let a script manage the origin and destination of files based (copying from dev directory to QGIS plugin directory):
Currently, I have to type in the extra commands text box something like
python C:\dev\copyMyPlugin.py pluginUnderDevelopment
. With his PR, I only need to typepython C:\dev\copyMyPlugin.py
and thepluginUnderDevelopment
will be appended as the last argument automatically. That way, if I now switch my development tocoolOtherPlugin
, I don't have to change anything in my command and risk messing things up by misspelling the name for example.Second thoughs It may not be the best approach. I was also thinking of simply adding a function to replace a specific string like
%PluginName%
by the plugin's name everywhere in the command string. That way, the name can be used at multiple places instead of just at the end. I would be replacingextra_commands += " " + currentPlugin()
byextra_commands = extra_commands.replace('%PluginName%', currentPlugin())
. I think it would have the added benefit to be more explicit.