CondaInfoDialog: made some information displays dependent upon returned data and hide them, if the conda version doesn't deliver. conda

Wed, 13 Feb 2019 19:03:29 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 13 Feb 2019 19:03:29 +0100
branch
conda
changeset 6737
26a4738dd206
parent 6736
9a244f0d5dc0
child 6738
a7f835b41606

CondaInfoDialog: made some information displays dependent upon returned data and hide them, if the conda version doesn't deliver.

CondaInterface/CondaInfoDialog.py file | annotate | diff | comparison | revisions
CondaInterface/CondaInfoDialog.ui file | annotate | diff | comparison | revisions
--- a/CondaInterface/CondaInfoDialog.py	Wed Feb 13 19:01:34 2019 +0100
+++ b/CondaInterface/CondaInfoDialog.py	Wed Feb 13 19:03:29 2019 +0100
@@ -37,17 +37,22 @@
         self.iconLabel.setPixmap(
             UI.PixmapCache.getPixmap("miniconda48.png"))
         
+        # version information
         if "conda_version" in infoDict:
             self.condaVersionLabel.setText(
                 infoDict["conda_version"])
         if "conda_build_version" in infoDict:
             self.condaBuildVersionLabel.setText(
                 infoDict["conda_build_version"])
-        # TODO: add 'conda_env_version
+        if "conda_env_version" in infoDict:
+            self.condaEnvVersionLabel.setText(
+                infoDict["conda_env_version"])
         if "python_version" in infoDict:
             self.pythonVersionLabel.setText(
                 infoDict["python_version"])
