Started implementing an extension to the debug/run/... start dialog. eric7

Sun, 22 Aug 2021 19:59:18 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 22 Aug 2021 19:59:18 +0200
branch
eric7
changeset 8528
2175f268ad9b
parent 8527
2bd1325d727e
child 8529
569623270e29

Started implementing an extension to the debug/run/... start dialog.

eric7/Debugger/StartCoverageDialog.ui file | annotate | diff | comparison | revisions
eric7/Debugger/StartDebugDialog.ui file | annotate | diff | comparison | revisions
eric7/Debugger/StartDialog.py file | annotate | diff | comparison | revisions
eric7/Debugger/StartProfileDialog.ui file | annotate | diff | comparison | revisions
eric7/Debugger/StartRunDialog.ui file | annotate | diff | comparison | revisions
--- a/eric7/Debugger/StartCoverageDialog.ui	Sat Aug 21 14:21:44 2021 +0200
+++ b/eric7/Debugger/StartCoverageDialog.ui	Sun Aug 22 19:59:18 2021 +0200
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>550</width>
-    <height>303</height>
+    <height>327</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -18,18 +18,68 @@
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_2">
    <item>
-    <layout class="QGridLayout" name="gridLayout_3">
-     <item row="2" column="0">
-      <widget class="QLabel" name="TextLabel2">
+    <layout class="QGridLayout" name="gridLayout">
+     <item row="0" column="0">
+      <widget class="QLabel" name="label">
        <property name="text">
-        <string>Working directory:</string>
+        <string>Virtual Environment:</string>
        </property>
        <property name="buddy">
-        <cstring>workdirPicker</cstring>
+        <cstring>venvComboBox</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="1">
+      <widget class="QComboBox" name="venvComboBox">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="toolTip">
+        <string>Select the virtual environment to be used</string>
+       </property>
+       <property name="whatsThis">
+        <string>&lt;b&gt;Virtual Environment&lt;/b&gt;
+&lt;p&gt;Enter the virtual environment to be used. Leave it empty to use the default environment, i.e. the one configured globally or per project.&lt;/p&gt;</string>
+       </property>
+       <property name="sizeAdjustPolicy">
+        <enum>QComboBox::AdjustToContentsOnFirstShow</enum>
        </property>
       </widget>
      </item>
      <item row="1" column="0">
+      <widget class="QLabel" name="TextLabel1_2">
+       <property name="text">
+        <string>Script Name:</string>
+       </property>
+       <property name="buddy">
+        <cstring>cmdlineCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="1">
+      <widget class="EricComboPathPicker" name="scriptnamePicker" native="true">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="focusPolicy">
+        <enum>Qt::WheelFocus</enum>
+       </property>
+       <property name="toolTip">
+        <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter the script file name&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+       </property>
+       <property name="whatsThis">
+        <string>&lt;b&gt;Script Name&lt;/b&gt;
+&lt;p&gt;Enter the the name of the script. Leave empty to use the script of the current editor.&lt;/p&gt;</string>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="0">
       <widget class="QLabel" name="TextLabel1">
        <property name="text">
         <string>Script Parameters:</string>
@@ -39,7 +89,7 @@
        </property>
       </widget>
      </item>
-     <item row="1" column="1">
+     <item row="2" column="1">
       <widget class="QComboBox" name="cmdlineCombo">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -68,7 +118,47 @@
        </property>
       </widget>
      </item>
+     <item row="3" column="0">
+      <widget class="QLabel" name="TextLabel2">
+       <property name="text">
+        <string>Working directory:</string>
+       </property>
+       <property name="buddy">
+        <cstring>workdirPicker</cstring>
+       </property>
+      </widget>
+     </item>
      <item row="3" column="1">
+      <widget class="EricComboPathPicker" name="workdirPicker" native="true">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="focusPolicy">
+        <enum>Qt::WheelFocus</enum>
+       </property>
+       <property name="toolTip">
+        <string>Enter the working directory</string>
+       </property>
+       <property name="whatsThis">
+        <string>&lt;b&gt;Working directory&lt;/b&gt;
+&lt;p&gt;Enter the working directory of the application to be debugged. Leave it empty to set the working directory to the executable directory.&lt;/p&gt;</string>
+       </property>
+      </widget>
+     </item>
+     <item row="4" column="0">
+      <widget class="QLabel" name="textLabel1">
+       <property name="text">
+        <string>Environment Variables:</string>
+       </property>
+       <property name="buddy">
+        <cstring>environmentCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="4" column="1">
       <widget class="QComboBox" name="environmentCombo">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -98,66 +188,6 @@
        </property>
       </widget>
      </item>
