Commit graph

722 commits

Author SHA1 Message Date
Jonathan Pietkiewicz 795e1fa9c0 Fix crash when regex is not valid (Fixes olivierkes#989)
Wrap regex preparation in try-catch
Log when there is a problem preparing the regex
2022-01-25 14:05:50 -06:00
Olivier Keshavjee 0330336311 Does not simply warn of duplicate IDs, but fixes them. 2022-01-22 09:53:36 +01:00
Olivier Keshavjee 47b55ba164 Potential fix for #719, #1001 2022-01-21 16:49:04 +01:00
Daniele Scasciafratte b66208791a feat(pandoc): hard_line_breaks support 2022-01-17 15:33:24 +01:00
Megan Conners 01036e4540 fixes #992 and #998 with explicit int casts 2022-01-16 12:31:16 -05:00
TheJackiMonster 9ccf665e12
========== manuskript-0.13.1 ========== 2021-12-13 14:30:49 +01: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 c9c18fae57
========== manuskript-0.13.0 ========== 2021-12-13 13:57:26 +01:00
TheJackiMonster d56c2225a3
Fixed issue #865 by adjusting the available IDs in an items constructor
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-12-11 01:34:39 +01:00
TheJackiMonster 77eee852de
Fixed issue #808 by resetting POV once the character gets deleted
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-11-30 23:40:31 +01:00
TheJackiMonster a63da8d0a8
Fixed issue #937
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-11-30 23:08:59 +01:00
TheJackiMonster 08e8714f1d
Delegated export stderr output without exit code zero to warnings and fixed one crash during loading
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-11-27 23:03:31 +01:00
TheJackiMonster 25adfd2437
Adjusted inconsistent pandoc behavior depending on installed version
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-11-27 16:47:38 +01:00
TheJackiMonster c52dab475c
Updated indonesian qt language files and ui files
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-11-27 01:39:53 +01:00
TheJackiMonster 7e5edf98ed
Fixed translation files which got messed up by last update
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-11-07 00:32:07 +01:00
Tobias Frisch 23ead413c1
Merge pull request #895 from zeth/bug-891
Kill old insecure pickle setting files (untested)
2021-11-06 22:56:39 +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 1af7d89d2a
Fixed issue #931, updated ui files and updated translation files
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-10-23 16:15:58 +02:00
Jan Wester d6e472b939 Implemented fix for failed cursor iteration (#729)
A long time ago, I identified this failure but wasn't sure why it was
failing. I still don't know why, but the emergency fix at least prevents
other people from running into it. As a bonus, since we have a proper
logging facility now, we can actually log it as I desired to do back
then!

This commit tentatively fixes issue 729.
2021-07-10 19:01:58 +02:00
Jan Wester 32caf6aa04 Partial fix for erroneous nbsp->space conversion
QDocument::toPlainText() has the stupid decision to convert nbsp to
spaces in it, which our users obviously hate. Unfortunately, this is
out of our control to fix completely. It is a very deep rabbit hole. :(

Typing non-breaking spaces in the editor now works. Reopening these
files at a later point has these characters remain intact.

What does NOT work is copy-pasting non-breaking spaces. These will end
up looking like normal spaces when you paste them somewhere else, be it
in Manuskript or some other document. In other words: it is impossible
for users to verify whether something is a non-breaking space or an
ordinary one.

I realize that it makes this partial fix meaningless for many. Sorry. :/

Partially fixes issue 738.
2021-07-10 19:01:58 +02:00
Jan Wester 87f1fc0187 Bugfix for filtering on POV characters
If a project only had one character, and it was marked as a POV
character, then that could lead to the accessing of a non-existent
second character. (Yes. That code was very broken.)

Fixes issues 843, 875, 896.
2021-07-10 19:01:58 +02:00
Jan Wester 0ea4c0d174 Share OpenGL contexts to make Qt WebEngine happy
This takes care of the following warning in our log file:

Qt WebEngine seems to be initialized from a plugin. Please set
Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute before
constructing QGuiApplication
2021-07-10 19:01:58 +02:00
Jan Wester 0a0ffb6d54 Fix broken filename argument handling (issue #898)
In addition to fixing the bug, related code that allowed this one to
slip under the radar has been cleaned up. Validation of the FILENAME
argument is now performed during parsing.
2021-07-10 19:01:58 +02:00
Tobias Frisch 4bfd663886
Merge pull request #894 from zeth/race-condition
Deal with race condition.
2021-06-21 18:38:35 +02:00
Tobias Frisch 9a5117be38
Fixed identation to match other code 2021-06-21 14:34:41 +02:00
Zeth Green 6f841f9655 Everyone with really old projects will lose their settings but will get a new settings file. 2021-06-21 03:48:28 +01:00
Zeth Green 8acb9b3839 Deal with race condition. 2021-06-21 02:56:16 +01:00
Zeth Green bc10cd3671 Someone was in a JavaScript mood? 2021-06-21 02:43:09 +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 1eab9890b5
========== manuskript-0.12.0 ==========
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-04-30 16:43:17 +02:00
Belug 96a3d282cc Fix missing root when using world building template 2021-04-20 18:57:36 -04:00
TheJackiMonster fc08e9b740
Fix changing language in LanguageTool spellchecker
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-04-16 19:44:24 +02:00
TheJackiMonster 3beac4a50e
Generated QML from translations
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-04-16 13:47:51 +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
DarkRedman 49f0c298c3
Fixed pandoc command arguments (#790)
* Fixed pandoc command arguments

`--base-header-level` throws a new export error because it is deprecated, now we should use `--shift-heading-level-by`

* Adjusted default and min value for base-header

Co-authored-by: Tobias Frisch <thejackimonster@gmail.com>
2021-04-10 14:58:00 +02:00
TheJackiMonster 173531ef2c
Combined #777 with changes from #827
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-04-10 14:46:03 +02:00
Tobias Frisch 653357d2e9
Merge pull request #777 from siliconserf/Issue-324-NoID-Fix
Update abstractModel.py
2021-04-10 14:39:50 +02:00
Belug d22eb3bcb9 Fixing the tests for travis-CI 2021-04-09 19:19:03 -04:00
Alexandre f5fa60c50c
Fix #855 - Avoid a crash when there's no model (#856)
* Fix #855 - Avoid a crash when there's no model

* Moved the update id to the AbstactItem class
2021-04-09 16:03:59 +02:00
Alexandre 40e6bf0793
Fix #846 close Fullscreen when exiting main editor (#854)
* Fix #846 close Fullscreen when exiting main screen

* Removing debug code and initializing _fullscreen

* Removing the print
2021-04-09 16:03:31 +02:00
Tobias Frisch 0a615bdef2
Merge pull request #667 from worstje/arguments-and-logging
Logging and command-line arguments
2021-04-08 19:37:09 +02:00
Jan Wester 2d622792f3 Additional logging centered around sys module
Due to my struggles reproducing the official build, I felt it might be
useful to log extra information regarding the version of PyInstaller.

Unfortunately, such information is not available due to the way things
work. However, during that process I came across some other interesting
details that would likely be useful when logged.
2021-04-08 18:44:28 +02:00
Jan Wester 5117f7d476 Logging uncaught & unraisable exceptions
When implementing most of the logging code weeks ago, I got so caught up
in implementing and testing the Qt bits that I completely blanked on
actually implementing the Python-side of catching exceptions.

Unfortunately, it is not exactly trivial. PyQt complicates things, but
also Python itself isn't very helpful in older versions which will rob
the ability to properly log errors from threads. By the time I realized
we don't actually use the threading module and that catching the errors
on there does not actually help to fix the weirdness I was seeing, it
was already implemented. Thank you PyQt for surprising me yet again! :-)

I have tested this on Python 3.7 by raising random exceptions in various
parts of the codebase to make sure it behaves as expected. I haven't
quite gotten around to installing Python 3.8 yet but this gets it out
for testing. I'll hopefully not forget to do more tests in 3.8 when I do
the final squashing prior to a merge.
2021-04-08 18:44:28 +02:00
Jan Wester 0910246899 Write log file in UTF-8 to fix encoding errors
Some log messages use characters in the Unicode character set that
aren't typically represented in the older encodings. One such example
was  the messages that happen when renaming an item and saving the
project.

Positive note though: errors while logging might not end up in the log
file when the log file is the cause, but they still showed on the
terminal with excessive detail. Also, despite the exceptions and errors,
the project I was testing successfully completed its saving procedures
as a subsequent reload showed. I am personally quite happy with the
degree of thought and care put into the Python logging system. :-)
2021-04-08 18:44:28 +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
Jan Wester 239e66e7cb Comprehensively log all version information
Manuskript now logs the versions of modules and libraries powering them
for as far those are easily accessible. This includes all the optional
modules, too. None of this is visible on the terminal of course - unless
Manuskript is run with the --verbose flag. This clears up the last bit
of unnecessary console spam, leaving our users blissfully unaware.

Until we (and/or Qt) break something again, that is...
2021-04-08 18:44:28 +02:00
Jan Wester 37becdf80a Converted version_1.py to new logging style
It had its own mini-logging facility to suppress the most useless debug
messages. Since the new facility does not show debug messages to the
user, but still allows them to end up in the log file, I replaced it
entirely with DEBUG-level logging.

Some spots have received an extra ERROR-level logging on top for the
sake of alerting the user to issues we would like to hear about, and to
avoid breaking up the hierarchical indenting done by the DEBUG-level
messages.
2021-04-08 18:44:28 +02:00
Jan Wester ff2cbca028 Converted most print statements to use logging
Some snippets have yet to be converted due to the more complex nature
of those snippets, and to keep things neat a separate commit makes more
sense for those.
2021-04-08 18:44:28 +02:00
Tobias Frisch 7c93567279
Merge branch 'develop' into develop 2021-04-08 18:33:27 +02:00
Jan Wester 8884bac0ed Added logging & proper argument parsing.
Sometimes you want to do just one thing, and in the process of
implementing that one thing, you implement several others. This is one
of those types of commits.

Implementing the argparse library is for the sake of controlling the
logging behaviour as well as other future I have yet to implement.

It has all the standard goodies you'd expect, and I have also ported
over the existing commandline arguments. (They may need a bit of polish
still, but there is no regression compared to before, only improvement.)

The logger is because it really needed to happen for numerous reasons.

It still logs to the terminal, but by default it only does so for
messages classified WARNING and above. These are the things we actively
want users to see. But if this is not good enough, adding the --verbose
flag will increasingly show more (-v shows INFO level and -vv also shows
the DEBUG messages) so that us coders don't have to miss anything in the
most convenient location.

It also logs to a file with the very original filename manuskript.log. I
may have to add commandline and/or settings arguments to improve that at
some point in the future, but there distractions are endless.

The log file contains timestamps and module information for easy
interpretation that are not present on the terminal, and it contains all
messages classified DEBUG and up. Ideally users will just be able to
attach it to an issue(*) to deliver us all the information we need to
help them with their inquiry.

Last but not least, the other reason I needed logging implemented is
that Qt has its own logging framework, and I needed to figure out how to
siphon out the data and make it shut up. But there was no point in doing
that as long as our own logging facilities were lacking...

(*) I have yet to convert all existing print statements over to the new
system, but that is probably going to be the next commit. This one has
enough change in it already.
2021-04-08 18:29:15 +02:00
Jan Wester b41fb00b0d Several tiny things squashed into one
All Models should have only one object managing them, and it is not the
class responsible for doing the welcome-related tasks.

Small .gitignore update
2021-04-08 18:28:53 +02:00
emgineering bee24d45b0 Change ID assignment method for Outline 2021-04-08 09:57:36 -06:00
Tobias Frisch 2545f9c7a3
Merge pull request #793 from FrancoisDuchene/notEnoughArgsFix
Fix for TypeErrors when using certain app styles
2021-04-08 14:46:59 +02:00
Belug 696678e25d Fix #456 - Force the distraction free window to be display on the same screen as the main window 2021-04-07 20:43:37 -04: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
Robert Barlow a266b1bfff
Fixed project not opening with missing background
This is the quick way to patch this. I'd recommend changing the findFirstFile function in functions/__init__.py for a more permanent solution, but this should suffice for now.
2021-04-04 13:48:54 -04:00
Moisés J 1e52af54e2 Add global search 2021-04-02 14:15:17 +01:00
Ling Samuel 41ebf87471
setup signal handler to avoid accident data loss
Signed-off-by: Ling Samuel <lingsamuelgrace@gmail.com>
2021-02-23 16:53:49 +08:00
bentleyjoakes 7e9fbf27fb Properly disconnect add person connection. 2021-02-22 21:31:15 +01:00
TheJackiMonster 3effe5c7fa
Added more consistency to the context menu 2021-02-22 03:18:45 +01:00
nagolinc 22fdab3f46 added 3 buttons to the textEditView that allow quickly adding new items
add character takes parameter name
2021-02-21 20:06:17 -05:00
TheJackiMonster 0cb65c452e
Fixed cursor selection without suggestions 2021-02-22 01:26:07 +01:00
TheJackiMonster ad21d5faa5
Fixed finding suggestions using enchant and word selection without external dictionary 2021-02-22 01:13:19 +01:00
TheJackiMonster d27910449d
Fixed issue #817 with the settings style picking 2021-02-21 23:59:23 +01:00
TheJackiMonster 12be4c3a3d
Fixed all Python syntax warnings 2021-02-21 23:45:34 +01:00
bentleyjoakes 06e35cd969 Clones importance setting.
When creating a new character, sets an appropriate importance level.
* If a character is selected, the new character has the same importance level.
* If a top-level importance level is selected, the new character has that level
* Otherwise, the importance level is zero
2021-02-21 21:09:20 +01:00
Tobias Frisch 13d1f1bddd
Merge pull request #735 from johnbintz/select-newly-added-world-item
Select newly added world items, opening branches as necessary
2021-02-21 18:14:41 +01:00
Tobias Frisch e8c61e74ba
Merge branch 'develop' into optional-pov 2021-02-19 16:02:45 +01:00
TheJackiMonster 61734c1afa
Enabling/Disabling POV for a specific character 2021-02-19 16:01:30 +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
Tobias Frisch 1b62288982
Merge branch 'develop' into charcount 2021-02-19 15:08:51 +01:00
Tobias Frisch 30b15b94dc
Merge branch 'develop' into characterscount 2021-02-19 15:05:15 +01:00
Zeth Green 344c21be5f Add a test to prove a scene's content comes through. 2021-02-02 23:29:17 +00:00
Zeth Green 0bbf70b455 Make the naming match here too. 2021-02-02 21:59:02 +00:00
Zeth Green 2410598de0 More consistant naming. 2021-02-02 21:54:39 +00:00
Zeth Green 64c67eaf48 Write a test for ParseMMDFile function. 2021-02-02 21:47:36 +00:00
FrancoisDuchene bd7b1e96f7 Fix for TypeErrors when using certain styles
When i was using certain styles like cleanlooks or qt5ct-style, a TypeError was raising in cascade about the function not having enough arguments.
It looked like that, despite the last args of Qstyle.subElementRect() and Qstyle.sizeFromContents() were optional, it was still required to mention it (even if it was just None).
That TypeError was only appearing with certain styles, at startup or when changing styles in the settings window.
2020-08-13 19:10:16 +02:00
TheJackiMonster fc653ad74b Added setting to disable counting spaces as chars but requires restart 2020-07-05 01:27:54 +02:00
siliconserf ed78f6e56f Update abstractModel.py 2020-06-04 14:25:27 -07:00
TheJackiMonster 6c84e4c8e3 Merge remote-tracking branch 'charcount/characterscount' into charcount 2020-03-27 15:31:28 +01:00
TheJackiMonster 24f3f092bb Added char-count with settings to enable/disable it. 2020-03-27 15:12:44 +01:00
John Bintz 5ca087a67d Select newly added world items, opening branches as necessary 2020-02-09 10:54:40 -05:00
Curtis Gedak 12defa8fa4 ========== manuskript-0.11.0 ========== 2020-01-18 10:37:45 -07:00
Curtis Gedak 2411409260 Update copyright year 2020-01-18 10:26:14 -07:00
Curtis Gedak a3ee840846 Add new language translations to the Settings window 2020-01-18 10:23:53 -07:00
Curtis Gedak 82169dbf4f Change wording of import warning for PyQt/Qt versions 5.11 and 5.12
Two separate pull requests indicate an issue translating the warning
for when an import is attempted with PyQt/Qt versions 5.11 and 5.12.
As such change the warning message.

See PRs #668 and #701.
2020-01-15 10:01:55 -07:00
TheJackiMonster 9f6b65aaca Fixed bugs caused by parallel access during multithreading 2020-01-06 11:16:02 -07:00
Jan Wester 67f987d44b Fix for Windows 10 Dark Theme on older Qt versions
QtCore.Qt.GlobalColor does not have any accessors for the predefined
colors on PyQt versions before 5.11 despite the object itself existing.

It would have been nice if the documentation* had mentioned that object
being broken on older versions, but I should have tested with even older
versions of PyQt before submitting the original patch.

Apparently the most supported way to access these colors is through the
Qt namespace itself, but those aren't documented in the slightest. Ugh.

My apologies to all those affected. Fixes issue #659.

*: https://www.riverbankcomputing.com/static/Docs/PyQt5/api/qtcore/qt.html#GlobalColor
2019-10-02 09:49:52 -06:00
Curtis Gedak f9970fc09a ========== manuskript-0.10.0 ========== 2019-09-30 09:49:14 -06:00
Curtis Gedak 4784d2b5aa Add new language translations to the Settings window 2019-09-30 09:31:49 -06:00
Jan Wester 7377a34714 Added warning to revision UI 2019-09-29 09:34:48 -06:00
Jan Wester 961bac7e16 UI enforces >=1 revision kept per timespan 2019-09-29 09:34:48 -06:00
leela decb60cbef change markdown to "Markdown" in....
...A universal document converter. Can be used to convert markdown to a wide range of other formats.
see https://en.wikipedia.org/wiki/Markdown
2019-09-29 09:09:31 -06: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
Curtis Gedak be35786b68 Default keep revisions to disabled, and remove tests for revisions
This commit sets the "keep revisions" setting to disabled by default
for new projects.  It also removes the test cases associated with
revisions.

The revisions feature as currently implemented is of questionable use.
It has been a source of performance issues for users, and has consumed
developer time in attempts to address its shortcomings.  This commit
is the first step to deprecate the current revisions feature.
2019-09-22 10:45:07 -06:00
Curtis Gedak b473ead98e Fix word recognition for spell checker, ignore active partial words
See PR #651

This commit restores the functionality that prevents spell checking a
word that is being actively typed at the end of a paragraph.

The goals for the spell check word match regexp are:

A. Words should include those with an apostrophe
   *E.g., can't*
B. Words should exclude underscore
   *E.g., hello_world is two words*
C. Words in other languages should be recognized
   *E.g., French word familiarisé*
D. Spell check should include word at absolute end of line with no
   trailing space or punctuation
   *E.g., tezt*
E. Spell check should ignore partial words in progress (user typing)
   *E.g., paragr while midway through typing paragraph*

This commit addresses all five of the above goals.

HISTORY:
- See issue #166 and commit 6ec0c19 in the 0.5.0 release.
- See issue #283 and commit 63b471e in the 0.7.0 release.

Also fix minor incorrect utf-8 encoding at top of source file.
2019-09-22 10:28:49 -06:00
Curtis Gedak 10df2baf8d Fix typo missed in two previous commits
See PR #645 and PR #648.

Change second instance in string of "save" to "saved".
2019-09-19 10:38:16 -06:00
luz.paz d20e7a8122 Fix typo missed in previous commit
https://github.com/olivierkes/manuskript/pull/489#issuecomment-533195819
2019-09-19 10:13:15 -06:00
luz.paz 2fd45dc42c Fix misc. typos
Found via `codespell -q 3 -S *.ts,./libs,./sample-projects -L searchin`
2019-09-19 09:58:24 -06:00
Curtis Gedak 0943d81317 Move Qt 5.11 / 5.12 version warning to Import invocation
See issue #611 and pull request #642.

The warning previously added in PR #612 for Manuskript users with Qt
5.11 / 5.12 has shown itself, in my opinion, to be overly annoying.
This is because the warning *always* displays on systems with the
affected Qt versions even though the crash is verified to happen with
the import feature only.

Additionally the process to upgrade to a newer version of PyQt / Qt is
not trivial for users who rely on pre-built packages and do not run
from source code.

Because the crash has been verified with the Import feature only, limit
the scope of the warning to the Import feature.
2019-09-17 10:41:33 -06:00
luz.paz 1368a9b79b Fix source typo
Split off from #489
2019-09-17 10:26:46 -06:00
Jan Wester 5dcd93ced3 Improved detection of UI language
The user can configure a language for Manuskript in the dialog, but
before that setting is ever written to disk, there is the default
behaviour that tries to auto-detect the best language to show based on
the configuration of the device it is running on.

While doing my due diligence on issue #619, I realized we were relying
on the system locale, which is not necessarily equivalent to the
language the user is working with. Worse still: a user can have multiple
preferred languages for their user interface, and our old approach might
actually offer them the 'wrong' language. This patch fixes this.

It also refactors and comments things a little bit where necessary.
2019-09-15 09:21:31 -06:00
Jan Wester 0aa83180de Reworked translation loading to avoid ambiguity
Issue #619 revealed an unintentional overlap between the auto-detection
of the locale and the implicit builtin English language, which resulted
in users being unable to select the builtin English language when their
device was configured with a locale that we happen to have a translation
for. The code has been rewritten to more clearly separate auto-detection
and the final fallback that is the builtin English translations.
2019-09-15 09:21:31 -06:00
Curtis Gedak a2fc4c5ecd Set default window tab to Word frequency for Frequency Analyzer tool
This code change sets:
- Fequency Analyzer tool default first tab of "Word frequency"
  (was Phrase frequency)

Steps to set default window tab:

1. Start Qt Designer
2. Open .ui file
3. Ensure that each selected window tab is the one desired as default
4. Save .ui file
5. Exit Qt Designer
6. Generate .py file with:  make ui

See PR #623
2019-09-13 10:00:29 -06:00
Curtis Gedak 8f4ddefb48 Fix tab key order, and default window tab for character pane and plot pane
This code change sets:
- Character pane default first tab of "Basic info" (was Notes)
- Character pane Basic info "Name" as the default first field (was Motivation)
- Plots pane default first tab of "Basic info" (was Resolution steps)

Steps to edit tab order and default window tab:

1. Start Qt Designer
2. Open .ui file
3. Choose menu **Edit -> Edit Tab Order**
4. Ctrl-click on item just before the first incorrect tab order item
5. Click other items in order until remaining order is correct
6. Ensure that each selected window tab is the one desired as default
7. Save .ui file
8. Exit Qt Designer
9. Generate .py file with:  make ui

See https://doc.qt.io/qt-5/designer-tab-order.html

This code change implements a portion of issue #244
2019-09-13 10:00:29 -06:00
Jan Wester d626d3ba75 Fixed & robustified image tooltips (issue #593)
Last time I touched this code, I went in looking for a specific problem,
and came out with a fix specific to that issue. That fix was not wrong,
yet it hardly covered all the problems present in the code once one took
into account issues like:

- local vs remote resources,
- relative vs absolute paths,
- different operating systems behaving differently, and
- Qt being uniquely buggy on different platforms.

The major part of it was fixed by using QUrl.fromUserInput(), which does
the exact kind of auto-detection for the nature of the resource that we
were in need of.

The rest of the issues were fixed by creating a number of test cases and
fixing problems as they popped up. Testing was done in Windows & Ubunty
against the above-mentioned test cases, which can be found in PR #629.

Regarding ImageTooltip.supportedSchemes

When QUrl.fromUserInput() misidentifies the scheme on Linux, it causes
all resemblance between the original request and the reply.request() in
the finished() signal to be lost, which results in this item getting
stuck in the ImageTooltip processing pipeline.

Limiting the supported schemes to the ones most commonly encountered
('file', 'http', 'https' and the schema-less local paths) is the only
reliable method I have found to work around this particular bug in Qt.
2019-09-10 11:30:35 -06:00
Jan Wester 860ada2c1b Basic dark theme support (Windows 10)
Windows 10 has supported a 'dark theme' option for a while, and the fact
Manuskript is like looking into a bastion of bright white while using it
is bothersome to say the least.

Since this is a setting defined as the OS level, I believe this should
be something Manuskript automatically adjusts itself to match, thus the
lack of a configurable setting on the Manuskript end.
2019-09-10 10:15:54 -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 f6fa3e8375 Do not try to export after dismissing the dialog
I happened to notice the UI briefly locking up when testing my previous
changes on some of the Pandoc exporters. While the bigger mess I found
along the way is more than a little fix can handle, this stopgap measure
will at least stop us from running pandoc when it isn't needed.
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
Jan Wester bcf749d165 Use native look for the import FileDialog
It is the only FileDialog in the entire codebase that does not conform
to the rest of the OS like its brethren, and it stuck out like a sore
thumb because of it.
2019-09-04 14:18:02 -06:00
Jan Wester c2dce6e0c6 Warn user about buggy libraries
Some bugs are out of our reach to fix, but can still impact the user
considerably. Because losing progress always hurts, we want to make
the user aware of the risks before any tears are shed. (PR #612)
2019-09-04 14:18:02 -06:00
Jan Wester fe0405ca8f Reinstate importer-specific settings in UI
Once upon a time very long ago, someone commented out one line too many.

And that broke all Pandoc-based imports. Oops. See issue #611.
2019-09-04 14:18:02 -06:00
Curtis Gedak 65fb184f60 Rename setting "Save on quit" to "Save on project close"
See PR #615

This rename is being done to clarify that when a user enables "Save on
project close" then the project will be saved whenever the user
chooses to close the project or to quit Manuskript.

Note that the actual name of the setting saveOnQuit should also be
changed but instead has been marked as a future TODO because it
involves a change in the project file format.
2019-08-22 15:18:18 -06:00
Curtis Gedak f4c8108b28 Do not prompt "Save project?" when _Save on quit_ setting enabled
See PR #615

The Travis CI tests began failing after merging Pull Request #583.

Log snippet:

----------------------------------------------------------------------
...
Ref not implemented
PASSED
manuskript/tests/ui/test_welcome.py::test_autoLoad QXcbConnection: XCB error: 8 (BadMatch), sequence: 613, resource id: 2097162, major code: 42 (SetInputFocus), minor code: 0
QXcbConnection: XCB error: 8 (BadMatch), sequence: 619, resource id: 2097168, major code: 42 (SetInputFocus), minor code: 0
QXcbConnection: XCB error: 8 (BadMatch), sequence: 625, resource id: 2097171, major code: 42 (SetInputFocus), minor code: 0
----------------------------------------------------------------------

When running "pytest -vs" locally, which is a command used in our
.travis.yml file, a dialog to "Save project?" is displayed.  Because
the test scripts use the "saveOnQuit" default setting of *enabled*,
the "Save project?" dialog should not be displayed.

In other words when a call is made to close the project, a "Save
project?" dialog is incorrectly displayed because the dirtyProject
flag is set, but so too is saveOnQuit set to True.  What should happen
is an automatic save with no prompt.  This PR fixes this logic so that
the Travis CI test suite completes successfully.
2019-08-22 15:18:18 -06:00
Jan Wester 34f84126df Fixed race when closing an auto-saving project.
Turning off the timer for saveTimerNoChanges just like the code
already did in closeProject() for saveTimer fixes this bug. Easy.

But how to prevent this kind of race condition in the future?

Several related routines have been adjusted to fail gracefully or report
a bug to the console when something goes wrong, depending on what is
most suitable for that bit of logic.
2019-08-12 10:35:07 -06:00
Jan Wester 97cf0e1373 Track dirty state and have the UI respect it
Intending to learn more about the way Manuskript goes about saving the
project in order to figure out how to tackle some recent saving-related
issues, I stumbled into learning that Manuskript likes to save data a
whole lot. Too much, in fact. When I close the project with unsaved
changes, I expected those changes to not be saved... but they were. This
completely subverts my expectations of a program using typical
file-based operations involving opening, saving and closing files.

There are three more settings that influence when the program saves, and
I personally consider them a bit overkill or even detrimental to the
stated purpose. What if Manuskript forces a save when nothing was
changed and something goes wrong? Saving too much can in fact be
dangerous!

For now, I have left existing functionality as-is, but I would prefer to
respect the dirty flag I have introduced in this commit for at least the
'save-on-quit' and 'save every X minutes' features. (The third is
smarter and only triggers after noticing changes, so it is less
important.)

Making sure the dirty flag works as expected is the first step in making
such changes in the future.

UI-wise, this commit now offers the user the opportunity to save their
changes, discard them, or outright cancel their action entirely when
performing a destructive action on a dirty project. As of this commit, I
have identified two of such scenarios:

1) closing the project,
2) closing the window with save-on-quit turned off.

If I missed any, do let me know. But for now, maybe now I can finally
start digging into those issues that sent me down this rabbit hole...
2019-08-12 10:35:07 -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
Curtis Gedak dc51f6d84e Add new language translations to the Settings window 2019-07-14 10:11:52 -06:00
Allan Nordhøy 761be5784a Spelling: Manuscript, could not, process, … No content (#588)
* Spelling: Plaintext, Manuscript, could not, process, … No content

* Reverted to "plain text"
2019-06-06 11:55:24 -06:00
NocturnalFred 995eda101f fix issue #468 'unit' is reset 2019-06-05 10:34:11 -06:00
Curtis Gedak 1711f8decf Fix pandoc export crashes is project title is empty
Fixes #535
2019-05-31 10:19:04 -06:00
Youness Alaoui a8ec6512c9 Fix crash if invalid character is inserted into the text.
If an invalid character is inserted into the text, such as a "^L" (ASCII 0x0C)
when copy-pasting from a google document that has a page break in it, a crash
will happen as the character cannot be inserted into XML. This patch removes
those invalid characters from the text so the revisions.xml can be saved.

Fixes #562
2019-05-21 09:52:18 -06:00
Youness Alaoui f1baab8b3a Fix crash if using a custom pandoc installation
Fixes #563
2019-05-20 09:39:45 -06:00
Youness Alaoui 3dfb43f6c1 Center dialog for the frequency analyzer too. 2019-05-20 09:25:17 -06:00
Youness Alaoui e4da844708 Fix dialog windows being created outside the desktop area
The About/Settings/Import/Export/ExportManager windows were all created
in odd places, usually to the left of the main window, which meant outside the
desktop area with little overlap if the main window is maximized. The logic in
centering the window on its parent was wrong. This fixes it.
2019-05-20 09:25:17 -06:00
Jan Wester 12390a9aab Fix occasional crashes when (re)moving items
Describing all the rabbitholes that I and kakaroto have gone through
while debugging this one until dawn can frankly not do enough justice to
the crazy amount of rubberducking that went on while trying to fix this.

This bug would be triggered whenever you had a document open in the
editor and then moved an ancestor object downwards (visually) in the tree.
Or when you simply deleted the ancestor. Depending on the exact method
that caused the opened item to be removed from the internal model, the
exact nature of the bug would vary, which means this commit fixes a few
different bits of code that lead to what appears to be the same bug.

In order of appearance, the bugs that ruined our sleep were:

1) The editor widget was trying to handle the removed item at too late a
stage.

2) The editor widget tried to fix its view after a move by searching for
the new item with the same ID, but in the case of moving an object down
it came across its own old item, ruining the attempt.

3) The editor widget did not properly account for the hierarchical
nature of the model.

Upon fixing these the next day, it was revealed that:

4) The outlineItem.updateWordCount(emit=False) flag is broken. This
function would call setData() in several spots which would still cause
emits to bubble through the system despite emit=False, and we simply got
lucky that it stopped enough of them until now.

