#include <FWPathsPopup.h>
Public Member Functions | |
void | applyEditor () |
void | cellClicked (Int_t iRow, Int_t iColumn, Int_t iButton, Int_t iKeyMod, Int_t iGlobalX, Int_t iGlobalY) |
FWPathsPopup (FWFFLooper *, FWGUIManager *) | |
virtual Bool_t | HandleKey (Event_t *event) |
bool & | hasChanges () |
void | postModule (edm::ModuleDescription const &) |
void | postProcessEvent (edm::Event const &, edm::EventSetup const &) |
void | preModule (edm::ModuleDescription const &) |
void | scheduleReloadEvent () |
void | setup (const edm::ScheduleInfo *info) |
void | updateFilterString (const char *str) |
void | windowIsClosing () |
Private Member Functions | |
ClassDef (FWPathsPopup, 0) | |
Private Attributes | |
TGTextButton * | m_apply |
FWGUIManager * | m_guiManager |
bool | m_hasChanges |
const edm::ScheduleInfo * | m_info |
FWFFLooper * | m_looper |
TGLabel * | m_moduleLabel |
TGLabel * | m_moduleName |
FWPSetTableManager * | m_psTable |
TGTextEntry * | m_search |
FWTableWidget * | m_tableWidget |
Definition at line 26 of file FWPathsPopup.h.
FWPathsPopup::FWPathsPopup | ( | FWFFLooper * | looper, |
FWGUIManager * | guiManager | ||
) |
Definition at line 37 of file FWPathsPopup.cc.
References FWDialogBuilder::addLabel(), FWDialogBuilder::addTable(), FWDialogBuilder::addTextButton(), FWDialogBuilder::addTextEntry(), FWTableWidget::body(), FWTableWidget::disableGrowInWidth(), idDealer::editor, FWDialogBuilder::expand(), FWDialogBuilder::floatLeft(), FWDialogBuilder::indent(), m_apply, FWPSetTableManager::m_editor, m_psTable, m_search, m_tableWidget, FWTableWidget::SetBackgroundColor(), FWPSetTableManager::setCellValueEditor(), FWTableWidget::SetHeaderBackgroundColor(), FWTableWidget::SetLineSeparatorColor(), and FWDialogBuilder::spaceDown().
: TGMainFrame(gClient->GetRoot(), 400, 600), m_info(0), m_looper(looper), m_hasChanges(false), m_moduleLabel(0), m_moduleName(0), m_apply(0), m_psTable(new FWPSetTableManager()), m_guiManager(guiManager) { gVirtualX->SelectInput(GetId(), kKeyPressMask | kKeyReleaseMask | kExposureMask | kPointerMotionMask | kStructureNotifyMask | kFocusChangeMask | kEnterWindowMask | kLeaveWindowMask); this->Connect("CloseWindow()","FWPathsPopup",this,"windowIsClosing()"); FWDialogBuilder builder(this); builder.indent(4) .spaceDown(10) .addLabel("Filter:").floatLeft(4).expand(false, false) .addTextEntry("", &m_search).expand(true, false) .spaceDown(10) .addTable(m_psTable, &m_tableWidget).expand(true, true) .addTextButton("Apply changes and reload", &m_apply); FWPSetCellEditor *editor = new FWPSetCellEditor(m_tableWidget->body(), ""); editor->SetBackgroundColor(gVirtualX->GetPixel(kYellow-7)); editor->SetFrameDrawn(false); m_psTable->setCellValueEditor(editor); m_psTable->m_editor->Connect("ReturnPressed()", "FWPathsPopup", this, "applyEditor()"); m_apply->Connect("Clicked()", "FWPathsPopup", this, "scheduleReloadEvent()"); m_apply->SetEnabled(false); m_search->SetEnabled(true); m_search->Connect("TextChanged(const char *)", "FWPathsPopup", this, "updateFilterString(const char *)"); m_tableWidget->SetBackgroundColor(0xffffff); m_tableWidget->SetLineSeparatorColor(0x000000); m_tableWidget->SetHeaderBackgroundColor(0xececec); m_tableWidget->Connect("cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)", "FWPathsPopup",this, "cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)"); m_tableWidget->disableGrowInWidth(); SetWindowName("CMSSW Configuration Editor"); MapSubwindows(); editor->UnmapWindow(); Layout(); }
void FWPathsPopup::applyEditor | ( | ) |
Proxies the applyEditor() method in the model so that it can be connected to GUI, signals.
Definition at line 107 of file FWPathsPopup.cc.
References FWPSetTableManager::applyEditor(), m_apply, and m_psTable.
Referenced by cellClicked(), and scheduleReloadEvent().
{ bool applied = m_psTable->applyEditor(); if (applied) m_apply->SetEnabled(true); }
void FWPathsPopup::cellClicked | ( | Int_t | iRow, |
Int_t | iColumn, | ||
Int_t | iButton, | ||
Int_t | iKeyMod, | ||
Int_t | iGlobalX, | ||
Int_t | iGlobalY | ||
) |
Handles clicking on the table cells.
Clicking on a cell in the first column opens / closes a given node. Clicking on a cell in the second column moves the editor to that cell.
Definition at line 121 of file FWPathsPopup.cc.
References applyEditor(), FWPSetTableManager::data(), FWPSetTableManager::PSetData::editable, m_psTable, FWPSetTableManager::rowToIndex(), FWPSetTableManager::selectedColumn(), FWPSetTableManager::selectedRow(), FWPSetTableManager::setExpanded(), and FWPSetTableManager::setSelection().
{ if (iButton != kButton1) return; if (iColumn == 0 || iColumn == 1) { // Save and close the previous editor, if required. if (m_psTable->selectedColumn() == 1 && m_psTable->selectedRow() != -1) { int oldIndex = m_psTable->rowToIndex()[m_psTable->selectedRow()]; FWPSetTableManager::PSetData& oldData = m_psTable->data()[oldIndex]; if (oldData.editable) applyEditor(); } m_psTable->setSelection(iRow, iColumn, iKeyMod); if (iColumn == 0) m_psTable->setExpanded(iRow); } }
FWPathsPopup::ClassDef | ( | FWPathsPopup | , |
0 | |||
) | [private] |
Bool_t FWPathsPopup::HandleKey | ( | Event_t * | event | ) | [virtual] |
Handle pressing of esc.
Definition at line 91 of file FWPathsPopup.cc.
References FWPSetTableManager::cancelEditor(), m_psTable, and FWPSetTableManager::setSelection().
{ UInt_t keysym = event->fCode; if (keysym == (UInt_t) gVirtualX->KeysymToKeycode(kKey_Escape)) { // called from FWPSetCellEditor m_psTable->cancelEditor(); m_psTable->setSelection(-1, -1, 0); } return TGMainFrame::HandleKey(event); }
bool& FWPathsPopup::hasChanges | ( | ) | [inline] |
Definition at line 35 of file FWPathsPopup.h.
References m_hasChanges.
Referenced by FWFFLooper::duringLoop().
{ return m_hasChanges; }
void FWPathsPopup::postModule | ( | edm::ModuleDescription const & | description | ) |
Gets called by CMSSW as modules are about to be processed.
Definition at line 165 of file FWPathsPopup.cc.
References m_guiManager, edm::ModuleDescription::moduleName(), and FWGUIManager::updateStatus().
Referenced by FWFFLooper::attachTo().
{ m_guiManager->updateStatus((description.moduleName() + " processed.").c_str()); gSystem->ProcessEvents(); }
void FWPathsPopup::postProcessEvent | ( | edm::Event const & | event, |
edm::EventSetup const & | eventSetup | ||
) |
Definition at line 181 of file FWPathsPopup.cc.
References FWTableWidget::body(), FWPSetTableManager::PathUpdate::choiceMaker, FWTableManagerBase::dataChanged(), FWTabularWidget::DoRedraw(), alignCSCRings::e, fwLog, i, edm::HandleBase::isValid(), fwlog::kInfo, m_guiManager, m_info, m_psTable, m_tableWidget, FWPSetTableManager::PathUpdate::passed, FWPSetTableManager::PathUpdate::pathName, pi, edm::Event::processHistory(), GlobalPosition_Frontier_DevDB_cff::tag, edm::TriggerNames::triggerName(), edm::TriggerNames::triggerNames(), patRefSel_triggerSelection_cff::triggerResults, FWPSetTableManager::update(), update, FWPSetTableManager::updateSchedule(), and FWGUIManager::updateStatus().
Referenced by FWFFLooper::attachTo().
{ m_guiManager->updateStatus("Done processing."); gSystem->ProcessEvents(); // Get the last process name from the process history: // this should be the one specified in the cfg file if (event.processHistory().empty()) { fwLog(fwlog::kInfo) << "Path GUI:: no process history available.\n"; return; } edm::ProcessHistory::const_iterator pi = event.processHistory().end() - 1; std::string processName = pi->processName(); // It's called TriggerResults but actually contains info on all paths edm::InputTag tag("TriggerResults", "", processName); edm::Handle<edm::TriggerResults> triggerResults; event.getByLabel(tag, triggerResults); std::vector<FWPSetTableManager::PathUpdate> pathUpdates; if (triggerResults.isValid()) { edm::TriggerNames triggerNames = event.triggerNames(*triggerResults); for (size_t i = 0, e = triggerResults->size(); i != e; ++i) { FWPSetTableManager::PathUpdate update; update.pathName = triggerNames.triggerName(i); update.passed = triggerResults->accept(i); update.choiceMaker = triggerResults->index(i); pathUpdates.push_back(update); } } m_psTable->updateSchedule(m_info); m_psTable->update(pathUpdates); m_psTable->dataChanged(); m_tableWidget->body()->DoRedraw(); }
void FWPathsPopup::preModule | ( | edm::ModuleDescription const & | description | ) |
Gets called by CMSSW as we process modules.
Definition at line 173 of file FWPathsPopup.cc.
References m_guiManager, edm::ModuleDescription::moduleName(), and FWGUIManager::updateStatus().
Referenced by FWFFLooper::attachTo().
{ m_guiManager->updateStatus(("Processing " + description.moduleName() + "...").c_str()); gSystem->ProcessEvents(); }
void FWPathsPopup::scheduleReloadEvent | ( | ) |
Modifies the module and asks the looper to reload the event.
1. Read the configuration snippet from the GUI, 2. Use the python interpreter to parse it and get the new parameter set. 3. Notify the looper about the changes.
FIXME: implement 2 and 3.
Definition at line 234 of file FWPathsPopup.cc.
References applyEditor(), gather_cfg::cout, data, FWPSetTableManager::ModuleInfo::dirty, FWPSetTableManager::entries(), FWPSetTableManager::ModuleInfo::entry, exception, FWPSetTableManager::PSetData::label, m_apply, m_hasChanges, m_looper, m_psTable, FWPSetTableManager::modules(), FWPSetTableManager::PSetData::pset, pythonToCppException(), FWFFLooper::requestChanges(), and cms::Exception::what().
{ applyEditor(); try { for (size_t mni = 0, mne = m_psTable->modules().size(); mni != mne; ++mni) { FWPSetTableManager::ModuleInfo &module = m_psTable->modules()[mni]; if (module.dirty == false) continue; FWPSetTableManager::PSetData &data = m_psTable->entries()[module.entry]; m_looper->requestChanges(data.label, data.pset); } m_hasChanges = true; m_apply->SetEnabled(false); gSystem->ExitLoop(); } catch (boost::python::error_already_set) { edm::pythonToCppException("Configuration"); Py_Finalize(); } catch (cms::Exception &exception) { std::cout << exception.what() << std::endl; } // Return control to the FWFFLooper so that it can decide what to do next. }
void FWPathsPopup::setup | ( | const edm::ScheduleInfo * | info | ) |
Finish the setup of the GUI
Definition at line 157 of file FWPathsPopup.cc.
Referenced by FWFFLooper::startingNewLoop().
void FWPathsPopup::updateFilterString | ( | const char * | str | ) |
Definition at line 148 of file FWPathsPopup.cc.
References FWPSetTableManager::applyEditor(), m_psTable, FWPSetTableManager::setSelection(), and FWPSetTableManager::updateFilter().
{ m_psTable->applyEditor(); m_psTable->setSelection(-1, -1, 0); m_psTable->updateFilter(str); }
void FWPathsPopup::windowIsClosing | ( | ) |
Definition at line 31 of file FWPathsPopup.cc.
{ UnmapWindow(); DontCallClose(); }
TGTextButton* FWPathsPopup::m_apply [private] |
Definition at line 55 of file FWPathsPopup.h.
Referenced by applyEditor(), FWPathsPopup(), and scheduleReloadEvent().
FWGUIManager* FWPathsPopup::m_guiManager [private] |
Definition at line 59 of file FWPathsPopup.h.
Referenced by postModule(), postProcessEvent(), and preModule().
bool FWPathsPopup::m_hasChanges [private] |
Definition at line 50 of file FWPathsPopup.h.
Referenced by hasChanges(), and scheduleReloadEvent().
const edm::ScheduleInfo* FWPathsPopup::m_info [private] |
Definition at line 45 of file FWPathsPopup.h.
Referenced by postProcessEvent(), and setup().
FWFFLooper* FWPathsPopup::m_looper [private] |
Definition at line 48 of file FWPathsPopup.h.
Referenced by scheduleReloadEvent().
TGLabel* FWPathsPopup::m_moduleLabel [private] |
Definition at line 52 of file FWPathsPopup.h.
TGLabel* FWPathsPopup::m_moduleName [private] |
Definition at line 53 of file FWPathsPopup.h.
FWPSetTableManager* FWPathsPopup::m_psTable [private] |
Definition at line 56 of file FWPathsPopup.h.
Referenced by applyEditor(), cellClicked(), FWPathsPopup(), HandleKey(), postProcessEvent(), scheduleReloadEvent(), and updateFilterString().
TGTextEntry* FWPathsPopup::m_search [private] |
Definition at line 58 of file FWPathsPopup.h.
Referenced by FWPathsPopup().
FWTableWidget* FWPathsPopup::m_tableWidget [private] |
Definition at line 57 of file FWPathsPopup.h.
Referenced by FWPathsPopup(), and postProcessEvent().