mirror of https://github.com/KLayout/klayout.git
Do not show two templates for DRC scripts
This commit is contained in:
parent
b57bfa0f34
commit
ede16aacfb
|
|
@ -835,7 +835,7 @@ ApplicationBase::init_app ()
|
|||
mc->finish ();
|
||||
|
||||
// as this regenerates the macro collection, autorun_early is required again
|
||||
// note: this does no re-execute macros that have been executed already
|
||||
// note: this does not re-execute macros that have been executed already
|
||||
lym::MacroCollection::root ().autorun_early ();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,13 +62,15 @@ MacroController::add_macro_category (const std::string &name, const std::string
|
|||
void
|
||||
MacroController::finish ()
|
||||
{
|
||||
lym::MacroCollection::root ().clear ();
|
||||
lym::MacroCollection &root = lym::MacroCollection::root ();
|
||||
|
||||
root.clear ();
|
||||
|
||||
// Scan built-in macros
|
||||
// These macros are always taken, even if there are no macros requested (they are required to
|
||||
// fully form the API).
|
||||
lym::MacroCollection::root ().add_folder (tl::to_string (QObject::tr ("Built-In")), ":/built-in-macros", "macros", true);
|
||||
lym::MacroCollection::root ().add_folder (tl::to_string (QObject::tr ("Built-In")), ":/built-in-pymacros", "pymacros", true);
|
||||
root.add_folder (tl::to_string (QObject::tr ("Built-In")), ":/built-in-macros", "macros", true);
|
||||
root.add_folder (tl::to_string (QObject::tr ("Built-In")), ":/built-in-pymacros", "pymacros", true);
|
||||
|
||||
// scans the macros from techs and packages (this will allow autorun-early on them)
|
||||
// and updates m_external_paths
|
||||
|
|
@ -92,13 +94,13 @@ MacroController::finish ()
|
|||
description += " - " + tl::to_string (tr ("%1 branch").arg (tl::to_qstring (*f)));
|
||||
}
|
||||
|
||||
lym::MacroCollection::root ().add_folder (description, mp, m_macro_categories[c].name, p->readonly);
|
||||
root.add_folder (description, mp, m_macro_categories[c].name, p->readonly);
|
||||
|
||||
}
|
||||
|
||||
} else if (p->cat == m_macro_categories[c].name) {
|
||||
|
||||
lym::MacroCollection::root ().add_folder (p->description, p->path, m_macro_categories[c].name, p->readonly);
|
||||
root.add_folder (p->description, p->path, m_macro_categories[c].name, p->readonly);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +123,7 @@ MacroController::finish ()
|
|||
|
||||
if (! m_no_implicit_macros) {
|
||||
for (std::vector <ExternalPathDescriptor>::const_iterator p = m_external_paths.begin (); p != m_external_paths.end (); ++p) {
|
||||
lym::MacroCollection *mc = lym::MacroCollection::root ().add_folder (p->description, p->path, p->cat, p->readonly);
|
||||
lym::MacroCollection *mc = root.add_folder (p->description, p->path, p->cat, p->readonly);
|
||||
if (mc) {
|
||||
mc->set_virtual_mode (p->type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,6 +123,14 @@ public:
|
|||
|
||||
void register_gsi (const char *name)
|
||||
{
|
||||
// do not register an interpreter again (this is important as registration code
|
||||
// may be executed again and we do not want to have two interpreters for the same thing)
|
||||
for (tl::Registrar<lym::MacroInterpreter>::iterator cls = tl::Registrar<lym::MacroInterpreter>::begin (); cls != tl::Registrar<lym::MacroInterpreter>::end (); ++cls) {
|
||||
if (cls.current_name () == name) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// makes the object owned by the C++ side
|
||||
keep ();
|
||||
|
||||
|
|
@ -220,6 +228,16 @@ public:
|
|||
m->set_interpreter (lym::Macro::DSLInterpreter);
|
||||
m->set_format (storage_scheme ());
|
||||
|
||||
// avoid registering the same template twice
|
||||
for (auto t = m_templates.begin (); t != m_templates.end (); ++t) {
|
||||
if ((*t)->path () == m->path ()) {
|
||||
delete *t;
|
||||
*t = m;
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
||||
// not present yet - install at end
|
||||
m_templates.push_back (m);
|
||||
return m;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue