|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the conda information dialog. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 from PyQt5.QtCore import Qt |
|
13 from PyQt5.QtWidgets import QDialog |
|
14 |
|
15 from .Ui_CondaInfoDialog import Ui_CondaInfoDialog |
|
16 |
|
17 import UI.PixmapCache |
|
18 |
|
19 |
|
20 class CondaInfoDialog(QDialog, Ui_CondaInfoDialog): |
|
21 """ |
|
22 Class implementing the conda information dialog. |
|
23 """ |
|
24 def __init__(self, infoDict, parent=None): |
|
25 """ |
|
26 Constructor |
|
27 |
|
28 @param infoDict dictionary containing the information to be shown |
|
29 @type dict |
|
30 @param parent reference to the parent widget |
|
31 @type QWidget |
|
32 """ |
|
33 super(CondaInfoDialog, self).__init__(parent) |
|
34 self.setupUi(self) |
|
35 self.setWindowFlags(Qt.Window) |
|
36 |
|
37 self.iconLabel.setPixmap( |
|
38 UI.PixmapCache.getPixmap("miniconda48.png")) |
|
39 |
|
40 if "conda_version" in infoDict: |
|
41 self.condaVersionLabel.setText( |
|
42 infoDict["conda_version"]) |
|
43 if "conda_build_version" in infoDict: |
|
44 self.condaBuildVersionLabel.setText( |
|
45 infoDict["conda_build_version"]) |
|
46 if "python_version" in infoDict: |
|
47 self.pythonVersionLabel.setText( |
|
48 infoDict["python_version"]) |
|
49 if "active_prefix" in infoDict and "active_prefix_name" in infoDict: |
|
50 if infoDict["active_prefix_name"] and infoDict["active_prefix"]: |
|
51 self.activeEnvironmentEdit.setText( |
|
52 "{0} ({1})".format(infoDict["active_prefix_name"], |
|
53 infoDict["active_prefix"])) |
|
54 elif infoDict["active_prefix"]: |
|
55 self.activeEnvironmentEdit.setText( |
|
56 infoDict["active_prefix"]) |
|
57 elif infoDict["active_prefix_name"]: |
|
58 self.activeEnvironmentEdit.setText( |
|
59 infoDict["active_prefix_name"]) |
|
60 else: |
|
61 self.activeEnvironmentEdit.setText( |
|
62 self.tr("None")) |
|
63 if "rc_path" in infoDict: |
|
64 self.userConfigEdit.setText( |
|
65 infoDict["rc_path"]) |
|
66 if "user_rc_path" in infoDict: |
|
67 # overwrite with more specific info |
|
68 self.userConfigEdit.setText( |
|
69 infoDict["user_rc_path"]) |
|
70 if "sys_rc_path" in infoDict: |
|
71 self.systemConfigEdit.setText( |
|
72 infoDict["sys_rc_path"]) |
|
73 if "config_files" in infoDict: |
|
74 self.configurationsEdit.setPlainText( |
|
75 "\n".join(infoDict["config_files"])) |
|
76 if "root_prefix" in infoDict: |
|
77 if "root_writable" in infoDict and infoDict["root_writable"]: |
|
78 self.baseEnvironmentEdit.setText( |
|
79 self.tr("{0} (writable)").format(infoDict["root_prefix"])) |
|
80 else: |
|
81 self.baseEnvironmentEdit.setText( |
|
82 infoDict["root_prefix"]) |
|
83 if "channels" in infoDict: |
|
84 self.channelsEdit.setPlainText( |
|
85 "\n".join(infoDict["channels"])) |
|
86 if "pkgs_dirs" in infoDict: |
|
87 self.cachesEdit.setPlainText( |
|
88 "\n".join(infoDict["pkgs_dirs"])) |
|
89 if "envs_dirs" in infoDict: |
|
90 self.envDirsEdit.setPlainText( |
|
91 "\n".join(infoDict["envs_dirs"])) |
|
92 if "platform" in infoDict: |
|
93 self.platformLabel.setText( |
|
94 infoDict["platform"]) |
|
95 if "user_agent" in infoDict: |
|
96 self.useragentEdit.setText( |
|
97 infoDict["user_agent"]) |
|
98 if "UID" in infoDict and "GID" in infoDict: |
|
99 self.uidGidLabel.setText( |
|
100 "{0}:{1}".format(infoDict["UID"], infoDict["GID"])) |
|
101 if "netrc_file" in infoDict: |
|
102 if infoDict["netrc_file"]: |
|
103 self.netrcEdit.setText( |
|
104 infoDict["netrc_file"]) |
|
105 else: |
|
106 self.netrcEdit.setText( |
|
107 self.tr("None")) |
|
108 if "offline" in infoDict: |
|
109 self.offlineCheckBox.setChecked( |
|
110 infoDict["offline"]) |