13 |
13 |
14 from E5Gui.E5Application import e5App |
14 from E5Gui.E5Application import e5App |
15 |
15 |
16 from Ui_MatchesDialog import Ui_MatchesDialog |
16 from Ui_MatchesDialog import Ui_MatchesDialog |
17 |
17 |
|
18 |
18 class MatchesDialog(QDialog, Ui_MatchesDialog): |
19 class MatchesDialog(QDialog, Ui_MatchesDialog): |
19 """ |
20 """ |
20 Class implementing a dialog to show matching references/definitions. |
21 Class implementing a dialog to show matching references/definitions. |
21 """ |
22 """ |
22 def __init__(self, ui, showConfidence, parent = None, name = None): |
23 def __init__(self, ui, showConfidence, parent=None, name=None): |
23 """ |
24 """ |
24 Constructor |
25 Constructor |
25 |
26 |
26 @param ui reference to the UI object |
27 @param ui reference to the UI object |
27 @param showConfidence flag indicating the display of the |
28 @param showConfidence flag indicating the display of the |
28 confidence column (boolean) |
29 confidence column (boolean) |
29 @param parent parent of this dialog (QWidget) |
30 @param parent parent of this dialog (QWidget) |
30 @param name name of this dialog (string) |
31 @param name name of this dialog (string) |
31 """ |
32 """ |
32 QDialog.__init__(self, parent) |
33 QDialog.__init__(self, parent) |
45 |
46 |
46 def __resort(self): |
47 def __resort(self): |
47 """ |
48 """ |
48 Private method to resort the tree. |
49 Private method to resort the tree. |
49 """ |
50 """ |
50 self.matchesList.sortItems(self.matchesList.sortColumn(), |
51 self.matchesList.sortItems(self.matchesList.sortColumn(), |
51 self.matchesList.header().sortIndicatorOrder()) |
52 self.matchesList.header().sortIndicatorOrder()) |
52 |
53 |
53 def __resizeColumns(self): |
54 def __resizeColumns(self): |
54 """ |
55 """ |
55 Private method to resize the list columns. |
56 Private method to resize the list columns. |
68 |
69 |
69 def addEntry(self, resource, lineno, unsure=False): |
70 def addEntry(self, resource, lineno, unsure=False): |
70 """ |
71 """ |
71 Public slot to add an entry to the list. |
72 Public slot to add an entry to the list. |
72 |
73 |
73 @param resource reference to the resource object |
74 @param resource reference to the resource object |
74 (rope.base.resources.Resource) |
75 (rope.base.resources.Resource) |
75 @param lineno linenumber of the match (integer) |
76 @param lineno linenumber of the match (integer) |
76 @param unsure flag indicating an unsure match (boolean) |
77 @param unsure flag indicating an unsure match (boolean) |
77 """ |
78 """ |
78 if unsure: |
79 if unsure: |
79 conf = 50 |
80 conf = 50 |
80 else: |
81 else: |
81 conf = 100 |
82 conf = 100 |
82 itm = QTreeWidgetItem(self.matchesList, |
83 itm = QTreeWidgetItem(self.matchesList, |
83 [resource.real_path, |
84 [resource.real_path, |
84 " {0:5d}".format(lineno), |
85 " {0:5d}".format(lineno), |
85 " {0:5d}%".format(conf)]) |
86 " {0:5d}%".format(conf)]) |
86 itm.setTextAlignment(1, Qt.AlignRight) |
87 itm.setTextAlignment(1, Qt.AlignRight) |
87 itm.setTextAlignment(2, Qt.AlignRight) |
88 itm.setTextAlignment(2, Qt.AlignRight) |
88 self.__resort() |
89 self.__resort() |
89 self.__resizeColumns() |
90 self.__resizeColumns() |