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 
12 
17 
20 
24 
25 
26 
27 #include "TGLabel.h"
28 #include "KeySymbols.h"
29 
30 void
32 {
33  UnmapWindow();
34  DontCallClose();
35 }
36 
38  : TGMainFrame(gClient->GetRoot(), 400, 600),
39  m_info(0),
40  m_looper(looper),
41  m_hasChanges(false),
42  m_moduleLabel(0),
43  m_moduleName(0),
44  m_apply(0),
45  m_psTable(new FWPSetTableManager()),
46  m_guiManager(guiManager)
47 {
48  gVirtualX->SelectInput(GetId(), kKeyPressMask | kKeyReleaseMask | kExposureMask |
49  kPointerMotionMask | kStructureNotifyMask | kFocusChangeMask |
50  kEnterWindowMask | kLeaveWindowMask);
51  this->Connect("CloseWindow()","FWPathsPopup",this,"windowIsClosing()");
52 
53  FWDialogBuilder builder(this);
54  builder.indent(4)
55  .spaceDown(10)
56  .addLabel("Filter:").floatLeft(4).expand(false, false)
57  .addTextEntry("", &m_search).expand(true, false)
58  .spaceDown(10)
59  .addTable(m_psTable, &m_tableWidget).expand(true, true)
60  .addTextButton("Apply changes and reload", &m_apply);
61 
63  editor->SetBackgroundColor(gVirtualX->GetPixel(kYellow-7));
64  editor->SetFrameDrawn(false);
66  m_psTable->m_editor->Connect("ReturnPressed()", "FWPathsPopup", this, "applyEditor()");
67 
68  m_apply->Connect("Clicked()", "FWPathsPopup", this, "scheduleReloadEvent()");
69  m_apply->SetEnabled(false);
70  m_search->SetEnabled(true);
71  m_search->Connect("TextChanged(const char *)", "FWPathsPopup",
72  this, "updateFilterString(const char *)");
76  m_tableWidget->Connect("cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)",
77  "FWPathsPopup",this,
78  "cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)");
80 
81  SetWindowName("CMSSW Configuration Editor");
82  MapSubwindows();
83  editor->UnmapWindow();
84 
85  Layout();
86 }
87 
90 Bool_t
92 {
93  UInt_t keysym = event->fCode;
94 
95  if (keysym == (UInt_t) gVirtualX->KeysymToKeycode(kKey_Escape))
96  {
97  // called from FWPSetCellEditor
99  m_psTable->setSelection(-1, -1, 0);
100  }
101  return TGMainFrame::HandleKey(event);
102 }
103 
106 void
108 {
109  bool applied = m_psTable->applyEditor();
110  if (applied)
111  m_apply->SetEnabled(true);
112 }
113 
120 void
121 FWPathsPopup::cellClicked(Int_t iRow, Int_t iColumn, Int_t iButton, Int_t iKeyMod, Int_t, Int_t)
122 {
123  if (iButton != kButton1)
124  return;
125 
126 
127  if (iColumn == 0 || iColumn == 1)
128  {
129  // Save and close the previous editor, if required.
130  if (m_psTable->selectedColumn() == 1
131  && m_psTable->selectedRow() != -1)
132  {
133  int oldIndex = m_psTable->rowToIndex()[m_psTable->selectedRow()];
134  FWPSetTableManager::PSetData& oldData = m_psTable->data()[oldIndex];
135 
136  if (oldData.editable)
137  applyEditor();
138  }
139 
140  m_psTable->setSelection(iRow, iColumn, iKeyMod);
141 
142  if (iColumn == 0)
143  m_psTable->setExpanded(iRow);
144  }
145 }
146 
147 void
149 {
151  m_psTable->setSelection(-1, -1, 0);
152  m_psTable->updateFilter(str);
153 }
154 
156 void
158 {
159  assert(info);
160  m_info = info;
161 }
162 
164 void
166 {
167  m_guiManager->updateStatus((description.moduleName() + " processed.").c_str());
168  gSystem->ProcessEvents();
169 }
170 
172 void
174 {
175  m_guiManager->updateStatus(("Processing " + description.moduleName() + "...").c_str());
176  gSystem->ProcessEvents();
177 }
178 
179 
180 void
182 {
183  m_guiManager->updateStatus("Done processing.");
184  gSystem->ProcessEvents();
185 
186  // Get the last process name from the process history:
187  // this should be the one specified in the cfg file
188 
189  if (event.processHistory().empty()) {
190  fwLog(fwlog::kInfo) << "Path GUI:: no process history available.\n";
191  return;
192  }
193  edm::ProcessHistory::const_iterator pi = event.processHistory().end() - 1;
194  std::string processName = pi->processName();
195 
196  // It's called TriggerResults but actually contains info on all paths
197  edm::InputTag tag("TriggerResults", "", processName);
199  event.getByLabel(tag, triggerResults);
200 
201  std::vector<FWPSetTableManager::PathUpdate> pathUpdates;
202 
203  if (triggerResults.isValid())
204  {
205  edm::TriggerNames triggerNames = event.triggerNames(*triggerResults);
206 
207  for (size_t i = 0, e = triggerResults->size(); i != e; ++i)
208  {
210  update.pathName = triggerNames.triggerName(i);
211  update.passed = triggerResults->accept(i);
212  update.choiceMaker = triggerResults->index(i);
213  pathUpdates.push_back(update);
214  }
215  }
217  m_psTable->update(pathUpdates);
220 }
221 
222 
223 
233 void
235 {
236  applyEditor();
237  try
238  {
239  for (size_t mni = 0, mne = m_psTable->modules().size(); mni != mne; ++mni)
240  {
242  if (module.dirty == false)
243  continue;
245  m_looper->requestChanges(data.label, * module.current_pset);
246  }
247  m_hasChanges = true;
248  m_apply->SetEnabled(false);
249  gSystem->ExitLoop();
250  }
251  catch (boost::python::error_already_set)
252  {
253  edm::pythonToCppException("Configuration");
254  Py_Finalize();
255  }
256  catch (cms::Exception &exception)
257  {
258  std::cout << exception.what() << std::endl;
259  }
260  // Return control to the FWFFLooper so that it can decide what to do next.
261 }
collection_type::const_iterator const_iterator
virtual char const * what() const
Definition: Exception.cc:141
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:91
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:529
void applyEditor()
void disableGrowInWidth()
void windowIsClosing()
Definition: FWPathsPopup.cc:31
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
bool empty() const
void preModule(edm::ModuleDescription const &)
void updateSchedule(const edm::ScheduleInfo *info)
virtual ProcessHistory const & processHistory() const
Definition: Event.cc:180
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)
#define fwLog(_level_)
Definition: fwLog.h:51
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
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
#define update(a, b)
void update(std::vector< PathUpdate > &pathUpdates)
void setSelection(int row, int column, int mask)
tuple cout
Definition: gather_cfg.py:121
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:37
FWDialogBuilder & indent(int left=2, int right=-1)
Definition: vlib.h:209
std::vector< PSetData > & entries()
FWDialogBuilder & spaceDown(size_t spacing=3)