Commit Graph

1063 Commits

Author SHA1 Message Date
Damien Elmes
56e1643bfa allow pycmd() to return a value
based on pull request #228
2018-03-08 17:48:14 +10:00
Damien Elmes
9db9d144b9 don't show completion dropdown on focus in
obscures buttons and gives the impression something needs to be chosen
https://anki.tenderapp.com/discussions/ankidesktop/27132-anki-bug-with-tags-and-decks#comment_44820594
2018-03-02 12:19:10 +10:00
Damien Elmes
dc6ebca944 filter middle click pastes 2018-03-02 11:16:02 +10:00
Damien Elmes
25c3f2cb24 work around issues writing to Windows clipboard
https://anki.tenderapp.com/discussions/beta-testing/1014-cannot-copy-from-fields-in-anki-210beta36
2018-03-01 15:53:25 +10:00
Damien Elmes
53f0793b9e clean up deck chooser hook on importer close
fixes
https://anki.tenderapp.com/discussions/ankidesktop/20841-editingimport-limitation#comment_44777511
2018-03-01 14:20:30 +10:00
Damien Elmes
724513ca91 clarify 'delete unused' button, and don't show when n/a 2018-03-01 14:00:05 +10:00
Damien Elmes
c87b9be73a ignore delete key if card list is not focused
https://anki.tenderapp.com/discussions/beta-testing/1004-ctrl-delete-erases-my-cards
2018-03-01 13:31:52 +10:00
Damien Elmes
9902e21cba fix error when unsetting browser appearance 2018-02-26 11:21:12 +11:00
Damien Elmes
9a23f0958d load add-ons in consistent order
if ANKIREVADDONS env var is defined, reverse order for debugging

partially addresses pull req #225
2018-02-24 13:23:15 +11:00
Damien Elmes
8a15bc897b fix importing of v2 colpkg files 2018-02-05 15:30:57 +10:00
Damien Elmes
5cd063a8bd check shift key when paste starts; avoid progress dlg for local file
https://anki.tenderapp.com/discussions/ankidesktop/26661-conot-paste-image-and-text-together-from-word-into-anki
2018-02-05 13:40:56 +10:00
Damien Elmes
b08e25dafb fix temp folder msg 2018-02-05 12:34:38 +10:00
Damien Elmes
275af7e9b5 catch more problems with corrupt collections
if collapseTime is missing from col.conf, the initial load was
succeeding, but then the UI was getting stuck in moveToState()
2018-02-05 12:34:31 +10:00
Damien Elmes
a617be1779 prevent find duplicates scrolling to top on link click 2018-02-03 17:11:32 +10:00
Damien Elmes
1b7a7df4f0 raise profile window on macos
otherwise profile manager opens without focus
2018-02-01 12:14:04 +10:00
Damien Elmes
0cce540d83 enforce schema version; allow importing+exporting v2 scheduler
To avoid all sorts of problems, we need to ensure cards scheduled with
the V2 scheduler are not studied in older clients. Unfortunately we
can't just bump the file's schema version, as the existing clients will
freely import files created with newer versions. This patch changes
that, so things should be a bit easier in the future.

In the mean time, we need a way to prevent older clients from importing
files created with the V2 scheduler. To do this, we switch to using a
'collection.anki21' file in the archive, and include a dummy collection
.anki2 file.

