Commit Graph

2512 Commits

Author SHA1 Message Date
Damien Elmes
9a103b3716 use extra variable in stdHtml() to work around a pylint crash 2021-10-02 22:47:13 +10:00
Damien Elmes
0000a3b302
Merge pull request #1402 from RumovZ/row-changed
Connect `currentChanged()` and add legacy alias for `onRowChanged()`
2021-10-02 09:06:05 +10:00
RumovZ
c146f33faa Add legacy alias browser.onRowChanged() 2021-10-01 18:36:12 +02:00
RumovZ
3a5d86c344 React to currentChanged() signal
Decouples changes of the current element and changes of the selection.
Introduces `browser.current_card` which has previously been amalgamated
with the previewer card `browser.card`.
2021-10-01 16:40:25 +02:00
Damien Elmes
812bf76b96
Merge pull request #1399 from abdnh/addon-homepage-manifest-prop
Add the homepage property to manifest.json
2021-10-01 21:52:00 +10:00
Abdo
3822568667 Add the homepage property to manifest.json 2021-10-01 14:40:36 +03:00
Damien Elmes
a174c41801
Merge pull request #1397 from RumovZ/column-tooltips
Add tooltips for some browser columns
2021-10-01 19:12:59 +10:00
Damien Elmes
7a81a1c7b6
Merge pull request #1400 from RumovZ/revert-hide-completer
Remove workaround for Qt completer bug
2021-10-01 15:30:37 +10:00
Damien Elmes
ee99578c06
Merge pull request #1392 from RumovZ/missing-row-handling
Handle missing rows consistently and speed up selections
2021-10-01 14:24:04 +10:00
Damien Elmes
a3d9f90af5 update to latest rules_nodejs & switch to ts_project
ts_library() is deprecated and will presumably be dropped from a
future rules_nodejs, and it wasn't working with the jest tests
after updating, so we switch over to ts_project().

There are some downsides:

- It's a bit slower, as the worker mode doesn't appear to function
at the moment.
- Getting it working with a mix of source files and generated files
was quite tricky, especially as things behave differently on Windows,
and differently when editing with VS Code. Solved with a small patch
to the rules, and a wrapper script that copies everything into the
bin folder first. To keep VS Code working correctly as well, the built
files are symlinked into the source folder.
- TS libraries are not implicitly linked to node_modules, so they
can't be imported with an absolute name like "lib/proto" - we need
to use relative paths like "../lib/proto" instead. Adjusting "paths"
in tsconfig.json makes it work for TS compilation, but then it fails
at the esbuild stage. We could resolve it by wrapping the TS
libraries in a subsequent js_library() call, but that has the downside
of losing the transient dependencies, meaning they need to be listed
again.  Alternatively we might be able to solve it in the future by
adjusting esbuild, but for now the paths have been made relative to
keep things simple.

Upsides:

- Along with updates to the Svelte tooling, Svelte typing has improved.
All exports made in a Svelte file are now visible to other files that
import them, and we no longer rebuild the Svelte files when TS files
are updated, as the Svelte files do no type checking themselves, and
are just a simple transpilation. Svelte-check now works on Windows again,
and there should be no errors when editing in VS Code after you've
built the project. The only downside seems to be that cmd+clicking
on a Svelte imports jumps to the .d.ts file instead of the original now;
presumably they'll fix that in a future plugin update.
- Each subfolder now has its own tsconfig.json, and tsc can be called
directly for testing purposes (but beware it will place build products
in the source tree): ts/node_modules/.bin/tsc -b ts
- We can drop the custom esbuild_toolchain, as it's included in the
latest rules_nodejs.

Other changes:

- "image_module_support" is moved into lib/, and imported with
<reference types=...>
- Images are now imported directly from their npm package; the
extra copy step has been removed.

Windows users may need to use "bazel clean" before building this,
due to old files lying around in the build folder.
2021-10-01 12:52:53 +10:00
RumovZ
e5cf649d6a Remove workaround for Qt completer bug
Reverts  #803.
2021-09-30 17:56:37 +02:00
RumovZ
ee2ecd0700 Add tooltips for some browser columns 2021-09-30 13:15:09 +02:00
RumovZ
326cf0f77f Remove redundant call to len_columns() 2021-09-28 12:11:20 +02:00
RumovZ
72f6f9a47a
Tweak comment
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
2021-09-28 11:48:35 +02:00
RumovZ
46ffbb936d Speed up to_row_of_unselected_note()
Skip rows between selected rows and return fetched note ids.
2021-09-28 11:47:13 +02:00
RumovZ
a592c5b3a9 Cache selectionModel().selectedRows() 2021-09-28 11:45:22 +02:00
RumovZ
eac8972a28 Calculate len_selection depending on modifiers
If no modifiers are pressed, a single row has probably been clicked and
`selectedRows()` is fast, while a lot of rows might have been deselcted.
2021-09-28 10:22:20 +02:00
RumovZ
287854d014 Prefer selectionModel().reset() over .clear()
The latter triggers `selectionChanged()` unreliably, probably due to the
aggregation of chronologically close events, causing problems in
tracking `_len_selection`. `reset()` never emits signals.
2021-09-28 10:19:33 +02:00
Damien Elmes
2a2469e7a2 Revert "Revert "Merge pull request #1364 from evandroforks/fix_unclosed_python_file""
This reverts commit a2ac197fd786b31880c8334735b4a2d6bd76b0bd.

Looks like it wasn't the cause of the previously reported problem:

