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 27 of file FWPathsPopup.h.

Constructor & Destructor Documentation

◆ FWPathsPopup()

FWPathsPopup::FWPathsPopup ( FWFFLooper looper,
FWGUIManager guiManager 
)

Definition at line 36 of file FWPathsPopup.cc.

References FWDialogBuilder::addLabel(), FWDialogBuilder::addTable(), FWDialogBuilder::addTextButton(), FWDialogBuilder::addTextEntry(), FWTableWidget::body(), FWTableWidget::disableGrowInWidth(), 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().

37  : TGMainFrame(gClient->GetRoot(), 400, 600),
38  m_info(nullptr),
40  m_hasChanges(false),
41  m_moduleLabel(nullptr),
42  m_moduleName(nullptr),
43  m_apply(nullptr),
45  m_guiManager(guiManager) {
46  gVirtualX->SelectInput(GetId(),
47  kKeyPressMask | kKeyReleaseMask | kExposureMask | kPointerMotionMask | kStructureNotifyMask |
48  kFocusChangeMask | kEnterWindowMask | kLeaveWindowMask);
49  this->Connect("CloseWindow()", "FWPathsPopup", this, "windowIsClosing()");
50 
51  FWDialogBuilder builder(this);
52  builder.indent(4)
53  .spaceDown(10)
54  .addLabel("Filter:")
55  .floatLeft(4)
56  .expand(false, false)
57  .addTextEntry("", &m_search)
58  .expand(true, false)
59  .spaceDown(10)
60  .addTable(m_psTable, &m_tableWidget)
61  .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", this, "updateFilterString(const char *)");
77  m_tableWidget->Connect("cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)",
78  "FWPathsPopup",
79  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:59
void SetHeaderBackgroundColor(Pixel_t)
TGTextEntry * m_search
Definition: FWPathsPopup.h:58
void SetLineSeparatorColor(Pixel_t)
Definition: looper.py:1
void disableGrowInWidth()
TGLabel * m_moduleLabel
Definition: FWPathsPopup.h:52
TGLabel * m_moduleName
Definition: FWPathsPopup.h:53
FWTableWidget * m_tableWidget
Definition: FWPathsPopup.h:57
FWTabularWidget * body()
Definition: FWTableWidget.h:90
FWPSetCellEditor * m_editor
const edm::ScheduleInfo * m_info
Definition: FWPathsPopup.h:45
TGTextButton * m_apply
Definition: FWPathsPopup.h:55
void SetBackgroundColor(Pixel_t) override
void setCellValueEditor(FWPSetCellEditor *editor)
bool m_hasChanges
Definition: FWPathsPopup.h:50
FWFFLooper * m_looper
Definition: FWPathsPopup.h:48
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56

Member Function Documentation

◆ applyEditor()

void FWPathsPopup::applyEditor ( )

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

Definition at line 105 of file FWPathsPopup.cc.

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

Referenced by cellClicked(), and scheduleReloadEvent().

105  {
106  bool applied = m_psTable->applyEditor();
107  if (applied)
108  m_apply->SetEnabled(true);
109 }
TGTextButton * m_apply
Definition: FWPathsPopup.h:55
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56

◆ cellClicked()

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 117 of file FWPathsPopup.cc.

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

117  {
118  if (iButton != kButton1)
119  return;
120 
121  if (iColumn == 0 || iColumn == 1) {
122  // Save and close the previous editor, if required.
123  if (m_psTable->selectedColumn() == 1 && m_psTable->selectedRow() != -1) {
124  int oldIndex = m_psTable->rowToIndex()[m_psTable->selectedRow()];
125  FWPSetTableManager::PSetData &oldData = m_psTable->data()[oldIndex];
126 
127  if (oldData.editable)
128  applyEditor();
129  }
130 
131  m_psTable->setSelection(iRow, iColumn, iKeyMod);
132 
133  if (iColumn == 0)
134  m_psTable->setExpanded(iRow);
135  }
136 }
std::vector< int > & rowToIndex()
void applyEditor()
std::vector< PSetData > & data()
void setSelection(int row, int column, int mask)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56

◆ ClassDefOverride()

FWPathsPopup::ClassDefOverride ( FWPathsPopup  ,
 
)
private

◆ HandleKey()

Bool_t FWPathsPopup::HandleKey ( Event_t *  event)
override

Handle pressing of esc.

Definition at line 92 of file FWPathsPopup.cc.

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

92  {
93  UInt_t keysym = event->fCode;
94 
95  if (keysym == (UInt_t)gVirtualX->KeysymToKeycode(kKey_Escape)) {
96  // called from FWPSetCellEditor
98  m_psTable->setSelection(-1, -1, 0);
99  }
100  return TGMainFrame::HandleKey(event);
101 }
void setSelection(int row, int column, int mask)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
Definition: event.py:1

◆ hasChanges()

bool& FWPathsPopup::hasChanges ( )
inline

Definition at line 35 of file FWPathsPopup.h.

References m_hasChanges.

Referenced by FWFFLooper::duringLoop().

35 { return m_hasChanges; }
bool m_hasChanges
Definition: FWPathsPopup.h:50

◆ postEvent()

void FWPathsPopup::postEvent ( edm::Event const &  event)

Definition at line 162 of file FWPathsPopup.cc.

References FWTableWidget::body(), FWTableManagerBase::dataChanged(), FWTabularWidget::DoRedraw(), MillePedeFileConverter_cfg::e, fwLog, mps_fire::i, fwlog::kInfo, m_guiManager, m_info, m_psTable, m_tableWidget, pi, SimL1EmulatorRepack_CalouGT_cff::processName, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, L1TEGammaOffline_cfi::triggerNames, triggerResults, update, FWPSetTableManager::update(), FWPSetTableManager::updateSchedule(), and FWGUIManager::updateStatus().

Referenced by FWFFLooper::duringLoop().

162  {
163  m_guiManager->updateStatus("Done processing.");
164  gSystem->ProcessEvents();
165 
166  // Get the last process name from the process history:
167  // this should be the one specified in the cfg file
168 
169  if (event.processHistory().empty()) {
170  fwLog(fwlog::kInfo) << "Path GUI:: no process history available.\n";
171  return;
172  }
173  edm::ProcessHistory::const_iterator pi = event.processHistory().end() - 1;
174  std::string processName = pi->processName();
175 
176  // It's called TriggerResults but actually contains info on all paths
177  edm::InputTag tag("TriggerResults", "", processName);
179  event.getByLabel(tag, triggerResults);
180 
181  std::vector<FWPSetTableManager::PathUpdate> pathUpdates;
182 
183  if (triggerResults.isValid()) {
184  const edm::TriggerNames &triggerNames = event.triggerNames(*triggerResults);
185 
186  for (size_t i = 0, e = triggerResults->size(); i != e; ++i) {
188  update.pathName = triggerNames.triggerName(i);
189  update.passed = triggerResults->accept(i);
190  update.choiceMaker = triggerResults->index(i);
191  pathUpdates.push_back(update);
192  }
193  }
195  m_psTable->update(pathUpdates);
198 }
collection_type::const_iterator const_iterator
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:59
void DoRedraw() override
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
void updateStatus(const char *status)
const Double_t pi
FWTableWidget * m_tableWidget
Definition: FWPathsPopup.h:57
FWTabularWidget * body()
Definition: FWTableWidget.h:90
static std::string const triggerResults
Definition: EdmProvDump.cc:47
const edm::ScheduleInfo * m_info
Definition: FWPathsPopup.h:45
void updateSchedule(const edm::ScheduleInfo *info)
#define fwLog(_level_)
Definition: fwLog.h:45
#define update(a, b)
void update(std::vector< PathUpdate > &pathUpdates)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
Definition: event.py:1

◆ postModuleEvent()

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 151 of file FWPathsPopup.cc.

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

Referenced by FWFFLooper::attachTo().

151  {
152  m_guiManager->updateStatus((mcc.moduleDescription()->moduleName() + " processed.").c_str());
153  gSystem->ProcessEvents();
154 }
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:59
void updateStatus(const char *status)

◆ preModuleEvent()

void FWPathsPopup::preModuleEvent ( edm::StreamContext const &  s,
edm::ModuleCallingContext const &  mcc 
)

Gets called by CMSSW as we process modules.

Definition at line 157 of file FWPathsPopup.cc.

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

Referenced by FWFFLooper::attachTo().

157  {
158  m_guiManager->updateStatus(("Processing " + mcc.moduleDescription()->moduleName() + "...").c_str());
159  gSystem->ProcessEvents();
160 }
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:59
void updateStatus(const char *status)

◆ scheduleReloadEvent()

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 209 of file FWPathsPopup.cc.

References applyEditor(), gather_cfg::cout, data, FWPSetTableManager::entries(), cppFunctionSkipper::exception, m_apply, m_hasChanges, m_looper, m_psTable, FWPSetTableManager::modules(), edm::pythonToCppException(), and FWFFLooper::requestChanges().

209  {
210  applyEditor();
211  try {
212  for (size_t mni = 0, mne = m_psTable->modules().size(); mni != mne; ++mni) {
214  if (module.dirty == false)
215  continue;
217  m_looper->requestChanges(data.label, *module.current_pset);
218  }
219  m_hasChanges = true;
220  m_apply->SetEnabled(false);
221  gSystem->ExitLoop();
222  } catch (boost::python::error_already_set const &) {
223  edm::pythonToCppException("Configuration", "");
224  Py_Finalize();
225  } catch (cms::Exception &exception) {
226  std::cout << exception.what() << std::endl;
227  }
228  // Return control to the FWFFLooper so that it can decide what to do next.
229 }
std::vector< ModuleInfo > & modules()
void pythonToCppException(const std::string &iType, const std::string &error)
void requestChanges(const std::string &, const edm::ParameterSet &)
Definition: FWFFLooper.cc:449
void applyEditor()
TGTextButton * m_apply
Definition: FWPathsPopup.h:55
bool m_hasChanges
Definition: FWPathsPopup.h:50
FWFFLooper * m_looper
Definition: FWPathsPopup.h:48
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
std::vector< PSetData > & entries()

◆ setup()

void FWPathsPopup::setup ( const edm::ScheduleInfo info)

Finish the setup of the GUI

Definition at line 145 of file FWPathsPopup.cc.

References cms::cuda::assert(), info(), and m_info.

Referenced by FWFFLooper::startingNewLoop().

145  {
146  assert(info);
147  m_info = info;
148 }
static const TGPicture * info(bool iBackgroundIsBlack)
assert(be >=bs)
const edm::ScheduleInfo * m_info
Definition: FWPathsPopup.h:45

◆ updateFilterString()

void FWPathsPopup::updateFilterString ( const char *  str)

Definition at line 138 of file FWPathsPopup.cc.

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

138  {
140  m_psTable->setSelection(-1, -1, 0);
142 }
virtual void updateFilter(const char *filter)
void setSelection(int row, int column, int mask)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
#define str(s)

◆ windowIsClosing()

void FWPathsPopup::windowIsClosing ( )

Definition at line 31 of file FWPathsPopup.cc.

31  {
32  UnmapWindow();
33  DontCallClose();
34 }

Member Data Documentation

◆ m_apply

TGTextButton* FWPathsPopup::m_apply
private

Definition at line 55 of file FWPathsPopup.h.

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

◆ m_guiManager

FWGUIManager* FWPathsPopup::m_guiManager
private

Definition at line 59 of file FWPathsPopup.h.

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

◆ m_hasChanges

bool FWPathsPopup::m_hasChanges
private

Definition at line 50 of file FWPathsPopup.h.

Referenced by hasChanges(), and scheduleReloadEvent().

◆ m_info

const edm::ScheduleInfo* FWPathsPopup::m_info
private

Definition at line 45 of file FWPathsPopup.h.

Referenced by postEvent(), and setup().

◆ m_looper

FWFFLooper* FWPathsPopup::m_looper
private

Definition at line 48 of file FWPathsPopup.h.

Referenced by scheduleReloadEvent().

◆ m_moduleLabel

TGLabel* FWPathsPopup::m_moduleLabel
private

Definition at line 52 of file FWPathsPopup.h.

◆ m_moduleName

TGLabel* FWPathsPopup::m_moduleName
private

Definition at line 53 of file FWPathsPopup.h.

◆ m_psTable

FWPSetTableManager* FWPathsPopup::m_psTable
private

◆ m_search

TGTextEntry* FWPathsPopup::m_search
private

Definition at line 58 of file FWPathsPopup.h.

Referenced by FWPathsPopup().

◆ m_tableWidget

FWTableWidget* FWPathsPopup::m_tableWidget
private

Definition at line 57 of file FWPathsPopup.h.

Referenced by FWPathsPopup(), and postEvent().