CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 *)
 
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
 
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 26 of file FWPathsPopup.h.

Constructor & Destructor Documentation

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(), 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().

37  : TGMainFrame(gClient->GetRoot(), 400, 600),
38  m_info(0),
39  m_looper(looper),
40  m_hasChanges(false),
41  m_moduleLabel(0),
42  m_moduleName(0),
43  m_apply(0),
45  m_guiManager(guiManager)
46 {
47  gVirtualX->SelectInput(GetId(), kKeyPressMask | kKeyReleaseMask | kExposureMask |
48  kPointerMotionMask | kStructureNotifyMask | kFocusChangeMask |
49  kEnterWindowMask | kLeaveWindowMask);
50  this->Connect("CloseWindow()","FWPathsPopup",this,"windowIsClosing()");
51 
52  FWDialogBuilder builder(this);
53  builder.indent(4)
54  .spaceDown(10)
55  .addLabel("Filter:").floatLeft(4).expand(false, false)
56  .addTextEntry("", &m_search).expand(true, false)
57  .spaceDown(10)
58  .addTable(m_psTable, &m_tableWidget).expand(true, true)
59  .addTextButton("Apply changes and reload", &m_apply);
60 
62  editor->SetBackgroundColor(gVirtualX->GetPixel(kYellow-7));
63  editor->SetFrameDrawn(false);
65  m_psTable->m_editor->Connect("ReturnPressed()", "FWPathsPopup", this, "applyEditor()");
66 
67  m_apply->Connect("Clicked()", "FWPathsPopup", this, "scheduleReloadEvent()");
68  m_apply->SetEnabled(false);
69  m_search->SetEnabled(true);
70  m_search->Connect("TextChanged(const char *)", "FWPathsPopup",
71  this, "updateFilterString(const char *)");
75  m_tableWidget->Connect("cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)",
76  "FWPathsPopup",this,
77  "cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)");
79 
80  SetWindowName("CMSSW Configuration Editor");
81  MapSubwindows();
82  editor->UnmapWindow();
83 
84  Layout();
85 }
void SetBackgroundColor(Pixel_t)
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:59
void SetHeaderBackgroundColor(Pixel_t)
TGTextEntry * m_search
Definition: FWPathsPopup.h:58
void SetLineSeparatorColor(Pixel_t)
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:93
FWPSetCellEditor * m_editor
const edm::ScheduleInfo * m_info
Definition: FWPathsPopup.h:45
TGTextButton * m_apply
Definition: FWPathsPopup.h:55
tuple editor
Definition: idDealer.py:73
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

void FWPathsPopup::applyEditor ( )

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

Definition at line 106 of file FWPathsPopup.cc.

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

Referenced by cellClicked(), and scheduleReloadEvent().

107 {
108  bool applied = m_psTable->applyEditor();
109  if (applied)
110  m_apply->SetEnabled(true);
111 }
TGTextButton * m_apply
Definition: FWPathsPopup.h:55
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
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 120 of file FWPathsPopup.cc.

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

121 {
122  if (iButton != kButton1)
123  return;
124 
125 
126  if (iColumn == 0 || iColumn == 1)
127  {
128  // Save and close the previous editor, if required.
129  if (m_psTable->selectedColumn() == 1
130  && m_psTable->selectedRow() != -1)
131  {
132  int oldIndex = m_psTable->rowToIndex()[m_psTable->selectedRow()];
133  FWPSetTableManager::PSetData& oldData = m_psTable->data()[oldIndex];
134 
135  if (oldData.editable)
136  applyEditor();
137  }
138 
139  m_psTable->setSelection(iRow, iColumn, iKeyMod);
140 
141  if (iColumn == 0)
142  m_psTable->setExpanded(iRow);
143  }
144 }
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
FWPathsPopup::ClassDef ( FWPathsPopup  ,
 
)
private
Bool_t FWPathsPopup::HandleKey ( Event_t *  event)
virtual

Handle pressing of esc.

Definition at line 90 of file FWPathsPopup.cc.

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

91 {
92  UInt_t keysym = event->fCode;
93 
94  if (keysym == (UInt_t) gVirtualX->KeysymToKeycode(kKey_Escape))
95  {
96  // called from FWPSetCellEditor
98  m_psTable->setSelection(-1, -1, 0);
99  }
100  return TGMainFrame::HandleKey(event);
101 }
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
unsigned int UInt_t
Definition: FUTypes.h:12
void setSelection(int row, int column, int mask)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
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
void FWPathsPopup::postModule ( edm::ModuleDescription const &  description)

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

Definition at line 164 of file FWPathsPopup.cc.

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

Referenced by FWFFLooper::attachTo().

165 {
166  m_guiManager->updateStatus((description.moduleName() + " processed.").c_str());
167  gSystem->ProcessEvents();
168 }
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:59
void updateStatus(const char *status)
tuple description
Definition: idDealer.py:66
void FWPathsPopup::postProcessEvent ( edm::Event const &  event,
edm::EventSetup const &  eventSetup 
)

Definition at line 180 of file FWPathsPopup.cc.

