CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FWPathsPopup Class Reference

#include <FWPathsPopup.h>

Inheritance diagram for FWPathsPopup:

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 *)
 
Bool_t HandleKey (Event_t *event) override
 
bool & hasChanges ()
 
void postEvent (edm::Event const &event)
 
void postModuleEvent (edm::StreamContext const &, edm::ModuleCallingContext const &)
 
void preModuleEvent (edm::StreamContext const &, edm::ModuleCallingContext const &)
 
void scheduleReloadEvent ()
 
void setup (const edm::ScheduleInfo *info)
 
void updateFilterString (const char *str)
 
void windowIsClosing ()
 

Private Member Functions

 ClassDefOverride (FWPathsPopup, 0)
 

Private Attributes

TGTextButton * m_apply
 
FWGUIManagerm_guiManager
 
bool m_hasChanges
 
const edm::ScheduleInfom_info
 
FWFFLooperm_looper
 
TGLabel * m_moduleLabel
 
TGLabel * m_moduleName
 
FWPSetTableManagerm_psTable
 
TGTextEntry * m_search
 
FWTableWidgetm_tableWidget
 

Detailed Description

Definition at line 28 of file FWPathsPopup.h.

Constructor & Destructor Documentation

FWPathsPopup::FWPathsPopup ( FWFFLooper looper,
FWGUIManager guiManager 
)

Definition at line 39 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().

40  : TGMainFrame(gClient->GetRoot(), 400, 600),
41  m_info(nullptr),
42  m_looper(looper),
43  m_hasChanges(false),
44  m_moduleLabel(nullptr),
45  m_moduleName(nullptr),
46  m_apply(nullptr),
48  m_guiManager(guiManager)
49 {
50  gVirtualX->SelectInput(GetId(), kKeyPressMask | kKeyReleaseMask | kExposureMask |
51  kPointerMotionMask | kStructureNotifyMask | kFocusChangeMask |
52  kEnterWindowMask | kLeaveWindowMask);
53  this->Connect("CloseWindow()","FWPathsPopup",this,"windowIsClosing()");
54 
55  FWDialogBuilder builder(this);
56  builder.indent(4)
57  .spaceDown(10)
58  .addLabel("Filter:").floatLeft(4).expand(false, false)
59  .addTextEntry("", &m_search).expand(true, false)
60  .spaceDown(10)
61  .addTable(m_psTable, &m_tableWidget).expand(true, true)
62  .addTextButton("Apply changes and reload", &m_apply);
63 
65  editor->SetBackgroundColor(gVirtualX->GetPixel(kYellow-7));
66  editor->SetFrameDrawn(false);
68  m_psTable->m_editor->Connect("ReturnPressed()", "FWPathsPopup", this, "applyEditor()");
69 
70  m_apply->Connect("Clicked()", "FWPathsPopup", this, "scheduleReloadEvent()");
71  m_apply->SetEnabled(false);
72  m_search->SetEnabled(true);
73  m_search->Connect("TextChanged(const char *)", "FWPathsPopup",
74  this, "updateFilterString(const char *)");
78  m_tableWidget->Connect("cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)",
79  "FWPathsPopup",this,
80  "cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)");
82 
83  SetWindowName("CMSSW Configuration Editor");
84  MapSubwindows();
85  editor->UnmapWindow();
86 
87  Layout();
88 }
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:61
void SetHeaderBackgroundColor(Pixel_t)
TGTextEntry * m_search
Definition: FWPathsPopup.h:60
void SetLineSeparatorColor(Pixel_t)
void disableGrowInWidth()
TGLabel * m_moduleLabel
Definition: FWPathsPopup.h:54
TGLabel * m_moduleName
Definition: FWPathsPopup.h:55
FWTableWidget * m_tableWidget
Definition: FWPathsPopup.h:59
FWTabularWidget * body()
Definition: FWTableWidget.h:92
FWPSetCellEditor * m_editor
const edm::ScheduleInfo * m_info
Definition: FWPathsPopup.h:47
TGTextButton * m_apply
Definition: FWPathsPopup.h:57
void SetBackgroundColor(Pixel_t) override
void setCellValueEditor(FWPSetCellEditor *editor)
bool m_hasChanges
Definition: FWPathsPopup.h:52
FWFFLooper * m_looper
Definition: FWPathsPopup.h:50
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:58