The code has been tested with both deck and collection packages, but
exporting deck packages w/ scheduling info will remain disabled until
the V2 scheduler has had more testing.
2018-01-29 14:12:04 +10:00
Damien Elmes
8cceb24857 preserve newlines when pasting plain text 2018-01-26 19:18:24 +10:00
Damien Elmes
ed9110d530 fix unbury op w/ v1 scheduler 2018-01-26 19:05:08 +10:00
Damien Elmes
a6ccae95b6 remove missed format literals 2018-01-24 21:07:06 +10:00
Damien Elmes
d78176debe fix opening prefs screen in V1 sched 2018-01-22 11:24:45 +10:00
Damien Elmes
d3d61ce93f add option to show day learn cards before reviews 2018-01-20 16:07:57 +10:00
Damien Elmes
b17a0552d0 support customizing day cutoff w/ V2 scheduler 2018-01-20 15:32:52 +10:00
Damien Elmes
651b107b18 make preview delay customizable 2018-01-20 15:26:11 +10:00
Damien Elmes
fecd1a0354 log traceback in case of sync error 2018-01-20 11:24:01 +10:00
Damien Elmes
118326df1e remove format literals so we can support python 3.5 2018-01-16 16:07:30 +10:00
Damien Elmes
52313fd0bf work around progress dlg hang at startup on osx
with autosync on, when the progress dialog is closed and the main window
appears, it becomes stuck. hiding the dialog instead of closing it
seems to fix this.
2018-01-14 19:29:56 +10:00
Damien Elmes
bff61b95e9 hide second filter for v1 sched 2018-01-14 19:20:01 +10:00
Damien Elmes
b9aa3a3083 fix bad margins in progress dialog 2018-01-14 18:05:43 +10:00
Damien Elmes
3a059d15b5 check prefs21.db integrity
otherwise some corruption errors only become apparent when trying to
load an individual profile
2018-01-14 17:47:21 +10:00
Damien Elmes
1e0b97f25b support a second filter in filtered decks 2018-01-14 13:08:38 +10:00
Damien Elmes
4e52f43365 distinguish between buried siblings and manually buried cards 2018-01-14 12:16:53 +10:00
Damien Elmes
4070f4eef8 schedtest changes, squashed from local branch 2018-01-14 12:16:53 +10:00
Damien Elmes
1c390218fc fixes to progress window
- make sure _shown reset to False on finish()
- ignore calls to .update() after finish() called, which can happen with
async signals in the sync code
2018-01-14 12:16:47 +10:00
dubiousjim
df1704f578
Factor out definition of context menu in reviewer.py
Handle definition of context menu in same way that shortcutKeys are handled. This makes it easier for add-ons to modify the context menu without needing to re-implement the whole showContextMenu method.
2018-01-07 18:19:49 +01:00
Damien Elmes
5ad8f67f12 move away from qprogressdialog
qprogressdialog has been the source of a number of problems in the past,
and the most recent issue is that it's showing the progress dialog
early, regardless of what the minimum duration is set to. since we're
already using our own logic for deciding when to show the dialog, it's
easier to move to a normal dialog box

also prevent timers from firing while a progress dialog is visible, or
if the refresh timer fires we end up with the same issue.

https://anki.tenderapp.com/discussions/beta-testing/949-anki-stops-when-field-is-added
2017-12-28 18:31:05 +10:00
Kerrick Staley
61b4a6b655 Bind mediaserver on 127.0.0.1 instead of localhost 2017-12-24 23:10:07 -08:00
Damien Elmes
65b826d787 refuse to run on qt 5.10
- on Linux and Windows, opening the browser and stats window back and
forth multiple times triggers a crash in the GL libraries, even with
software rendering enabled. Will try again when .1 is out
- on Mac, shortcut keys fire multiple times:
https://bugreports.qt.io/browse/QTBUG-65184
2017-12-18 14:50:14 +10:00
Damien Elmes
405cea6a60 add context menu to browser 2017-12-14 14:49:51 +10:00
Damien Elmes
7981db1466 more raw string literals 2017-12-13 14:34:54 +10:00
Damien Elmes
81d4b77ee1 more open() and regex strings 2017-12-11 17:25:51 +10:00
Damien Elmes
bc65baeff7 cgi.escape is deprecated 2017-12-11 16:20:00 +10:00
Damien Elmes
fccfdef73d add a flag to keep editor buttons enabled when no field selected 2017-12-08 21:06:16 +10:00
Damien Elmes
774c19e83e add the ability to disable cert verification 2017-12-07 17:15:20 +10:00
Damien Elmes
39c0a57b13 work around pops in recording start
https://anki.tenderapp.com/discussions/ankidesktop/26005-when-recording-sound-on-mbp

on my machine, the pops start around sample 2048 of a 44.1khz recording,
and only for the first recording after the audio hardware has gone to
sleep
2017-12-05 11:07:52 +10:00
Damien Elmes
341da7385a ignore editor shortcuts when no field focused 2017-12-04 12:53:28 +10:00
Damien Elmes
c451141f97 play question audio when preview set to 'show both sides' 2017-12-04 12:45:22 +10:00
Damien Elmes
fcccf12ba6 night mode 2017-12-04 12:20:56 +10:00
Damien Elmes
15e102e047 make sure to preserve focus when reloading on editFocusLost 2017-12-04 12:03:01 +10:00
Piotr Kubowicz
879ca0b72b Allow to better translate "in x minutes"
"There is 1 minute" and "in 1 minute" need to be translated
differently in Slavic languages.

