src/eric7/DataViews/PyProfileDialog.py

branch
eric7
changeset 10423
299802979277
parent 10373
093dcebe5ecb
child 10439
21c28b0f9e41
equal deleted inserted replaced
10422:e28b89693f37 10423:299802979277
35 35
36 def __getNC(self, itm): 36 def __getNC(self, itm):
37 """ 37 """
38 Private method to get the value to compare on for the first column. 38 Private method to get the value to compare on for the first column.
39 39
40 @param itm item to operate on (ProfileTreeWidgetItem) 40 @param itm item to operate on
41 @return comparison value for the first column (integer) 41 @type ProfileTreeWidgetItem
42 @return comparison value for the first column
43 @rtype int
42 """ 44 """
43 s = itm.text(0) 45 s = itm.text(0)
44 return int(s.split("/")[0]) 46 return int(s.split("/")[0])
45 47
46 def __lt__(self, other): 48 def __lt__(self, other):
47 """ 49 """
48 Special method to check, if the item is less than the other one. 50 Special method to check, if the item is less than the other one.
49 51
50 @param other reference to item to compare against 52 @param other reference to item to compare against
51 (ProfileTreeWidgetItem) 53 @type ProfileTreeWidgetItem
52 @return true, if this item is less than other (boolean) 54 @return true, if this item is less than other
55 @rtype bool
53 """ 56 """
54 column = self.treeWidget().sortColumn() 57 column = self.treeWidget().sortColumn()
55 if column == 0: 58 if column == 0:
56 return self.__getNC(self) < self.__getNC(other) 59 return self.__getNC(self) < self.__getNC(other)
57 if column == 6: 60 if column == 6:
66 69
67 def __init__(self, parent=None): 70 def __init__(self, parent=None):
68 """ 71 """
69 Constructor 72 Constructor
70 73
71 @param parent parent widget (QWidget) 74 @param parent parent widget
75 @type QWidget
72 """ 76 """
73 super().__init__(parent) 77 super().__init__(parent)
74 self.setupUi(self) 78 self.setupUi(self)
75 self.setWindowFlags(Qt.WindowType.Window) 79 self.setWindowFlags(Qt.WindowType.Window)
76 80
112 functionName, 116 functionName,
113 ): 117 ):
114 """ 118 """
115 Private method to create an entry in the result list. 119 Private method to create an entry in the result list.
116 120
117 @param calls number of calls (integer) 121 @param calls number of calls
118 @param totalTime total time (double) 122 @type int
119 @param totalTimePerCall total time per call (double) 123 @param totalTime total time
120 @param cumulativeTime cumulative time (double) 124 @type float
121 @param cumulativeTimePerCall cumulative time per call (double) 125 @param totalTimePerCall total time per call
122 @param file filename of file (string) 126 @type float
123 @param line linenumber (integer) 127 @param cumulativeTime cumulative time
124 @param functionName function name (string) 128 @type float
129 @param cumulativeTimePerCall cumulative time per call
130 @type float
131 @param file filename of file
132 @type str
133 @param line linenumber
134 @type int
135 @param functionName function name
136 @type str
125 """ 137 """
126 itm = ProfileTreeWidgetItem( 138 itm = ProfileTreeWidgetItem(
127 self.resultList, 139 self.resultList,
128 [ 140 [
129 calls, 141 calls,
141 153
142 def __createSummaryItem(self, label, contents): 154 def __createSummaryItem(self, label, contents):
143 """ 155 """
144 Private method to create an entry in the summary list. 156 Private method to create an entry in the summary list.
145 157
146 @param label text of the first column (string) 158 @param label text of the first column
147 @param contents text of the second column (string) 159 @type str
160 @param contents text of the second column
161 @type str
148 """ 162 """
149 itm = QTreeWidgetItem(self.summaryList, [label, contents]) 163 itm = QTreeWidgetItem(self.summaryList, [label, contents])
150 itm.setTextAlignment(1, Qt.AlignmentFlag.AlignRight) 164 itm.setTextAlignment(1, Qt.AlignmentFlag.AlignRight)
151 165
152 def __resortResultList(self): 166 def __resortResultList(self):
161 """ 175 """
162 Private method used to populate the listviews. 176 Private method used to populate the listviews.
163 177
164 @param exclude flag indicating whether files residing in the 178 @param exclude flag indicating whether files residing in the
165 Python library should be excluded 179 Python library should be excluded
180 @type bool
166 """ 181 """
167 self.resultList.clear() 182 self.resultList.clear()
168 self.summaryList.clear() 183 self.summaryList.clear()
169 184
170 self.checkProgress.setMaximum(len(self.stats)) 185 self.checkProgress.setMaximum(len(self.stats))
240 255
241 def start(self, pfn, fn=None): 256 def start(self, pfn, fn=None):
242 """ 257 """
243 Public slot to start the calculation of the profile data. 258 Public slot to start the calculation of the profile data.
244 259
245 @param pfn basename of the profiling file (string) 260 @param pfn basename of the profiling file
246 @param fn file to display the profiling data for (string) 261 @type str
262 @param fn file to display the profiling data for
263 @type str
247 """ 264 """
248 self.basename = os.path.splitext(pfn)[0] 265 self.basename = os.path.splitext(pfn)[0]
249 266
250 fname = "{0}.profile".format(self.basename) 267 fname = "{0}.profile".format(self.basename)
251 if not os.path.exists(fname): 268 if not os.path.exists(fname):
316 333
317 def on_buttonBox_clicked(self, button): 334 def on_buttonBox_clicked(self, button):
318 """ 335 """
319 Private slot called by a button of the button box clicked. 336 Private slot called by a button of the button box clicked.
320 337
321 @param button button that was clicked (QAbstractButton) 338 @param button button that was clicked
339 @type QAbstractButton
322 """ 340 """
323 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close): 341 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close):
324 self.close() 342 self.close()
325 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel): 343 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel):
326 self.__finish() 344 self.__finish()
327 345
328 def __showContextMenu(self, coord): 346 def __showContextMenu(self, coord):
329 """ 347 """
330 Private slot to show the context menu of the listview. 348 Private slot to show the context menu of the listview.
331 349
332 @param coord the position of the mouse pointer (QPoint) 350 @param coord the position of the mouse pointer
351 @type QPoint
333 """ 352 """
334 self.__menu.popup(self.mapToGlobal(coord)) 353 self.__menu.popup(self.mapToGlobal(coord))
335 354
336 def __eraseProfile(self): 355 def __eraseProfile(self):
337 """ 356 """

eric ide

mercurial