Member Function Documentation

void FWPathsPopup::applyEditor ( )

Proxies the applyEditor() method in the model so that it can be connected to GUI, signals.

Definition at line 110 of file FWPathsPopup.cc.

References FWPSetTableManager::applyEditor(), m_apply, and m_psTable.

Referenced by cellClicked(), and scheduleReloadEvent().

111 {
112  bool applied = m_psTable->applyEditor();
113  if (applied)
114  m_apply->SetEnabled(true);
115 }
TGTextButton * m_apply
Definition: FWPathsPopup.h:57
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:58
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 124 of file FWPathsPopup.cc.

References applyEditor(), FWPSetTableManager::data(), FWPSetTableManager::PSetData::editable, m_psTable, FWPSetTableManager::rowToIndex(), FWPSetTableManager::selectedColumn(), FWPSetTableManager::selectedRow(), FWPSetTableManager::setExpanded(), and FWPSetTableManager::setSelection().

125 {
126  if (iButton != kButton1)
127  return;
128 
129 
130  if (iColumn == 0 || iColumn == 1)
131  {
132  // Save and close the previous editor, if required.
133  if (m_psTable->selectedColumn() == 1
134  && m_psTable->selectedRow() != -1)
135  {
136  int oldIndex = m_psTable->rowToIndex()[m_psTable->selectedRow()];
137  FWPSetTableManager::PSetData& oldData = m_psTable->data()[oldIndex];
138 
139  if (oldData.editable)
140  applyEditor();
141  }
142 
143  m_psTable->setSelection(iRow, iColumn, iKeyMod);
144 
145  if (iColumn == 0)
146  m_psTable->setExpanded(iRow);
147  }
148 }
std::vector< int > & rowToIndex()
void applyEditor()
std::vector< PSetData > & data()
void setSelection(int row, int column, int mask)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:58
FWPathsPopup::ClassDefOverride ( FWPathsPopup  ,
 
)
private
Bool_t FWPathsPopup::HandleKey ( Event_t *  event)
override

Handle pressing of esc.

Definition at line 94 of file FWPathsPopup.cc.

References FWPSetTableManager::cancelEditor(), m_psTable, and FWPSetTableManager::setSelection().

95 {
96  UInt_t keysym = event->fCode;
97 
98  if (keysym == (UInt_t) gVirtualX->KeysymToKeycode(kKey_Escape))
99  {
100  // called from FWPSetCellEditor
102  m_psTable->setSelection(-1, -1, 0);
103  }
104  return TGMainFrame::HandleKey(event);
105 }
void setSelection(int row, int column, int mask)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:58
Definition: event.py:1
bool& FWPathsPopup::hasChanges ( )
inline

Definition at line 37 of file FWPathsPopup.h.

References info(), GeneralSetup::setup(), and str.

37 { return m_hasChanges; }
bool m_hasChanges
Definition: FWPathsPopup.h:52
void FWPathsPopup::postEvent ( edm::Event const &  event)

Definition at line 184 of file FWPathsPopup.cc.

References edm::HLTGlobalStatus::accept(), FWTableWidget::body(), FWPSetTableManager::PathUpdate::choiceMaker, FWTableManagerBase::dataChanged(), FWTabularWidget::DoRedraw(), MillePedeFileConverter_cfg::e, edm::ProcessHistory::empty(), fwLog, mps_fire::i, edm::HLTGlobalStatus::index(), edm::HandleBase::isValid(), fwlog::kInfo, m_guiManager, m_info, m_psTable, m_tableWidget, FWPSetTableManager::PathUpdate::passed, FWPSetTableManager::PathUpdate::pathName, pi, edm::Event::processHistory(), modifiedElectrons_cfi::processName, edm::HLTGlobalStatus::size(), AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, edm::TriggerNames::triggerName(), edm::TriggerNames::triggerNames(), triggerResults, update, FWPSetTableManager::update(), FWPSetTableManager::updateSchedule(), and FWGUIManager::updateStatus().