-     <item row="2" column="1">
-      <widget class="EricComboPathPicker" name="workdirPicker" native="true">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="focusPolicy">
-        <enum>Qt::WheelFocus</enum>
-       </property>
-       <property name="toolTip">
-        <string>Enter the working directory</string>
-       </property>
-       <property name="whatsThis">
-        <string>&lt;b&gt;Working directory&lt;/b&gt;
-&lt;p&gt;Enter the working directory of the application to be debugged. Leave it empty to set the working directory to the executable directory.&lt;/p&gt;</string>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="1">
-      <widget class="QComboBox" name="venvComboBox">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="toolTip">
-        <string>Select the virtual environment to be used</string>
-       </property>
-       <property name="whatsThis">
-        <string>&lt;b&gt;Virtual Environment&lt;/b&gt;
-&lt;p&gt;Enter the virtual environment to be used. Leave it empty to use the default environment, i.e. the one configured globally or per project.&lt;/p&gt;</string>
-       </property>
-       <property name="sizeAdjustPolicy">
-        <enum>QComboBox::AdjustToContentsOnFirstShow</enum>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="0">
-      <widget class="QLabel" name="label">
-       <property name="text">
-        <string>Virtual Environment:</string>
-       </property>
-       <property name="buddy">
-        <cstring>venvComboBox</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="3" column="0">
-      <widget class="QLabel" name="textLabel1">
-       <property name="text">
-        <string>Environment Variables:</string>
-       </property>
-       <property name="buddy">
-        <cstring>environmentCombo</cstring>
-       </property>
-      </widget>
-     </item>
     </layout>
    </item>
    <item>
@@ -279,6 +309,7 @@
  </customwidgets>
  <tabstops>
   <tabstop>venvComboBox</tabstop>
+  <tabstop>scriptnamePicker</tabstop>
   <tabstop>cmdlineCombo</tabstop>
   <tabstop>workdirPicker</tabstop>
   <tabstop>environmentCombo</tabstop>
--- a/eric7/Debugger/StartDebugDialog.ui	Sat Aug 21 14:21:44 2021 +0200
+++ b/eric7/Debugger/StartDebugDialog.ui	Sun Aug 22 19:59:18 2021 +0200
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>550</width>
-    <height>410</height>
+    <height>434</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -18,7 +18,7 @@
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_2">
    <item>
-    <layout class="QGridLayout" name="gridLayout_3">
+    <layout class="QGridLayout" name="gridLayout_2">
      <item row="0" column="0">
       <widget class="QLabel" name="label">
        <property name="text">
@@ -47,6 +47,36 @@
       </widget>
      </item>
      <item row="1" column="0">
+      <widget class="QLabel" name="TextLabel1_3">
+       <property name="text">
+        <string>Script Name:</string>
+       </property>
+       <property name="buddy">
+        <cstring>cmdlineCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="1">
+      <widget class="EricComboPathPicker" name="scriptnamePicker" native="true">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="focusPolicy">
+        <enum>Qt::WheelFocus</enum>
+       </property>
+       <property name="toolTip">
+        <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter the script file name&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+       </property>
+       <property name="whatsThis">
+        <string>&lt;b&gt;Script Name&lt;/b&gt;
+&lt;p&gt;Enter the the name of the script. Leave empty to use the script of the current editor.&lt;/p&gt;</string>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="0">
       <widget class="QLabel" name="TextLabel1">
        <property name="text">
         <string>Script Parameters:</string>
@@ -56,7 +86,7 @@
        </property>
       </widget>
      </item>
-     <item row="1" column="1">
+     <item row="2" column="1">
       <widget class="QComboBox" name="cmdlineCombo">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -85,7 +115,7 @@
        </property>
       </widget>
      </item>
-     <item row="2" column="0">
+     <item row="3" column="0">
       <widget class="QLabel" name="TextLabel2">
        <property name="text">
         <string>Working directory:</string>
@@ -95,7 +125,7 @@
        </property>
       </widget>
      </item>
-     <item row="2" column="1">
+     <item row="3" column="1">
       <widget class="EricComboPathPicker" name="workdirPicker" native="true">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -115,7 +145,7 @@
        </property>
       </widget>
      </item>
