Commit graph

136 commits

Author SHA1 Message Date
Damien Elmes
d3feb931ba add option to webview to skip external browser open 2020-06-29 15:48:01 +10:00
Andrew Gaul
00ca676df5 Handle None from QApplication.desktop().screen()
This prevents a crash when Anki is open for multiple days.  Reference:
https://anki.tenderapp.com/discussions/ankidesktop/41879-qt-cannot-create-window-no-screens-available
2020-06-09 09:57:35 +09:00
Damien Elmes
2b01c5c607 new stubs don't require as many ignores 2020-06-02 17:56:32 +10:00
Damien Elmes
fa8a9499ce Merge pull request #636 from BlueGreenMagick/typing-contextmenuevent
add evt type for contextMenuEvent method
2020-05-27 10:23:44 +10:00
BlueGreenMagick
60501852c2 add evt type for contextMenuEvent method 2020-05-26 17:12:39 +09:00
BlueGreenMagick
b8f73fee2f add typehint for eventFilter method 2020-05-26 17:08:55 +09:00
evandrocoan
4fe92bfc6b Add missing close file descriptors using context managers 2020-05-18 15:54:20 -03: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
evandrocoan
8d9ba4377a Cache webview.py console regex expression and disable multiline 2020-04-17 03:43:16 -03:00
Damien Elmes
09ac540168 fix delays caused by console.log regression in PR #560
https://anki.tenderapp.com/discussions/beta-testing/1918-reliably-reproduced-bug-in-2124beta6
2020-04-17 10:51:03 +10:00
evandrocoan
2d84e8feee Set to use a regular expression to remove the server name because
it is less prone to break in future updates.
2020-04-15 16:27:41 -03:00
evandrocoan
d5df05ae6b Set to javaScriptConsoleMessage output to stdout because it
may raise error messages on the anki GUI.
2020-04-15 16:06:45 -03:00
evandrocoan
c0f5110843 Fixed javaScriptConsoleMessage showing 'error on line' for
all lines. The new output format is:
JS info /_anki/reviewer.js:166 autoadd
JS error /_anki/reviewer.js:240 Uncaught (in promise) NotAllowedError: play() can only be initiated by a user gesture.
2020-04-15 04:12:47 -03:00
Alan Du
c6817d296b Monkeytype qt/aqt/webview.py 2020-03-01 10:16:08 -05:00
BlueGreenMagick
ffb6ae2dc6 match both forward slash and os seperator 2020-02-29 12:36:10 +09:00
Damien Elmes
dee114df63 put head text after css/js imports so it can override them
as discussed in PR #438
2020-02-17 08:38:59 +10:00
Glutanimate
356eda66f4 Update documentation for webview_will_set_content and WebContent 2020-02-15 15:03:58 +01:00
Glutanimate
28a394a074 Assume that web assets without a specified subpath are under /_anki
Maintains compatibility with existing add-ons
2020-02-15 15:03:43 +01:00
Glutanimate
d7836e3af8 Add webview_will_set_content hook & update supporting code accordingly 2020-02-12 22:00:13 +01:00
Glutanimate
88b5d94513 Refactor web view title setting and add titles to all web views
Simplifies debugging web views
2020-02-12 21:03:11 +01:00
Damien Elmes
fc40182335 pass instance to webview_did_receive_js_message instead of string 2020-02-09 08:59:29 +10:00
Damien Elmes
68dc9d1e61 fix webview button alignment on Linux
caused by the height: specification inside webview.py
2020-01-26 10:18:24 +10:00
Damien Elmes
1dc673a068 fix white background in day mode 2020-01-23 18:36:42 +10:00
Damien Elmes
a9749bbcb1 fix inconsistently sized buttons and add platform classes 2020-01-23 18:05:55 +10:00
Damien Elmes
6e984b3cc3 fix audio displaying console window on Windows 2020-01-23 17:27:07 +10:00
Damien Elmes
6c50b09ff0 fix white flash on webview load 2020-01-23 17:27:07 +10:00
Damien Elmes
35435a130e basic night mode support
Forces the Fusion theme when running night mode, so we don't need
to work around platform themes that don't respond to the defined
palette.

Feedback/suggestions on the chosen colours welcome - _vars.scss is the
file to change if you want to experiment with adjustments.
2020-01-23 17:27:07 +10:00
Damien Elmes
f987310a50 move ignore statements for python 3.7
sigh :-(

https://github.com/python/mypy/issues/3251#issuecomment-490298556
2020-01-22 16:54:18 +10:00
Damien Elmes
4f9c9e1770 add a webview_did_receive_js_message hook 2020-01-22 11:06:12 +10:00
Damien Elmes
f02f845193 fix cases where we used the wrong type sig to connect to gui hook 2020-01-16 07:53:12 +10: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
b22dc71810 more tweaks for readability/consistency 2020-01-15 17:45:35 +10:00
Damien Elmes
8bad40152d remove _hook/_filter suffix 2020-01-15 16:53:24 +10:00
Damien Elmes
550264b1e5 add more hooks, tweak wording for consistency 2020-01-15 12:16:54 +10:00
Damien Elmes
80d7333c9d add some more hooks; stringify fully qualified types
To avoid circular imports, types that contain a '.' are automatically
converted to strings.
2020-01-15 08:56:56 +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/webview.py (Browse further)