185 {
186  m_guiManager->updateStatus("Done processing.");
187  gSystem->ProcessEvents();
188 
189  // Get the last process name from the process history:
190  // this should be the one specified in the cfg file
191 
192  if (event.processHistory().empty()) {
193  fwLog(fwlog::kInfo) << "Path GUI:: no process history available.\n";
194  return;
195  }
196  edm::ProcessHistory::const_iterator pi = event.processHistory().end() - 1;
197  std::string processName = pi->processName();
198 
199  // It's called TriggerResults but actually contains info on all paths
200  edm::InputTag tag("TriggerResults", "", processName);
202  event.getByLabel(tag, triggerResults);
203 
204  std::vector<FWPSetTableManager::PathUpdate> pathUpdates;
205 
206  if (triggerResults.isValid())
207  {
208  const edm::TriggerNames& triggerNames = event.triggerNames(*triggerResults);
209 
210  for (size_t i = 0, e = triggerResults->size(); i != e; ++i)
211  {
213  update.pathName = triggerNames.triggerName(i);
214  update.passed = triggerResults->accept(i);
215  update.choiceMaker = triggerResults->index(i);
216  pathUpdates.push_back(update);
217  }
218  }
220  m_psTable->update(pathUpdates);
223 }
collection_type::const_iterator const_iterator
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:61
bool accept() const
Has at least one path accepted the event?
void DoRedraw() override
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
void updateStatus(const char *status)
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
const Double_t pi
unsigned int size() const
Get number of paths stored.
FWTableWidget * m_tableWidget
Definition: FWPathsPopup.h:59
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
FWTabularWidget * body()
Definition: FWTableWidget.h:92
static std::string const triggerResults
Definition: EdmProvDump.cc:41
bool isValid() const
Definition: HandleBase.h:74
const edm::ScheduleInfo * m_info
Definition: FWPathsPopup.h:47
void updateSchedule(const edm::ScheduleInfo *info)
#define fwLog(_level_)
Definition: fwLog.h:50
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
#define update(a, b)
void update(std::vector< PathUpdate > &pathUpdates)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:58
Definition: event.py:1
void FWPathsPopup::postModuleEvent ( edm::StreamContext const &  s,
edm::ModuleCallingContext const &  mcc 
)

Gets called by CMSSW as modules are about to be processed.

Definition at line 168 of file FWPathsPopup.cc.

References m_guiManager, edm::ModuleCallingContext::moduleDescription(), edm::ModuleDescription::moduleName(), and FWGUIManager::updateStatus().

Referenced by FWFFLooper::attachTo().

169 {
170  m_guiManager->updateStatus((mcc.moduleDescription()->moduleName() + " processed.").c_str());
171  gSystem->ProcessEvents();
172 }
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:61
void updateStatus(const char *status)
void FWPathsPopup::preModuleEvent ( edm::StreamContext const &  s,
edm::ModuleCallingContext const &  mcc 
)

Gets called by CMSSW as we process modules.

Definition at line 176 of file FWPathsPopup.cc.

References m_guiManager, edm::ModuleCallingContext::moduleDescription(), edm::ModuleDescription::moduleName(), and FWGUIManager::updateStatus().

Referenced by FWFFLooper::attachTo().

177 {
178  m_guiManager->updateStatus(("Processing " + mcc.moduleDescription()->moduleName() + "...").c_str());
179  gSystem->ProcessEvents();
180 }
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:61
void updateStatus(const char *status)
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 237 of file FWPathsPopup.cc.

References applyEditor(), gather_cfg::cout, FWPSetTableManager::ModuleInfo::current_pset, data, FWPSetTableManager::ModuleInfo::dirty, FWPSetTableManager::entries(), FWPSetTableManager::ModuleInfo::entry, cppFunctionSkipper::exception, FWPSetTableManager::PSetData::label, m_apply, m_hasChanges, m_looper, m_psTable, FWPSetTableManager::modules(), edm::pythonToCppException(), FWFFLooper::requestChanges(), and cms::Exception::what().

