Debugger/EditBreakpointDialog.py

changeset 4579
3b54b95afc47
parent 4021
195a471c327b
child 4631
5c1a96925da4
equal deleted inserted replaced
4578:5d611151cdec 4579:3b54b95afc47
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 import os.path 12 import os.path
13 13
14 from PyQt5.QtCore import pyqtSlot
15 from PyQt5.QtWidgets import QDialog, QDialogButtonBox 14 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
16 15
17 from E5Gui.E5Completers import E5FileCompleter 16 from E5Gui.E5PathPicker import E5PathPickerModes
18 from E5Gui import E5FileDialog
19 17
20 from .Ui_EditBreakpointDialog import Ui_EditBreakpointDialog 18 from .Ui_EditBreakpointDialog import Ui_EditBreakpointDialog
21
22 import Utilities
23 import UI.PixmapCache
24 19
25 20
26 class EditBreakpointDialog(QDialog, Ui_EditBreakpointDialog): 21 class EditBreakpointDialog(QDialog, Ui_EditBreakpointDialog):
27 """ 22 """
28 Class implementing a dialog to edit breakpoint properties. 23 Class implementing a dialog to edit breakpoint properties.
48 self.setupUi(self) 43 self.setupUi(self)
49 if name: 44 if name:
50 self.setObjectName(name) 45 self.setObjectName(name)
51 self.setModal(modal) 46 self.setModal(modal)
52 47
53 self.fileButton.setIcon(UI.PixmapCache.getIcon("open.png")) 48 self.filenamePicker.setMode(E5PathPickerModes.OpenFileMode)
54 49
55 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) 50 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok)
56 self.filenameCompleter = E5FileCompleter(self.filenameCombo)
57 51
58 fn, lineno = id 52 fn, lineno = id
59 53
60 if not addMode: 54 if not addMode:
61 cond, temp, enabled, count = properties 55 cond, temp, enabled, count = properties
62 56
63 # set the filename 57 # set the filename
64 if fn is not None: 58 if fn is not None:
65 self.filenameCombo.setEditText(fn) 59 self.filenamePicker.setEditText(fn)
66 60
67 # set the line number 61 # set the line number
68 self.linenoSpinBox.setValue(lineno) 62 self.linenoSpinBox.setValue(lineno)
69 63
70 # set the condition 64 # set the condition
83 77
84 # set the checkboxes 78 # set the checkboxes
85 self.temporaryCheckBox.setChecked(temp) 79 self.temporaryCheckBox.setChecked(temp)
86 self.enabledCheckBox.setChecked(enabled) 80 self.enabledCheckBox.setChecked(enabled)
87 81
88 self.filenameCombo.setEnabled(False) 82 self.filenamePicker.setEnabled(False)
89 self.fileButton.setEnabled(False)
90 self.linenoSpinBox.setEnabled(False) 83 self.linenoSpinBox.setEnabled(False)
91 self.conditionCombo.setFocus() 84 self.conditionCombo.setFocus()
92 else: 85 else:
93 self.setWindowTitle(self.tr("Add Breakpoint")) 86 self.setWindowTitle(self.tr("Add Breakpoint"))
94 # set the filename 87 # set the filename
97 try: 90 try:
98 curr = filenameHistory.index(fn) 91 curr = filenameHistory.index(fn)
99 except ValueError: 92 except ValueError:
100 filenameHistory.insert(0, fn) 93 filenameHistory.insert(0, fn)
101 curr = 0 94 curr = 0
102 self.filenameCombo.addItems(filenameHistory) 95 self.filenamePicker.addItems(filenameHistory)
103 self.filenameCombo.setCurrentIndex(curr) 96 self.filenamePicker.setCurrentIndex(curr)
104 97
105 # set the condition 98 # set the condition
106 cond = '' 99 cond = ''
107 try: 100 try:
108 curr = condHistory.index(cond) 101 curr = condHistory.index(cond)
116 self.okButton.setEnabled(False) 109 self.okButton.setEnabled(False)
117 110
118 msh = self.minimumSizeHint() 111 msh = self.minimumSizeHint()
119 self.resize(max(self.width(), msh.width()), msh.height()) 112 self.resize(max(self.width(), msh.width()), msh.height())
120 113
121 @pyqtSlot() 114 def on_filenamePicker_editTextChanged(self, fn):
122 def on_fileButton_clicked(self):
123 """
124 Private slot to select a file via a file selection dialog.
125 """
126 file = E5FileDialog.getOpenFileName(
127 self,
128 self.tr("Select filename of the breakpoint"),
129 self.filenameCombo.currentText(),
130 "")
131
132 if file:
133 self.filenameCombo.setEditText(Utilities.toNativeSeparators(file))
134
135 def on_filenameCombo_editTextChanged(self, fn):
136 """ 115 """
137 Private slot to handle the change of the filename. 116 Private slot to handle the change of the filename.
138 117
139 @param fn text of the filename edit (string) 118 @param fn text of the filename edit (string)
140 """ 119 """
160 139
161 @return a tuple containing the new breakpoints properties 140 @return a tuple containing the new breakpoints properties
162 (filename, lineno, condition, temporary flag, enabled flag, 141 (filename, lineno, condition, temporary flag, enabled flag,
163 ignore count) 142 ignore count)
164 """ 143 """
165 fn = self.filenameCombo.currentText() 144 fn = self.filenamePicker.currentText()
166 if not fn: 145 if not fn:
167 fn = None 146 fn = None
168 else: 147 else:
169 fn = os.path.expanduser(os.path.expandvars(fn)) 148 fn = os.path.expanduser(os.path.expandvars(fn))
170 149

eric ide

mercurial