Commit graph

3604 commits

Author SHA1 Message Date
Damien Elmes
c710580604 move media folder/db paths into collection
this breaks background media syncing for now
2020-03-20 21:15:23 +10:00
Damien Elmes
8c8674f57b drop unused col_path 2020-03-20 21:15:23 +10:00
Damien Elmes
3cacc00fc3 make the collection optional 2020-03-20 21:15:23 +10:00
Damien Elmes
90a44509be drop usage of flushSched() 2020-03-20 21:15:23 +10:00
Damien Elmes
fa527bca4f import .colpkg in a background thread 2020-03-20 21:15:23 +10:00
Damien Elmes
8c6e2cdb82 import .apkg files in a background thread 2020-03-20 21:15:23 +10:00
Damien Elmes
128b45aa40 import mapped files like csv in a background thread 2020-03-20 21:15:23 +10:00
Damien Elmes
37b24bf782 export in a background thread 2020-03-20 21:15:23 +10:00
Damien Elmes
e53ee52d2a remove db.close() 2020-03-20 21:15:23 +10:00
Damien Elmes
258a8282d4 move .reopen() to mw; fix exporting 2020-03-20 21:15:23 +10:00
Damien Elmes
07381f74e6 fix mypy warning 2020-03-20 21:15:23 +10:00
Damien Elmes
a02c4ed994 drop the DB progress handler code
This code was an awful hack to provide some semblance of UI
responsiveness while executing DB statements on the main thread.
Instead, we can just run DB statements in a background thread now,
keeping the UI responsive.
2020-03-20 21:15:23 +10:00
Damien Elmes
cd78da24d9 use a timer to automatically show progress window
We were previously relying on the DB progress hook to cause the
progress window to display.

Qt's progress dialogs do have built in support for automatically
showing, but it's easier to add a timer than change the existing
code to use it.
2020-03-20 21:15:23 +10:00
Damien Elmes
df33b04be8 run Check DB in a background thread
Since the DB is now stored behind a mutex, we're no longer limited
to accessing the database on the main thread.
2020-03-20 21:15:23 +10:00
Damien Elmes
d4df98c90f release the GIL during a DB request 2020-03-20 21:15:23 +10:00
Damien Elmes
8cb3ed7435 drop lock() and setAutocommit()
We no longer need to worry about pysqlite implicitly beginning
transactions, and can be more explicit about beginning/ending
transactions

save() now also has a trx argument controlling whether a
transaction should be started / left open
2020-03-20 21:15:23 +10:00
Damien Elmes
3256c74409 pass weakref in from storage to fix type checking/code completion 2020-03-20 21:15:23 +10:00
Damien Elmes
116f7fa3f1 support first_row_only 2020-03-20 21:15:23 +10:00
Damien Elmes
7e5f713f05 proper implementation of executemany(); drop executescript() 2020-03-20 21:15:23 +10:00
Damien Elmes
121687ea91 wrap the collection in a mutex so DB access is thread safe 2020-03-20 21:15:23 +10:00
Damien Elmes
e72d21e09e move note code into notes.rs, add ability to rollback when unchanged 2020-03-20 21:15:23 +10:00
Damien Elmes
3f3a45e2ba add Collection struct, and get media check working again
- media check no longer needs collection to be closed
- use savepoints for operations initiated by Rust, so they are
atomic without forcing a commit
2020-03-20 21:15:23 +10:00
Damien Elmes
700d713f80 add begin/commit/rollback, and support creating collections
all but one unit test is now passing
2020-03-20 21:15:23 +10:00
Damien Elmes
0147d9e470 drop log= argument from Collection 2020-03-20 21:15:23 +10:00
Damien Elmes
70c7cde2cd remove remaining db kwargs 2020-03-20 21:15:23 +10:00
Damien Elmes
d42df6e0f1 add a temporary executemany() 2020-03-20 21:15:23 +10:00
Damien Elmes
bd7ded18c3 drop the protobuf prototype 2020-03-20 21:15:23 +10:00
Damien Elmes
38d4ea5311 use (or)json for DB bridge
Some initial testing with orjson indicates performance varies from
slightly better than pysqlite to about 2x slower depending on the type
of query.

Performance could be improved by building the Python list in rspy
instead of sending back json that needs to be decoded, but it may make
more sense to rewrite the hotspots in Rust instead. More testing is
required in any case.
2020-03-20 21:15:23 +10:00
Damien Elmes
a129b8f8cf initial work on DB handling in Rust
committing the Protobuf implementation for posterity, but will replace
it with json, as Protobuf measures about 6x slower for some workloads
like 'select * from notes'
2020-03-20 21:15:23 +10:00
Damien Elmes
1db876ba1c tweak db type hints 2020-03-20 21:15:23 +10:00
Damien Elmes
7fbc229dcd drop usage of pysqlite Cursor 2020-03-20 21:15:23 +10:00
Damien Elmes
e5a465cccb tweak layout of db methods 2020-03-20 21:15:23 +10:00
Damien Elmes
7bf27febe6 drop .cursor() 2020-03-20 21:15:23 +10:00
Damien Elmes
fb9db72dde use total_changes() sqlite func 2020-03-20 21:15:23 +10:00
Damien Elmes
45bc1cd73e drop the schema <11 upgrade code 2020-03-20 21:15:23 +10:00
Damien Elmes
fcfe1bd66c drop context manager 2020-03-20 21:15:23 +10:00
Damien Elmes
9e67ea736a drop named sql arguments 2020-03-20 21:15:23 +10:00
Damien Elmes
6d0c84a1e9 drop progress handler and timeout arg 2020-03-20 21:15:23 +10:00
Damien Elmes
45399df30d drop echo and text factory 2020-03-20 21:15:23 +10:00
Damien Elmes
923d85f66b clone db.py into dbproxy.py 2020-03-20 21:15:23 +10:00
Damien Elmes
f6472f7430 tweak add-on wording 2020-03-20 21:00:21 +10:00
Damien Elmes
1accffbd34 Merge pull request #517 from Arthur-Milchior/backup_is_done
hook backup_is_done
2020-03-20 20:56:33 +10:00
Damien Elmes
9a36800ddb Merge pull request #470 from Arthur-Milchior/accept_card
Hook to decide whether a note should be added.
2020-03-20 20:56:04 +10:00
Damien Elmes
9ea9bab3fa Merge pull request #514 from evandroforks/box-sizing_border-box
Added box-sizing: border-box; to typeans by default
2020-03-20 20:50:40 +10:00
Damien Elmes
44a704b27b Merge pull request #516 from Arthur-Milchior/hook_models_advanced_will_show
Hook models_advanced_will_show
2020-03-20 20:42:14 +10:00
Damien Elmes
1da94f4a43 Merge pull request #518 from Arthur-Milchior/time_format_in_browser
Browser introduce method time_format
2020-03-20 20:37:57 +10:00
Damien Elmes
476cf5804f ftl git attributes 2020-03-20 20:33:12 +10:00
Arthur Milchior
1993c0af70 Browser introduce method time_format
I expect to use this in my add-on 1243668133 (by monkey patching in
this case) where it would allow to show hours/minutes/seconds... in browser
2020-03-19 22:59:59 +01:00
Arthur Milchior
7192ee96ac hook backup_is_done
I expect to use this hook in add-on 529955533. It'll serve me to
create long term backup at the same time than your backup
2020-03-19 13:21:00 +01:00
Arthur Milchior
6e85e8ccce Hook models_advanced_will_show
This will be useful for add-on 1863928230. I want to let users change
the LaTeX footer/header everywhere.
2020-03-19 12:03:09 +01:00