Commit graph

47 commits

Author SHA1 Message Date
Hikaru Y
92ae6ad247 Fix new deck not being selected (#1681)
* Improve type annotations in studydeck.py

* Use `super()`

* Explicitly delete widget after closing dialog if parent is None

* Consolidate common cleanup tasks into a function

..., and connect it to `finished` signal

* Fix new deck not being selected

* Remove redundant assignments
2022-02-22 21:51:23 +10:00
RumovZ
de20a9ef90 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
roxgib
5e320e344f Make dialogs non-blocking (#1650)
* 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
2022-02-10 09:53:13 +10:00
roxgib
46d5b68e8c Add callback and non-blocking option to StudyDeck (#1643)
* Callback for StudyDeck, use with onModelChange

* Add types to callback function

* Rationalise types

* Update CONTRIBUTORS

* Fix type hints

I'm still getting to grips with the type hints!

* Consistency with callback checks

* | not supported for type hints on 3.9
2022-02-07 22:05:59 +10:00
Damien Elmes
631c345ef0 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
32df40216e .exec_() -> .exec()
The former is not supported in PyQt6
2021-10-12 16:17:37 +10:00
Damien Elmes
3c1729e91b 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
3dc7bd6051 fix study deck->add deck->cancel 2021-07-30 11:35:55 +10:00
Damien Elmes
3669e948c4 migrate more ops to CollectionOp 2021-04-06 14:36:13 +10:00
Damien Elmes
a9e40622e5 move operations into submodule 2021-04-03 16:26:10 +10:00
Damien Elmes
6b72aaf8c2 ID -> Id in protobuf and Python
follow-up to a90d5aa359
2021-03-27 21:38:20 +10:00
Damien Elmes
1df14f7c9c update no-arg tr references in qt/ 2021-03-26 13:48:26 +10:00
Arthur Milchior
ea3b55a3a4 NF: DeckID type 2021-03-26 11:14:08 +10:00
Damien Elmes
fafe30f4b4 use perform_op() for deck creation 2021-03-22 23:17:07 +10:00
Damien Elmes
9ad1e50544 fix a bunch of qt typing issues uncovered by the following commit 2021-03-19 19:45:21 +10:00
Damien Elmes
5045517f8a Merge pull request #1040 from RumovZ/deck-name-err
Catch deck rename errors and localise warnings
2021-03-01 09:40:55 +10:00
RumovZ
c4a2a212ec Catch DeckIsFilteredError directly on frontend 2021-02-26 11:32:40 +01:00
bluegreenmagick
5ef9401686 StudyDeck without add button 2021-02-25 07:34:01 +09:00
RumovZ
b8f828a465 Fix #1024 – catch deck rename errors 2021-02-24 13:59:38 +01:00
Damien Elmes
42a44875ab convert qt strings to f-strings with flynt
Also revealed an incorrect type def in editor.py that mypy wasn't
noticing before :-(
2021-02-11 10:09:06 +10:00
Damien Elmes
bf7528d90a minor code cleanups with pyupgrade
- pyupgrade --py38-plus --keep-runtime-typing --keep-percent-format
- third-party mpv and winpaths excluded
2021-02-11 09:43:40 +10:00
Damien Elmes
9702532fc4 more typing updates 2021-02-02 23:31:55 +10:00
Damien Elmes
748aeb9df1 add a bunch of return types 2021-02-01 23:53:23 +10:00
Damien Elmes
83892eac51 add types to various other files
Mainly automated with MonkeyType
2021-02-01 22:08:56 +10:00
Arthur Milchior
cb2df4fc1a NF: HelpPage in an enum
Hopefully, this can help with updating on next manual update and maybe even linking to manual translation
2021-01-26 02:16:37 +01:00
Damien Elmes
8075d46011 convert setWindowFlags call into helper, and fix invalid variables
"type: ignore" was masking the invalid references to self in places
like showText()
2021-01-07 14:24:49 +10:00
BlueGreenMagick
9a29d1b97a remove context help button 2021-01-06 22:15:48 +09:00
Damien Elmes
7e655614b2 fix remaining _() references; remove unused imports 2020-11-18 12:43:46 +10:00
Damien Elmes
066b1498ae merge bulk of qt/ - designer files still to do 2020-11-17 17:42:43 +10:00
johan456789
0ebe5d14eb fix help url paths 2020-10-10 00:38:07 +08:00
Alexander Presnyakov
98238e1707 Don't call setCurrentRow if row didn't change 2020-07-13 12:33:36 +03:00
Alexander Presnyakov
3ccc6ce61a Allow to choose note type from list by pressing ctrl + row number 2020-07-12 22:15:58 +03:00
Arthur Milchior
7319ab8231 Strip name of added deck
There is currently what I believe to be a bug: create a deck "   ".
The creation is accepted and the name is renamed to "blank". Instead,
I believe you'd want to strip the deck name before testing its
emptiness.
2020-06-17 11:58:33 +02:00
Damien Elmes
fc99306d22 Merge pull request #667 from BlueGreenMagick/refresh-deck-list
refresh deck list when adding deck via deckchooser
2020-06-12 09:12:51 +10:00
BlueGreenMagick
512a9afed6 refresh deck list when adding deck via deckchooser 2020-06-11 13:00:10 +09:00
BlueGreenMagick
5aa0addca2 get deck name after adding deck 2020-06-11 12:50:17 +09:00
BlueGreenMagick
b8f73fee2f add typehint for eventFilter method 2020-05-26 17:08:55 +09:00
Damien Elmes
cbfc9d5a87 handle default deck and filtered deck suppression in the backend 2020-05-15 21:21:10 +10:00
Damien Elmes
4d33b2d8f7 use qconnect everywhere, and fix some typing issues
a step towards check_untyped_defs in aqt, but there's still 100+
issues to resolve
2020-05-04 13:23:08 +10:00
Arthur Milchior
7bef7ef8ec Sort decks according to their paths
Currently it's sorted alphabetically. Because of this, "A::B" appears
between "A9" and "AA" in list of decks.
2020-04-06 22:49:25 +02:00
Arthur Milchior
89b79d9800 forceDefault to force_default 2020-02-22 04:01:42 -08:00
Damien Elmes
e98e85a0b8 Revert "Merge pull request #452 from Arthur-Milchior/noDefaultDeckInBrowser"
This reverts commit 56d908cc28, reversing
changes made to c123b5bf95.

More discussion required on https://github.com/ankitects/anki/pull/452
2020-02-21 12:27:39 +10:00
Arthur Milchior
9860d5ba5e method shouldBeDisplayed 2020-02-19 01:56:33 -08:00
Damien Elmes
20db4ab2f3 add qconnect helper and some type hints
The type hints allow mypy to check the gui_hook calls, revealing a
bunch of places that are broken as they expect no arguments like the
legacy hooks.

To make mypy happy about PyQt's signal.connect(func), a qconnect()
helper has been added.
2020-01-16 07:41:23 +10:00
Damien Elmes
8bad40152d remove _hook/_filter suffix 2020-01-15 16:53:24 +10:00
Damien Elmes
32edb4522d migrate addHook/remHook calls 2020-01-15 13:49:26 +10:00
Damien Elmes
2a00e0a6b0 tweaking the folder names again
hopefully that's the last of it
2020-01-03 07:48:38 +10:00
Renamed from anki-qt/aqt/studydeck.py (Browse further)