eric6/CondaInterface/CondaPackageDetailsWidget.py

Sun, 02 Feb 2020 11:04:32 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 02 Feb 2020 11:04:32 +0100
changeset 7380
c99320e859ca
parent 7360
9190402e4505
child 7780
41420f82c0ac
permissions
-rw-r--r--

Fixed an issue related to showing the application name in the menu bar of Gnome desktop under Wayland.

6712
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7360
9190402e4505 Updated copyright for 2020.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
3 # Copyright (c) 2019 - 2020 Detlev Offenbach <detlev@die-offenbachs.de>
6712
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a widget and a dialog to show package details.
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt5.QtCore import Qt, QDateTime
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from PyQt5.QtWidgets import QWidget, QDialog, QVBoxLayout, QDialogButtonBox
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from .Ui_CondaPackageDetailsWidget import Ui_CondaPackageDetailsWidget
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from Globals import dataString
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 class CondaPackageDetailsWidget(QWidget, Ui_CondaPackageDetailsWidget):
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 Class implementing a widget to show package details.
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 def __init__(self, details, parent=None):
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 Constructor
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 @param details dictionary containing the package details
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 @type dict
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 @param parent reference to the parent widget
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @type QWidget
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 super(CondaPackageDetailsWidget, self).__init__(parent)
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 self.setupUi(self)
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.headerLabel.setText(self.tr("<b>{0} / {1} / {2}</b>").format(
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 details["name"], details["version"], details["build"]))
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 if "fn" in details:
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.filenameLabel.setText(details["fn"])
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 if "size" in details:
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 self.sizeLabel.setText(dataString(details["size"]))
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 if "channel" in details:
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.channelLabel.setText(details["channel"])
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 if "url" in details:
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.urlLabel.setText(details["url"])
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 if "md5" in details:
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 self.md5Label.setText(details["md5"])
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 if "license" in details:
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 self.licenseLabel.setText(details["license"])
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 if "subdir" in details:
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.platformLabel.setText(details["subdir"])
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 elif "platform" in details:
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 self.platformLabel.setText(details["platform"])
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 else:
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.platformLabel.setText(self.tr("unknown"))
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 if "depends" in details:
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 self.dependenciesEdit.setPlainText("\n".join(details["depends"]))
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 if "timestamp" in details:
6713
84024511120e CondaPackageDetailsWidget: fixed calculation of the timestamp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6712
diff changeset
59 dt = QDateTime.fromMSecsSinceEpoch(details["timestamp"], Qt.UTC)
6712
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 self.timestampLabel.setText(dt.toString("yyyy-MM-dd hh:mm:ss t"))
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61
6728
ba077788a882 Conda: continued implementing the conda menu functionality
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6713
diff changeset
62 self.resize(600, 450)
6712
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 class CondaPackageDetailsDialog(QDialog):
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 """
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 Class implementing a dialog to show package details.
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 """
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 def __init__(self, details, parent=None):
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 """
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 Constructor
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 @param details dictionary containing the package details
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 @type dict
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 @param parent reference to the parent widget
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 @type QWidget
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 """
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 super(CondaPackageDetailsDialog, self).__init__(parent)
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 self.setSizeGripEnabled(True)
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 self.__layout = QVBoxLayout(self)
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 self.setLayout(self.__layout)
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 self.__cw = CondaPackageDetailsWidget(details, self)
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 size = self.__cw.size()
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 self.__layout.addWidget(self.__cw)
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 self.__buttonBox = QDialogButtonBox(self)
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 self.__buttonBox.setStandardButtons(QDialogButtonBox.Close)
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 self.__layout.addWidget(self.__buttonBox)
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 self.resize(size)
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 self.setWindowTitle(self.tr("Package Details"))
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 self.__buttonBox.accepted.connect(self.accept)
91fa67e8ebbc Conda: implemented the package search and 'Show Details' functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 self.__buttonBox.rejected.connect(self.reject)

eric ide

mercurial