Additionally remove unused afterTimeTable.
2017-11-30 20:03:51 +01:00
Damien Elmes
9e5b909070 note media check stage in sync dialog 2017-11-27 11:21:03 +10:00
Damien Elmes
41205bd5ca allow user to override scaling
which may help wth issues like
https://anki.tenderapp.com/discussions/beta-testing/918-text-size-in-ubuntu-1710
and
https://anki.tenderapp.com/discussions/ankidesktop/25708-anki-with-high-dpi-screen
2017-11-27 11:01:15 +10:00
Piotr Kubowicz
674d45a606 Allow to better translate add-ons dialog 2017-11-19 10:28:04 +01:00
Damien Elmes
8e7ef1d1be detect image extension, catch errors, add timeout 2017-11-17 17:30:01 +10:00
Damien Elmes
56444ab967 don't check extension when localizing image sources
fixes https://anki.tenderapp.com/discussions/beta-testing/916-pictures-not-showing-on-iphoneipad-ios11-when-not-connected-to-internet
2017-11-17 16:20:33 +10:00
Damien Elmes
baae899864 don't error if pasted image in temp folder
https://anki.tenderapp.com/discussions/ankidesktop/25805-anki-21-error-reporting
2017-11-13 11:05:46 +10:00
Damien Elmes
e0d05e49d6 fix broken image links when pasting between fields
https://anki.tenderapp.com/discussions/beta-testing/853-anki-210-beta-21#comment_43959510
2017-11-11 11:51:30 +10:00
Damien Elmes
880243c361 disable main window while collection unloaded
fixes error when pressing y then d in rapid succession
2017-11-01 12:38:43 +10:00
Damien Elmes
1d3e5787a2 separate basic and extended paste modes
- basic mode is the default, and includes only HTML elements that can be
added/edited easily with the default editor
- extended mode is enabled by holding down shift and includes a bunch of
other HTML elements
2017-10-25 20:20:28 +10:00
Damien Elmes
23e0034278 use requests library for media downloads
fixes SSL errors when pasting media from https website
2017-10-25 19:42:20 +10:00
Damien Elmes
554ff3d8d2 drop experimental prewrap mode
- pasting in prewrap mode had been broken for a while and nobody noticed
- needs changes to export code and cloze handling code to deal with the
newlines
- newline rewriting in filterNode() is likely fragile
- may revisit post 2.1
2017-10-25 19:18:00 +10:00
Damien Elmes
c13b19820b clear audio queue when showing answer
fixes question audio playing again on answer
2017-10-25 19:00:24 +10:00
Damien Elmes
944bca0f44 fix type answer race condition
user may hit enter before the question has been written, due to fade out
delay
2017-10-24 17:08:36 +10:00
Damien Elmes
1cc29278f2 Revert "avoid setting modality in progress dialog"
This reverts commit 059db539a7.

