Open nswarup14 opened 5 years ago
Fetching the whole document in order after every change to count the words is very inefficient. Is there a better way? Look at the AbiWord method dlgWordCount?
@nswarup14 ping
@quozl @pro-panda
I tried as you suggested. I looked up the method called dlgWordCount
. It is an Edit method of the Abi.Widget class. https://www.abisource.com/doxygen/classap__EditMethods.html#a1bca73daaba032f99f6061997bb771da
I used Abi.Widget's invoke_ex
method, as it has been used in a number of other places in the activity. However I get the following traceback with no change in the activity usage.
I looked up as much as I could, as to why this was happening, but I could not find anything useful, particular to AbiWord.
Thanks. Underlines were destroyed in your screenshot. I suggest using text copy and paste for log errors, so they can be searched. There was no traceback in your screenshot. I don't know what you tried, as you haven't pushed. If you're not sure how to use the API, or get unexpected results, read the AbiWord source code.
Changes 1)
toolbar.py
Updates Now, the word and character count is displayed on the ViewToolbar of the activity. The count is updated every time there is a change in the AbiWord canvas.
The PR is based upon another PR.
I cannot find the AbiWord API for counting words on the official Abi 3.0 , hence I'm not sure if a python binding for such an API exists.
I have chosen to keep the word count and character count in the ViewToolbar itself, because I feel that is the right place to show. Buttons of common utility such as zoom-out, zoom-in and page no are also on the same toolbar.
Tested Ubuntu 18.04, Sugar v0.114. Thanks.