Commit graph

45 commits

Author SHA1 Message Date
TheJackiMonster 41e59d71c1
Fix newline changes to read universally
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2023-12-12 16:18:43 +01:00
TheJackiMonster 98d6eb4975
Remove usage of hardcoded path separators
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2023-12-12 15:53:37 +01:00
TheJackiMonster 82fe3262af
Prevent initial crash by changes in spellchecking
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2023-12-07 19:36:37 +01:00
Tobias Frisch 3d4eef2b49
Merge pull request #1214 from TheShadowblast123/develop
Update spellchecker.py And Fixed crashing
2023-12-07 16:06:03 +01:00
Tobias Frisch 892f8f0592
Merge pull request #1226 from drmousse/develop
Crash on spellcheck context menu #1224
2023-12-07 15:35:59 +01:00
Tobias Frisch cf4ff9f35a
Merge pull request #1196 from Dreaded-Gnu/cross-platform-fix
Fix inconsistent newline handling across operating systems
2023-12-07 15:04:25 +01:00
mousse 56dac84932 issue 1224: contextmenu on unknown word in context of pyspellchecker and symspellpy 2023-09-20 16:24:55 +02:00
Shadow fbab930c44 Update spellchecker.py
Corrected issue where words within certain quotations would show up as incorrectly spelled (ex: 'I'm fine') would indicate both words are misspelled
2023-09-12 18:57:03 -07:00
Sage Vaillancourt d149ae45e7 Better regex dot config 2023-09-04 20:24:41 -04:00
Sage Vaillancourt 18089ae44f Fix regex for ignoring multi-line comments. 2023-09-03 20:33:25 -04:00
Sage Vaillancourt f25b47149b Use regex to remove comments before counting 2023-08-25 14:46:45 -04:00
Sage Vaillancourt 6f6abc6f65 I think this reads slightly cleaner. 2023-08-19 21:38:30 -04:00
Sage Vaillancourt 80e90b5ddc Skip comments in word count. 2023-08-19 21:36:13 -04:00
Christian Freitag e267699667 - Adjusted open calls to use \n as newline for all platforms instead of guessing it 2023-08-07 13:09:55 +02:00
Arne Sostack b05377b417 Implemented history back and forward navigation 2023-05-14 11:59:07 +02:00
TheShadowOfHassen acd23e9651
Fixed error # #1095 (#1098)
The error: TypeError: expected string or bytes-like object can be fixed by just a str to the line:
         return [(m.start(), m.end(), getSearchResultContext(text, m.start(), m.end())) for m in searchRegex.finditer(text)]
2022-12-29 22:07:31 +01:00
TheJackiMonster a33249fc9d
Added guard to catch errors with translation
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2022-05-17 11:43:22 +02:00
TheJackiMonster dc86e3b14e
Adjusted fixes for python 3.10 to not crash immediately
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-12-13 14:27:59 +01:00
TheJackiMonster 15edb6efb7
Fixed issue #957 enforcing types supported by spec for QColor
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-11-04 00:50:44 +01:00
TheJackiMonster a58de3b1f6
Optimized counting words and characters via regex
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-06-01 15:17:54 +02:00
TheJackiMonster 7e05b72d83
Hotfix of unhandled exception by language_tool_python (#870)
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-04-30 20:46:30 +02:00
TheJackiMonster fc08e9b740
Fix changing language in LanguageTool spellchecker
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-04-16 19:44:24 +02:00
worstje b2817b5f08
Friendly logging for end users (#859)
* Changed default logging behaviour

We now log by default to a timestamped file in $datadir/logs/. No longer
shall restarting Manuskript after a crash wipe a very useful logfile.

Logs older than 35 days in the $datadir/logs/ directory are pruned
during startup. In case of subtle corruption detected a few weeks after
the fact, relevant logs might still exist to explain what had happened...
yet it does not come at the cost of infinitely gobbling up a users
storage space, either.

The --logfile (-L) argument can now utilize strftime() specifiers. A
special modifier %# is also supported which will insert the process id.
Besides being an added factor of uniqueness for a filename, it can also
be relevant to help identify the log file belonging to a misbehaving
Manuskript process.

* Added support-related items to Help menu

The 'Technical Support' item should lead to a landing page that will
guide the user to the most efficient way to resolve their problem.
How to report bugs and submit logs would be one of those.

The 'Locate Log File' item should open a file manager window with the
logfile of this session highlighted. Because Manuskript is still writing
to it, we first remind them of its limited use until Manuskript is
closed.

This approach was chosen because users might want to locate the file
prior to reproducing a bug, or because they'd like to look at other logs
from previous sessions.

* Updated translation files and added german translation

Co-authored-by: TheJackiMonster <thejackimonster@gmail.com>
2021-04-13 13:32:46 +02:00
Belug 9bb64d2471 Fix errors when language tool isn't installed 2021-04-11 11:07:20 -04:00
TheJackiMonster b090c11a9c
Fixed multiple processes for LanguageTool by using one instance only
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-04-11 16:02:41 +02:00
Alexandre 4107c48ea9
Fix 860 languagetool get locale language (#861)
* Fix #860 missing get_locale_language on languagetool

* Update spellchecker.py

Co-authored-by: Tobias Frisch <thejackimonster@gmail.com>
2021-04-11 14:31:06 +02:00
Jan Wester c797b5a18b Log the git revision if applicable
During development, the version number does not have much meaning... but
when faced with a reported issue, you would still like to know in more
detail what version of the Manuskript code was at work there.

Knowing the exact git revision will hopefully make it easier to
troubleshoot such issues in the future.

Note: this code takes special care to not rely on external modules
(we have enough dependencies) or even the git executable (invoking a
program can be relatively slow on some operating systems). It might not
handle all the edge cases, but I think it should cover our needs well
enough.
2021-04-08 18:44:28 +02:00
TheJackiMonster 83fae3f286
Fixed LanguageTool spellchecker working with newer versions
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-04-04 22:30:33 +02:00
Moisés J 1e52af54e2 Add global search 2021-04-02 14:15:17 +01:00
TheJackiMonster ad21d5faa5
Fixed finding suggestions using enchant and word selection without external dictionary 2021-02-22 01:13:19 +01:00
TheJackiMonster 12be4c3a3d
Fixed all Python syntax warnings 2021-02-21 23:45:34 +01:00
Tobias Frisch ca5a987e3c
Merge pull request #747 from TheJackiMonster/languagetool
Added basic support for LanguageTool via 'language_check' as advanced spellchecker
2021-02-19 15:46:47 +01:00
TheJackiMonster ac8cb3e403
Added support for LanguageTool via 'language_check' as advanced spellchecker 2021-02-19 15:44:38 +01:00
TheJackiMonster fc653ad74b Added setting to disable counting spaces as chars but requires restart 2020-07-05 01:27:54 +02:00
Jan Wester 3aa9cadfd8 Restore progress bar functionality
A previous fix (5f9ea3) inadvertently broke the progress bar by
converting to the wrong data type. (See issue #561 / PR #609).

While checking the code I realized the problem occurred primarily
because we weren't checking the validity of the values closer to the
source. Doing so alleviates the need to check elsewhere.

In the hope of inspiring a more systematic approach, a new uiParse()
utility function has been added to curb the further growth of toXxx()
functions that exist solely to validate user input.

There is no doubt room for improvement, both on the end of the new
uiParse() function as well as the spot where it is used. Ideally, the
data that comes out of the model should already be 'safe', but since
this is a bugfix for a bugfix I want to keep waves to a minimum.

This commit fixes issue #652.
2019-09-23 14:13:38 -06:00
Jan Wester 5da31230c7 Fixed crash for pre-Qt5.6
Qt has garbage documentation. I dug into Qt 5.0 source code to make sure
the crashing call can be safely left out for older versions, and that is
indeed the case. setSupportedSchemes() appears to be introduced together
with the future to select non-local files in the dialog, but we only
cared about local files to begin with.
2019-09-07 15:59:45 -06:00
Jan Wester 9317dc97d8 Do not reinvent QFileDialog's default suffix
According to issue #608 we were silently overwriting files when there
was a suffix being generated for a chosen export filename when one was
missing to begin with. Unfortunately, this helpful feature avoids all
the conveniences offered by QFileDialog in regards to alerting the user
to overwriting an existing file. Worse still, this feature already
exists in QFileDialog and the native APIs it can rely on.

This patch reimplements QFileDialog.getSaveFileName to allow the use of
the default suffix feature as functions.getSaveFileNameWithSuffix and
removes most of the magic involved with the old solution.
2019-09-07 15:59:45 -06:00
Curtis Gedak 5f9ea3baa5 Fix crash when setting word Goal on new Text (scene) in Outline pane
See issue #561.

The problem appears to be a due to a combination of factors, such as:

- Python does not automatically convert an empty/blank variable to the
  integer zero (0)
- Default goal value is empty/blank for a new Text (scene)
- Asynchronous events can occur such that the change in the Outline
  pane of a new Text (scene) goal from empty/blank to a value is not
  saved to the data model prior to the update event in the Editor pane
  accessing the model value for the word count progress display.

Steps to Reproduce:

1. Start manuskript and create new project (no template).

2. Select **Outline** pane.

3. Click "Text Plus" icon to create a text (default name "New")

4. Select **Editor** pane.

5. Click on **New** to display empty text.

6. Select **Outline** pane.

7. Double-click the empty area on **New** line under title **Goal**,
  type in "300", and press **Enter**.

   Note that manuskript crashes with a segmentation fault.

Work around the crash by using the already existing manuskript
function toInt() which handles conversion of empty/blank values to
integer value zero (0).
2019-07-31 10:46:06 -06:00
Youness Alaoui d513351162 spellchecker: Add file header to spellchecker.py 2019-04-30 09:54:31 -06:00
Youness Alaoui f9b181ff67 spellchecker: Improve support for symspellpy
Add support for 6.3.8 which has delete_dictionary_entry and do not use gzipped
pickle. Also give higher priority to symspellpy vs pyspellchecker.
List symspellpy dictionaries by order of cached vs non-cached.
symspellpy 6.3.8 is now the minimum version required and add support for showing
that information to the user.
Also add support for spellcheck libraries that are installed but without dicts.
2019-04-30 09:54:31 -06:00
Youness Alaoui e1edccc7d3 spellchecker: Add SymSpellPy support
SymSpell is a great spellchecker which works a lot faster than
pyspellchecker for finding suggestions but is a bit slow at
loading dictionaries (about 15 seconds initially, 2 seconds if
using a cached version).
SymSpell also doesn't come with dictionaries, so the code is currently
using dictionaries from pyspellchecker, so if pyspellchecker isn't
installed, then the user won't see any available dictionaries.
Eventually, would need to have an interface for people to manage
dictionaries for it.
2019-04-30 09:54:31 -06:00
Youness Alaoui e1b063a953 spellchecker: improve custom dictionary support
Improves the custom dictionary support by making it more generic
and moving it to the base class. Also makes PyEnchant uses a custom
PWL (Personal Word List) file within manuskript's resources directory
and made pyspellchecker detect available languages automatically.
2019-04-30 09:54:31 -06:00
Youness Alaoui 20c5586a6c Add support for pyspellchecker as an alternative to PyEnchant
This modifies the Spellchecker abstraction to add a new dictionary support, with
support for pyspellchecker. It also changes the main UI so that multiple libraries
can be supported and dictionaries provided to the user. The custom dictionary of
pyspellchecker has to be handled manually, and the performance and words of this
library isn't on par with PyEnchant, but at least it works with 64 bits.

Fixes #505
2019-04-30 09:54:31 -06:00
Youness Alaoui d0f02cb2a7 Add a Spellchecker abstraction layer and clean up code
This is in preparation for adding support for additional spellchecking libraries
other than PyEnchant which seems to be unmaintained and does not build in
Windows 64 bit.
2019-04-30 09:54:31 -06:00
Olivier Keshavjee cd8ad6cc3a Adds: clickable links, and display images as tooltips (#22, #215) 2017-12-14 14:55:14 +01:00