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 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

 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 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(0),
42  m_looper(looper),
43  m_hasChanges(false),
44  m_moduleLabel(0),
45  m_moduleName(0),
46  m_apply(0),
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 }
void SetBackgroundColor(Pixel_t)
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
tuple editor
Definition: idDealer.py:73
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::ClassDef ( FWPathsPopup  ,
 
)
private
Bool_t FWPathsPopup::HandleKey ( Event_t *  event)
virtual

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 }
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
void setSelection(int row, int column, int mask)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:58
bool& FWPathsPopup::hasChanges ( )
inline

Definition at line 37 of file FWPathsPopup.h.

References m_hasChanges.

Referenced by FWFFLooper::duringLoop().

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 FWTableWidget::body(), FWPSetTableManager::PathUpdate::choiceMaker, FWTableManagerBase::dataChanged(), FWTabularWidget::DoRedraw(), alignCSCRings::e, edm::ProcessHistory::empty(), 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(), FSQHLTOfflineSource_cfi::processName, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, edm::TriggerNames::triggerName(), edm::TriggerNames::triggerNames(), triggerResults, update, FWPSetTableManager::update(), FWPSetTableManager::updateSchedule(), and FWGUIManager::updateStatus().

Referenced by FWFFLooper::duringLoop().

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  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
int i
Definition: DBlmapReader.cc:9
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:61
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
FWTableWidget * m_tableWidget
Definition: FWPathsPopup.h:59
FWTabularWidget * body()
Definition: FWTableWidget.h:92
static std::string const triggerResults
Definition: EdmProvDump.cc:40
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
bool isValid() const
Definition: HandleBase.h:75
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
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 }
virtual char const * what() const
Definition: Exception.cc:141
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:538
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
tuple cout
Definition: gather_cfg.py:121
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 assert(), info(), and m_info.

Referenced by FWFFLooper::startingNewLoop().

161 {
162  assert(info);
163  m_info = info;
164 }
static const TGPicture * info(bool iBackgroundIsBlack)
assert(m_qm.get())
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);
155  m_psTable->updateFilter(str);
156 }
virtual void updateFilter(const char *filter)
void setSelection(int row, int column, int mask)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:58
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 hasChanges(), and 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().