/usr/share/pyshared/PythonCard/tools/oneEditor/scriptlets/selectionWordCount.py is in python-pythoncard 0.8.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import wx
from PythonCard import dialog, util
def wordCount(text):
chars = len(text)
words = len(text.split())
# this doesn't always match the getNumberOfLines() method
# so this should probably be changed
lines = len(text.splitlines())
return chars, words, lines
if self.currentPage.documentPath is None:
filename = 'Untitled'
else:
filename = os.path.basename(self.currentPage.documentPath)
text = util.normalizeEOL(self.currentDocument.GetSelectedText())
dialog.messageDialog(self, "Document: %s\n" % filename + "%d chars, %d words, %d lines" % wordCount(text), 'Word Count', wx.ICON_INFORMATION | wx.OK)
|