kelciour
ef1d61e35c
Scroll media sync log to the last line
2020-07-13 03:06:44 +03:00
Alexander Presnyakov
e092dadc9a
Allow to choose note type from list by pressing ctrl + row number
2020-07-12 22:15:58 +03:00
Damien Elmes
bc5b6dfb63
mediasrv symlink fix
...
https://forums.ankiweb.net/t/anki-2-1-28-beta/629/39
2020-07-11 10:53:41 +10:00
Glutanimate
15fd3a4856
Add top_toolbar_did_redraw hook
...
Notifies add-ons of the top toolbar being redrawn
2020-07-10 17:38:40 +02:00
Damien Elmes
93425be839
formatting
2020-07-07 13:28:30 +10:00
Damien Elmes
85cbd263da
tidy up logging
2020-07-07 10:50:12 +10:00
Damien Elmes
4ab9d04c95
if webexports does not match, return 403
2020-07-07 10:50:03 +10:00
evandrocoan
121725390d
Fix _addons/ URL prefix not being removed on Windows systems
...
Anki 2.1.28 Beta
https://forums.ankiweb.net/t/anki-2-1-28-beta/629/26
> Did the requirements on how to expose resources on the internal server change? Because scripts, css files and the like, registered with setWebExports, do not work anymore with beta2.
> A look at the console shows the following for all resources:
> Failed to load resource: the server responded with a status of 500 (INTERNAL SERVER ERROR)
**\Anki2\addons21\someaddon\__init__.py**
```py
from aqt import mw
import aqt
# assuming add-on folder is named "test"
# and assuming a 'test.js' is in the same folder
addon_id = "someaddon"
port = mw.mediaServer.getPort()
mw.addonManager.setWebExports(addon_id, ".*\\.js$")
print("Hello")
aqt.editor._html += f"""
<script>
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'http://127.0.0.1:{port}/_addons/{addon_id}/test.js ';
document.body.appendChild(script);
</script>"""
```
2020-07-06 13:51:37 -03:00
Andreas Reis
e8ddd17fec
Always use standard QT color dialog on Linux
...
On Linux only Gnome uses its own color dialog, and it's inferior to QT's own: See the same issue @ https://github.com/OpenShot/openshot-qt/pull/2425
(This is/was visible only on some distributions' packaged versions of Anki, not via ./run.)
isLin check since QT on Windows already uses the default, whereas Mac's own picker seems superior (from what I can judge by screenshots).
2020-07-05 13:21:38 +02:00
Damien Elmes
4033f00988
don't stuff mw into function objects
...
Using the global is preferable to fighting against mypy to insert mw
into a function object.
2020-07-03 10:55:29 +10:00
Damien Elmes
14602be0ca
port previous css workaround to flask
2020-07-03 10:40:23 +10:00
Damien Elmes
e45c939649
Merge pull request #554 from evandroforks/fix_html5_media_support
...
Fixed HTML5 media tags
2020-07-03 10:25:43 +10:00
evandrocoan
476b881987
Replaced flask.Response by flask.make_response to simplify the
...
implementation and because make_response is preferred over Response
as it respects the server defined Response type.
2020-07-02 20:39:03 -03:00
evandrocoan
a99e455414
Removed duplicated mediasrv.py security check and fixed invalid
...
command/path error message.
2020-07-02 20:39:03 -03:00
evandrocoan
1218d109e8
Fix jest unit tests after merge
...
# Conflicts:
# qt/aqt/mediasrv.py
# qt/ts/src/ankimedia.ts
# qt/ts/src/reviewer-exceptions.test.ts
# qt/ts/src/reviewer.test.ts
# ts/package.json
2020-07-02 14:30:43 -03:00
evandrocoan
0142ac3ca2
Replaced send_from_directory by send_file to simplify the code
2020-07-02 13:52:07 -03:00
evandrocoan
1e6fa5f8eb
Ensure protection against directory transversal
...
https://security.openstack.org/guidelines/dg_using-file-paths.html
2020-07-02 13:52:03 -03:00
evandrocoan
be10da58d9
Fixed aqt/mediasrv.py:14: error: unused 'type: ignore' comment
...
from waitress.server import create_server # type: ignore
https://github.com/evandroforks/anki/runs/743801391#step:25:1129
2020-07-02 13:51:59 -03:00
evandrocoan
020415efb9
Replaced the mediasrv.py SimpleHttp server by flask and waitress,
...
fixing HTML5 media support.
https://stackoverflow.com/questions/37044064/html-audio-cant-set-currenttime
https://stackoverflow.com/questions/21956683/enable-access-control-on-simple-http-server
https://stackoverflow.com/questions/5052635/what-is-relation-between-content-length-and-byte-ranges-in-http-1-1
https://stackoverflow.com/questions/16725907/google-app-engine-serving-mp3-for-audio-element-needs-content-range-header
I was trying to use HTML5 audio tag to display audios like:
```html
<audio id="elem_audio" src="myfile.mp3" controls></audio>
```
![image](https://user-images.githubusercontent.com/5332158/79063321-565b5500-7c77-11ea-9f8d-6e1df6f07892.png )
But the progress bar seek was not working. After researching, I found the problem was the HTML server not properly responding to the HTML5 header requests. The HTML server should respond to quite complicated things as 206 partial, properly handle keep-alive, provide media ranges and other HTTP headers: https://stackoverflow.com/questions/37044064/html-audio-cant-set-currenttime
To implement all these on the Simple HTTP server would be quite complicated. Then, instead, I imported the `flask` web server, which is quite simple and straight forward to use. Now, the back-end is using a secure complaint HTTP back-end:
1. https://palletsprojects.com/p/flask/
> Flask is a lightweight WSGI web application framework. It is designed to make getting started quick and easy, with the ability to scale up to complex applications. It began as a simple wrapper around Werkzeug and Jinja and has become one of the most popular Python web application frameworks.
>
> Flask offers suggestions, but doesn't enforce any dependencies or project layout. It is up to the developer to choose the tools and libraries they want to use. There are many extensions provided by the community that make adding new functionality easy.
1. https://docs.pylonsproject.org/projects/waitress/en/latest/
> Waitress is meant to be a production-quality pure-Python WSGI server with very acceptable performance. It has no dependencies except ones which live in the Python standard library. It runs on CPython on Unix and Windows under Python 2.7+ and Python 3.5+. It is also known to run on PyPy 1.6.0 on UNIX. It supports HTTP/1.0 and HTTP/1.1.
Right now, anki does not support fields passing file names directly to HTML audio tags, but this can be easily done with (https://github.com/ankitects/anki/pull 540 - Added arguments to the sound tag) plus the commit 826a97df61
, the HTML5 audio tag can be used like this:
```html
// Audio = [sound:myfile.mp3|onlyfilename]
<audio id="elem_audio" src="{{Audio}}" controls controlsList="nodownload"></audio>
```
![image](https://user-images.githubusercontent.com/5332158/79063736-c539ad80-7c79-11ea-8420-40b72185f4e7.png )
# Conflicts:
# qt/aqt/mediasrv.py
2020-07-02 13:51:49 -03:00
Damien Elmes
48b6510aef
dump error on profile load fail
...
may help diagnose
https://forums.ankiweb.net/t/i-couldnt-open-anki-resetting-corrupt-global/190
2020-07-02 10:35:01 +10:00
Damien Elmes
04b1ca7559
defer top toolbar drawing until after add-ons loaded
...
https://forums.ankiweb.net/t/anki-2-1-28-beta/629/13
2020-07-02 10:23:14 +10:00
Damien Elmes
dfda5750a1
add new strings to .po files as part of template update
...
Pontoon appears to only update existing gettext translations; it
won't add new ones on its own. Fixes
https://forums.ankiweb.net/t/anki-2-1-28-beta/629/6
2020-07-02 10:03:39 +10:00
Damien Elmes
97869d0f57
fix scrollbars on fields on Windows/Linux
2020-07-02 09:51:50 +10:00
Damien Elmes
4d23a69e9a
formatting
2020-07-01 14:01:24 +10:00
Damien Elmes
6db954fbbe
don't allow table inside field to extend outside of field
...
https://anki.tenderapp.com/discussions/private/4498-adjust-textbox-geometry-in-add-note-window
2020-07-01 12:13:04 +10:00
Damien Elmes
bedd9dadb1
add option to disable media syncing
...
https://forums.ankiweb.net/t/error-when-adding-audio-file/495/2
2020-07-01 11:35:24 +10:00
Damien Elmes
05fb67d409
show clearer error when media db locked
...
should not happen frequently during a sync, but may happen during
the initial change checking stage
https://forums.ankiweb.net/t/error-when-adding-audio-file/495/2
2020-07-01 11:19:06 +10:00
Damien Elmes
40f270c386
shift+click on the graphs button to access old graphs for now
2020-06-30 20:07:46 +10:00
Damien Elmes
101deb002b
graphs now work in night mode
2020-06-30 16:23:46 +10:00
Damien Elmes
f3febea4b0
update edited/changed column labels
...
https://github.com/ankitects/anki/pull/674/files
2020-06-29 18:34:03 +10:00
Damien Elmes
52cd9fc4b8
plug new graphs code into GUI
...
Still some work to do. Feedback welcome!
2020-06-29 15:53:56 +10:00
Damien Elmes
d4cd4535e6
lint fixes
2020-06-29 15:53:56 +10:00
Damien Elmes
72609bee18
add option to webview to skip external browser open
2020-06-29 15:48:01 +10:00
Damien Elmes
1f4f5b8c45
include generated js in aqt_data
2020-06-29 15:48:01 +10:00
Damien Elmes
41d77b0255
get i18n working in typescript
2020-06-29 15:48:01 +10:00
Damien Elmes
329186f140
qt's js code now shares ts/node_modules; more graph work
2020-06-29 15:48:01 +10:00
Damien Elmes
2a3ef80c90
update qt ts to prettier 2.0
2020-06-29 15:48:01 +10:00
Damien Elmes
dcff5e28fa
add top level component and pass search/day limit back from frontend
2020-06-29 15:48:00 +10:00
Damien Elmes
82568a1f3e
experiment with exposing raw card/revlog data to frontend
2020-06-29 15:48:00 +10:00
Damien Elmes
35975b142b
Merge pull request #675 from kelciour/mpv-changes-2
...
A few mpv changes 2
2020-06-29 15:47:09 +10:00
kelciour
696f7e4373
Fix "make check" by defining dummy _register_callbacks method in MPVBase
2020-06-27 13:07:46 +03:00
kelciour
d1b74dfcb6
Fix no sound after mpv restart
2020-06-27 03:46:40 +03:00
kelciour
422e313c16
Replace mpv "idle" property with "end-file" event
2020-06-27 03:46:40 +03:00
kelciour
610f9eb236
Replace default mpv quit keybindings if mpv version is >= 0.30
...
4614d432a8
2020-06-27 03:46:40 +03:00
neitrinoweb
69f73b57e7
add type hints
2020-06-25 17:27:52 +03:00
neitrinoweb
c7db6331cf
fix missing typing import
2020-06-25 16:53:24 +03:00
Damien Elmes
5e5dc517ca
work around yet another qt bug
...
https://anki.tenderapp.com/discussions/beta-testing/2017-httpsforumsankiwebnettrestore-defaults-config-not-visually-updated420
2020-06-24 11:12:45 +10:00
Damien Elmes
ef55c0a2ee
remove the script-message commands that older mpv version don't support
...
https://github.com/ankitects/anki/pull/671#issuecomment-647798343
2020-06-23 14:30:42 +10:00
Damien Elmes
c3e007f069
remove mpv keybindings on init
...
On a machine here, they cause the following error:
raise MPVCommandError("%r: %s" % (message["command"], e))
aqt.mpv.MPVCommandError: ['keybind', 'q', 'stop']: invalid parameter
2020-06-22 13:22:57 +10:00
Damien Elmes
f24321dc65
Merge pull request #671 from kelciour/mpv-changes
...
A few mpv changes
2020-06-22 12:12:58 +10:00
Damien Elmes
2cd86f38f4
Merge pull request #670 from evandroforks/print_version
...
Create the command line argument -v/--version to print version
2020-06-22 12:06:18 +10:00
kelciour
678b751010
Reset pause mode when switching to the next file
2020-06-20 02:04:35 +03:00
kelciour
d64c26f20a
Replace deprecated "idle" event with "idle-active" property
2020-06-20 02:04:35 +03:00
kelciour
9aee8085e0
Disable OSC idle message
2020-06-20 02:04:34 +03:00
kelciour
ae533fce71
Replace default mpv "quit" keybindings with "stop"
...
https://github.com/mpv-player/mpv/blob/master/etc/input.conf
2020-06-20 02:04:34 +03:00
evandrocoan
9867e5e1f7
Create the command line argument -v/--version to print version
...
https://forums.ankiweb.net/t/i-couldnt-open-anki-resetting-corrupt-global/190
2020-06-19 13:13:10 -03:00
Arthur Milchior
3eabe4c3f7
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
b51f03085e
migrate card stats to backend
...
Currently this renders the HTML directly like the previous Python
implementation - doing it in JS would probably make more sense in the
future.
2020-06-15 17:22:16 +10:00
Damien Elmes
2845941a28
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
Damien Elmes
9e0494047e
Merge pull request #666 from BlueGreenMagick/studydeck-name
...
get deck name after adding deck
2020-06-12 09:12:21 +10:00
Damien Elmes
8f36a0fbb0
Merge pull request #665 from BlueGreenMagick/remove-a-var
...
Add type hints to deckchooser
2020-06-12 09:11:54 +10:00
Damien Elmes
37bf56c56e
remove ellipsis
2020-06-12 09:04:19 +10:00
BlueGreenMagick
e3889d49c9
add typehint to deckchooser.py
...
every occurunce of self.widget is type ignored
because QHBoxLayout has a method named widget
renaming this property will allow type hints
2020-06-11 14:19:36 +09:00
BlueGreenMagick
20da11f57e
refresh deck list when adding deck via deckchooser
2020-06-11 13:00:10 +09:00
BlueGreenMagick
4e6ba4df78
get deck name after adding deck
2020-06-11 12:50:17 +09:00
BlueGreenMagick
552db2b94d
remove self.deck set to mw.col as it isn't used
2020-06-11 11:59:27 +09:00
Quentin Nerden
86713d110e
Update message to match gui
...
The Change Note Type... command is under the Notes menu, not the Edit menu
2020-06-09 11:49:47 +02:00
Damien Elmes
f44597bb3a
Merge pull request #650 from evandroforks/remember_last_inputs
...
Remember last inputs for Find and Replace and Duplicates Find
2020-06-09 14:43:58 +10:00
Damien Elmes
3275aff335
Merge pull request #662 from gaul/screen/none
...
Handle None from QApplication.desktop().screen()
2020-06-09 14:42:59 +10:00
Damien Elmes
30a8d3260b
Merge pull request #655 from Arthur-Milchior/history_line
...
History line
2020-06-09 14:42:45 +10:00
Damien Elmes
62ab2ed36d
remove unused import
2020-06-09 14:14:12 +10:00
Damien Elmes
1aaf1059b4
formatting
2020-06-09 14:07:39 +10:00
Damien Elmes
c77d017135
catch invalid regex in search
...
https://github.com/ankitects/anki/pull/652
2020-06-09 11:46:07 +10:00
Damien Elmes
43da12a445
(un)escape image references in HTML editor to fix ampersand handling
...
https://anki.tenderapp.com/discussions/ankidesktop/41479-image-names-with-are-breaking
2020-06-09 11:22:07 +10:00
Andrew Gaul
e366b86af2
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
5f2987d0f8
allow input.conf in Anki data folder
...
https://anki.tenderapp.com/discussions/beta-testing/1964-anki-2128-alpha#comment_48382756
2020-06-09 10:26:25 +10:00
Damien Elmes
4033f6d37e
fix mistaken qconnect replacement
2020-06-09 10:20:16 +10:00
Damien Elmes
20ee0a8b1b
fix 'NoneType' object has no attribute 'latest_progress'
...
https://anki.tenderapp.com/discussions/beta-testing/1964-anki-2128-alpha#comment_48382636
2020-06-09 09:07:41 +10:00
evandrocoan
947f58032f
Moved the utils.py new save/restore functions together
2020-06-08 16:23:32 -03:00
evandrocoan
38fba41fb2
Renamed save_combo_index to save_combo_index_for_session
2020-06-08 16:23:28 -03:00
Arthur Milchior
c81a9b3d61
hook: history_line
...
I expect to use this hook to create an add-on which will simply remove
the ",,". By ignoring empty fields I expect to make this easier to
use.
2020-06-08 20:47:01 +02:00
Damien Elmes
7c444b4d35
add progress to db check
2020-06-08 21:07:36 +10:00
evandrocoan
1d32873869
Renamed new function on qt/aqt/utils.py to snake case
2020-06-08 01:35:31 -03:00
evandrocoan
b23b404f68
Created the profiles.py session attribute for things to forgot
...
each time Anki restarted and set to only fill the find and replace
dialogs when they were filled on the actual session.
2020-06-08 01:35:31 -03:00
evandrocoan
4bc895f7df
Moved restoreComboHistory below saveComboHistory as others
2020-06-08 01:35:31 -03:00
evandrocoan
87d051fa71
Set to browser.py finddupes.ui remember the last selected field
...
https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
evandrocoan
bf55ebbd8a
Added some type checking to utils.py QComboBox restore functions
...
# Conflicts:
# qt/aqt/utils.py
2020-06-08 01:35:31 -03:00
evandrocoan
f27ad0c524
Moved restoreComboHistory closer to restoreComboIndex on utils.py
2020-06-08 01:35:31 -03:00
evandrocoan
6047c6ecc0
Renamed setupComboBoxHistory to restoreComboHisotory,
...
saveComboActiveIndex to saveComboIndex, saveComboBoxHistory to
saveComboHistory and restoreComboActiveIndex to restoreComboIndex.
2020-06-08 01:35:31 -03:00
evandrocoan
a78b3d522e
Set to browser.py finddupes.ui remember the last search text
...
https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
evandrocoan
a74e43a515
Set to browser.py findreplace.ui remember the last selected field
...
by creating saveComboActiveIndex and restoreComboActiveIndex.
https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
evandrocoan
40f98a244f
Set to browser.py findreplace.ui remember the last regex/case
...
by creating the saveIsChecked and restoreIsChecked.
https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
evandrocoan
54d7f136cb
Created the setupComboBoxHistory and saveComboBoxHistory to remove
...
duplicated/common code.
https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
evandrocoan
3971ea5518
Set to remember the last replace input for findreplace.ui
...
https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
evandrocoan
ba99c5ecb5
Set to remember the last find input for findreplace.ui
...
https://anki.tenderapp.com/discussions/ankidesktop/39468-find-and-replace-does-not-remember-the-input-from-last-time
2020-06-08 01:35:31 -03:00
Damien Elmes
a0c1b68b86
Merge pull request #660 from brownbat/tooltip-positioning
...
Update tooltip() in utils.py
2020-06-08 11:40:43 +10:00
Damien Elmes
fd895c88ca
Merge pull request #659 from BlueGreenMagick/paste-typehint
...
add type hint to paste-related functions
2020-06-08 11:32:16 +10:00
Damien Elmes
26330da119
Merge pull request #657 from BlueGreenMagick/prof-name
...
don't allow addons21 as profile name
2020-06-08 11:30:27 +10:00
Damien Elmes
186ccc5f01
pin legacy modules
...
https://anki.tenderapp.com/discussions/ankidesktop/42248-potentially-serious-image-issue#comment_48388863
2020-06-08 11:12:51 +10:00
Thomas B
26b94e1948
Update tooltip() in utils.py
...
Allow x,y offsets to be specified for tooltip(), useful for accomodating longer tooltips.
2020-06-07 16:06:23 -04:00