-     <item row="3" column="0">
+     <item row="4" column="0">
       <widget class="QLabel" name="textLabel1">
        <property name="text">
         <string>Environment Variables:</string>
@@ -125,7 +155,7 @@
        </property>
       </widget>
      </item>
-     <item row="3" column="1">
+     <item row="4" column="1">
       <widget class="QComboBox" name="environmentCombo">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -344,6 +374,7 @@
  </customwidgets>
  <tabstops>
   <tabstop>venvComboBox</tabstop>
+  <tabstop>scriptnamePicker</tabstop>
   <tabstop>cmdlineCombo</tabstop>
   <tabstop>workdirPicker</tabstop>
   <tabstop>environmentCombo</tabstop>
--- a/eric7/Debugger/StartDialog.py	Sat Aug 21 14:21:44 2021 +0200
+++ b/eric7/Debugger/StartDialog.py	Sun Aug 22 19:59:18 2021 +0200
@@ -31,7 +31,8 @@
                  parent=None, dialogType=0, modfuncList=None,
                  tracePython=False, autoClearShell=True, autoContinue=True,
                  enableMultiprocess=False, multiprocessNoDebugHistory=None,
-                 configOverride=None):
+                 configOverride=None,
+                 forProject=False, lastUsedScriptName="", scriptsList=None):
         """
         Constructor
         
@@ -78,6 +79,13 @@
         @param configOverride dictionary containing the global config override
             data
         @type dict
+        @param forProject flag indicating to get the parameters for a
+            run/debug/... action for a project
+        @type bool
+        @param lastUsedScriptName name of the most recently used script
+        @type str
+        @param scriptsList history list of script names
+        @type list of str
         """
         super().__init__(parent)
         self.setModal(True)
@@ -102,6 +110,20 @@
             sorted(ericApp().getObject("VirtualEnvManager")
                    .getVirtualenvNames()))
         
