Skip to content

Commit

Permalink
Merge pull request #321 from jerneju/concordances-report
Browse files Browse the repository at this point in the history
Concordances: add Send Report
  • Loading branch information
ajdapretnar authored Oct 27, 2017
2 parents b257a05 + 7967f18 commit bd8d9ac
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions orangecontrib/text/widgets/owconcordance.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from itertools import chain
from AnyQt.QtCore import Qt, QAbstractTableModel, QSize, QItemSelectionModel, \
QItemSelection
QItemSelection, QModelIndex
from AnyQt.QtWidgets import QSizePolicy, QApplication, QTableView, \
QStyledItemDelegate
from AnyQt.QtGui import QColor
Expand Down Expand Up @@ -101,10 +101,8 @@ def set_width(self, width):
def flags(self, _):
return Qt.ItemIsEnabled | Qt.ItemIsSelectable

def rowCount(self, parent=None, *args, **kwargs):
return 0 if parent is None or parent.isValid() or \
self.word_index is None \
else len(self.word_index)
def rowCount(self, parent=QModelIndex(), *args, **kwargs):
return 0 if parent.isValid() or self.word_index is None else len(self.word_index)

def columnCount(self, parent=None, *args, **kwargs):
return 3
Expand Down Expand Up @@ -321,6 +319,17 @@ def commit(self):
else:
self.Outputs.selected_documents.send(None)

def send_report(self):
view = self.conc_view
model = self.conc_view.model()
self.report_items("Concordances", (
("Query", model.word),
("Tokens", model.n_tokens),
("Types", model.n_types),
("Matching", self.n_matching),
))
self.report_table(view)


if __name__ == '__main__': # pragma: no cover
app = QApplication([])
Expand Down

0 comments on commit bd8d9ac

Please sign in to comment.