Modified the edit breakpoint dialog to use the new combo path picker.

Fri, 27 Nov 2015 20:07:55 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 27 Nov 2015 20:07:55 +0100
changeset 4579
3b54b95afc47
parent 4578
5d611151cdec
child 4581
76999ca7bbf1

Modified the edit breakpoint dialog to use the new combo path picker.

Debugger/EditBreakpointDialog.py file | annotate | diff | comparison | revisions
Debugger/EditBreakpointDialog.ui file | annotate | diff | comparison | revisions
--- a/Debugger/EditBreakpointDialog.py	Fri Nov 27 20:07:22 2015 +0100
+++ b/Debugger/EditBreakpointDialog.py	Fri Nov 27 20:07:55 2015 +0100
@@ -11,17 +11,12 @@
 
 import os.path
 
-from PyQt5.QtCore import pyqtSlot
 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
 
-from E5Gui.E5Completers import E5FileCompleter
-from E5Gui import E5FileDialog
+from E5Gui.E5PathPicker import E5PathPickerModes
 
 from .Ui_EditBreakpointDialog import Ui_EditBreakpointDialog
 
-import Utilities
-import UI.PixmapCache
-
 
 class EditBreakpointDialog(QDialog, Ui_EditBreakpointDialog):
     """
@@ -50,10 +45,9 @@
             self.setObjectName(name)
         self.setModal(modal)
         
-        self.fileButton.setIcon(UI.PixmapCache.getIcon("open.png"))
+        self.filenamePicker.setMode(E5PathPickerModes.OpenFileMode)
         
         self.okButton = self.buttonBox.button(QDialogButtonBox.Ok)
-        self.filenameCompleter = E5FileCompleter(self.filenameCombo)
         
         fn, lineno = id
         
@@ -62,7 +56,7 @@
             
             # set the filename
             if fn is not None:
-                self.filenameCombo.setEditText(fn)
+                self.filenamePicker.setEditText(fn)
             
             # set the line number
             self.linenoSpinBox.setValue(lineno)
@@ -85,8 +79,7 @@
             self.temporaryCheckBox.setChecked(temp)
             self.enabledCheckBox.setChecked(enabled)
             
-            self.filenameCombo.setEnabled(False)
-            self.fileButton.setEnabled(False)
+            self.filenamePicker.setEnabled(False)
             self.linenoSpinBox.setEnabled(False)
             self.conditionCombo.setFocus()
         else:
@@ -99,8 +92,8 @@
             except ValueError:
                 filenameHistory.insert(0, fn)
                 curr = 0
-            self.filenameCombo.addItems(filenameHistory)
-            self.filenameCombo.setCurrentIndex(curr)
+            self.filenamePicker.addItems(filenameHistory)
+            self.filenamePicker.setCurrentIndex(curr)
             
             # set the condition
             cond = ''
@@ -118,21 +111,7 @@
         msh = self.minimumSizeHint()
         self.resize(max(self.width(), msh.width()), msh.height())
         
-    @pyqtSlot()
-    def on_fileButton_clicked(self):
-        """
-        Private slot to select a file via a file selection dialog.
-        """
-        file = E5FileDialog.getOpenFileName(
-            self,
-            self.tr("Select filename of the breakpoint"),
-            self.filenameCombo.currentText(),
-            "")
-            
-        if file:
-            self.filenameCombo.setEditText(Utilities.toNativeSeparators(file))
-        
-    def on_filenameCombo_editTextChanged(self, fn):
+    def on_filenamePicker_editTextChanged(self, fn):
         """
         Private slot to handle the change of the filename.
         
