ATLAS Offline Software
VP1PluginDialog.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // //
7 // Implementation of class VP1PluginDialog //
8 // //
9 // Author: Thomas Kittelmann <Thomas.Kittelmann@cern.ch> //
10 // //
11 // Initial version: April 2007 //
12 // //
14 
15 #include "VP1Gui/VP1PluginDialog.h"
16 #include "ui_vp1plugindialog.h"
20 #include <QFileInfo>
21 #include <cassert>
22 
23 //____________________________________________________________________
25 public:
29  void setInfo();
31  QComboBox * comboBox_plugins;
33  QLabel * label_fullpath;
34  QLabel * label_channels;
35  QPushButton * pushButton_unload;
36  QTextBrowser * textBrowser_channels;
37  QMap<int,QString> index_2_fullpath;
38  QString unloadfile;
39 };
40 
41 //____________________________________________________________________
43  : QDialog(parent), m_d(new Imp)
44 {
45  m_d->pd = this;
47  m_d->scheduler=scheduler;
48  Ui::VP1PluginDialog ui;
49  ui.setupUi(this);
50  ui.textBrowser_channels->viewport()->setBackgroundRole(QPalette::NoRole);
51  m_d->label_selectplugin = ui.label_selectplugin;
52  m_d->comboBox_plugins = ui.comboBox_plugins;
53  m_d->label_fullpathtitle = ui.label_fullpathtitle;
54  m_d->label_fullpath = ui.label_fullpath;
55  m_d->label_channels = ui.label_channels;
56  m_d->pushButton_unload = ui.pushButton_unload;
57  m_d->textBrowser_channels = ui.textBrowser_channels;
58  m_d->setInfo();
59  setModal(true);
60  connect(m_d->comboBox_plugins,SIGNAL(currentIndexChanged(int)),this,SLOT(pluginSelected(int)));
61  connect(m_d->pushButton_unload,SIGNAL(clicked()),this,SLOT(unloadclicked()));
62  connect(scheduler,SIGNAL(refreshingStatusChanged(bool)),this,SLOT(updateRefreshInfo()));
63 
64 }
65 
66 //____________________________________________________________________
68 {
69  int i = m_d->comboBox_plugins->currentIndex();
70  if (i<0)
71  return;
72  assert(m_d->index_2_fullpath.contains(i));
74  accept();
75 }
76 
77 //____________________________________________________________________
79 {
80  return m_d->unloadfile;
81 }
82 
83 //____________________________________________________________________
85 {
86  delete m_d; m_d=0;
87 }
88 
89 //____________________________________________________________________
91 {
92  QStringList files = channelmanager->currentPluginFiles();
93  comboBox_plugins->clear();
94  index_2_fullpath.clear();
95  if (files.empty()) {
96  label_selectplugin->setEnabled(false);
97  comboBox_plugins->setEnabled(false);
98  label_fullpathtitle->setEnabled(false);
99  label_fullpath->setEnabled(false);
100  label_channels->setEnabled(false);
101  pushButton_unload->setEnabled(false);
102  label_fullpath->setText("n/a");
103  comboBox_plugins->addItem("No plugins loaded");
104  textBrowser_channels->setHtml("");
105  textBrowser_channels->setEnabled(false);
106  } else {
107  label_selectplugin->setEnabled(true);
108  comboBox_plugins->setEnabled(true);
109  label_fullpathtitle->setEnabled(true);
110  label_fullpath->setEnabled(true);
111  label_channels->setEnabled(true);
112  pushButton_unload->setEnabled(true);
113  textBrowser_channels->setEnabled(true);
114 
115  int i(0);
116  for(QString file : files) {
117  QFileInfo fi(file);
118  comboBox_plugins->addItem(fi.fileName());
119  index_2_fullpath.insert(i++,file);
120  }
121  comboBox_plugins->setCurrentIndex(0);
122  pd->pluginSelected(0);
123  }
124 }
125 
126 //____________________________________________________________________
128 {
129  assert(i<m_d->comboBox_plugins->count());
130  assert(m_d->index_2_fullpath.contains(i));
131  m_d->label_fullpath->setText(m_d->index_2_fullpath.value(i));
132  QStringList availablechannels = m_d->channelmanager->channelsInPluginFile(m_d->index_2_fullpath.value(i));
133  if (availablechannels.empty()) {
134  m_d->textBrowser_channels->setHtml("none");
135  m_d->textBrowser_channels->setEnabled(false);
136  } else {
137  QString text;
138  for(QString bn : availablechannels) {
139  QStringList uns = m_d->channelmanager->basename2UniqueNames(bn);
140  bool refreshing=false;
141  for(QString un : uns) {
143  refreshing=true;
145  assert(cw);
146  connect(cw,SIGNAL(systemRefreshInfoChanged(QString,int,int)),this,SLOT(updateRefreshInfo()));
147  }
148  m_d->pushButton_unload->setEnabled(!m_d->scheduler->isRefreshing());
149  QString icontext = m_d->channelmanager->getIconLocation(bn);
150  text += (icontext.isEmpty()?"":"<img src=\""+icontext+"\">")+"<i>"
151  +bn+(uns.empty()?"":" ["+QString::number(uns.count())
152  +" active"+(refreshing?" (refreshing)":"")+"]")+"</i><br/>";
153  }
154  m_d->textBrowser_channels->setHtml(text);
155  m_d->textBrowser_channels->setEnabled(true);
156  }
157 }
158 
159 //____________________________________________________________________
161  int i = m_d->comboBox_plugins->currentIndex();
162  if (i!=-1)
163  pluginSelected(i);
164 }
VP1PluginDialog::Imp::channelmanager
VP1ChannelManager * channelmanager
Definition: VP1PluginDialog.cxx:27
python.changerun.bn
bn
Definition: changerun.py:79
VP1PluginDialog::unloadfile
QString unloadfile()
Definition: VP1PluginDialog.cxx:78
VP1ExecutionScheduler.h
VP1PluginDialog::Imp::pushButton_unload
QPushButton * pushButton_unload
Definition: VP1PluginDialog.cxx:35
VP1PluginDialog::Imp::index_2_fullpath
QMap< int, QString > index_2_fullpath
Definition: VP1PluginDialog.cxx:37
VP1ChannelManager::getIconLocation
QString getIconLocation(const QString &channelname, const bool &isbasename=true)
Definition: VP1ChannelManager.cxx:588
CutsMETMaker::accept
StatusCode accept(const xAOD::Muon *mu)
Definition: CutsMETMaker.cxx:18
fillPileUpNoiseLumi.connect
string connect
Definition: fillPileUpNoiseLumi.py:70
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
VP1ChannelManager.h
VP1PluginDialog::Imp::textBrowser_channels
QTextBrowser * textBrowser_channels
Definition: VP1PluginDialog.cxx:36
VP1ChannelManager::currentPluginFiles
QStringList currentPluginFiles() const
Definition: VP1ChannelManager.cxx:535
VP1ChannelManager
Definition: VP1ChannelManager.h:27
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
VP1PluginDialog::~VP1PluginDialog
virtual ~VP1PluginDialog()
Definition: VP1PluginDialog.cxx:84
VP1PluginDialog::Imp::scheduler
VP1ExecutionScheduler * scheduler
Definition: VP1PluginDialog.cxx:28
VP1PluginDialog::Imp::setInfo
void setInfo()
Definition: VP1PluginDialog.cxx:90
VP1ChannelManager::channelsInPluginFile
QStringList channelsInPluginFile(QString filename) const
Definition: VP1ChannelManager.cxx:358
lumiFormat.i
int i
Definition: lumiFormat.py:92
VP1PluginDialog::VP1PluginDialog
VP1PluginDialog(QWidget *parent, VP1ChannelManager *, VP1ExecutionScheduler *)
Definition: VP1PluginDialog.cxx:42
VP1ChannelManager::basename2UniqueNames
QStringList basename2UniqueNames(QString basename) const
Definition: VP1ChannelManager.cxx:546
VP1PluginDialog::Imp::label_fullpath
QLabel * label_fullpath
Definition: VP1PluginDialog.cxx:33
generateReferenceFile.files
files
Definition: generateReferenceFile.py:12
file
TFile * file
Definition: tile_monitor.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
VP1PluginDialog::Imp::label_channels
QLabel * label_channels
Definition: VP1PluginDialog.cxx:34
VP1PluginDialog::Imp::label_selectplugin
QLabel * label_selectplugin
Definition: VP1PluginDialog.cxx:30
IVP1ChannelWidget
Definition: IVP1ChannelWidget.h:34
VP1ExecutionScheduler
Definition: VP1ExecutionScheduler.h:42
VP1ExecutionScheduler::isRefreshing
bool isRefreshing() const
Definition: VP1ExecutionScheduler.cxx:798
VP1PluginDialog::Imp::label_fullpathtitle
QLabel * label_fullpathtitle
Definition: VP1PluginDialog.cxx:32
VP1PluginDialog::Imp::unloadfile
QString unloadfile
Definition: VP1PluginDialog.cxx:38
python.selection.number
number
Definition: selection.py:20
VP1PluginDialog.h
VP1PluginDialog
Definition: VP1PluginDialog.h:23
VP1PluginDialog::m_d
Imp * m_d
Definition: VP1PluginDialog.h:35
VP1ChannelManager::uniqueName2Channel
IVP1ChannelWidget * uniqueName2Channel(QString uniquename) const
Definition: VP1ChannelManager.cxx:455
VP1PluginDialog::Imp::pd
VP1PluginDialog * pd
Definition: VP1PluginDialog.cxx:26
VP1PluginDialog::unloadclicked
void unloadclicked()
Definition: VP1PluginDialog.cxx:67
VP1PluginDialog::Imp
Definition: VP1PluginDialog.cxx:24
checkFileSG.fi
fi
Definition: checkFileSG.py:65
makeTransCanvas.text
text
Definition: makeTransCanvas.py:11
VP1PluginDialog::Imp::comboBox_plugins
QComboBox * comboBox_plugins
Definition: VP1PluginDialog.cxx:31
VP1PluginDialog::updateRefreshInfo
void updateRefreshInfo()
Definition: VP1PluginDialog.cxx:160
VP1ChannelManager::hasRefreshingSystem
bool hasRefreshingSystem(const QString &uniquename) const
Definition: VP1ChannelManager.cxx:581
VP1PluginDialog::pluginSelected
void pluginSelected(int i)
Definition: VP1PluginDialog.cxx:127
IVP1ChannelWidget.h