##// END OF EJS Templates
Initial Pybind11 binding experiment working....
Initial Pybind11 binding experiment working. Can open an amda formatted file from Python and get few attributes from ScalarSeries. Loading module from python works. Embedding python interpreter also works. Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>

File last commit:

r1327:07b2554d7734
r1339:98271eda8c6e
Show More
CatalogueExplorer.cpp
207 lines | 8.1 KiB | text/x-c | CppLexer
/ gui / src / Catalogue / CatalogueExplorer.cpp
Adds the new CatalogueExplorer dialog
r1093 #include "Catalogue/CatalogueExplorer.h"
#include "ui_CatalogueExplorer.h"
Zone actions to create a new event
r1163 #include <Catalogue/CatalogueActionManager.h>
Adaptation to last version of catalogue controller
r1164 #include <Catalogue/CatalogueController.h>
#include <SqpApplication.h>
Link between selection zone item and event
r1293 #include <Visualization/VisualizationGraphWidget.h>
#include <Visualization/VisualizationSelectionZoneItem.h>
Retrieves zone names from the visualization
r1136 #include <Visualization/VisualizationWidget.h>
Display catalogues and events with CatalogueAPI
r1129 #include <DBCatalogue.h>
#include <DBEvent.h>
Link between selection zone item and event
r1293 #include <DBEventProduct.h>
#include <unordered_map>
Display catalogues and events with CatalogueAPI
r1129
Retrieves zone names from the visualization
r1136 struct CatalogueExplorer::CatalogueExplorerPrivate {
Zone actions to create a new event
r1163 CatalogueActionManager m_ActionManager;
Link between selection zone item and event
r1293 std::unordered_map<std::shared_ptr<DBEvent>, QVector<VisualizationSelectionZoneItem *> >
m_SelectionZonesPerEvents;
Updates model after an event has been created through the colored zone
r1231
Link with selection zone on event creation
r1294 QMetaObject::Connection m_Conn;
Updates model after an event has been created through the colored zone
r1231 CatalogueExplorerPrivate(CatalogueExplorer *catalogueExplorer)
: m_ActionManager(catalogueExplorer)
{
}
Retrieves zone names from the visualization
r1136 };
Adds the new CatalogueExplorer dialog
r1093 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
Fix window flags of the catalogue gui
r1100 : QDialog(parent, Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
Retrieves zone names from the visualization
r1136 ui(new Ui::CatalogueExplorer),
Updates model after an event has been created through the colored zone
r1231 impl{spimpl::make_unique_impl<CatalogueExplorerPrivate>(this)}
Adds the new CatalogueExplorer dialog
r1093 {
ui->setupUi(this);
Basic interactions
r1103
Zone actions to create a new event
r1163 impl->m_ActionManager.installSelectionZoneActions();
Link between selection zone item and event
r1293 // Updates events and inspector when something is selected in the catalogue widget
Multi selection of catalogues
r1132 connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto catalogues) {
if (catalogues.count() == 1) {
ui->inspector->setCatalogue(catalogues.first());
}
else {
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
}
ui->events->populateWithCatalogues(catalogues);
Basic interactions
r1103 });
Multi selection of catalogues
r1132 connect(ui->catalogues, &CatalogueSideBarWidget::databaseSelected, [this](auto databases) {
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
});
Handle selection of trash and repository items
r1234 connect(ui->catalogues, &CatalogueSideBarWidget::trashSelected, [this]() {
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
ui->events->clear();
});
Multi selection of catalogues
r1132
Displays all events
r1160 connect(ui->catalogues, &CatalogueSideBarWidget::allEventsSelected, [this]() {
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
ui->events->populateWithAllEvents();
});
Multi selection of catalogues
r1132
Handle selection of trash and repository items
r1234 connect(ui->catalogues, &CatalogueSideBarWidget::databaseSelected, [this](auto databaseList) {
QVector<std::shared_ptr<DBCatalogue> > catalogueList;
for (auto database : databaseList) {
catalogueList.append(ui->catalogues->getCatalogues(database));
}
ui->events->populateWithCatalogues(catalogueList);
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
});
connect(ui->catalogues, &CatalogueSideBarWidget::selectionCleared, [this]() {
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
ui->events->clear();
});
Multi selection of catalogues
r1132
Save a statical catalogue now remove events save gui button
r1316 connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSaved, ui->events,
&CatalogueEventsWidget::refresh);
Refresh catalogue menu when the catalogue list changed
r1327 connect(ui->catalogues, &CatalogueSideBarWidget::catalogueListChanged,
[this]() { impl->m_ActionManager.refreshCreateInCatalogueAction(); });
Link between selection zone item and event
r1293 // Updates the inspectot when something is selected in the events
Manage inspector with multiple events selected
r1131 connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) {
if (events.count() == 1) {
ui->inspector->setEvent(events.first());
}
else {
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
}
});
Edition of catalogues from the inspector
r1147
Edition of event products via the inspector
r1150 connect(ui->events, &CatalogueEventsWidget::eventProductsSelected, [this](auto eventProducts) {
if (eventProducts.count() == 1) {
ui->inspector->setEventProduct(eventProducts.first().first,
eventProducts.first().second);
}
else {
ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
}
});
connect(ui->events, &CatalogueEventsWidget::selectionCleared,
[this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
Link between selection zone item and event
r1293 // Manage Selection Zones associated to events
connect(ui->events, &CatalogueEventsWidget::selectionZoneAdded,
[this](auto event, auto productId, auto zone) {
Link with selection zone on event creation
r1294 this->addSelectionZoneItem(event, productId, zone);
Link between selection zone item and event
r1293 });
connect(ui->events, &CatalogueEventsWidget::eventsRemoved, [this](auto events) {
for (auto event : events) {
auto associatedSelectionZonesIt = impl->m_SelectionZonesPerEvents.find(event);
if (associatedSelectionZonesIt != impl->m_SelectionZonesPerEvents.cend()) {
for (auto selectionZone : associatedSelectionZonesIt->second) {
auto parentGraph = selectionZone->parentGraphWidget();
parentGraph->removeSelectionZone(selectionZone);
}
impl->m_SelectionZonesPerEvents.erase(event);
}
}
});
// Updates changes from the inspector
Adaptation to last version of catalogue controller
r1164 connect(ui->inspector, &CatalogueInspectorWidget::catalogueUpdated, [this](auto catalogue) {
sqpApp->catalogueController().updateCatalogue(catalogue);
ui->catalogues->setCatalogueChanges(catalogue, true);
Refresh catalogue menu when the catalogue list changed
r1327 impl->m_ActionManager.refreshCreateInCatalogueAction();
Adaptation to last version of catalogue controller
r1164 });
Edition of events from the inspector
r1148
Adaptation to last version of catalogue controller
r1164 connect(ui->inspector, &CatalogueInspectorWidget::eventUpdated, [this](auto event) {
sqpApp->catalogueController().updateEvent(event);
ui->events->setEventChanges(event, true);
});
Edition of event products via the inspector
r1150
connect(ui->inspector, &CatalogueInspectorWidget::eventProductUpdated,
Add init of DisplayedEvent. Add save on EventProduct modif
r1226 [this](auto event, auto eventProduct) {
sqpApp->catalogueController().updateEventProduct(eventProduct);
ui->events->setEventChanges(event, true);
});
Remove Event from catalogue statique only remove the reference.
r1313
connect(ui->events, &CatalogueEventsWidget::eventCataloguesModified,
[this](const QVector<std::shared_ptr<DBCatalogue> > &catalogues) {
for (auto catalogue : catalogues) {
ui->catalogues->setCatalogueChanges(catalogue, true);
}
});
Adds the new CatalogueExplorer dialog
r1093 }
CatalogueExplorer::~CatalogueExplorer()
{
Link with selection zone on event creation
r1294 disconnect(impl->m_Conn);
Adds the new CatalogueExplorer dialog
r1093 delete ui;
}
Retrieves zone names from the visualization
r1136
void CatalogueExplorer::setVisualizationWidget(VisualizationWidget *visualization)
{
ui->events->setVisualizationWidget(visualization);
}
Updates model after an event has been created through the colored zone
r1231
CatalogueEventsWidget &CatalogueExplorer::eventsWidget() const
{
return *ui->events;
}
CatalogueSideBarWidget &CatalogueExplorer::sideBarWidget() const
{
return *ui->catalogues;
}
Link with selection zone on event creation
r1294
void CatalogueExplorer::clearSelectionZones()
{
impl->m_SelectionZonesPerEvents.clear();
}
void CatalogueExplorer::addSelectionZoneItem(const std::shared_ptr<DBEvent> &event,
const QString &productId,
VisualizationSelectionZoneItem *selectionZone)
{
impl->m_SelectionZonesPerEvents[event] << selectionZone;
connect(selectionZone, &VisualizationSelectionZoneItem::rangeEdited,
[event, productId, this](auto range) {
auto productList = event->getEventProducts();
for (auto &product : productList) {
if (product.getProductId() == productId) {
product.setTStart(range.m_TStart);
product.setTEnd(range.m_TEnd);
}
}
event->setEventProducts(productList);
sqpApp->catalogueController().updateEvent(event);
ui->events->refreshEvent(event);
ui->events->setEventChanges(event, true);
ui->inspector->refresh();
});
impl->m_Conn = connect(selectionZone, &VisualizationSelectionZoneItem::destroyed,
[event, selectionZone, this]() {
if (!impl->m_SelectionZonesPerEvents.empty()) {
impl->m_SelectionZonesPerEvents[event].removeAll(selectionZone);
}
});
}