seems to work correctly in qt 5.9.2
2017-10-20 13:25:38 +10:00
Damien Elmes
eaf09b5093 Merge branch 'master' of github.com:dae/anki 2017-10-20 11:26:15 +10:00
krassowski
f90f3dbc53 Clean up reviewer code from unused code 2017-10-18 16:12:04 +00:00
Damien Elmes
3df98573b4 fix detection of media links in paste
'.aspx' was matching the 'spx' filter
2017-10-18 21:58:36 +10:00
Damien Elmes
a6391bbe8c ctrl+d to deselect all in tag picker 2017-10-16 15:31:29 +10:00
Damien Elmes
ed151de19b don't die on _anki.png et al
https://anki.tenderapp.com/discussions/beta-testing/747-anki-210-beta-16/page/2#comment_43769227
2017-10-16 15:02:16 +10:00
krassowski
e21de9ed7e Setup shortcuts after setting-up web. 2017-10-11 18:51:26 +00:00
Damien Elmes
d8d6430ec7 fall back to mplayer if mpv not found or too old
ubuntu 14.04 looks to be using an ancient mpv version
2017-10-05 17:24:55 +10:00
Damien Elmes
33c5b5f9e7 remove lodpi hack, don't assume physical DPI is always 72 2017-10-05 16:42:46 +10:00
Damien Elmes
3840f012be catch errors caused by old mpv versions 2017-10-05 15:46:20 +10:00
Damien Elmes
0b15a4a3b3 show field numbers for easier positioning 2017-10-05 14:52:05 +10:00
Damien Elmes
7b844d12cb increase default number of backups; don't put in trash 2017-10-05 14:39:47 +10:00
Damien Elmes
f7062ff0c6 user-friendly warning when mpv missing 2017-10-05 13:48:24 +10:00
Damien Elmes
e1a4c52175 pass opts to main window; force zoom factor to 1 on lodpi 2017-10-03 12:12:57 +10:00
Damien Elmes
78d7ae388e make sure we clear the queue when previewing attached 2017-10-02 17:21:34 +10:00
Damien Elmes
d530134218 option to disable qt's hidpi scaling
https://anki.tenderapp.com/discussions/beta-testing/765-problem-with-the-ui-of-anki
2017-10-02 16:26:23 +10:00
Damien Elmes
7dc8f82906 mpv support 2017-09-30 19:29:48 +10:00
Damien Elmes
fad6b244cd normalize filenames in colpkg import 2017-09-30 19:29:21 +10:00
Damien Elmes
fff49a1370 Merge pull request #211 from krassowski/master
Allow to run App&GUI without entering the main event loop
2017-09-26 13:21:59 +10:00
krassowski
755c9487c9 Add docstring explaining introduced arguments of _run() 2017-09-23 15:01:29 +00:00
krassowski
b863d7972c Allow to run App&GUI without entering the main event loop 2017-09-21 03:02:39 +00:00
Damien Elmes
6007cf5e3a add missing shortcuts back to advanced menu 2017-09-19 17:07:28 +10:00
Damien Elmes
1842db2a8f work around python not handling non-latin hostname
https://anki.tenderapp.com/discussions/beta-testing/763-anki-does-not-seem-to-start-on-windows-10
2017-09-16 12:19:44 +10:00
Damien Elmes
5deb75f5c4 preserve user_files folder in add-ons 2017-09-10 18:53:47 +10:00
Damien Elmes
0bc4a1a220 replace _ with space in add-on names 2017-09-10 17:02:32 +10:00
Damien Elmes
905bd10efe use documents instead of desktop as default location
have observed users doing a collection export to their desktop, then
thinking that double clicking the collection file was the way to
start Anki in the future
2017-09-10 17:01:52 +10:00
Damien Elmes
0c80b5454f use separate .colpkg extension for collection exports
- allows translations of filename
- allows users to keep multiple collection exports in the same folder
- provides a clearer distinction between deck and collection packages
- the collection/backup .apkg special cases will continue to work in
future 2.1.x releases
2017-09-10 16:58:55 +10:00
Damien Elmes
b454d6f169 default to desktop in getSaveFile; don't force desktop in stats 2017-09-10 16:42:29 +10:00
Damien Elmes
1e2f934480 allow user to pick graph save location 2017-09-10 15:50:34 +10:00
Damien Elmes
d3d96222bc prefs and dialog tweaks
- manage prefs window so it only opens once, and gets closed properly
- provide silentlyClose shortcut to dialogmanager windows
2017-09-10 15:15:12 +10:00
Damien Elmes
a5bbdf0c5f fix backups failing to complete
the behaviour of daemon=True was the opposite of what I expected
2017-09-10 13:17:56 +10:00
Damien Elmes
c5188d9f3a fix backup rotation
add missing d and make pattern more specific
2017-09-10 12:56:27 +10:00
Damien Elmes
5bd2e10f3c close preview window on collection close 2017-09-08 19:44:13 +10:00
Damien Elmes
35923630bf make sure we update preview buttons at after state determined
fixes duplicate calls and inability to reveal answer of last card
2017-09-08 19:43:35 +10:00
Damien Elmes
4990b2f8eb mathjax tweaks
- drop support for $$ in favour of separate opening and closing tags
- add shortcuts to add mathjax
- don't highlight any clozes in blue if field contains mathjax chars
2017-09-08 19:20:37 +10:00
Damien Elmes
90a5a48d6c fix silentlyClose check 2017-09-08 18:42:26 +10:00
Damien Elmes
63befa7c0c force correct css mime type
fixes broken styling on machines with an incorrect mime type
2017-09-07 14:52:46 +10:00
Damien Elmes
2e7da0f3c6 provide more info in error screen, and link to support site 2017-09-06 16:40:35 +10:00
Damien Elmes
e518619ed3 Merge pull request #205 from matthin/master
Fix typo in error message
2017-09-06 13:04:06 +10:00
Damien Elmes
38688ef8ef prepareQA hook
see updated docs on https://apps.ankiweb.net/docs/addons21.html
2017-09-06 13:02:00 +10:00
Justin Harrison
5e3cee8c6c
Fix typo in error message 2017-09-05 15:29:45 -07:00
Damien Elmes
27b42fcac9 use readable name instead of mid in browser searches
mid should no longer be required now that note type names are made
unique
2017-09-02 16:15:01 +10:00
Damien Elmes
a0afec9938 escape ideographic space 2017-09-02 16:10:19 +10:00
Damien Elmes
a7ed7fa4e3 fix cutting and copying between fields
the shortcut keys are handled by webengine on platforms other than
osx, so rather than messing with an event filter we catch the cut and
copy events in js and send a signal back
2017-09-02 13:48:03 +10:00
Damien Elmes
be14703e7f strip trailing <br> tag when saving field 2017-09-02 13:26:57 +10:00
Damien Elmes
3b79204924 update self.card on multiple selection
fixes
https://anki.tenderapp.com/discussions/beta-testing/713-anki-210-beta-13#comment_43315776
2017-08-31 20:38:12 +10:00
Damien Elmes
f9f8b117d9 fix formatting preservation when pasting between fields
- make sure js is passed the internal flag
- make sure we flag text after the asynchronous clipboard change
- be explicit about clipboard data update
2017-08-31 18:10:37 +10:00
Damien Elmes
598df47967 Merge pull request #204 from glutanimate/tagedit-improve-keyboard-nav
Improve keyboard navigation in TagEdit
2017-08-31 16:04:59 +10:00
Damien Elmes
2689c7cfe1 setConfigAction() and writeConfig() should work in submodules 2017-08-31 14:41:00 +10:00
Glutanimate
8d6507c062 Space-separate inserted tags
New completions now show up after hitting space again
2017-08-30 14:52:58 +02:00
Glutanimate
e237324873 Show new autosuggestions on typing space 2017-08-30 14:19:15 +02:00
Glutanimate
a7cdff6d96 Invoke autosuggestion pop-up with arrow-key up/down 2017-08-30 13:13:10 +02:00
Glutanimate
153849c01b Apply first tag autosuggestion with Enter/Return 2017-08-30 13:11:03 +02:00
Glutanimate
0c85aed04a Navigate through tag autocompletions with Ctrl+Tab 2017-08-30 12:49:04 +02:00
Damien Elmes
7b93d8423f make sure media server can handle a flood of requests
fixes intermittent failures when loading js/css files, especially during
startup
2017-08-30 16:05:39 +10:00
Damien Elmes
5a11efa0e3 merge new keys from config.json into user conf 2017-08-30 15:31:03 +10:00
Damien Elmes
9fb9d9c902 Merge pull request #203 from glutanimate/previewer-both-sides-patches
Assign "both sides" toggle to hotkey, refresh preview on toggle
2017-08-30 15:03:32 +10:00
Glutanimate
fc59fab967 Assign "both sides" toggle to hotkey, refresh preview on toggle 2017-08-29 16:41:01 +02:00
Damien Elmes
9ddaa20881 syncing media -> syncing
in the no changes case, the progress window is forced open for a while,
making it look like media syncing is to blame
2017-08-29 14:11:41 +10:00
Damien Elmes
29d6d93881 option for showing both sides in preview screen 2017-08-28 22:16:05 +10:00
Damien Elmes
3faa82571c warn about subfolders 2017-08-28 22:01:13 +10:00
Damien Elmes
226bb2bc83 add record icon back to dialog 2017-08-28 21:46:22 +10:00
Damien Elmes
b28eb4fba6 add collection/deck shortcuts, refresh when saved changes 2017-08-28 21:43:44 +10:00
Damien Elmes
fa2e0e6428 fix clear flag text and shortcut 2017-08-28 21:17:16 +10:00
Damien Elmes
a4b45af5a9 fix scrollbar appearing in toolbar
https://anki.tenderapp.com/discussions/beta-testing/675-anki-210-beta-10/page/2#comment_43239350
2017-08-28 21:15:38 +10:00
Damien Elmes
737a8d934e persistent add-on configuration
- add-ons can ship default config in a config.json file
- users can edit the config in the add-ons dialog, easily syntax-check
the json, and restore it to the defaults
- an optional config.md contains instructions to the user in markdown
format
- config will be preserved when add-on is updated, instead of being
overwritten as is the case when users are required to edit the source
files

