BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ScriptPanel.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/SampleDesigner/ScriptPanel.h
6 //! @brief Defines class SampleDesigner
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SCRIPTPANEL_H
16 #define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SCRIPTPANEL_H
17 
18 #include <QWidget>
19 
21 class UpdateTimer;
22 class CautionSign;
23 class QShowEvent;
24 class QHideEvent;
25 class QTextEdit;
26 class QModelIndex;
27 class MultiLayerItem;
28 
29 //! Resides at the bottom of SampleView and displays a Python script.
30 
31 class ScriptPanel : public QWidget {
32  Q_OBJECT
33 
34 public:
35  explicit ScriptPanel(QWidget* parent);
36 
37  void setCurrentSample(MultiLayerItem* sampleItem);
38  void onSampleModified();
39 
40 protected:
41  void showEvent(QShowEvent*) override;
42  void hideEvent(QHideEvent*) override;
43 
44 private:
45  //! generates string representing code snippet for all multi layers in the model
46  QString generateCodeSnippet();
47 
48  //! Update the editor with the script content
49  void updateEditor();
50 
51  QTextEdit* m_textEdit;
56 };
57 
58 #endif // BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SCRIPTPANEL_H
The CautionSign controls appearance of CautionSignWidget on top of parent widget.
Definition: CautionSign.h:25
Implementation of highlighting for Python code.
Resides at the bottom of SampleView and displays a Python script.
Definition: ScriptPanel.h:31
UpdateTimer * m_updateTimer
Definition: ScriptPanel.h:53
ScriptPanel(QWidget *parent)
Definition: ScriptPanel.cpp:35
void updateEditor()
Update the editor with the script content.
Definition: ScriptPanel.cpp:73
void showEvent(QShowEvent *) override
Definition: ScriptPanel.cpp:91
QTextEdit * m_textEdit
Definition: ScriptPanel.h:51
QString generateCodeSnippet()
generates string representing code snippet for all multi layers in the model
MultiLayerItem * m_currentMultiLayerItem
Definition: ScriptPanel.h:55
void onSampleModified()
Definition: ScriptPanel.cpp:67
void hideEvent(QHideEvent *) override
Definition: ScriptPanel.cpp:96
CautionSign * m_cautionSign
Definition: ScriptPanel.h:54
void setCurrentSample(MultiLayerItem *sampleItem)
Definition: ScriptPanel.cpp:61
PythonSyntaxHighlighter * m_highlighter
Definition: ScriptPanel.h:52
The UpdateTimer class accumulates update requests during certain period of time, and at the end of th...
Definition: UpdateTimer.h:27