Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkPipInstallDialog.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkPipInstallDialog_h
14 #define QmitkPipInstallDialog_h
15 
17 
18 #include <mitkPipPackageInfo.h>
19 
20 #include <QDialog>
21 #include <QTimer>
22 #include <memory>
23 
24 class QCloseEvent;
25 class QShowEvent;
26 class QmitkPipInstaller;
27 
28 namespace Ui
29 {
31 }
32 
60 {
61  Q_OBJECT
62 
63 public:
71  enum class Mode { Install, Update };
72 
73  explicit QmitkPipInstallDialog(const mitk::PipInstallSpec& spec, QWidget* parent = nullptr, Mode mode = Mode::Install);
75 
76 protected:
77  void closeEvent(QCloseEvent* event) override;
78  void showEvent(QShowEvent* event) override;
79  void reject() override;
80 
81 private slots:
82  void OnInstallClicked();
83  void OnAdvancedSettingsClicked();
84  void OnToggleDetailsClicked();
85 
86  void OnVirtualEnvCreationStarted();
87  void OnPipUpgradeStarted();
88  void OnResolveStarted();
89  void OnPackageStatusChanged(int index, const QString& name, mitk::PackageStatus status);
90  void OnPostInstallStepStarted(const QString& displayName);
91  void OnInstallFinished(bool success);
92  void OnProgressChanged(int current, int total);
93  void OnErrorOccurred(const QString& message);
94  void OnOutputReceived(const QString& text, bool isError);
95  void OnDotTimer();
96 
97 private:
98  bool ConfirmCancel();
99  void SetUiInstalling();
100  void SetUiFinished(bool success);
101  void OfferDetails();
102  void SetDetailsVisible(bool show);
103 
104  void SetStatus(const QString& text);
105  void SetTerminalStatus(const QString& text);
106 
107  std::unique_ptr<Ui::QmitkPipInstallDialog> m_Ui;
108  QmitkPipInstaller* m_Installer = nullptr;
109  mitk::PipInstallSpec m_Spec;
110  Mode m_Mode = Mode::Install;
111  QTimer* m_DotTimer = nullptr;
112  QString m_PackageLabelBaseText;
113  int m_DotCount = 0;
114  int m_CurrentStep = 0;
115  int m_TotalSteps = 0;
116  int m_CompactHeight = 0;
117  int m_ExpandedHeight = 0;
118  bool m_HeightsCaptured = false;
119  bool m_IsCancelling = false;
120  bool m_TerminalStatusSet = false;
121 };
122 
123 #endif
#define MITKPYTHONINSTALLERUI_EXPORT
Reusable dialog for installing Python packages via pip.
void reject() override
QmitkPipInstallDialog(const mitk::PipInstallSpec &spec, QWidget *parent=nullptr, Mode mode=Mode::Install)
~QmitkPipInstallDialog() override
Mode
Whether the dialog presents a fresh install or an in-place update.
void closeEvent(QCloseEvent *event) override
void showEvent(QShowEvent *event) override
Headless pip installer with structured progress reporting.
PackageStatus
Status of a single package during installation.
Full specification for a pip installation run.