void Model_PluginManager::registerPlugin(ModelAPI_Plugin* thePlugin)
{
myPluginObjs[myCurrentPluginName] = thePlugin;
+ static Events_ID EVENT_LOAD = Events_Loop::loop()->eventByName(EVENT_PLUGIN_LOADED);
+ ModelAPI_EventCreator::get()->sendUpdated(ObjectPtr(), EVENT_LOAD);
+ Events_Loop::loop()->flush(EVENT_LOAD);
}
ModelAPI_ValidatorsFactory* Model_PluginManager::validators()
static const char * EVENT_OBJECT_TO_REDISPLAY = "ObjectsToRedisplay";
/// Event ID that visualization must be redisplayed (comes with ModelAPI_ObjectUpdatedMessage)
static const char * EVENT_OPERATION_LAUNCHED = "OperationLaunched";
+/// Event ID that plugin is loaded (comes with ModelAPI_ObjectUpdatedMessage)
+static const char * EVENT_PLUGIN_LOADED = "PliginLoaded";
/// Message that feature was changed (used for Object Browser update): moved, updated and deleted
class ModelAPI_ObjectUpdatedMessage : public Events_MessageGroup
{
XGUI_Preferences::updateCustomProps();
LightApp_Preferences* pref = preferences();
- int catId = pref->addPreference( moduleName(), -1 );
+ QString aModName = moduleName();
+
+ QtxPreferenceItem* item = pref->findItem(aModName, true );
+ if ( item && (!item->isEmpty() )) {
+ item->parentItem()->removeItem(item);
+ delete item;
+ }
+
+ int catId = pref->addPreference(aModName, -1 );
if ( catId == -1 )
return;
- NewGeom_PrefMgr aMgr(pref, moduleName());
+ NewGeom_PrefMgr aMgr(pref, aModName);
XGUI_Preferences::createEditContent(&aMgr, catId);
pref->retrieve();
}
//! Returns interface to Salome viewer
virtual XGUI_SalomeViewer* viewer() const = 0;
+
+ virtual void createPreferences() = 0;
};
#endif
mySalomeConnector(theConnector),
myPropertyPanel(0),
myObjectBrowser(0),
- myDisplayer(0)
+ myDisplayer(0),
+ myUpdatePrefs(false)
{
myMainWindow = mySalomeConnector ? 0 : new XGUI_MainWindow();
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED));
aLoop->registerListener(this, Events_Loop::eventByName("LongOperation"));
+ aLoop->registerListener(this, Events_Loop::eventByName(EVENT_PLUGIN_LOADED));
registerValidators();
activateModule();
const ModelAPI_ObjectUpdatedMessage* aUpdMsg =
dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
onFeatureCreatedMsg(aUpdMsg);
+ if (myUpdatePrefs) {
+ if (mySalomeConnector)
+ mySalomeConnector->createPreferences();
+ myUpdatePrefs = false;
+ }
+ return;
+ }
+ if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_PLUGIN_LOADED)) {
+ myUpdatePrefs = true;
return;
}
}
}
+
//******************************************************
void XGUI_Workshop::onStartWaiting()
{
void displayDocumentResults(DocumentPtr theDoc);
void displayGroupResults(DocumentPtr theDoc, std::string theGroup);
- protected slots:
+ private slots:
/// SLOT, that is called after the operation is started. Update workshop state according to
/// the started operation, e.g. visualizes the property panel and connect to it.
void onOperationStarted();
QString myCurrentDir;
static QMap<QString, QString> myIcons;
+
+ bool myUpdatePrefs;
};
#endif