|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2023 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the standalone pip packages management window. |
|
8 """ |
|
9 |
|
10 from PyQt6.QtCore import Qt |
|
11 from PyQt6.QtWidgets import QDialogButtonBox, QVBoxLayout, QWidget |
|
12 |
|
13 from eric7.EricWidgets.EricApplication import ericApp |
|
14 from eric7.EricWidgets.EricMainWindow import EricMainWindow |
|
15 from eric7.PipInterface.Pip import Pip |
|
16 from eric7.PipInterface.PipPackagesWidget import PipPackagesWidget |
|
17 from eric7.VirtualEnv.VirtualenvManager import VirtualenvManager |
|
18 |
|
19 |
|
20 class PipPackagesWindow(EricMainWindow): |
|
21 """ |
|
22 Main window class for the standalone pip packages manager. |
|
23 """ |
|
24 |
|
25 def __init__(self, parent=None): |
|
26 """ |
|
27 Constructor |
|
28 |
|
29 @param parent reference to the parent widget |
|
30 @type QWidget |
|
31 """ |
|
32 super().__init__(parent) |
|
33 |
|
34 self.__pip = Pip(self) |
|
35 ericApp().registerObject("Pip", self.__pip) |
|
36 |
|
37 self.__venvManager = VirtualenvManager(self) |
|
38 ericApp().registerObject("VirtualEnvManager", self.__venvManager) |
|
39 |
|
40 self.__centralWidget = QWidget(self) |
|
41 self.__layout = QVBoxLayout(self.__centralWidget) |
|
42 self.__centralWidget.setLayout(self.__layout) |
|
43 |
|
44 self.__pipPackagesWidget = PipPackagesWidget( |
|
45 self.__pip, parent=self.__centralWidget |
|
46 ) |
|
47 self.__layout.addWidget(self.__pipPackagesWidget) |
|
48 |
|
49 self.__buttonBox = QDialogButtonBox( |
|
50 QDialogButtonBox.StandardButton.Close, Qt.Orientation.Horizontal, self |
|
51 ) |
|
52 self.__layout.addWidget(self.__buttonBox) |
|
53 |
|
54 self.setCentralWidget(self.__centralWidget) |
|
55 self.resize(700, 900) |
|
56 self.setWindowTitle(self.tr("Manage Packages")) |
|
57 |
|
58 self.__buttonBox.accepted.connect(self.close) |
|
59 self.__buttonBox.rejected.connect(self.close) |