eric6/Debugger/WatchPointViewer.py

changeset 7251
bc5b1b00560a
parent 7229
53054eb5b15a
child 7360
9190402e4505
equal deleted inserted replaced
7250:d8bdc55aee1a 7251:bc5b1b00560a
6 """ 6 """
7 Module implementing the watch expression viewer widget. 7 Module implementing the watch expression viewer widget.
8 """ 8 """
9 9
10 10
11 from PyQt5.QtCore import Qt, QModelIndex, QItemSelectionModel, \ 11 from PyQt5.QtCore import (
12 QSortFilterProxyModel 12 Qt, QModelIndex, QItemSelectionModel, QSortFilterProxyModel
13 from PyQt5.QtWidgets import QTreeView, QAbstractItemView, QMenu, QHeaderView, \ 13 )
14 QDialog 14 from PyQt5.QtWidgets import (
15 QTreeView, QAbstractItemView, QMenu, QHeaderView, QDialog
16 )
15 17
16 from E5Gui.E5Application import e5App 18 from E5Gui.E5Application import e5App
17 from E5Gui import E5MessageBox 19 from E5Gui import E5MessageBox
18 20
19 import Utilities 21 import Utilities
154 self.menu.addAction(self.tr("Configure..."), self.__configure) 156 self.menu.addAction(self.tr("Configure..."), self.__configure)
155 157
156 self.backMenuActions = {} 158 self.backMenuActions = {}
157 self.backMenu = QMenu() 159 self.backMenu = QMenu()
158 self.backMenu.addAction(self.tr("Add"), self.__addWatchPoint) 160 self.backMenu.addAction(self.tr("Add"), self.__addWatchPoint)
159 self.backMenuActions["EnableAll"] = \ 161 self.backMenuActions["EnableAll"] = self.backMenu.addAction(
160 self.backMenu.addAction(self.tr("Enable all"), 162 self.tr("Enable all"),
161 self.__enableAllWatchPoints) 163 self.__enableAllWatchPoints)
162 self.backMenuActions["DisableAll"] = \ 164 self.backMenuActions["DisableAll"] = self.backMenu.addAction(
163 self.backMenu.addAction(self.tr("Disable all"), 165 self.tr("Disable all"),
164 self.__disableAllWatchPoints) 166 self.__disableAllWatchPoints)
165 self.backMenuActions["DeleteAll"] = \ 167 self.backMenuActions["DeleteAll"] = self.backMenu.addAction(
166 self.backMenu.addAction(self.tr("Delete all"), 168 self.tr("Delete all"),
167 self.__deleteAllWatchPoints) 169 self.__deleteAllWatchPoints)
168 self.backMenu.addSeparator() 170 self.backMenu.addSeparator()
169 self.backMenu.addAction(self.tr("Configure..."), self.__configure) 171 self.backMenu.addAction(self.tr("Configure..."), self.__configure)
170 self.backMenu.aboutToShow.connect(self.__showBackMenu) 172 self.backMenu.aboutToShow.connect(self.__showBackMenu)
171 173
172 self.multiMenu = QMenu() 174 self.multiMenu = QMenu()
230 @return flag indicating a duplicate entry (boolean) 232 @return flag indicating a duplicate entry (boolean)
231 """ 233 """
232 if index is None: 234 if index is None:
233 index = QModelIndex() 235 index = QModelIndex()
234 idx = self.__model.getWatchPointIndex(cond, special) 236 idx = self.__model.getWatchPointIndex(cond, special)
235 duplicate = idx.isValid() and \ 237 duplicate = (idx.isValid() and
236 idx.internalPointer() != index.internalPointer() 238 idx.internalPointer() != index.internalPointer())
237 if showMessage and duplicate: 239 if showMessage and duplicate:
238 if not special: 240 if not special:
239 msg = self.tr("""<p>A watch expression '<b>{0}</b>'""" 241 msg = self.tr(
240 """ already exists.</p>""")\ 242 """<p>A watch expression '<b>{0}</b>'"""
241 .format(Utilities.html_encode(cond)) 243 """ already exists.</p>"""
244 ).format(Utilities.html_encode(cond))
242 else: 245 else:
243 msg = self.tr( 246 msg = self.tr(
244 """<p>A watch expression '<b>{0}</b>'""" 247 """<p>A watch expression '<b>{0}</b>'"""
245 """ for the variable <b>{1}</b> already exists.</p>""")\ 248 """ for the variable <b>{1}</b> already exists.</p>"""
246 .format(special, Utilities.html_encode(cond)) 249 ).format(special, Utilities.html_encode(cond))
247 E5MessageBox.warning( 250 E5MessageBox.warning(
248 self, 251 self,
249 self.tr("Watch expression already exists"), 252 self.tr("Watch expression already exists"),
250 msg) 253 msg)
251 254
436 439
437 def __configure(self): 440 def __configure(self):
438 """ 441 """
439 Private method to open the configuration dialog. 442 Private method to open the configuration dialog.
440 """ 443 """
441 e5App().getObject("UserInterface")\ 444 e5App().getObject("UserInterface").showPreferences(
442 .showPreferences("debuggerGeneralPage") 445 "debuggerGeneralPage")

eric ide

mercurial