References FWTableWidget::body(), FWPSetTableManager::PathUpdate::choiceMaker, FWTableManagerBase::dataChanged(), FWTabularWidget::DoRedraw(), i, edm::HandleBase::isValid(), m_guiManager, m_info, m_psTable, m_tableWidget, FWPSetTableManager::PathUpdate::passed, FWPSetTableManager::PathUpdate::pathName, pi, GlobalPosition_Frontier_DevDB_cff::tag, edm::TriggerNames::triggerName(), edm::TriggerNames::triggerNames(), update, FWPSetTableManager::update(), FWPSetTableManager::updateSchedule(), and FWGUIManager::updateStatus().

Referenced by FWFFLooper::attachTo().

181 {
182  m_guiManager->updateStatus("Done processing.");
183  gSystem->ProcessEvents();
184 
185  // Get the last process name from the process history:
186  // this should be the one specified in the cfg file
187  edm::ProcessHistory::const_iterator pi = event.processHistory().end() - 1;
188  std::string processName = pi->processName();
189 
190  // It's called TriggerResults but actually contains info on all paths
191  edm::InputTag tag("TriggerResults", "", processName);
192  edm::Handle<edm::TriggerResults> triggerResults;
193  event.getByLabel(tag, triggerResults);
194 
195  std::vector<FWPSetTableManager::PathUpdate> pathUpdates;
196 
197  if (triggerResults.isValid())
198  {
199  edm::TriggerNames triggerNames = event.triggerNames(*triggerResults);
200 
201  for (size_t i = 0, e = triggerResults->size(); i != e; ++i)
202  {
204  update.pathName = triggerNames.triggerName(i);
205  update.passed = triggerResults->accept(i);
206  update.choiceMaker = triggerResults->index(i);
207  pathUpdates.push_back(update);
208  }
209  }
211  m_psTable->update(pathUpdates);
214 }
collection_type::const_iterator const_iterator
int i
Definition: DBlmapReader.cc:9
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:59
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
FWTableWidget * m_tableWidget
Definition: FWPathsPopup.h:57
FWTabularWidget * body()
Definition: FWTableWidget.h:93
bool isValid() const
Definition: HandleBase.h:76
const edm::ScheduleInfo * m_info
Definition: FWPathsPopup.h:45
void updateSchedule(const edm::ScheduleInfo *info)
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:56
double pi
void FWPathsPopup::preModule ( edm::ModuleDescription const &  description)

Gets called by CMSSW as we process modules.

Definition at line 172 of file FWPathsPopup.cc.

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

Referenced by FWFFLooper::attachTo().

173 {
174  m_guiManager->updateStatus(("Processing " + description.moduleName() + "...").c_str());
175  gSystem->ProcessEvents();
176 }
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:59
void updateStatus(const char *status)
tuple description
Definition: idDealer.py:66
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 228 of file FWPathsPopup.cc.

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

229 {
230  applyEditor();
231  try
232  {
233  for (size_t mni = 0, mne = m_psTable->modules().size(); mni != mne; ++mni)
234  {
236  if (module.dirty == false)
237  continue;
239  m_looper->requestChanges(data.label, data.pset);
240  }
241  m_hasChanges = true;
242  m_apply->SetEnabled(false);
243  gSystem->ExitLoop();
244  }
245  catch (boost::python::error_already_set)
246  {
247  edm::pythonToCppException("Configuration");
248  Py_Finalize();
249  }
250  catch (cms::Exception &exception)
251  {
252  std::cout << exception.what() << std::endl;
253  }
254  // Return control to the FWFFLooper so that it can decide what to do next.
255 }
virtual char const * what() const
Definition: Exception.cc:97
std::vector< ModuleInfo > & modules()
void pythonToCppException(const std::string &iType)
Definition: PythonWrapper.cc:6
void requestChanges(const std::string &, const edm::ParameterSet &)
Definition: FWFFLooper.cc:498
void applyEditor()
TGTextButton * m_apply
Definition: FWPathsPopup.h:55
bool m_hasChanges
Definition: FWPathsPopup.h:50
FWFFLooper * m_looper
Definition: FWPathsPopup.h:48
tuple cout
Definition: gather_cfg.py:41
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
Definition: vlib.h:209
std::vector< PSetData > & entries()
void FWPathsPopup::setup ( const edm::ScheduleInfo info)

Finish the setup of the GUI

Definition at line 156 of file FWPathsPopup.cc.

References info, and m_info.

Referenced by FWFFLooper::startingNewLoop().

157 {
158  assert(info);
159  m_info = info;
160 }
const edm::ScheduleInfo * m_info
Definition: FWPathsPopup.h:45
void FWPathsPopup::updateFilterString ( const char *  str)

Definition at line 147 of file FWPathsPopup.cc.

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

148 {
150  m_psTable->setSelection(-1, -1, 0);
151  m_psTable->updateFilter(str);
152 }
virtual void updateFilter(const char *filter)
void setSelection(int row, int column, int mask)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
void FWPathsPopup::windowIsClosing ( )

Definition at line 30 of file FWPathsPopup.cc.

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

Member Data Documentation

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
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().