Commit Graph

21 Commits

Author SHA1 Message Date
Aristotelis
0f86c9fd11
Rework & unify webview identification and title setting (#2366)
* Create common web view registry and unify title setting

* Consistently use space-separated naming for webview titles

None of the modified titles seem to be in use by add-ons, so we are not bound to the current naming.

The old naming was likely following camelCase as the name was also acting as a key for saveGeom, which is no longer the case.

* Update webview_did_inject_style_into_page example

* Add docstring to addon-targeted method

* Change AnkiWebView.origin to property

* Fix dupe enum value

* Tweak method name

* Add semicolon

* Rename `AnkiWebViewOrigin` to `AnkiWebViewKind`
2023-02-10 14:53:11 +10:00
Damien Elmes
1215ee7849 Deck options: hide webview after showing dialog
This seems to reduce flicker, presumably because the webview doesn't pick
up the correct geometry until the dialog is shown.
2022-12-08 22:18:28 +10:00
Damien Elmes
1870253589 Add default_size argument to restoreGeom(); fix missing dialogs
The starting size of a webview seems to be 640x480, but if it is hidden
without retainSizeWhenHidden being set, the dialog it contains can end
up with a height of 0, which prevents the dialog from being shown.

By being explicit about our desired starting size, we can use a more
useful default, and avoid the issue of missing dialogs.
2022-12-08 22:02:12 +10:00
roxgib
14af96d580
Remove .exec() from QMenus in Deck Browser, Reviewer, and Card Template screens (#1674)
* Call StudyDeck with callback

* StudyDeck w/ callback, remove redundant assignment

* Replace exec() with show() for various dialogs

* Update super init args for Models.__init__

* Make StudyDialog ApplicationModal

* Remove .exec() from various dialogs and menus
2022-02-18 17:18:29 +10:00
RumovZ
9c54f85be6
Import submodules directly (#1662)
* Use submodule imports in aqt

* Use submodule imports in pylib

* More submodule imports in pylib

These required removing some direct imports to get rid of import cycles.
2022-02-13 13:40:47 +10:00
Henrik Giesel
478b3a53f1
Remove individual .html files + other refactorings (#1588)
* Move some AddCards specific code to NoteCreator.svelte

* Add new strings for Toggling the Visual / HTML editor

* Set LabelContainer vertical-align to text-top

- Makes them look more centered

* Remove appendInParentheses helper

* Make all ts/*.html files include only module.js and module.css

* Move any JS from .html to index files

* Remove .html files from ts modules

* Remove Python with Starlark implemenation

* Remove reference to non-existing file

* Remove deck-option.html as well

* fix change-notetype screen (dae)
2022-01-16 15:05:35 +10:00
Damien Elmes
cee57f4cb7 work around 'which deck would you like' sticking around on Qt6/macOS
Not a problem on Qt5, and not really sure why this works 🤷
2021-12-06 18:24:38 +10:00
Hikaru Y
d2cbd15bbe
Fix memory leak in AnkiWebView (#1510) 2021-11-29 12:31:37 +10:00
Damien Elmes
a7812dedc0 switch to new-style PyQt scoped enums and Qt6
The enum changes should work on PyQt 5.x, and are required in PyQt 6.x.
They are not supported by the PyQt5 typings however, so we need to run
our tests with PyQt6.
2021-10-15 12:57:19 +10:00
Damien Elmes
69c196b409 .exec_() -> .exec()
The former is not supported in PyQt6
2021-10-12 16:17:37 +10:00
Damien Elmes
b9251290ca run pyupgrade over codebase [python upgrade required]
This adds Python 3.9 and 3.10 typing syntax to files that import
attributions from __future___. Python 3.9 should be able to cope with
the 3.10 syntax, but Python 3.8 will no longer work.

On Windows/Mac, install the latest Python 3.9 version from python.org.
There are currently no orjson wheels for Python 3.10 on Windows/Mac,
which will break the build unless you have Rust installed separately.

On Linux, modern distros should have Python 3.9 available already. If
you're on an older distro, you'll need to build Python from source first.
2021-10-04 15:05:48 +10:00
Damien Elmes
79cf49f38d fix default deck being shown in deck options deck prompt 2021-08-19 12:33:36 +10:00
Henrik Giesel
24af5bada3 More uniform file naming
kebap-case for .ts, .scss, .html, and directories
2021-07-01 12:24:16 +02:00
Damien Elmes
1b15069b24 PEP8 collection.py 2021-06-27 15:12:22 +10:00
Damien Elmes
29c4869aef remove deck protobuf from frontend
Like the previous change, avoid exposing the protobuf as a public API
for now. It requires more thought, and is probably better done with
either extra helper accessors like decks.name(), or via a native class.
2021-05-31 16:31:06 +10:00
Damien Elmes
f26c7ed99e ask user to confirm which deck they want when opening options in reviewer
Also fixes https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/57
2021-05-27 13:15:28 +10:00
abdo
bbb2f7158f Strip Unicode isolation characters from title 2021-05-19 18:21:57 +03:00
Damien Elmes
df38788e07 move deck name into window title; v-center sticky bar 2021-05-19 19:34:15 +10:00
Damien Elmes
b485b8cbb9 deckconfig->deckoptions 2021-04-25 19:02:30 +10:00
Damien Elmes
e2a4d6041c basic support for add-ons in new deck config screen
- expose the data as a writable store
- currently only supports raw HTML; example to come
- fix changes not marking a deck config as modified
- the data is currently packed into the deckconfig object, but we
may move these to a separate store in the collection config in the
future, like is done with decks/notetypes
2021-04-24 11:08:01 +10:00
Damien Elmes
30f5269304 hook new deck config screen up behind an env var 2021-04-22 10:59:16 +10:00