+        self.ui.scriptnamePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
+        self.ui.scriptnamePicker.setDefaultDirectory(
+            Preferences.getMultiProject("Workspace"))
+        self.ui.scriptnamePicker.setInsertPolicy(
+            QComboBox.InsertPolicy.InsertAtTop)
+        self.ui.scriptnamePicker.setSizeAdjustPolicy(
+            QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
+        self.ui.scriptnamePicker.setFilters(self.tr(
+            "Python Files (*.py *.py3);;"
+            "Python GUI Files (*.pyw *.pyw3);;"
+            "All Files (*)"
+        ))
+        self.ui.scriptnamePicker.setEnabled(not forProject)
+        
         self.ui.workdirPicker.setMode(EricPathPickerModes.DIRECTORY_MODE)
         self.ui.workdirPicker.setDefaultDirectory(
             Preferences.getMultiProject("Workspace"))
@@ -110,6 +132,7 @@
         self.ui.workdirPicker.setSizeAdjustPolicy(
             QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
         
+        # TODO: extend these History actions
         self.clearButton = self.ui.buttonBox.addButton(
             self.tr("Clear Histories"), QDialogButtonBox.ButtonRole.ActionRole)
         self.editButton = self.ui.buttonBox.addButton(
--- a/eric7/Debugger/StartProfileDialog.ui	Sat Aug 21 14:21:44 2021 +0200
+++ b/eric7/Debugger/StartProfileDialog.ui	Sun Aug 22 19:59:18 2021 +0200
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>550</width>
-    <height>303</height>
+    <height>327</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -18,7 +18,7 @@
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_2">
    <item>
-    <layout class="QGridLayout" name="gridLayout_3">
+    <layout class="QGridLayout" name="gridLayout">
      <item row="0" column="0">
       <widget class="QLabel" name="label">
        <property name="text">
@@ -47,6 +47,36 @@
       </widget>
      </item>
      <item row="1" column="0">
+      <widget class="QLabel" name="TextLabel1_2">
+       <property name="text">
+        <string>Script Name:</string>
+       </property>
+       <property name="buddy">
+        <cstring>cmdlineCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="1">
+      <widget class="EricComboPathPicker" name="scriptnamePicker" native="true">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="focusPolicy">
+        <enum>Qt::WheelFocus</enum>
+       </property>
+       <property name="toolTip">
+        <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter the script file name&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+       </property>
+       <property name="whatsThis">
+        <string>&lt;b&gt;Script Name&lt;/b&gt;
+&lt;p&gt;Enter the the name of the script. Leave empty to use the script of the current editor.&lt;/p&gt;</string>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="0">
       <widget class="QLabel" name="TextLabel1">
        <property name="text">
         <string>Script Parameters:</string>
@@ -56,7 +86,7 @@
        </property>
       </widget>
      </item>
-     <item row="1" column="1">
+     <item row="2" column="1">
       <widget class="QComboBox" name="cmdlineCombo">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -85,7 +115,7 @@
        </property>
       </widget>
      </item>
-     <item row="2" column="0">
+     <item row="3" column="0">
       <widget class="QLabel" name="TextLabel2">
        <property name="text">
         <string>Working directory:</string>
@@ -95,7 +125,7 @@
        </property>
       </widget>
      </item>
-     <item row="2" column="1">
+     <item row="3" column="1">
       <widget class="EricComboPathPicker" name="workdirPicker" native="true">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -115,7 +145,7 @@
        </property>
       </widget>
      </item>
-     <item row="3" column="0">
+     <item row="4" column="0">
       <widget class="QLabel" name="textLabel1">
        <property name="text">
         <string>Environment Variables:</string>
@@ -125,7 +155,7 @@
        </property>
       </widget>
      </item>
-     <item row="3" column="1">
+     <item row="4" column="1">
       <widget class="QComboBox" name="environmentCombo">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -276,6 +306,7 @@
  </customwidgets>
  <tabstops>
   <tabstop>venvComboBox</tabstop>
+  <tabstop>scriptnamePicker</tabstop>
   <tabstop>cmdlineCombo</tabstop>
   <tabstop>workdirPicker</tabstop>
   <tabstop>environmentCombo</tabstop>
--- a/eric7/Debugger/StartRunDialog.ui	Sat Aug 21 14:21:44 2021 +0200
+++ b/eric7/Debugger/StartRunDialog.ui	Sun Aug 22 19:59:18 2021 +0200
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>550</width>
-    <height>303</height>
+    <height>327</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -47,6 +47,36 @@
       </widget>
      </item>
      <item row="1" column="0">
+      <widget class="QLabel" name="TextLabel1_2">
+       <property name="text">
+        <string>Script Name:</string>
+       </property>
+       <property name="buddy">
+        <cstring>cmdlineCombo</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="1">
+      <widget class="EricComboPathPicker" name="scriptnamePicker" native="true">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="focusPolicy">
+        <enum>Qt::WheelFocus</enum>
+       </property>
+       <property name="toolTip">
+        <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter the script file name&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+       </property>
+       <property name="whatsThis">
+        <string>&lt;b&gt;Script Name&lt;/b&gt;
+&lt;p&gt;Enter the the name of the script. Leave empty to use the script of the current editor.&lt;/p&gt;</string>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="0">
       <widget class="QLabel" name="TextLabel1">
        <property name="text">
         <string>Script Parameters:</string>
@@ -56,7 +86,7 @@
        </property>
       </widget>
      </item>
-     <item row="1" column="1">
+     <item row="2" column="1">
       <widget class="QComboBox" name="cmdlineCombo">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -85,7 +115,7 @@
        </property>
       </widget>
      </item>
-     <item row="2" column="0">
+     <item row="3" column="0">
       <widget class="QLabel" name="TextLabel2">
        <property name="text">
         <string>Working directory:</string>
@@ -95,7 +125,7 @@
        </property>
       </widget>
      </item>
-     <item row="2" column="1">
+     <item row="3" column="1">
       <widget class="EricComboPathPicker" name="workdirPicker" native="true">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -115,7 +145,7 @@
        </property>
       </widget>
      </item>
-     <item row="3" column="0">
+     <item row="4" column="0">
       <widget class="QLabel" name="textLabel1">
        <property name="text">
         <string>Environment Variables:</string>
@@ -125,7 +155,7 @@
        </property>
       </widget>
      </item>
-     <item row="3" column="1">
+     <item row="4" column="1">
       <widget class="QComboBox" name="environmentCombo">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -259,6 +289,7 @@
  </customwidgets>
  <tabstops>
   <tabstop>venvComboBox</tabstop>
+  <tabstop>scriptnamePicker</tabstop>
   <tabstop>cmdlineCombo</tabstop>
   <tabstop>workdirPicker</tabstop>
   <tabstop>environmentCombo</tabstop>

eric ide

mercurial