Commit Graph

136 Commits

Author SHA1 Message Date
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
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
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
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
a16aa73d6e switch to svg images for better hidpi rendering 2017-08-15 13:54:58 +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
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
3014839d29 browser -> browse 2017-08-11 22:04:06 +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
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
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
c668efa4b4 work around adjustHeightToFit() crashing on Linux 2017-08-10 15:03:05 +10:00
Damien Elmes
4dae8ef661 make sure we adjust browser toolbar height 2017-08-10 14:36:55 +10:00
Damien Elmes
016338fa07 delete preview timer ref 2017-08-08 20:02:37 +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
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
797a7ea229 refactor editor focus handling
this fixes a bug where navigating to the next/previous card using
shortcut keys resulted in the first field being clobbered

- get rid of the stealFocus option in favour of explicitly passing
focusTo to setNote()
- setFields() is no longer responsible for setting focus
- add focusTo var to the browser so that the row changed hook can
restore focus when navigating to next/previous card
- fix the row changed hook being called twice
- the blur event now includes the field number instead of relying on the
 editor to have the correct currentField
- the current field is set to null on blur
- use deferred js and a callback rather than keeping track of when we
were loaded
- add shift+tab shortcut to go to previous field
2017-08-05 15:16:20 +10:00
Damien Elmes
96938e583a update browser toolbar to use delayed js 2017-08-05 13:47:48 +10:00
Damien Elmes
d9b5d11312 fix conflicting add tags/jump to tags shortcuts 2017-08-04 17:39:40 +10:00
Damien Elmes
61654ff70a skip useless focus preservation when navigating via preview screen 2017-08-01 17:46:08 +10:00
Damien Elmes
7405c1e7f1 don't force browser column font unless overriden 2017-07-29 16:00:02 +10:00
Damien Elmes
49e2d82aae fade next card in
- to minimize pop-in of images and mathjax, fade the previous card
out and fade the next card in
- render the answer at the same time as the question so it can be
shown immediately
- move reviewer css to separate file
- remove image preloading code that should no longer be necessary
2017-07-29 14:24:45 +10:00
Damien Elmes
7ad6966943 split js code out into separate files, mathjax improvements
- js code that was previously bundled in .py files is now in the
web folder
- add helpers to create links to bundled files, and update
stdHtml() to accept a list of javascript files to include
instead of text
- render MathJax in card layout and preview screens - these should be
updated in the future to update the document dynamically like the
reviewer does
- start media server earlier so it can be used to serve content for
the toolbar, etc
- work around a bug in WebEngine on Windows that could cause the
media server to hang
2017-07-28 16:35:45 +10:00
Damien Elmes
94b1768ba8 use ctrl+delete for delete shortcut in both reviewer and browser 2017-07-26 10:52:04 +10:00
Damien Elmes
e635157ee4 move stats and sync buttons to the center 2017-06-23 14:03:18 +10:00
Damien Elmes
e93f4abcab fix deck expanded state being reset
the setExpanded() call was triggering the callback, turning off
expanded state

https://anki.tenderapp.com/discussions/ankidesktop/23841-bug-when-editing-card-fields-decks-automatically-collapse
2017-06-14 11:43:47 +10:00
Damien Elmes
43a662a250 hack around the browser not closing on sync
saveNow() must run asynchronously, but unloadCollection() was not
designed to. fix the issue by skipping the save, as it's unlikely
the user can move the cursor from the editor to the
main window and start a sync before the timer has automatically saved
the contents.
2017-04-12 18:40:37 +10:00
Damien Elmes
783767be0d Merge pull request #181 from Glutanimate/fix-previewer-navigation
Improve previewer navigation
2017-03-26 15:49:34 +10:00
Damien Elmes
bcdfeaa9c6 Merge pull request #180 from Glutanimate/preserve-tag-focus-in-browser
Preserve tag field focus when switching between cards in the browser
2017-03-26 15:49:03 +10:00
Glutanimate
a70e751238 Tweak previewer navigation behaviour 2017-03-24 17:09:16 +01:00
Glutanimate
0bcf60fea6 Tweak previewer navigation button display 2017-03-24 17:05:33 +01:00
Glutanimate
8f7f7db861 Preserve tag field focus when switching between cards 2017-03-24 16:23:48 +01:00
Damien Elmes
bb50976ce2 remove modeltest 2017-03-18 08:08:21 +09:00
Damien Elmes
17d68cc957 use a clearer name for fmtQA() 2017-03-14 15:48:40 +09:00
Henrik Enggaard Hansen
1dfc4466f1 Move card formatting to anki.utils 2017-03-13 15:52:02 +01:00
Damien Elmes
bcaf5762ec fix errors when previewing 2017-02-23 16:21:00 +10:00
Damien Elmes
9c2c590de9 Merge pull request #170 from illia-v/super-no-arguments
Use `super()` without arguments
2017-02-22 18:34:08 +10:00
Illia Volochii
ddc4c6a7e3 Use super() without arguments 2017-02-21 23:08:41 +02:00
Damien Elmes
7ebd66a1c8 add modeltest to browser; fix an issue with rowCount()/columnCount() 2017-02-19 14:30:35 +10:00
Damien Elmes
2fc47773b6 show error on invalid search 2017-02-02 21:00:58 +10:00
Damien Elmes
7c76a23cce we can revert to fix#1 for the modSchema issue now
as we save at start of change note type screen, instead of in
beginReset()
2016-07-14 21:49:40 +10:00
Damien Elmes
8e71554ac4 saveNow() now requires a callback
the current code was freezing when clicking on 'cards' in the
browser - it looks like like the javascript callback was never
being called despite calling processEvents(). so we need to
refactor the code to call saveNow() with a callback that does the
subsequent processing.

a lot of the browser code was implicitly calling saveNow() via
beginReset(), so we've had to change all that code to save
immediately before it begins any processing. found a probable bug in
the process - it doesn't look like onRowChange() was saving before
overwriting the note, so theoretically edits could be lost if the
user switched to another card very quickly after typing something.

onSearch() has been split into a GUI-activated onSearchActivated()
that takes care of saving, and a lower level search() that refreshes
the current search. it keeps track of the last search via an instance
variable so that it refreshes properly if a user accidentally adds
some characters to their search without activating the search, then
does something like reverse the sort order.
2016-07-14 20:23:44 +10:00