eric6/Debugger/BreakPointModel.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 8077
1fd8f611f26a
child 8142
43248bafe9b2
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7882
diff changeset
3 # Copyright (c) 2006 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the Breakpoint model.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
8009
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
10 import copy
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
11
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
12 from PyQt5.QtCore import pyqtSignal, Qt, QAbstractItemModel, QModelIndex
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
14
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 class BreakPointModel(QAbstractItemModel):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 Class implementing a custom model for breakpoints.
5726
e1dbd217214a Fixed a few source docu issues (forgotten signals and exceptions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5656
diff changeset
18
e1dbd217214a Fixed a few source docu issues (forgotten signals and exceptions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5656
diff changeset
19 @signal dataAboutToBeChanged(QModelIndex, QModelIndex) emitted to indicate
e1dbd217214a Fixed a few source docu issues (forgotten signals and exceptions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5656
diff changeset
20 a change of the data
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 """
460
6a3899e91d76 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
22 dataAboutToBeChanged = pyqtSignal(QModelIndex, QModelIndex)
6a3899e91d76 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
23
8077
1fd8f611f26a Debug Viewer:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8009
diff changeset
24 def __init__(self, project, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
8077
1fd8f611f26a Debug Viewer:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8009
diff changeset
28 @param project reference to the project object
1fd8f611f26a Debug Viewer:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8009
diff changeset
29 @type Project
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
30 @param parent reference to the parent widget
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
31 @type QObject
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
33 super(BreakPointModel, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
8077
1fd8f611f26a Debug Viewer:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8009
diff changeset
35 self.__project = project
1fd8f611f26a Debug Viewer:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8009
diff changeset
36
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.breakpoints = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.header = [
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
39 self.tr("Filename"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
40 self.tr("Line"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
41 self.tr('Condition'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
42 self.tr('Temporary'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
43 self.tr('Enabled'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
44 self.tr('Ignore Count'),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 ]
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
46 self.alignments = [Qt.Alignment(Qt.AlignLeft),
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
47 Qt.Alignment(Qt.AlignRight),
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
48 Qt.Alignment(Qt.AlignLeft),
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
49 Qt.Alignment(Qt.AlignHCenter),
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
50 Qt.Alignment(Qt.AlignHCenter),
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
51 Qt.Alignment(Qt.AlignRight),
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
52 Qt.Alignment(Qt.AlignHCenter),
3032
927a2f8b3669 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
53 ]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54
5656
9c21b2746218 Fixed a few code style issues related to the usage of class instances for default arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
55 def columnCount(self, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 Public method to get the current column count.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
59 @param parent reference to parent index (Unused)
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
60 @type QModelIndex
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
61 @return column count
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
62 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 """
531
26efb720a299 Change the appearance of the breakpoint and watchpoint viewers (via the models).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 460
diff changeset
64 return len(self.header)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
5656
9c21b2746218 Fixed a few code style issues related to the usage of class instances for default arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
66 def rowCount(self, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 Public method to get the current row count.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
70 @param parent reference to parent index
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
71 @type QModelIndex
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
72 @return row count
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
73 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 # we do not have a tree, parent should always be invalid
5656
9c21b2746218 Fixed a few code style issues related to the usage of class instances for default arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
76 if parent is None or not parent.isValid():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 return len(self.breakpoints)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 return 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
1928
adde55ed4ce5 Fixed the breakpoint performance issue properly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1758
diff changeset
81 def data(self, index, role=Qt.DisplayRole):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 Public method to get the requested data.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
85 @param index index of the requested data
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
86 @type QModelIndex
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
87 @param role role of the requested data
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
88 @type Qt.ItemDataRole
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
89 @return the requested data
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
90 @rtype any
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 if not index.isValid():
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
93 return None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94
531
26efb720a299 Change the appearance of the breakpoint and watchpoint viewers (via the models).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 460
diff changeset
95 if role == Qt.DisplayRole:
8077
1fd8f611f26a Debug Viewer:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8009
diff changeset
96 if index.column() == 0:
1fd8f611f26a Debug Viewer:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8009
diff changeset
97 filename = self.breakpoints[index.row()][0]
1fd8f611f26a Debug Viewer:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8009
diff changeset
98 if self.__project.isOpen():
1fd8f611f26a Debug Viewer:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8009
diff changeset
99 return self.__project.getRelativePath(filename)
1fd8f611f26a Debug Viewer:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8009
diff changeset
100 else:
1fd8f611f26a Debug Viewer:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8009
diff changeset
101 return filename
1fd8f611f26a Debug Viewer:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8009
diff changeset
102 elif index.column() in (1, 2, 5):
531
26efb720a299 Change the appearance of the breakpoint and watchpoint viewers (via the models).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 460
diff changeset
103 return self.breakpoints[index.row()][index.column()]
26efb720a299 Change the appearance of the breakpoint and watchpoint viewers (via the models).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 460
diff changeset
104
26efb720a299 Change the appearance of the breakpoint and watchpoint viewers (via the models).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 460
diff changeset
105 if role == Qt.CheckStateRole:
8077
1fd8f611f26a Debug Viewer:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8009
diff changeset
106 if index.column() in (3, 4):
531
26efb720a299 Change the appearance of the breakpoint and watchpoint viewers (via the models).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 460
diff changeset
107 return self.breakpoints[index.row()][index.column()]
26efb720a299 Change the appearance of the breakpoint and watchpoint viewers (via the models).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 460
diff changeset
108
26efb720a299 Change the appearance of the breakpoint and watchpoint viewers (via the models).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 460
diff changeset
109 if role == Qt.ToolTipRole:
8077
1fd8f611f26a Debug Viewer:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8009
diff changeset
110 if index.column() in (0, 2):
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
111 return self.breakpoints[index.row()][index.column()]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 if role == Qt.TextAlignmentRole:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 if index.column() < len(self.alignments):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 return self.alignments[index.column()]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
117 return None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118
1928
adde55ed4ce5 Fixed the breakpoint performance issue properly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1758
diff changeset
119 def setData(self, index, value, role=Qt.EditRole):
adde55ed4ce5 Fixed the breakpoint performance issue properly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1758
diff changeset
120 """
adde55ed4ce5 Fixed the breakpoint performance issue properly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1758
diff changeset
121 Public method to change data in the model.
adde55ed4ce5 Fixed the breakpoint performance issue properly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1758
diff changeset
122
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
123 @param index index of the changed data
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
124 @type QModelIndex
1928
adde55ed4ce5 Fixed the breakpoint performance issue properly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1758
diff changeset
125 @param value value of the changed data
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
126 @type any
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
127 @param role role of the changed data
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
128 @type Qt.ItemDataRole
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
129 @return flag indicating success
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
130 @rtype bool
1928
adde55ed4ce5 Fixed the breakpoint performance issue properly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1758
diff changeset
131 """
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
132 if (not index.isValid() or
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
133 index.column() >= len(self.header) or
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
134 index.row() >= len(self.breakpoints)):
1928
adde55ed4ce5 Fixed the breakpoint performance issue properly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1758
diff changeset
135 return False
adde55ed4ce5 Fixed the breakpoint performance issue properly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1758
diff changeset
136
adde55ed4ce5 Fixed the breakpoint performance issue properly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1758
diff changeset
137 self.dataAboutToBeChanged.emit(index, index)
adde55ed4ce5 Fixed the breakpoint performance issue properly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1758
diff changeset
138 self.breakpoints[index.row()][index.column()] = value
2126
3744863a534e Reverted the dataChanged signal change due to corrections in PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2081
diff changeset
139 self.dataChanged.emit(index, index)
1928
adde55ed4ce5 Fixed the breakpoint performance issue properly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1758
diff changeset
140 return True
adde55ed4ce5 Fixed the breakpoint performance issue properly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1758
diff changeset
141
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 def flags(self, index):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 Public method to get item flags.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
146 @param index index of the requested flags
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
147 @type QModelIndex
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
148 @return item flags for the given index
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
149 @rtype Qt.ItemFlags
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 if not index.isValid():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 return Qt.ItemIsEnabled
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 return Qt.ItemIsEnabled | Qt.ItemIsSelectable
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
156 def headerData(self, section, orientation, role=Qt.DisplayRole):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 Public method to get header data.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
160 @param section section number of the requested header data
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
161 @type int
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
162 @param orientation orientation of the header
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
163 @type Qt.Orientation
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
164 @param role role of the requested data
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
165 @type Qt.ItemDataRole
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
166 @return header data
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
167 @rtype str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 if orientation == Qt.Horizontal and role == Qt.DisplayRole:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 if section >= len(self.header):
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
171 return ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 return self.header[section]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
175 return None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176
5656
9c21b2746218 Fixed a few code style issues related to the usage of class instances for default arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
177 def index(self, row, column, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 Public method to create an index.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
181 @param row row number for the index
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
182 @type int
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
183 @param column column number for the index
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
184 @type int
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
185 @param parent index of the parent item
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
186 @type QModelIndex
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
187 @return requested index
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
188 @rtype QModelIndex
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 """
7251
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
190 if ((parent and parent.isValid()) or
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
191 row < 0 or row >= len(self.breakpoints) or
bc5b1b00560a Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
192 column < 0 or column >= len(self.header)):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 return QModelIndex()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 return self.createIndex(row, column, self.breakpoints[row])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 def parent(self, index):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 Public method to get the parent index.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
201 @param index index of item to get parent
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
202 @type QModelIndex
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
203 @return index of parent
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
204 @rtype QModelIndex
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 return QModelIndex()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207
5656
9c21b2746218 Fixed a few code style issues related to the usage of class instances for default arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
208 def hasChildren(self, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 Public method to check for the presence of child items.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
212 @param parent index of parent item
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
213 @type QModelIndex
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
214 @return flag indicating the presence of child items
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
215 @rtype bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 """
5656
9c21b2746218 Fixed a few code style issues related to the usage of class instances for default arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
217 if parent is None or not parent.isValid():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 return len(self.breakpoints) > 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
222 ###########################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 def addBreakPoint(self, fn, line, properties):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 Public method to add a new breakpoint to the list.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
228 @param fn filename of the breakpoint
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
229 @type str
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
230 @param line line number of the breakpoint
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
231 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 @param properties properties of the breakpoint
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
233 (tuple of condition, temporary flag, enabled flag, ignore count)
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
234 @type tuple of (str, bool, bool, int)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 bp = [fn, line] + list(properties)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 cnt = len(self.breakpoints)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 self.beginInsertRows(QModelIndex(), cnt, cnt)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 self.breakpoints.append(bp)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 self.endInsertRows()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241
8009
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
242 def addBreakPoints(self, breakpoints):
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
243 """
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
244 Public method to add multiple breakpoints to the list.
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
245
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
246 @param breakpoints list of breakpoints with file name, line number,
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
247 condition, temporary flag, enabled flag and ignore count each
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
248 @type list of (str, int, str, bool, bool, int)
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
249 """
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
250 cnt = len(self.breakpoints)
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
251 self.beginInsertRows(QModelIndex(), cnt, cnt + len(breakpoints) - 1)
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
252 self.breakpoints += breakpoints
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
253 self.endInsertRows()
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
254
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 def setBreakPointByIndex(self, index, fn, line, properties):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 Public method to set the values of a breakpoint given by index.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
259 @param index index of the breakpoint
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
260 @type QModelIndex
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
261 @param fn filename of the breakpoint
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
262 @type str
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
263 @param line line number of the breakpoint
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
264 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 @param properties properties of the breakpoint
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
266 (tuple of condition, temporary flag, enabled flag, ignore count)
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
267 @type tuple of (str, bool, bool, int)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 if index.isValid():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 row = index.row()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 index1 = self.createIndex(row, 0, self.breakpoints[row])
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2988
diff changeset
272 index2 = self.createIndex(
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2988
diff changeset
273 row, len(self.breakpoints[row]), self.breakpoints[row])
460
6a3899e91d76 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
274 self.dataAboutToBeChanged.emit(index1, index2)
1758
e18f96b1714b A few optimizations and a fix for a bug, that caused incorrect display of breakpoints in the editor margin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
275 self.breakpoints[row] = [fn, line] + list(properties)
2126
3744863a534e Reverted the dataChanged signal change due to corrections in PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2081
diff changeset
276 self.dataChanged.emit(index1, index2)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 def setBreakPointEnabledByIndex(self, index, enabled):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 Public method to set the enabled state of a breakpoint given by index.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
282 @param index index of the breakpoint
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
283 @type QModelIndex
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
284 @param enabled flag giving the enabled state
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
285 @type bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 if index.isValid():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 row = index.row()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 col = 4
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 index1 = self.createIndex(row, col, self.breakpoints[row])
460
6a3899e91d76 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
291 self.dataAboutToBeChanged.emit(index1, index1)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 self.breakpoints[row][col] = enabled
2126
3744863a534e Reverted the dataChanged signal change due to corrections in PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2081
diff changeset
293 self.dataChanged.emit(index1, index1)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 def deleteBreakPointByIndex(self, index):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 Public method to set the values of a breakpoint given by index.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
299 @param index index of the breakpoint
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
300 @type QModelIndex
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 if index.isValid():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 row = index.row()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 self.beginRemoveRows(QModelIndex(), row, row)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 del self.breakpoints[row]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 self.endRemoveRows()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 def deleteBreakPoints(self, idxList):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 Public method to delete a list of breakpoints given by their indexes.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
312 @param idxList list of breakpoint indexes
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
313 @type list of QModelIndex
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 rows = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 for index in idxList:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 if index.isValid():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 rows.append(index.row())
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
319 rows.sort(reverse=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 for row in rows:
7025
83e110e3fcc6 BreakPointModel, WatchPointModel: fixed a potential issue deleting breakpoints/watchpoints.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
321 if row < len(self.breakpoints):
83e110e3fcc6 BreakPointModel, WatchPointModel: fixed a potential issue deleting breakpoints/watchpoints.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
322 self.beginRemoveRows(QModelIndex(), row, row)
83e110e3fcc6 BreakPointModel, WatchPointModel: fixed a potential issue deleting breakpoints/watchpoints.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
323 del self.breakpoints[row]
83e110e3fcc6 BreakPointModel, WatchPointModel: fixed a potential issue deleting breakpoints/watchpoints.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
324 self.endRemoveRows()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 def deleteAll(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 Public method to delete all breakpoints.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 if self.breakpoints:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 self.beginRemoveRows(QModelIndex(), 0, len(self.breakpoints) - 1)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 self.breakpoints = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 self.endRemoveRows()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 def getBreakPointByIndex(self, index):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 Public method to get the values of a breakpoint given by index.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
339 @param index index of the breakpoint
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
340 @type QModelIndex
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
341 @return breakpoint (list of six values (filename, line number,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 condition, temporary flag, enabled flag, ignore count))
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
343 @rtype list of (str, int, str, bool, bool, int)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 if index.isValid():
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
346 return self.breakpoints[index.row()][:] # return a copy
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 return []
8009
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
349
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
350 def getAllBreakpoints(self):
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
351 """
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
352 Public method to get a copy of the breakpoints.
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
353
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
354 @return list of breakpoints
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
355 @rtype list of list of [str, int, str, bool, bool, int]
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
356 """
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
357 return copy.deepcopy(self.breakpoints)
29818ac4853c Implemented the JSON based session files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
358
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 def getBreakPointIndex(self, fn, lineno):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360 """
2988
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
361 Public method to get the index of a breakpoint given by filename and
f53c03574697 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
362 line number.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
364 @param fn filename of the breakpoint
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
365 @type str
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
366 @param lineno line number of the breakpoint
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
367 @type int
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
368 @return index
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
369 @rtype QModelIndex
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 for row in range(len(self.breakpoints)):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 bp = self.breakpoints[row]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 if bp[0] == fn and bp[1] == lineno:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 return self.createIndex(row, 0, self.breakpoints[row])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 return QModelIndex()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 def isBreakPointTemporaryByIndex(self, index):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 """
2763
e4794166ad70 Fixed a serious typo.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
380 Public method to test, if a breakpoint given by its index is temporary.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381
7882
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
382 @param index index of the breakpoint to test
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
383 @type QModelIndex
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
384 @return flag indicating a temporary breakpoint
617cc27f11af Updated some source docu strings and added TODO markers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
385 @rtype bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
387 if index.isValid():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388 return self.breakpoints[index.row()][3]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 return False

eric ide

mercurial