|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the conda packages management widget. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 import os |
|
13 |
|
14 from PyQt5.QtCore import pyqtSlot, Qt |
|
15 from PyQt5.QtWidgets import QWidget, QToolButton, QMenu |
|
16 |
|
17 from .Ui_CondaPackagesWidget import Ui_CondaPackagesWidget |
|
18 |
|
19 import UI.PixmapCache |
|
20 |
|
21 |
|
22 class CondaPackagesWidget(QWidget, Ui_CondaPackagesWidget): |
|
23 """ |
|
24 Class implementing the conda packages management widget. |
|
25 """ |
|
26 def __init__(self, parent=None): |
|
27 """ |
|
28 Constructor |
|
29 |
|
30 @param parent reference to the parent widget |
|
31 @type QWidget |
|
32 """ |
|
33 super(CondaPackagesWidget, self).__init__(parent) |
|
34 self.setupUi(self) |
|
35 |
|
36 self.condaMenuButton.setObjectName( |
|
37 "navigation_supermenu_button") |
|
38 self.condaMenuButton.setIcon(UI.PixmapCache.getIcon("superMenu.png")) |
|
39 self.condaMenuButton.setToolTip(self.tr("Conda Menu")) |
|
40 self.condaMenuButton.setPopupMode(QToolButton.InstantPopup) |
|
41 self.condaMenuButton.setToolButtonStyle(Qt.ToolButtonIconOnly) |
|
42 self.condaMenuButton.setFocusPolicy(Qt.NoFocus) |
|
43 self.condaMenuButton.setAutoRaise(True) |
|
44 self.condaMenuButton.setShowMenuInside(True) |
|
45 |
|
46 self.__initCondaMenu() |
|
47 self.__populateEnvironments() |
|
48 |
|
49 def __populateEnvironments(self): |
|
50 """ |
|
51 Private method to get a list of environments and populate the selector. |
|
52 """ |
|
53 # TODO: replace this by the real stuff |
|
54 envs = [ |
|
55 "path/to/envs/sqlite", |
|
56 "path/to/envs/pyqt4", |
|
57 "path/to/envs/pyqt5", |
|
58 ] |
|
59 |
|
60 environmentNames = [os.path.basename(e) for e in envs] |
|
61 self.environmentsComboBox.addItems(sorted(environmentNames)) |
|
62 |
|
63 def __initCondaMenu(self): |
|
64 """ |
|
65 Private method to create the super menu and attach it to the super |
|
66 menu button. |
|
67 """ |
|
68 self.__condaMenu = QMenu(self) |
|
69 # TODO: implement Conda menu |
|
70 self.__condaMenu.addAction(self.tr("Test Entry"), self.on_refreshButton_clicked) |
|
71 |
|
72 self.condaMenuButton.setMenu(self.__condaMenu) |
|
73 |
|
74 @pyqtSlot(str) |
|
75 def on_environmentsComboBox_activated(self, p0): |
|
76 """ |
|
77 Slot documentation goes here. |
|
78 |
|
79 @param p0 DESCRIPTION |
|
80 @type str |
|
81 """ |
|
82 # TODO: not implemented yet |
|
83 raise NotImplementedError |
|
84 |
|
85 @pyqtSlot() |
|
86 def on_packagesList_itemSelectionChanged(self): |
|
87 """ |
|
88 Slot documentation goes here. |
|
89 """ |
|
90 # TODO: not implemented yet |
|
91 raise NotImplementedError |
|
92 |
|
93 @pyqtSlot() |
|
94 def on_refreshButton_clicked(self): |
|
95 """ |
|
96 Slot documentation goes here. |
|
97 """ |
|
98 # TODO: not implemented yet |
|
99 raise NotImplementedError |
|
100 |
|
101 @pyqtSlot() |
|
102 def on_upgradeButton_clicked(self): |
|
103 """ |
|
104 Slot documentation goes here. |
|
105 """ |
|
106 # TODO: not implemented yet |
|
107 raise NotImplementedError |
|
108 |
|
109 @pyqtSlot() |
|
110 def on_upgradeAllButton_clicked(self): |
|
111 """ |
|
112 Slot documentation goes here. |
|
113 """ |
|
114 # TODO: not implemented yet |
|
115 raise NotImplementedError |
|
116 |
|
117 @pyqtSlot() |
|
118 def on_uninstallButton_clicked(self): |
|
119 """ |
|
120 Slot documentation goes here. |
|
121 """ |
|
122 # TODO: not implemented yet |
|
123 raise NotImplementedError |