This last one was caused by a small mistake in the fixes for the first
three bugs, but it has led to a couple of extra changes to make any
future bug hunts slightly less arduous and frustrating:

a) When calling item.removeChild(c), it now resets the associated parent
and model to mirror item.insertChild(c). This has also led to an extra
check in model.parent() to check for its validity.

b) The outlineItem.updateWordCount(emit=) flag has been removed entirely
and it now emits away with reckless abandon. I have been unable to
reproduce the crashes the code warned about, so I consider this a code
quality fix to prevent mysterious future issues where things sometimes
do not properly update right.

Worthy of note is that the original code clearly showed the intention to
close tabs for items that were removed. Reworking the editor to support
closing a tab is unfortunately way out of scope, so this intention was
left in and the new fix was structured to make it trivial to implement
such a change when the time comes. An existing FIXME regarding unrelated
buggy editor behaviour was left in, too.

Many thanks to Kakaroto for burning the midnight oil with me to get to
the bottom of this. (I learned a lot that night!)

Issues #479, #516 and #559 are fixed by this commit. And maybe some others,
too.
2019-05-19 09:33:19 -06:00
Jan-Niklas Meier 385396c089 trying to resolve full screen exit issues on macOS 2019-05-03 09:41:39 -06:00
Youness Alaoui d513351162 spellchecker: Add file header to spellchecker.py 2019-04-30 09:54:31 -06:00
Youness Alaoui 4f7c81bbff spellcheck: Handle use case of a dictionary becoming unavailable. 2019-04-30 09:54:31 -06:00
Youness Alaoui 5c33ce54f3 spellcheck: show 'add to dictionary' even if a word has no suggestions 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
Jan Wester 0238ccec7b Fixed #549 and refactored the image tooltip also
Issue #549 was caused because the request and reply object urls are not
guaranteed to be the same. Redirects are the most common cause, but a
malformed URL apparently also qualifies. We now make sure to look at the
original request.

