CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWPathsPopup.cc
Go to the documentation of this file.
4 
7 
8 
11 
16 
19 
23 
24 
25 
26 #include "TGLabel.h"
27 #include "KeySymbols.h"
28 
29 void
31 {
32  UnmapWindow();
33  DontCallClose();
34 }
35 
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),
44  m_psTable(new FWPSetTableManager()),
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 }
86 
89 Bool_t
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 }
102 
105 void
107 {
108  bool applied = m_psTable->applyEditor();
109  if (applied)
110  m_apply->SetEnabled(true);
111 }
112 
119 void
120 FWPathsPopup::cellClicked(Int_t iRow, Int_t iColumn, Int_t iButton, Int_t iKeyMod, Int_t, Int_t)
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 }
145 
146 void
148 {
150  m_psTable->setSelection(-1, -1, 0);
151  m_psTable->updateFilter(str);
152 }
153 
155 void
157 {
158  assert(info);
159  m_info = info;
160 }
161 
163 void
165 {
166  m_guiManager->updateStatus((description.moduleName() + " processed.").c_str());
167  gSystem->ProcessEvents();
168 }
169 
171 void
173 {
174  m_guiManager->updateStatus(("Processing " + description.moduleName() + "...").c_str());
175  gSystem->ProcessEvents();
176 }
177 
178 
179 void
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 }
215 
216 
217 
227 void
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 }
collection_type::const_iterator const_iterator
virtual char const * what() const
Definition: Exception.cc:97
std::vector< ModuleInfo > & modules()
void scheduleReloadEvent()
int i
Definition: DBlmapReader.cc:9
void SetBackgroundColor(Pixel_t)
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:59
FWDialogBuilder & addLabel(const char *text, size_t fontSize=12, size_t weight=0, TGLabel **out=0)
std::vector< int > & rowToIndex()
void pythonToCppException(const std::string &iType)
Definition: PythonWrapper.cc:6
void cellClicked(Int_t iRow, Int_t iColumn, Int_t iButton, Int_t iKeyMod, Int_t iGlobalX, Int_t iGlobalY)
std::string const & moduleName() const
void SetHeaderBackgroundColor(Pixel_t)
TGTextEntry * m_search
Definition: FWPathsPopup.h:58
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
virtual Bool_t HandleKey(Event_t *event)
Definition: FWPathsPopup.cc:90
void updateStatus(const char *status)
FWDialogBuilder & addTable(FWTableManagerBase *manager, FWTableWidget **out=0)
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
void SetLineSeparatorColor(Pixel_t)
void requestChanges(const std::string &, const edm::ParameterSet &)
Definition: FWFFLooper.cc:498
void applyEditor()
void disableGrowInWidth()
void windowIsClosing()
Definition: FWPathsPopup.cc:30
std::vector< PSetData > & data()
FWDialogBuilder & addTextButton(const char *text, TGTextButton **out=0)
FWTableWidget * m_tableWidget
Definition: FWPathsPopup.h:57
FWTabularWidget * body()
Definition: FWTableWidget.h:93
FWPSetCellEditor * m_editor
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:76
const edm::ScheduleInfo * m_info
Definition: FWPathsPopup.h:45
void preModule(edm::ModuleDescription const &)
void updateSchedule(const edm::ScheduleInfo *info)
TGTextButton * m_apply
Definition: FWPathsPopup.h:55
unsigned int UInt_t
Definition: FUTypes.h:12
tuple description
Definition: idDealer.py:66
FWDialogBuilder & addTextEntry(const char *defaultText, TGTextEntry **out)
void updateFilterString(const char *str)
virtual void updateFilter(const char *filter)
FWDialogBuilder & floatLeft(size_t spacing=3)
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
tuple editor
Definition: idDealer.py:73
void postModule(edm::ModuleDescription const &)
void setCellValueEditor(FWPSetCellEditor *editor)
bool m_hasChanges
Definition: FWPathsPopup.h:50
FWDialogBuilder & expand(size_t expandX=true, size_t expandY=false)
FWFFLooper * m_looper
Definition: FWPathsPopup.h:48
#define update(a, b)
void update(std::vector< PathUpdate > &pathUpdates)
void setSelection(int row, int column, int mask)
tuple cout
Definition: gather_cfg.py:41
void postProcessEvent(edm::Event const &, edm::EventSetup const &)
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
double pi
void setup(const edm::ScheduleInfo *info)
FWPathsPopup(FWFFLooper *, FWGUIManager *)
Definition: FWPathsPopup.cc:36
FWDialogBuilder & indent(int left=2, int right=-1)
Definition: vlib.h:209
std::vector< PSetData > & entries()
FWDialogBuilder & spaceDown(size_t spacing=3)