3
3
# Copyright (c) 2003 - 2007 Detlev Offenbach <detlev@die-offenbachs.de>
7
from MatchesForm import MatchesForm
6
from PyQt4.QtCore import *
7
from PyQt4.QtGui import *
9
from KdeQt.KQApplication import e4App
11
from Ui_MatchesDialog import Ui_MatchesDialog
10
14
Module implementing a dialog to show matching references/definitions.
13
class MatchesDialog(MatchesForm):
17
class MatchesDialog(QDialog, Ui_MatchesDialog):
15
19
Class implementing a dialog to show matching references/definitions.
17
def __init__(self,ui,parent = None,name = None,modal = 0,fl = 0):
21
def __init__(self, ui, parent = None, name = None):
21
25
@param ui reference to the UI object
22
26
@param parent parent of this dialog (QWidget)
23
27
@param name name of this dialog (string or QString)
24
@param modal flag indicating a modal window (boolean)
25
@param fl window flags
27
MatchesForm.__init__(self,parent,name,modal,fl)
29
QDialog.__init__(self, parent)
31
self.setObjectName(name)
34
self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
31
self.matchesList.setSorting(0)
32
self.matchesList.setColumnAlignment(1, Qt.AlignRight)
33
self.matchesList.setColumnAlignment(2, Qt.AlignRight)
35
dummy = self.trUtf8("Dummy")
37
def handleDoubleClicked(self, itm):
39
Private slot to handle the DoubleClicked signal of the list.
37
self.matchesList.header().setSortIndicator(0, Qt.AscendingOrder)
41
Private method to resort the tree.
43
self.matchesList.sortItems(self.matchesList.sortColumn(),
44
self.matchesList.header().sortIndicatorOrder())
46
def __resizeColumns(self):
48
Private method to resize the list columns.
50
self.matchesList.header().resizeSections(QHeaderView.ResizeToContents)
51
self.matchesList.header().setStretchLastSection(True)
53
def on_matchesList_itemActivated(self, itm, column):
55
Private slot to handle the itemActivated signal of the list.
41
57
lineno = int(str(itm.text(1)))
42
58
fn = unicode(itm.text(0))
43
self.ui.getViewManager().displayPythonFile(fn, lineno)
59
e4App().getObject("ViewManager").openSourceFile(fn, lineno)
45
61
def addEntry(self, ref):
47
Public slot to add a reference to the listview.
63
Public slot to add a reference to the list.
49
itm = QListViewItem(self.matchesList, ref.filename,
50
" %5d" % ref.lineno, " %5d" % ref.confidence)
65
itm = QTreeWidgetItem(self.matchesList, QStringList() \
66
<< ref.filename << " %5d" % ref.lineno << " %5d" % ref.confidence)
67
itm.setTextAlignment(1, Qt.AlignRight)
68
itm.setTextAlignment(2, Qt.AlignRight)
70
self.__resizeColumns()