Because the code confused me while I was working on it, I decided to
refactor and document it in order to understand what was going on. I am
glad I did: I found another crashing bug involving the rapid-firing of
tooltip requests, and the processing dict never had its entries removed
either, leading to a (very slow) memory leak over time.

All is good in the world of image tooltips now.
2019-04-23 12:25:39 -06:00
Curtis Gedak f6293ca3d9 ========== manuskript-0.9.0 ========== 2019-04-04 10:34:25 -06:00
Curtis Gedak 362673ec21 Update copyright year 2019-04-04 10:33:08 -06:00
Curtis Gedak fbbdead43e Add new language translations to the Settings window 2019-04-04 10:08:17 -06:00
Youness Alaoui 5a9c82a03a fullscreen: Rework panel 'addDisplay' API and improve top panel Path UX
The 'displays' system of panels is now changed into simply a settings system
where settings can be associated to widgets. The new API is :
addWidgetSetting, addSetting and setSettingCallback.

The top panel was reworked to have the settings appear in the order of the
widgets, and the path/title choice was changed into a Title widget with a
"Title: Show Full Path" setting.
2019-04-02 11:42:25 -06:00
Youness Alaoui 156e2d0067 fullscreen: Add a auto-show/hide progress setting.
Realizing that the show/hide progress was being ignored if we navigate to a
scene without a goal set. Also, if we go fullscreen on a scene without a goal
then navigate to a scene with one, the progress wouldn't get shown. Adding the
"Auto Show/Hide" setting fixes the issue with all use cases.
2019-04-02 11:42:25 -06:00
Youness Alaoui 8900a0ed3f fullscreen: Change navigation/new-document layout
Left-align the navigation and new-document buttons in the top panel to
prevent them from moving around when changing scenes.
2019-04-02 11:42:25 -06:00
Youness Alaoui a27a1f399a Adding navigation support to fullscreen editor
This makes the fullscreen editor much more powerful in terms of navigating
through chapters and scenes. This should make issue #234 users happy and
fix #444.

Top panel now has left/right arrows to navigate through the scenes. It will
automatically find the next/previous text item and display it, navigating through
the outline tree.

There's also a "New document" icon which will create a new text entry immediately
after the current one and switch to it.

Navigation can also be done using Alt+Page-Up, Alt+Page-Down or Alt+Left and Alt+right
shortcuts (Fixing #444).

There's now also the option between Title or Path for the top panel, if Path is chosen
then the full path of the scene is displayed and clicking on the scene or parent items
opens a menu to quickly switch to the selected chapter/scene. Selecting a folder will
automatically display the first text entry available in that folder.
2019-04-02 11:42:25 -06:00
Youness Alaoui 62b225e22c Fullscreen: Add scene title to top panel 2019-04-02 11:42:25 -06:00