-        if "active_prefix" in infoDict and "active_prefix_name" in infoDict:
+        
+        # prefixes
+        if "active_prefix" in infoDict or "active_prefix_name" in infoDict:
             if infoDict["active_prefix_name"] and infoDict["active_prefix"]:
                 self.activeEnvironmentEdit.setText(
                     "{0} ({1})".format(infoDict["active_prefix_name"],
@@ -62,8 +67,20 @@
                 self.activeEnvironmentEdit.setText(
                     self.tr("None"))
         else:
-            self.activeEnvironmentEdit.setText(
-                self.tr("Unknown"))
+            self.activeEnvironmentLabel.hide()
+            self.activeEnvironmentEdit.hide()
+        if "root_prefix" in infoDict:
+            if "root_writable" in infoDict and infoDict["root_writable"]:
+                self.baseEnvironmentEdit.setText(
+                    self.tr("{0} (writable)").format(infoDict["root_prefix"]))
+            else:
+                self.baseEnvironmentEdit.setText(
+                    infoDict["root_prefix"])
+        if "envs_dirs" in infoDict:
+            self.envDirsEdit.setPlainText(
+                "\n".join(infoDict["envs_dirs"]))
+        
+        # configurations
         if "rc_path" in infoDict:
             self.userConfigEdit.setText(
                 infoDict["rc_path"])
@@ -77,32 +94,34 @@
         if "config_files" in infoDict:
             self.configurationsEdit.setPlainText(
                 "\n".join(infoDict["config_files"]))
-        if "root_prefix" in infoDict:
-            if "root_writable" in infoDict and infoDict["root_writable"]:
-                self.baseEnvironmentEdit.setText(
-                    self.tr("{0} (writable)").format(infoDict["root_prefix"]))
-            else:
-                self.baseEnvironmentEdit.setText(
-                    infoDict["root_prefix"])
+        else:
+            self.configurationsLabel.hide()
+            self.configurationsEdit.hide()
+        
+        # channels
         if "channels" in infoDict:
             self.channelsEdit.setPlainText(
                 "\n".join(infoDict["channels"]))
+        
+        # various
         if "pkgs_dirs" in infoDict:
             self.cachesEdit.setPlainText(
                 "\n".join(infoDict["pkgs_dirs"]))
-        if "envs_dirs" in infoDict:
-            self.envDirsEdit.setPlainText(
-                "\n".join(infoDict["envs_dirs"]))
         if "platform" in infoDict:
             self.platformLabel.setText(
                 infoDict["platform"])
-        # TODO: suppress user_agent, UID/GID and netrc_file if not present
         if "user_agent" in infoDict:
             self.useragentEdit.setText(
                 infoDict["user_agent"])
+        else:
+            self.useragentLabel.hide()
+            self.useragentEdit.hide()
         if "UID" in infoDict and "GID" in infoDict:
-            self.uidGidLabel.setText(
+            self.uidGidDataLabel.setText(
                 "{0}:{1}".format(infoDict["UID"], infoDict["GID"]))
+        else:
+            self.uidGidLabel.hide()
+            self.uidGidDataLabel.hide()
         if "netrc_file" in infoDict:
             if infoDict["netrc_file"]:
                 self.netrcEdit.setText(
@@ -110,6 +129,9 @@
             else:
                 self.netrcEdit.setText(
                     self.tr("None"))
+        else:
+            self.netrcLabel.hide()
+            self.netrcEdit.hide()
         if "offline" in infoDict:
             self.offlineCheckBox.setChecked(
                 infoDict["offline"])
--- a/CondaInterface/CondaInfoDialog.ui	Wed Feb 13 19:01:34 2019 +0100
+++ b/CondaInterface/CondaInfoDialog.ui	Wed Feb 13 19:03:29 2019 +0100
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>650</width>
-    <height>650</height>
+    <height>669</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -83,48 +83,48 @@
      <item row="1" column="1">
       <widget class="QLabel" name="condaBuildVersionLabel"/>
      </item>
-     <item row="2" column="0">
+     <item row="3" column="0">
       <widget class="QLabel" name="label_5">
        <property name="text">
         <string>python Version:</string>
        </property>
       </widget>
      </item>
-     <item row="2" column="1">
+     <item row="3" column="1">
       <widget class="QLabel" name="pythonVersionLabel"/>
      </item>
-     <item row="3" column="0">
-      <widget class="QLabel" name="label_2">
+     <item row="4" column="0">
+      <widget class="QLabel" name="activeEnvironmentLabel">
        <property name="text">
         <string>Active Environment:</string>
        </property>
       </widget>
      </item>
-     <item row="3" column="1">
+     <item row="4" column="1">
       <widget class="QLineEdit" name="activeEnvironmentEdit"/>
      </item>
-     <item row="4" column="0">
+     <item row="5" column="0">
       <widget class="QLabel" name="label_6">
        <property name="text">
         <string>User Configuration:</string>
        </property>
       </widget>
      </item>
-     <item row="4" column="1">
+     <item row="5" column="1">
       <widget class="QLineEdit" name="userConfigEdit"/>
      </item>
-     <item row="5" column="0">
+     <item row="6" column="0">
       <widget class="QLabel" name="label_17">
        <property name="text">
         <string>System Configuration:</string>
        </property>
       </widget>
      </item>
-     <item row="5" column="1">
+     <item row="6" column="1">
       <widget class="QLineEdit" name="systemConfigEdit"/>
      </item>
-     <item row="6" column="0">
-      <widget class="QLabel" name="label_7">
+     <item row="7" column="0">
+      <widget class="QLabel" name="configurationsLabel">
        <property name="text">
         <string>Populated Configurations:</string>
        </property>
@@ -133,20 +133,20 @@
        </property>
       </widget>
      </item>
-     <item row="6" column="1">
+     <item row="7" column="1">
       <widget class="QPlainTextEdit" name="configurationsEdit"/>
      </item>
-     <item row="7" column="0">
+     <item row="8" column="0">
       <widget class="QLabel" name="label_8">
        <property name="text">
         <string>Base Environment:</string>
        </property>
       </widget>
      </item>
-     <item row="7" column="1">
+     <item row="8" column="1">
       <widget class="QLineEdit" name="baseEnvironmentEdit"/>
      </item>
-     <item row="8" column="0">
+     <item row="9" column="0">
       <widget class="QLabel" name="label_9">
        <property name="text">
         <string>Channel URLs:</string>
@@ -156,10 +156,10 @@
        </property>
       </widget>
      </item>
-     <item row="8" column="1">
+     <item row="9" column="1">
       <widget class="QPlainTextEdit" name="channelsEdit"/>
      </item>
-     <item row="9" column="0">
+     <item row="10" column="0">
       <widget class="QLabel" name="label_10">
        <property name="text">
         <string>Package Cache:</string>
@@ -169,10 +169,10 @@
        </property>
       </widget>
      </item>
-     <item row="9" column="1">
+     <item row="10" column="1">
       <widget class="QPlainTextEdit" name="cachesEdit"/>
      </item>
-     <item row="10" column="0">
+     <item row="11" column="0">
       <widget class="QLabel" name="label_11">
        <property name="text">
         <string>Environment Directories:</string>
@@ -182,63 +182,73 @@
        </property>
       </widget>
      </item>
-     <item row="10" column="1">
+     <item row="11" column="1">
       <widget class="QPlainTextEdit" name="envDirsEdit"/>
      </item>
-     <item row="11" column="0">
+     <item row="12" column="0">
       <widget class="QLabel" name="label_12">
        <property name="text">
         <string>Platform:</string>
        </property>
       </widget>
      </item>
-     <item row="11" column="1">
+     <item row="12" column="1">
       <widget class="QLabel" name="platformLabel"/>
      </item>
-     <item row="12" column="0">
-      <widget class="QLabel" name="label_13">
+     <item row="13" column="0">
+      <widget class="QLabel" name="useragentLabel">
        <property name="text">
         <string>User-Agent:</string>
        </property>
       </widget>
      </item>
-     <item row="12" column="1">
+     <item row="13" column="1">
       <widget class="QLineEdit" name="useragentEdit"/>
      </item>
-     <item row="13" column="0">
-      <widget class="QLabel" name="label_14">
+     <item row="14" column="0">
+      <widget class="QLabel" name="uidGidLabel">
        <property name="text">
         <string>UID:GID:</string>
        </property>
       </widget>
      </item>
-     <item row="13" column="1">
-      <widget class="QLabel" name="uidGidLabel"/>
+     <item row="14" column="1">
+      <widget class="QLabel" name="uidGidDataLabel"/>
      </item>
-     <item row="14" column="0">
-      <widget class="QLabel" name="label_15">
+     <item row="15" column="0">
+      <widget class="QLabel" name="netrcLabel">
        <property name="text">
         <string>netrc File:</string>
        </property>
       </widget>
      </item>
-     <item row="14" column="1">
+     <item row="15" column="1">
       <widget class="QLineEdit" name="netrcEdit"/>
      </item>
-     <item row="15" column="0">
+     <item row="16" column="0">
       <widget class="QLabel" name="label_16">
        <property name="text">
         <string>Offline Mode:</string>
        </property>
       </widget>
      </item>
-     <item row="15" column="1">
+     <item row="16" column="1">
       <widget class="QCheckBox" name="offlineCheckBox">
        <property name="text">
         <string/>
        </property>
       </widget>
      </item>
+     <item row="2" column="0">
+      <widget class="QLabel" name="label_18">
+       <property name="text">
+        <string>conda-env Version:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="1">
+      <widget class="QLabel" name="condaEnvVersionLabel"/>
+     </item>
     </layout>
    </item>
    <item>

eric ide

mercurial