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 
27 
28 
29 #include "TGLabel.h"
30 #include "KeySymbols.h"
31 
32 void
34 {
35  UnmapWindow();
36  DontCallClose();
37 }
38 
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),
47  m_psTable(new FWPSetTableManager()),
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 }
89 
90 
93 Bool_t
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 }
106 
109 void
111 {
112  bool applied = m_psTable->applyEditor();
113  if (applied)
114  m_apply->SetEnabled(true);
115 }
116 
123 void
124 FWPathsPopup::cellClicked(Int_t iRow, Int_t iColumn, Int_t iButton, Int_t iKeyMod, Int_t, Int_t)
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 }
149 
150 void
152 {
154  m_psTable->setSelection(-1, -1, 0);
155  m_psTable->updateFilter(str);
156 }
157 
159 void
161 {
162  assert(info);
163  m_info = info;
164 }
165 
167 void
169 {
170  m_guiManager->updateStatus((mcc.moduleDescription()->moduleName() + " processed.").c_str());
171  gSystem->ProcessEvents();
172 }
173 
175 void
177 {
178  m_guiManager->updateStatus(("Processing " + mcc.moduleDescription()->moduleName() + "...").c_str());
179  gSystem->ProcessEvents();
180 }
181 
182 
183 void
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 }
224 
225 
226 
236 void
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 }
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)
void preModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
static const TGPicture * info(bool iBackgroundIsBlack)
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:61
FWDialogBuilder & addLabel(const char *text, size_t fontSize=12, size_t weight=0, TGLabel **out=0)
assert(m_qm.get())
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:60
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:94
void updateStatus(const char *status)
FWDialogBuilder & addTable(FWTableManagerBase *manager, FWTableWidget **out=0)
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
void SetLineSeparatorColor(Pixel_t)
const Double_t pi
void requestChanges(const std::string &, const edm::ParameterSet &)
Definition: FWFFLooper.cc:543
void applyEditor()
void disableGrowInWidth()
void windowIsClosing()
Definition: FWPathsPopup.cc:33
std::vector< PSetData > & data()
FWDialogBuilder & addTextButton(const char *text, TGTextButton **out=0)
FWTableWidget * m_tableWidget
Definition: FWPathsPopup.h:59
ModuleDescription const * moduleDescription() const
FWTabularWidget * body()
Definition: FWTableWidget.h:92
static std::string const triggerResults
Definition: EdmProvDump.cc:40
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:75
const edm::ScheduleInfo * m_info
Definition: FWPathsPopup.h:47
bool empty() const
void updateSchedule(const edm::ScheduleInfo *info)
virtual ProcessHistory const & processHistory() const
Definition: Event.cc:180
TGTextButton * m_apply
Definition: FWPathsPopup.h:57
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:50
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
tuple editor
Definition: idDealer.py:73
void setCellValueEditor(FWPSetCellEditor *editor)
bool m_hasChanges
Definition: FWPathsPopup.h:52
FWDialogBuilder & expand(size_t expandX=true, size_t expandY=false)
void postModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
FWFFLooper * m_looper
Definition: FWPathsPopup.h:50
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
#define update(a, b)
void postEvent(edm::Event const &event)
void update(std::vector< PathUpdate > &pathUpdates)
void setSelection(int row, int column, int mask)
tuple cout
Definition: gather_cfg.py:121
volatile std::atomic< bool > shutdown_flag false
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:58
void setup(const edm::ScheduleInfo *info)
FWPathsPopup(FWFFLooper *, FWGUIManager *)
Definition: FWPathsPopup.cc:39
FWDialogBuilder & indent(int left=2, int right=-1)
Definition: vlib.h:208
std::vector< PSetData > & entries()
FWDialogBuilder & spaceDown(size_t spacing=3)