Lua Script-Selector update
* register bindings for action_param * honor pre-seeded value (don't ask) * allow to pre-seed a script-name * allow to cancel interactive script load at parameter-stage
This commit is contained in:
parent
bb5345614d
commit
f3be5bb421
|
@ -1330,11 +1330,20 @@ LuaInstance::interactive_add (LuaScriptInfo::ScriptType type, int id)
|
|||
return false;
|
||||
}
|
||||
|
||||
LuaScriptParamList lsp = LuaScriptParams::script_params (spi, param_function);
|
||||
LuaState ls;
|
||||
register_classes (ls.getState ());
|
||||
LuaScriptParamList lsp = LuaScriptParams::script_params (ls, spi->path, param_function);
|
||||
|
||||
/* allow cancel */
|
||||
for (size_t i = 0; i < lsp.size(); ++i) {
|
||||
if (lsp[i]->preseeded && lsp[i]->name == "x-script-abort") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ScriptParameterDialog spd (_("Set Script Parameters"), spi, reg, lsp);
|
||||
|
||||
if (!spd.need_interation ()) {
|
||||
if (spd.need_interation ()) {
|
||||
switch (spd.run ()) {
|
||||
case Gtk::RESPONSE_ACCEPT:
|
||||
break;
|
||||
|
@ -1343,7 +1352,7 @@ LuaInstance::interactive_add (LuaScriptInfo::ScriptType type, int id)
|
|||
}
|
||||
}
|
||||
|
||||
LuaScriptParamPtr lspp (new LuaScriptParam("x-script-origin", "", spi->path, false));
|
||||
LuaScriptParamPtr lspp (new LuaScriptParam("x-script-origin", "", spi->path, false, true));
|
||||
lsp.push_back (lspp);
|
||||
|
||||
switch (type) {
|
||||
|
|
|
@ -162,6 +162,13 @@ ScriptParameterDialog::ScriptParameterDialog (std::string title,
|
|||
t->set_spacings (6);
|
||||
|
||||
_name_entry.set_text (spi->name);
|
||||
|
||||
for (size_t i = 0; i < _lsp.size(); ++i) {
|
||||
if (_lsp[i]->preseeded && _lsp[i]->name == "x-script-name" && !_lsp[i]->value.empty ()) {
|
||||
_name_entry.set_text (_lsp[i]->value);
|
||||
}
|
||||
}
|
||||
|
||||
_name_entry.signal_changed().connect (sigc::mem_fun (*this, &ScriptParameterDialog::update_sensitivity));
|
||||
|
||||
int ty = 0;
|
||||
|
@ -211,13 +218,15 @@ ScriptParameterDialog::ScriptParameterDialog (std::string title,
|
|||
bool
|
||||
ScriptParameterDialog::need_interation () const
|
||||
{
|
||||
if (_lsp.size () > 0) {
|
||||
return false;
|
||||
}
|
||||
if (!parameters_ok ()) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
for (size_t i = 0; i < _lsp.size(); ++i) {
|
||||
if (!_lsp[i]->optional && !_lsp[i]->preseeded) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
Loading…
Reference in New Issue
Block a user