{
// Get the current module's name
auto moduleNameItem = PyList_GetItem(removedModules, pos);
- QString name(PyUnicode_AsUTF8(moduleNameItem));
- SCRUTE(name.toStdString());
+ QString moduleInnerName(PyUnicode_AsUTF8(moduleNameItem));
+ SCRUTE(moduleInnerName.toStdString());
+
+ // There is a some confusion point, because now we have a module's 'inner' name
+ // from the extension's salomexd file.
+ // But, in the next GUI methods we need to use a module title (user name).
+ // For example, PYHELLO (inner name) and PyHello (user name to display in GUI).
+ // Then, from the inner module's name we need to get a user one.
+ QString moduleUserName = moduleTitle(moduleInnerName);
+ SCRUTE(moduleUserName.toStdString());
// Set current state in modules combo box
- if (activeModule() && activeModule()->moduleName() == name)
- activateModule( "" );
+ // Don't confuse again, because activeModule()->moduleName() returns a module title, not an inner one!
+ if (activeModule() && activeModule()->moduleName() == moduleUserName)
+ activateModule("");
// Remove from "Modules" menu and toolbar
if (moduleAction)
{
- moduleAction->removeModule(name);
+ moduleAction->removeModule(moduleUserName);
}
// Remove Help menu items
- removeHelpItems(name);
+ removeHelpItems(moduleUserName);
// Remove Preferences
LightApp_Preferences* prefs = preferences();
if (prefs)
- prefs->removeModule(name);
+ prefs->removeModule(moduleUserName);
// Remove settings
+ // Here we use an inner module name!
QStringList customModules = resourceMgr()->stringValue("launch", "user_modules").split(";", QString::SkipEmptyParts);
- customModules.removeAll(moduleName(name));
+ customModules.removeAll(moduleInnerName);
resourceMgr()->setValue("launch", "user_modules", customModules.join(";"));
- removeModuleInfo(moduleName(name));
+ removeModuleInfo(moduleInnerName);
}
// Remove an ext from UI
a->setStatusTip( tr( "ACTIVATE_MODULE_TOP" ).arg( name ) );
a->setData( isCustom );
- // Commented because of using buttons for extension instead of modules
- // if ( isCustom )
- // {
- // myRemove->setEnabled( true );
- // QAction* inserted = myRemove->menu()->addAction( name );
- // connect( inserted, SIGNAL( triggered() ), myMapper, SLOT( map() ) );
- // myMapper->setMapping( inserted, name );
- // }
-
mySet->insertAction( a, -1, idx );
update();
}
MESSAGE("Start to remove module...");
int id = mySet->moduleId( name );
+ SCRUTE(id);
if ( id == -1 )
+ {
MESSAGE("Can't get a module's id! Return");
return;
+ }
- QAction* a = moduleAction( name );
- bool isCustom = a->data().toBool();
-
- SCRUTE(id);
- mySet->removeAction( id );
- // Commented because of using buttons for extension instead of modules
- // if ( isCustom )
- // {
- // foreach ( QAction* ma, myRemove->menu()->actions() )
- // {
- // if ( ma->text() == name )
- // {
- // myRemove->menu()->removeAction( ma );
- // break;
- // }
- // }
- // myRemove->setEnabled( !myRemove->menu()->actions().isEmpty() );
- // }
+ MESSAGE("Remove action by id...");
+ mySet->removeAction(id);
update();