238 {
239  applyEditor();
240  try
241  {
242  for (size_t mni = 0, mne = m_psTable->modules().size(); mni != mne; ++mni)
243  {
245  if (module.dirty == false)
246  continue;
248  m_looper->requestChanges(data.label, * module.current_pset);
249  }
250  m_hasChanges = true;
251  m_apply->SetEnabled(false);
252  gSystem->ExitLoop();
253  }
254  catch (boost::python::error_already_set)
255  {
256  edm::pythonToCppException("Configuration");
257  Py_Finalize();
258  }
259  catch (cms::Exception &exception)
260  {
261  std::cout << exception.what() << std::endl;
262  }
263  // Return control to the FWFFLooper so that it can decide what to do next.
264 }
std::vector< ModuleInfo > & modules()
void pythonToCppException(const std::string &iType)
Definition: PythonWrapper.cc:6
char const * what() const override
Definition: Exception.cc:141
void requestChanges(const std::string &, const edm::ParameterSet &)
Definition: FWFFLooper.cc:543
void applyEditor()
TGTextButton * m_apply
Definition: FWPathsPopup.h:57
bool m_hasChanges
Definition: FWPathsPopup.h:52
FWFFLooper * m_looper
Definition: FWPathsPopup.h:50
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:58
Definition: vlib.h:208
std::vector< PSetData > & entries()
void FWPathsPopup::setup ( const edm::ScheduleInfo info)

Finish the setup of the GUI

Definition at line 160 of file FWPathsPopup.cc.

References info(), and m_info.

161 {
162  assert(info);
163  m_info = info;
164 }
static const TGPicture * info(bool iBackgroundIsBlack)
const edm::ScheduleInfo * m_info
Definition: FWPathsPopup.h:47
void FWPathsPopup::updateFilterString ( const char *  str)

Definition at line 151 of file FWPathsPopup.cc.

References FWPSetTableManager::applyEditor(), m_psTable, FWPSetTableManager::setSelection(), and FWPSetTableManager::updateFilter().

152 {
154  m_psTable->setSelection(-1, -1, 0);
156 }
virtual void updateFilter(const char *filter)
void setSelection(int row, int column, int mask)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:58
#define str(s)
void FWPathsPopup::windowIsClosing ( )

Definition at line 33 of file FWPathsPopup.cc.

34 {
35  UnmapWindow();
36  DontCallClose();
37 }

Member Data Documentation

TGTextButton* FWPathsPopup::m_apply
private

Definition at line 57 of file FWPathsPopup.h.

Referenced by applyEditor(), FWPathsPopup(), and scheduleReloadEvent().

FWGUIManager* FWPathsPopup::m_guiManager
private

Definition at line 61 of file FWPathsPopup.h.

Referenced by postEvent(), postModuleEvent(), and preModuleEvent().

bool FWPathsPopup::m_hasChanges
private

Definition at line 52 of file FWPathsPopup.h.

Referenced by scheduleReloadEvent().

const edm::ScheduleInfo* FWPathsPopup::m_info
private

Definition at line 47 of file FWPathsPopup.h.

Referenced by postEvent(), and setup().

FWFFLooper* FWPathsPopup::m_looper
private

Definition at line 50 of file FWPathsPopup.h.

Referenced by scheduleReloadEvent().

TGLabel* FWPathsPopup::m_moduleLabel
private

Definition at line 54 of file FWPathsPopup.h.

TGLabel* FWPathsPopup::m_moduleName
private

Definition at line 55 of file FWPathsPopup.h.

FWPSetTableManager* FWPathsPopup::m_psTable
private
TGTextEntry* FWPathsPopup::m_search
private

Definition at line 60 of file FWPathsPopup.h.

Referenced by FWPathsPopup().

FWTableWidget* FWPathsPopup::m_tableWidget
private

Definition at line 59 of file FWPathsPopup.h.

Referenced by FWPathsPopup(), and postEvent().