A simple example: in config.json:

{"myvar": 5}

In your add-on's code:

from aqt import mw
config = mw.addonManager.getConfig(__name__)
print("var is", config['myvar'])

Add-ons that manage options in their own GUI can have that GUI
displayed when the config button is clicked:

mw.addonManager.setConfigAction(__name__, myOptionsFunc)
2017-08-28 20:51:43 +10:00
Damien Elmes
b0a62838b5 profile tweaks
- handle unpickling of anki 2.0 prefs
- copy the prefs on first load, as python2 is not capable of reading the
protocol 3 pickles we write for proper bytes support
- when there's an error unpickling, write a clean copy of the
preferences instead of forgetting all profiles and starting from scratch
2017-08-28 18:35:24 +10:00
Damien Elmes
a96ddfc3fd allow templates and add-ons to hook into reviewer updated/shown
eg

from anki.hooks import addHook

def prepare(q):
    return q + """
<script>
onUpdateHook.push(function () {
    window.scrollTo(0, 2000);
})
</script>"""

addHook('prepareQuestion', prepare)
2017-08-28 14:54:22 +10:00
Damien Elmes
76b4343c5e fix browse link 2017-08-26 22:40:11 +10:00
Damien Elmes
92fe869653 fix error on add-on download
suspect this was the cause of the mystery enclosing scope errors as well
2017-08-26 19:55:39 +10:00
Damien Elmes
02a3e14c13 setupEditorShortcuts is a hook, not a filter
add-ons can modify cuts in place
2017-08-26 18:47:45 +10:00
Damien Elmes
7288a9b063 new add-on handling
- separate dialog for managing add-ons
- only add-ons compatible with Anki 2.1 will be shown on AnkiWeb
- can delete or toggle disabled on multiple add-ons at once
- check for updates button
- button to view add-on's AnkiWeb page