https://forums.ankiweb.net/t/2-1-48-tts-problem/13587/2
2021-09-27 18:43:16 +10:00
Damien Elmes
96798f018a
Merge pull request #1382 from RumovZ/tags-from-sidebar
Tags from sidebar
2021-09-27 18:41:32 +10:00
Damien Elmes
339fd159aa
Merge pull request #1388 from lolilolicon/patch-1
Quote $PREFIX properly for paths with spaces
2021-09-27 18:39:25 +10:00
RumovZ
f89811870e Calculate number of selected rows manually
`len(self._view.selectionModel().selectedRows())` is slow for large
selections, because Qt queries flags() for every selected cell, so we
calculate the number of selected rows ourselves.
2021-09-27 10:15:53 +02:00
RumovZ
18f0d026b5 Switch to new row before deleting notes
The table now properly deselects deleted rows, but that takes effort and
it's more convenient to have a selected row after deleting.
2021-09-25 17:28:38 +02:00
RumovZ
f54f15cd44 Handle deleted or restored rows
- Cache the result of 'table.len_selection()'
- Update this cache manually when a row was deleted or restored
- Emit 'dataChanged()' after such a change to fix flags not updating
correctly to the shortcut in 'model.flags()'
- Remove/retsore focus if the current element was deleted/restored
2021-09-25 17:16:53 +02:00
RumovZ
3a8c494544 Only check flags of cached rows
Speeds up the selection process (esp. Ctrl+A) by avoiding to fetch rows.

Co-authored-by: BlueGreenMagick <BlueGreenMagick@users.noreply.github.com>
2021-09-25 15:32:22 +02:00
RumovZ
73ec0a2b2e Add callbacks to row fetching routine
Called when a row is detected that has been deleted or restored.
2021-09-25 15:27:19 +02:00
RumovZ
2b5bf23bbd Check 'index.isValid()' in 'table.model' 2021-09-25 15:21:06 +02:00
Soren Bjornstad
67f9fc519e Add hook after selecting a new note type in the add window 2021-09-24 21:54:33 -05:00
lolilolicon
ae7693a8a7
Quote $PREFIX properly for paths with spaces 2021-09-23 01:24:52 +00:00
lolilolicon
383cd44119
Quote $PREFIX properly for paths with spaces 2021-09-23 01:20:53 +00:00
hikaru-y
fc232eb0f7 Fix memory leak in previewer
Related thread:
https://forums.ankiweb.net/t/high-memory-usage-over-time-on-2-1-44/13544/
2021-09-22 17:21:08 +09:00
RumovZ
75f210a66c Enable adding/removing tags from the sidebar ...
... to selected notes.
2021-09-21 11:48:43 +02:00
Damien Elmes
d091a547a4
Merge pull request #1375 from RumovZ/disable-actions
Disable unusable browser actions on row change
2021-09-21 18:38:30 +10:00
Damien Elmes
81a8fe039b
Merge pull request #1379 from BlueGreenMagick/dont-fill-empty-on-add-cards
set CardLayout fill_empty=False for add cards editor
2021-09-21 15:08:54 +10:00
Damien Elmes
1ceb9965ad add hidden option to disable tooltips in browse screen
https://forums.ankiweb.net/t/browser-text-pop-up-when-hovering-over-card-poll/13254
2021-09-21 15:03:37 +10:00
Damien Elmes
9720592519 temporary fix for error on deleting (#1374) 2021-09-20 22:02:44 +10:00
Damien Elmes
66fc9cdbd8 add startup message about forcing Wayland 2021-09-20 21:42:16 +10:00
Damien Elmes
cdad1efdcf Revert "Merge pull request #1364 from evandroforks/fix_unclosed_python_file"
This reverts commit c05475a49e54ed7a56bc635e5e5528334d4ba6ac.

Revert "possible fix for reported audio issues"

This reverts commit f00f7f099f.

Reverting in case https://forums.ankiweb.net/t/2-1-48-release-candidate/13268/10
is related to this change. If the issue persists, we'll know this was
not the cause.
2021-09-20 21:39:15 +10:00
bluegreenmagick
f3db3fa768 set CardLayout fill_empty=False for add cards editor
Card layout view functions as a previewer in add cards dialog
so displaying accurately is more important than having placeholders.
Especially for card layouts using conditional-not fields {{^Field}}
card layout is rendered badly.
2021-09-20 18:34:49 +09:00
RumovZ
94b261f1ef Simplify sidebar context menu separators
Qt can collapse consecutive menu separators, so no need to check if a
subroutine has actually added any actions to the menu.
2021-09-19 18:33:36 +02:00
RumovZ
40bad0f65d Disable unusable browser actions on row change 2021-09-17 16:16:34 +02:00
Damien Elmes
f00f7f099f possible fix for reported audio issues
https://forums.ankiweb.net/t/2-1-48-release-candidate/13268/6

This is the only area of the sound code that has changed since 2.1.47
2021-09-16 10:27:37 +10:00
Henrik Giesel
c227c7dc39 Make StickyBottom actually stick and make editor fullsize + flexbox 2021-09-15 15:21:37 +02:00
Henrik Giesel
cd36fe2518 Correctly include editable css 2021-09-15 13:32:31 +02:00
Henrik Giesel
9b2378c3d2 Introduce editable module 2021-09-15 13:32:30 +02:00
Damien Elmes
9daf037c0b
Merge pull request #1264 from hgiesel/tageditor2
Svelte Tag Editor v2
2021-09-15 20:21:16 +10:00
evandrocoan
7e32e4efd5 Fix previous card attribute not initialized 2021-09-13 23:16:25 -03:00
Damien Elmes
926f0c7929 disable wayland again, but allow enabling it
Will add an entry to the known issues page.
2021-09-14 09:53:23 +10:00
Damien Elmes
18bd821a1f preserve focus on notetype change
Closes #1360
2021-09-13 15:31:24 +10:00
Damien Elmes
806fb0f102 allow wayland again
See #1368
2021-09-13 15:18:32 +10:00