@@ -162,7 +141,7 @@
             (filename, lineno, condition, temporary flag, enabled flag,
             ignore count)
         """
-        fn = self.filenameCombo.currentText()
+        fn = self.filenamePicker.currentText()
         if not fn:
             fn = None
         else:
--- a/Debugger/EditBreakpointDialog.ui	Fri Nov 27 20:07:22 2015 +0100
+++ b/Debugger/EditBreakpointDialog.ui	Fri Nov 27 20:07:55 2015 +0100
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>428</width>
-    <height>229</height>
+    <height>207</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -16,92 +16,37 @@
   <property name="sizeGripEnabled">
    <bool>true</bool>
   </property>
-  <layout class="QGridLayout">
-   <item row="6" column="0" colspan="4">
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
-   <item row="5" column="0" colspan="4">
-    <widget class="QCheckBox" name="enabledCheckBox">
-     <property name="toolTip">
-      <string>Select, whether the breakpoint is enabled</string>
-     </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0">
+    <widget class="QLabel" name="textLabel1_2">
      <property name="text">
-      <string>Enabled</string>
-     </property>
-     <property name="checked">
-      <bool>true</bool>
+      <string>Filename:</string>
      </property>
     </widget>
    </item>
-   <item row="4" column="0" colspan="4">
-    <widget class="QCheckBox" name="temporaryCheckBox">
-     <property name="toolTip">
-      <string>Select whether this is a temporary breakpoint</string>
-     </property>
-     <property name="text">
-      <string>Temporary Breakpoint</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="1" colspan="3">
-    <widget class="QComboBox" name="filenameCombo">
-     <property name="toolTip">
-      <string>Enter the filename of the breakpoint</string>
-     </property>
-     <property name="editable">
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="1" colspan="3">
-    <widget class="QComboBox" name="conditionCombo">
+   <item row="0" column="1" colspan="2">
+    <widget class="E5ComboPathPicker" name="filenamePicker" native="true">
      <property name="sizePolicy">
-      <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+      <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
      </property>
-     <property name="toolTip">
-      <string>Enter or select a condition for the breakpoint</string>
+     <property name="focusPolicy">
+      <enum>Qt::WheelFocus</enum>
      </property>
-     <property name="editable">
-      <bool>true</bool>
+     <property name="toolTip">
+      <string>Enter the filename of the breakpoint</string>
      </property>
     </widget>
    </item>
-   <item row="3" column="1">
-    <widget class="QSpinBox" name="ignoreSpinBox">
-     <property name="toolTip">
-      <string>Enter an ignore count for the breakpoint</string>
-     </property>
-     <property name="maximum">
-      <number>9999</number>
+   <item row="1" column="0">
+    <widget class="QLabel" name="textLabel2_2">
+     <property name="text">
+      <string>Linenumber:</string>
      </property>
     </widget>
    </item>
-   <item row="3" column="2" colspan="2">
-    <spacer>
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="sizeType">
-      <enum>QSizePolicy::Expanding</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>250</width>
-       <height>20</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
    <item row="1" column="1">
     <widget class="QSpinBox" name="linenoSpinBox">
      <property name="toolTip">
@@ -131,20 +76,6 @@
      </property>
     </spacer>
    </item>
-   <item row="1" column="0">
-    <widget class="QLabel" name="textLabel2_2">
-     <property name="text">
-      <string>Linenumber:</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="0">
-    <widget class="QLabel" name="textLabel1_2">
-     <property name="text">
-      <string>Filename:</string>
-     </property>
-    </widget>
-   </item>
    <item row="2" column="0">
     <widget class="QLabel" name="textLabel1">
      <property name="text">
@@ -152,6 +83,22 @@
      </property>
     </widget>
    </item>
+   <item row="2" column="1" colspan="2">
+    <widget class="QComboBox" name="conditionCombo">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="toolTip">
+      <string>Enter or select a condition for the breakpoint</string>
+     </property>
+     <property name="editable">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
    <item row="3" column="0">
     <widget class="QLabel" name="textLabel2">
      <property name="text">
@@ -159,10 +106,62 @@
      </property>
     </widget>
    </item>
-   <item row="1" column="3">
-    <widget class="QToolButton" name="fileButton">
+   <item row="3" column="1">
+    <widget class="QSpinBox" name="ignoreSpinBox">
      <property name="toolTip">
-      <string>Press to open a file selection dialog</string>
+      <string>Enter an ignore count for the breakpoint</string>
+     </property>
+     <property name="maximum">
+      <number>9999</number>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="2">
+    <spacer>
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeType">
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>250</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="4" column="0" colspan="3">
+    <widget class="QCheckBox" name="temporaryCheckBox">
+     <property name="toolTip">
+      <string>Select whether this is a temporary breakpoint</string>
+     </property>
+     <property name="text">
+      <string>Temporary Breakpoint</string>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="0" colspan="3">
+    <widget class="QCheckBox" name="enabledCheckBox">
+     <property name="toolTip">
+      <string>Select, whether the breakpoint is enabled</string>
+     </property>
+     <property name="text">
+      <string>Enabled</string>
+     </property>
+     <property name="checked">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="6" column="0" colspan="3">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
      </property>
     </widget>
    </item>
@@ -170,10 +169,17 @@
  </widget>
  <layoutdefault spacing="6" margin="6"/>
  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>E5ComboPathPicker</class>
+   <extends>QWidget</extends>
+   <header>E5Gui/E5PathPicker.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
  <tabstops>
-  <tabstop>filenameCombo</tabstop>
+  <tabstop>filenamePicker</tabstop>
   <tabstop>linenoSpinBox</tabstop>
-  <tabstop>fileButton</tabstop>
   <tabstop>conditionCombo</tabstop>
   <tabstop>ignoreSpinBox</tabstop>
   <tabstop>temporaryCheckBox</tabstop>

eric ide

mercurial