The new handling drops support for single file .py add-ons, and requires
add-ons to store all files in a single folder. This ensures all files
are cleaned up properly when updating or deleting an add-on, and
prevents file conflicts between separate add-ons. See the updated
add-on docs for more:

https://apps.ankiweb.net/docs/addons21.html#add-on-folders
https://apps.ankiweb.net/docs/addons21.html#sharing-add-ons

README.addons has been moved to the above page
2017-08-26 15:14:20 +10:00
Damien Elmes
7b1747d650 don't throw an error when closing with tooltip or debug window open 2017-08-25 12:14:59 +10:00
Damien Elmes
5b0d740948 Merge branch 'master' into editor-addbutton-convenience-function 2017-08-24 18:26:51 +10:00
Damien Elmes
ec27ca52b2 Merge pull request #200 from glutanimate/editor-button-labels
Reintroduce button labels for the Editor
2017-08-24 18:20:55 +10:00
Damien Elmes
5d05264f86 Merge pull request #199 from glutanimate/pass-editor-instance
Pass on Editor instance when running "setupEditorShortcuts" filter
2017-08-24 18:19:28 +10:00
Damien Elmes
77bbc14c59 remember export folder location 2017-08-24 14:38:05 +10:00
Glutanimate
e0038f8003 No need to assign QShortcut to variable 2017-08-24 00:17:28 +02:00
Glutanimate
2d0e74ee5f Convenience function to assign function a button, bridge cmd & shortcut
This is meant to more closely replicate Anki 2.0.x`s _addButton method
than the current one does. Its primary purpose is to reduce the
boilerplate code needed for add-on authors to implement a new button
alongside its hotkey.
2017-08-23 23:55:24 +02:00
Glutanimate
d7bf865524 Reintroduce button labels for the Editor
Anki 2.0.x provided add-on authors with the ability to define
labels that could be used instead of icons. This commit reintroduces
that ability and makes the use of an icon optional.
2017-08-23 23:48:08 +02:00
Glutanimate
16221cc47a Pass on Editor instance when running "setupEditorShortcuts" filter 2017-08-23 23:37:11 +02:00
Damien Elmes
13b331fb0a fix translations and shortcuts on editor buttons 2017-08-17 13:51:54 +10:00
Damien Elmes
3ad9261c8c catch corrupt media db, fix it in 'check media' 2017-08-17 13:33:54 +10:00
Damien Elmes
194c02ed16 make sure we swallow the exception when closing
otherwise the main window sticks around with no collection
2017-08-16 21:06:50 +10:00
Damien Elmes
4467b7c991 restore marking support
maybe multiple mark types would make sense in the future, but for now
let's stick to what will work in the older clients
2017-08-16 20:30:29 +10:00
Damien Elmes
a66c5f555f revamp profile manager
- use a main window instead of a dialog, so the menu items of the main
window don't appear while the profile window is active on OS X
- the profile manager now has a button to automatic restoring from
backup, which will prevent old backups from being clobbered
- drop support for profile passwords
- do the right thing when user quits from the menu in profile manager
mode
2017-08-16 19:45:39 +10:00
Damien Elmes
059db539a7 avoid setting modality in progress dialog
when modal, the program hangs on OS X when moving back and forth
between the main window and the profile manager, and I haven't been able
to find a better workaround

.update() ignores user input when processing events, so this will
hopefully not break things
2017-08-16 17:43:56 +10:00
Damien Elmes
489d16ed14 refactor profile and collection loading/unloading
- unloadCollection() now waits for all collection windows to
indicate they've closed, and calls a callback when it's done
- autosync runs when the collection is unloaded, and is no longer
responsible for reloading it
- make sure backup thread runs until completion
- ensure we return to profile manager when collection can't be loaded
- don't run the profile manager with exec_(), or opening+closing a
broken profile ends up nesting runloops
- warn if a window wasn't cleaned up as part of collection unloading
2017-08-16 17:39:37 +10:00
Damien Elmes
b3a569ed57 progress dialog tweaks
- don't use mw as parent if it's not visible
- wider
2017-08-16 13:20:29 +10:00
Damien Elmes
8ab5a3a176 use callback when closing windows
remove the old forceClose hack in favour of a callback when closing, so
all windows have a chance to save properly before the collection is
unloaded

also:

- fix a warning shown when opening about screen
- require a call to editor.cleanup() when closing a window, to make sure
 any pending js callbacks don't try to fire on a deleted object
- make sure we gc webview when closing editcurrent
- main.py still needs refactoring to make use of the change
2017-08-16 12:48:15 +10:00
Damien Elmes
ca9d80c014 py3 always has a db progress handler 2017-08-16 11:50:00 +10:00
Damien Elmes
b28ca8c0d1 make saveNow() consistently fire callback after returning to event loop
avoid gotchas with callback firing in the middle of a close event, etc
2017-08-16 11:49:33 +10:00
Damien Elmes
265bef2b68 likewise for manage note types 2017-08-15 18:49:41 +10:00
Damien Elmes
29dc4f298a add 'clear unused tags' back to menu
users who only use the sidebar may miss it
2017-08-15 18:48:22 +10:00
Damien Elmes
bef6e5bcf5 treat name resolution failure as internet offline 2017-08-15 18:46:07 +10:00
Damien Elmes
b558712976 filter menu tweaks
- make the chunking and menu code more generic
- decks and note types now chunk menus too
- chunked menu now shows start and end prefix
2017-08-15 18:41:36 +10:00
Damien Elmes
1b53ad4555 dock tweaks
- add frame to tree because dock widget has no frame on Windows, looking
 odd
- remove the title bar
2017-08-15 15:19:22 +10:00
Damien Elmes
f693edb328 make sure dock widget doesn't start out floating 2017-08-15 14:54:13 +10:00
Damien Elmes
a8ce74a784 compensate for qt's integer scaling on windows
fixes

https://anki.tenderapp.com/discussions/beta-testing/687-high-resolution-display-scaling-issue
2017-08-15 14:47:03 +10:00
Damien Elmes
a16aa73d6e switch to svg images for better hidpi rendering 2017-08-15 13:54:58 +10:00
Damien Elmes
30e6a34d25 only focus webview after fields have been set
on some platforms the old approach was causing a focus+blur event to
fire with the old note contents

fixes

https://anki.tenderapp.com/discussions/beta-testing/681-red-cloze

and probably fixes

https://anki.tenderapp.com/discussions/beta-testing/683-back-input-returns
2017-08-15 11:38:32 +10:00
Damien Elmes
8e2154dfbf change backup filename
- embed date in name to make it easier for people to locate correct
backup
- move old backups to the trash instead of deleting outright
- backups in the old format will not be rotated, and will need to be
deleted by the user - if we just deleted them at the start of  the
rotation it could lead to data loss for users moving back and forth
between 2.1 and 2.0
2017-08-14 18:53:39 +10:00
Damien Elmes
44c764b895 fix sidebar showing, tweak icons 2017-08-14 16:57:43 +10:00
Damien Elmes
c8127ee606 hideable sidebar
- rely on restoreGeom() to preserve visibility
- case-insensitive sort on tags
2017-08-13 19:11:40 +10:00
Damien Elmes
c4029e5680 shortcut keys to jump to first 9 templates 2017-08-12 17:29:47 +10:00
Damien Elmes
71101d041a ditch marked tag in favour of card flags
Users can now mark individual cards with one of four different coloured
flags, instead of relying on a tag that applied to the whole note.

- replaced marking functionality in reviewer and browser with new
flag options
- added flag:x search
- marked and leech tags now show in normal tag list in filter screen,
instead of being treated specially
- the other clients will need updating to set and shown the flags, but
flags set in the beta should be preserved by the other clients
2017-08-12 16:08:10 +10:00
Damien Elmes
6bbd6d2dd5 limit length of clayout field summary 2017-08-12 14:42:19 +10:00
Damien Elmes
3014839d29 browser -> browse 2017-08-11 22:04:06 +10:00
Damien Elmes
03b0ff4565 tidy up card name list 2017-08-11 21:44:05 +10:00
Damien Elmes
1fb2c96d07 use a full window on non-Mac platforms as well 2017-08-11 21:06:15 +10:00
Damien Elmes
75f58b86d6 disable rather than hide drop down in clayout cloze case 2017-08-11 21:04:17 +10:00
Damien Elmes
ba16b8714b remove images and move away from qt resources
- the bulk of image use is in webviews, so we move almost all used
images to web/imgs, as it's easier to manage
- change AnkiWebView to always use the local media server as a base, as
much of the UI has come to depend on it
- remove images from a few areas, as they felt dated
- delete a bunch of unused images
- href=# links were being opened in a browser window, so the code now
ignores them - the HTML should really be updated to return false in the
onclick handler
- update a few icons
2017-08-11 20:59:43 +10:00
Damien Elmes
3be43c2309 use ip for loopback, as localhost is wrong on some machines 2017-08-11 20:37:04 +10:00
Damien Elmes
2415611450 remove sidebar in browser
use a pop-up menu instead, which saves a lot of screen real estate and
should be more intuitive for new users

also:

- add options to manage note types and clear unused tags in the relevant
submenus
- shuffle a few shortcut keys
- remove the old favourites code - saving and removing now done via the
menu
- individual card templates now searchable
2017-08-11 19:10:39 +10:00
Damien Elmes
6c765d7302 remove toolbar in browser in favour of menu items 2017-08-11 14:40:51 +10:00
Damien Elmes
55b782581d global reviewer override, fix fading in previewer/clayout
you can use the debug console to define custom html/css/js to be added
to the bottom of the reviewer on all note types, so to increase the fade
time on the question you'd use

mw.col.conf["reviewExtra"]="<script>qFade=500;</script>"
mw.col.setMod()

also make sure the fading for question/answer is used correctly in
previewer, and use answer fading in clayout to speed it up
2017-08-10 21:39:04 +10:00
Damien Elmes
85d4511766 hide sound tags in preview screen 2017-08-10 21:11:38 +10:00
Damien Elmes
9af28b7159 proper fix for preview window's 'please select 1 card' message
setting self.card to None caused the following:

https://anki.tenderapp.com/discussions/beta-testing/661-anki-210-beta-7#comment_43180378
2017-08-10 19:32:19 +10:00
Damien Elmes
06fcccaf44 remove border on bottom toolbar; fix hacky spacing of top elements 2017-08-10 19:17:28 +10:00
Damien Elmes
f3f90842dc move the inline css and some more js into separate files
- stdHtml() css= arg now takes a list of files like js=
- the files are loaded in the head of the document so that styling
that comes later in the document can easily override it

fixes:
https://anki.tenderapp.com/discussions/beta-testing/661-anki-210-beta-7/page/1#comment_43164447
https://anki.tenderapp.com/discussions/beta-testing/661-anki-210-beta-7#comment_43177130
2017-08-10 19:02:32 +10:00
Damien Elmes
c8e8225395 remove unused bodyClass arg 2017-08-10 18:10:50 +10:00
Damien Elmes
c668efa4b4 work around adjustHeightToFit() crashing on Linux 2017-08-10 15:03:05 +10:00
Damien Elmes
a57b913450 opt in to qt's full hidpi support
doesn't seem to affect the webviews on Linux, so we need to keep the old
zoom code around for now
2017-08-10 15:02:46 +10:00
Damien Elmes
4dae8ef661 make sure we adjust browser toolbar height 2017-08-10 14:36:55 +10:00
Damien Elmes
3c5abe4af8 summarize used fields in card type list 2017-08-09 11:11:39 +10:00
Damien Elmes
2219736adc if focusTo provided, ensure webview is focused
fixes https://anki.tenderapp.com/discussions/beta-testing/661-anki-210-beta-7#comment_43155562
2017-08-08 20:25:42 +10:00
Damien Elmes
016338fa07 delete preview timer ref 2017-08-08 20:02:37 +10:00
Damien Elmes
d55318d83f clayout refactor
- tabs became difficult to read when users had a lot of templates, so we
use a combobox instead
- move the More button to the top and integrate adding/removing
templates
- start with no focus to avoid accidental modifications
- display confirmation before adding template
- remove 'edit to customize' text that some users had trouble editing
2017-08-08 19:45:31 +10:00
Damien Elmes
23f8e15816 give the preview window the same treatment
different approach to timer handling so that it's more responsive when
the user clicks a navigation button
2017-08-08 16:28:53 +10:00
Damien Elmes
4d064e1cba wait for keystrokes and don't reload entire page 2017-08-08 16:07:18 +10:00
Damien Elmes
2c54139d3c move main clayout area out of tab widget
it was wasteful to use separate webviews for each tab; still to come is
avoiding setHtml() for each edit, and either moving to a tab bar or
combo box
2017-08-08 15:31:36 +10:00
Damien Elmes
c74cbf6108 fix media server port allocation
the old code was allowing the main thread to read .port before it had
been updated, and was binding to sockets that were already in use on
Windows. instead, we use a system-assigned free port and block the main
thread until it's been allocated
2017-08-08 14:56:34 +10:00
Damien Elmes
bee6931dc9 fix issues with media server not going away
- use a non-daemonized python thread
- shut the server down on exit, including from profile manager
- use a timeout on requests, or the connection that webengine holds open
will block the thread and prevent it from exiting when anki closes
2017-08-08 12:55:30 +10:00
Damien Elmes
cfb50fa03c add hook for overriding state shortcuts 2017-08-08 10:09:12 +10:00
Damien Elmes
7ad8d761d1 put search prompt in dropdown history so down key does right thing
https://anki.tenderapp.com/discussions/beta-testing/661-anki-210-beta-7#comment_43157037
2017-08-08 10:05:10 +10:00
Damien Elmes
dc81af96ac fix autoplay on the answer side 2017-08-07 16:15:15 +10:00
Damien Elmes
538119201c ensure deferred js is executed on the correct page
setHtml() and deferred js now share a single queue, to ensure that js
calls are delivered to the correct page

also remove the onLoadFinished hook, which is no longer used
2017-08-07 16:01:35 +10:00
Damien Elmes
9c63714e80 delay setHtml() until previous page has fully loaded
based on 0241eb70dc
2017-08-07 15:15:31 +10:00