Commit Graph

976 Commits

Author SHA1 Message Date
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
Damien Elmes
b0213b9fd7 ignore webchannel events received after webview deleted
thanks to David for the report
2017-08-07 14:51:42 +10:00
Damien Elmes
27f992c6b4 Merge pull request #193 from techdavid/fix-paste-url-with-hash
Fix error when dropping/pasting media file with a hash in its name
2017-08-07 12:19:30 +10:00
David Bailey
d4cf870ff7 Fix error when dropping/pasting media file with a hash in its name 2017-08-06 18:03:00 +01:00
David Bailey
4c43fcfe4e Prevent "Shorcut key: " appearing multiple times in tooltips 2017-08-06 16:03:11 +01:00
Damien Elmes
a11035b2fa Revert "fix TypeError: channel.execCallbacks[message.id] is not a function"
This reverts commit 331239de05.

This commit caused the blur event from the editor to fire after the saveNow()
callback had run, which broke the reviewer when returning from editcurrent.
Reverting for now, as the actual error is harmless AFAICT.
2017-08-06 15:12:28 +10:00
Damien Elmes
21b770cb10 explictly exit
let's see if this helps with https://anki.tenderapp.com/discussions/beta-testing/631-anki-210-beta-4/page/2#comment_43137707
2017-08-06 14:10:51 +10:00
Damien Elmes
51a0e5fa4b fix field content showing under editor buttons 2017-08-06 13:55:09 +10:00
Damien Elmes
331239de05 fix TypeError: channel.execCallbacks[message.id] is not a function
we need to avoid calling setHtml() until the bridge command has
had a chance to pass its return code back down the channel
2017-08-06 13:46:18 +10:00
Damien Elmes
718b4b35d1 don't translate js console msgs 2017-08-06 13:10:51 +10:00
Damien Elmes
68d55239b4 rework fade in code
there were a number of issues with preloading:
- it could result in duplicate IDs in the document
- embedded styles failed to apply, because a preloaded item was
overriding them
- the type answer code needed rewriting to support it

so we're back to something closer to the old approach - a single node
that we fade out, update, and then fade in again. this means there's a
longer delay when revealing mathjax, but should minimize the breakage of
existing notes
2017-08-06 12:01:30 +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
a56bddeb8d fix gifs failing to load
specifying max-height on img elements wasn't working when the parent
was an absolutely positioned element
2017-08-04 18:39:16 +10:00
Damien Elmes
d9b5d11312 fix conflicting add tags/jump to tags shortcuts 2017-08-04 17:39:40 +10:00
Damien Elmes
d656bff059 add contributor 2017-08-04 17:38:39 +10:00
Damien Elmes
37d3996be0 move height resizing to webview; remove onLoaded from toolbar/reviewer 2017-08-02 16:22:54 +10:00
Damien Elmes
538678a7a9 remove old comment 2017-08-02 16:18:09 +10:00
Damien Elmes
7d14a96889 automatically defer eval() calls until DOM loaded 2017-08-02 16:17:08 +10:00
Damien Elmes
321c4d7ff8 no longer need to hack around webengine stealing focus 2017-08-02 15:38:35 +10:00
Damien Elmes
9958dd57a4 remove superfluous lambda arg 2017-08-02 11:34:49 +10:00
Damien Elmes
61654ff70a skip useless focus preservation when navigating via preview screen 2017-08-01 17:46:08 +10:00
Damien Elmes
9ec9274011 fix fields being overwritten when dropping
remove the unneeded setFocus() call which was causing the blur event
to fire with the wrong data
2017-08-01 17:40:51 +10:00
Damien Elmes
66500f5262 move webview js into separate file 2017-08-01 17:04:55 +10:00
Damien Elmes
cd76281695 avoid errors caused by calling setHtml() before previous page loaded 2017-08-01 14:30:04 +10:00
Damien Elmes
0543a4533b add devMode flag to utils
also remove the extra toolbar call in loadProfile(), as we require a
restart to update the translations anyway
2017-08-01 14:28:13 +10:00
Damien Elmes
a5997e400b fix focus setting in resume screen 2017-08-01 13:57:15 +10:00
Damien Elmes
412d37fc13 another workaround for the KDE accelerator issue 2017-07-31 15:48:34 +10:00
Damien Elmes
b81a64272e allow browser override font to be unset 2017-07-29 16:09:00 +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
8cd20f3352 turn latex svg into a note type option
needed until the other clients support svgs
2017-07-28 18:38:31 +10:00
Damien Elmes
608a5662a9 fix ampersands appearing in deck names
https://bugs.kde.org/show_bug.cgi?id=345023
2017-07-28 17:40:26 +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
5ef1692c78 fix duplicate constructor call in editcurrent 2017-07-27 16:25:15 +10:00
Damien Elmes
fa3461e20b mathjax support 2017-07-27 14:18:10 +10:00
Damien Elmes
3d9d792dd4 bundle web folder 2017-07-27 12:28:44 +10:00
Damien Elmes
e7abd9f4ed fix crash when syncing media on windows
update() was being called when processing events, leading to
recursion until the stack was exhausted

https://anki.tenderapp.com/discussions/beta-testing/639-anki-210-beta4-crashing-during-syncing
2017-07-26 15:21:27 +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
630cddc786 fix superscript shortcut
https://anki.tenderapp.com/discussions/beta-testing/627-anki-210-beta-1#comment_43048185
2017-07-22 10:54:45 +10:00
Damien Elmes
17bb179d06 experimental prewrap support
- add option to wrap html in implicit pre-wrap environment during
editing and review - defaults to off
- update paste filter to convert divs/Ps to newlines and non-breaking
spaces to normal ones
- catch enter key and write \n instead of creating a new div

also:

- remove extra caretToEnd() call that is no longer required
- add dd/dt/dl to allowed tags
2017-07-20 12:16:47 +10:00
Damien Elmes
f7b3457ff0 fix drawLinks reference 2017-07-17 14:54:12 +10:00
Damien Elmes
dffab1376f Merge branch 'master' of github.com:dae/anki 2017-07-17 13:16:06 +10:00
Damien Elmes
d99dcaafdc don't open separate browser window on iframe load
https://anki.tenderapp.com/discussions/beta-testing/627-anki-210-beta-1#comment_43008395
2017-07-17 12:40:38 +10:00
Dmitry Mikheev
5bfd93842c Let users extend their bottom buttons functions
Like this:
```
aqt.deckbrowser.DeckBrowser.drawLinks.extend([
            ["", "rebuildAll", _("Rebuild All")],
            ["", "emptyAll", _("Empty All")],
])
```
2017-07-15 18:39:01 +05:00
Damien Elmes
7ecd889d8f preserve newlines and indents when pasting text
https://anki.tenderapp.com/discussions/ankidesktop/24123-paragraphsnew-lines-not-preserved-when-copypasting-into-anki
2017-07-12 10:57:01 +10:00
Damien Elmes
14597bd888 if a non-media link pasted, paste the url text directly 2017-07-11 14:58:22 +10:00
Damien Elmes
7d71170a33 catch windows firewall issue 2017-07-09 13:26:50 +10:00
Damien Elmes
15ca733f14 fix base folder location on windows 2017-07-09 13:22:01 +10:00
Damien Elmes
2d25069936 run garbage collector after webengine window
we GC on autosave, but doing an explicit GC prevents excess memory
consumption when rapidly opening and closing windows using
webengine
2017-07-08 12:28:11 +10:00
Damien Elmes
c392418ba7 bump version 2017-07-05 10:54:27 +10:00
Damien Elmes
2b8987f654 fix browse add-ons command failing to load on linux 2017-06-27 12:04:42 +10:00
Damien Elmes
1fe86e1bde about tweaks
- fix sort order
- treat as a collection window so it's only opened once, and is
closed on quit
- use our standard font
2017-06-26 13:05:11 +10:00
Damien Elmes
90f7038109 fix exit code 120 when quitting in python 3.6 2017-06-26 13:03:05 +10:00
Damien Elmes
ea5f2bb0ef don't need to set bgcol when the window is transparent 2017-06-24 19:15:14 +10:00
Damien Elmes
7bd33242cf disable pinch to zoom gesture 2017-06-23 14:34:56 +10:00
Damien Elmes
e635157ee4 move stats and sync buttons to the center 2017-06-23 14:03:18 +10:00
Damien Elmes
a3bdd04d42 set bgcol in ankiwebview 2017-06-23 13:07:59 +10:00
Damien Elmes
7af591cfd7 add cancel button to recording window 2017-06-23 13:04:32 +10:00
Damien Elmes
1b41e68f05 remove gradients from toolbars in favour of system colour 2017-06-22 18:06:40 +10:00
Damien Elmes
a3fa2ff5ba remove duplicate <html> in editor, set bg on page creation 2017-06-22 18:01:47 +10:00
Damien Elmes
59f877737e start webview as transparent to reduce flicker 2017-06-22 18:01:01 +10:00
Damien Elmes
7d86984a12 turn off webview cache to reduce memory footprint 2017-06-22 17:06:33 +10:00
Damien Elmes
aa77df0805 give toolbars an approx height to reduce flashing at startup 2017-06-22 16:56:29 +10:00
Damien Elmes
aeaf9df32f ensure only one copy of stats shown, and close with collection 2017-06-22 16:51:54 +10:00
Damien Elmes
34dcf64d76 another attempt at fixing key handling
we can't use an event filter on the top level webview, because it
ignores the return value of the filter and leads to Anki thinking
keys have been pressed twice

and if we use an event filter on the focusProxy(), the
keypress/release events are sent even when a text field is currently
focused, leading to shortcuts being triggered when typing in the answer

to solve this, we move away from handling the key press events
directly, and instead install shortcuts for the events we want to
trigger. in addition to the global shortcuts, each state can install
its own shortcuts, which we remove when transitioning to a new state

also remove the unused canFocus argument to ankiwebview, and accept a parent
argument as required by the code in forms/
2017-06-22 16:39:31 +10:00
Damien Elmes
22f2fdf7d6 fix esc key in type answer field
without the change, the selection disappears but typed characters
still go to the input area
2017-06-22 15:10:47 +10:00
Damien Elmes
ac81fefc14 add note about being an alpha 2017-06-14 11:59:58 +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
25cc3eceb5 make sure stats window starts focused on osx 2017-06-07 11:50:29 +10:00
Damien Elmes
017984c15c fix crash when opening profile from profile manager 2017-06-06 16:09:15 +10:00
Damien Elmes
76e508e25d various key handling fixes
- key presses while a webview is focused no longer make it to the
main window's keyPressEvent() routine, so AnkiWebView now uses its
event filter to pass the key events to the main window
- move the shared key handling out of keyPressEvent into
globalKeyHandler()
- make sure all key handling routines return true or false to
indicate if an event was handled or not
- remove focus when esc hit in the main window, to retain old
behaviour of allowing esc to clear focus from the type answer box
2017-06-06 15:56:21 +10:00
Damien Elmes
c24f122d6e require qt 5.9 2017-06-06 14:33:53 +10:00
Damien Elmes
ca08b742fa Revert "work around https://bugreports.qt.io/browse/QTBUG-54755"
This reverts commit 0bd79abe11.
2017-06-05 16:52:22 +10:00
Damien Elmes
476aedbd6b fix issues with 'lots of decks' msg
https://anki.tenderapp.com/discussions/beta-testing/460-anki-210-alpha-13#comment_42641183
2017-05-28 11:13:16 +10:00
Damien Elmes
e9104de197 add Guillem to about 2017-05-09 12:40:34 +10:00
Damien Elmes
22ca4c24de Merge pull request #186 from wetriner/master
'QDialogButtonBox' object has no attribute 'finished'
2017-05-04 11:59:49 +10:00
wetriner
80418c0fb7 'QDialogButtonBox' object has no attribute 'finished' 2017-05-02 23:22:01 -10:00
Dmitry Mikheev
50736ecf1d What about this one? 2017-05-03 13:55:24 +05:00
Damien Elmes
3991603bf4 Merge branch 'master' of github.com:dae/anki 2017-04-28 13:31:55 +10:00
Damien Elmes
8a2b1889aa suggest users start with add-ons disabled to diagnose problem 2017-04-28 13:31:40 +10:00
Dmitry Mikheev
b5fac33cc4 Otherwise showText never saves Geometry 2017-04-27 01:25:16 +05:00
Damien Elmes
5bf0040838 fix errors when closing the main window with browser still open
onClose() was calling closeAllWindows(), which sends a close signal
to dialogs without force=True, causing them to fire an asynchronous
save event that calls back after the collection has been closed

instead we just rely on the fact that unloadCollection() closes all
collection windows
2017-04-26 11:22:17 +10:00
Dmitry Mikheev
69fd37a5c4 2make top webview accessable
as well as main and bottom
2017-04-21 22:21:05 +05: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
857733c8e9 Use the same formatting for the browser and card history 2017-03-13 15:52:27 +01:00
Henrik Enggaard Hansen
1dfc4466f1 Move card formatting to anki.utils 2017-03-13 15:52:02 +01:00
Damien Elmes
07f175cec8 add m4a to attachable media formats 2017-03-02 12:10:13 +10:00
Damien Elmes
b06133a2e4 Merge pull request #174 from henrikh/master
Add name to about screen
2017-02-27 14:32:35 +10:00
Damien Elmes
9009703f0e Merge branch 'master' of github.com:dae/anki 2017-02-27 14:29:54 +10:00
Henrik Enggaard Hansen
e7ecb9c6a9 Add name to about screen 2017-02-26 15:19:34 +01:00
Damien Elmes
c2f7b48a29 use QStandardPaths instead of the env var 2017-02-25 18:07:01 +10:00
Damien Elmes
97f280923c Merge pull request #172 from Glutanimate/master
Add another name to about screen
2017-02-25 13:48:21 +10:00
Damien Elmes
90167b139a Merge pull request #171 from luoliyan/master
Add name to about screen
2017-02-25 13:47:59 +10:00
Glutanimate
96a252bebb Add another name to about screen 2017-02-25 02:41:26 +01:00
luoliyan
bf8fddfabc Add name to about screen 2017-02-24 21:41:47 +09:30
Damien Elmes
bcaf5762ec fix errors when previewing 2017-02-23 16:21:00 +10:00
Damien Elmes
d1ebc8d805 add dmitry to about.py
Anyone else who's contributed anything to Anki - however small - is most
welcome to be listed in the about screen. Sending me a pull request that
adds your name or alias would be easiest, but if that is difficult
please let us know on the support site and we'll do it for you.
2017-02-23 14:41:07 +10:00
Damien Elmes
8085f8bc04 refuse to load on qt5.8.0 due to lack of IME support, etc 2017-02-22 18:36:46 +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
Damien Elmes
57c8e43327 change profile folder on windows and linux
onedrive seems to frequently screw up the permissions on the documents
folder. since we're stuck with more difficult to find folders on
mac/win, we may as well migrate linux as well, to a more
standards-compliant path.
2017-02-22 18:16:19 +10:00
Illia Volochii
ddc4c6a7e3 Use super() without arguments 2017-02-21 23:08:41 +02:00
Damien Elmes
0f04744f7e fix embedded fonts 2017-02-21 13:27:29 +10:00
Damien Elmes
745108bffd make sure we close all windows prior to unloading the collection 2017-02-19 15:13:58 +10:00
Damien Elmes
7ebd66a1c8 add modeltest to browser; fix an issue with rowCount()/columnCount() 2017-02-19 14:30:35 +10:00
Damien Elmes
6335dcb90e canonicalize to NFC form on edit/import 2017-02-19 12:49:52 +10:00
Glutanimate
d530d5fdef Remove temporary note when switching note model 2017-02-16 05:00:49 +01:00
Damien Elmes
082448744d Merge pull request #165 from luoliyan/fix-tooltip-import
Fix NameError caused by missing import
2017-02-16 12:57:19 +10:00
luoliyan
c7e5a618a5 Fix NameError caused by missing import 2017-02-15 23:08:37 +09:30
luoliyan
e892a30728 Fix error caused by converting delimiter to bytes 2017-02-15 18:45:04 +09:30
Damien Elmes
b58c082e29 tweaks to add-on downloading
- avoid opening and closing multiple progress dialogs
- report errors at the end; download what we can
- update dialog text
2017-02-15 15:55:31 +10:00
Damien Elmes
f483753b6c Merge pull request #163 from ankitest/patch-7
Install addons by spaced list; showInfo -> tooltip
2017-02-15 15:37:20 +10:00
Damien Elmes
41dc837712 Merge pull request #162 from luoliyan/master
Handle invalid delimiters more gracefully
2017-02-15 13:42:21 +10:00
Damien Elmes
6d39c8f0cb Merge branch 'master' of github.com:dae/anki 2017-02-15 13:41:40 +10:00
Damien Elmes
88d8be32d9 allow setting base via env var 2017-02-15 13:41:19 +10:00
Dmitry Mikheev
94894d3750 Install addons by spaced list; showInfo -> tooltip
Allow users to install multiple addons simultaneously listed by white spaces
without asking user to hit the key after installation.
2017-02-14 09:48:46 +05:00
luoliyan
7002a2a4f8 Handle invalid delimiters more gracefully 2017-02-13 21:42:19 +09:30
Simone Gaiarin
b52159edd0 Improve usability of increase new/review card limit dialog
*Show to the user the number of card left in the deck exceeding the ones under review
*Fix spin box max value accordingly
2017-02-11 20:11:31 +01:00
Simone Gaiarin
dfa183a461 Remove unuseful statement, it does nothing 2017-02-11 20:11:30 +01:00
Damien Elmes
e870468ad6 Merge pull request #159 from illia-v/stop-object-inheritance
Stop inheriting from `object`
2017-02-08 17:02:09 +10:00
Illia Volochii
13b7e01044 Stop inheriting from object
It is not needed in Python 3.
2017-02-07 00:21:33 +02:00
Henrik Enggaard Hansen
86c332e064 Typographic changes in history string 2017-02-05 09:13:14 +01:00
Henrik Enggaard Hansen
ce8ae436ea Insert ellipsis in history string 2017-02-05 08:45:08 +01:00
Damien Elmes
2fc47773b6 show error on invalid search 2017-02-02 21:00:58 +10:00
Damien Elmes
9ed315cbb7 fix progress window getting stuck on ubuntu 16.10
https://anki.tenderapp.com/discussions/beta-testing/231-anki-210-alpha-9#comment_41810358
2017-01-25 16:50:57 +10:00
Damien Elmes
6ae21e86af remove print statements that were causing unicode errors 2017-01-25 15:12:48 +10:00
Damien Elmes
b81998a374 stop logging gc 2017-01-20 15:12:48 +10:00
Damien Elmes
02975d43ad partial sync cancellation
each time we send or receive a chunk of data we check to see if the
user wants to cancel sync

in the case of a hung connection, it will still take a minute to time
out
2017-01-17 17:15:50 +10:00
Damien Elmes
fe8f6d518a embedded fonts should work on osx now; remove font-weight hack 2017-01-17 14:45:12 +10:00
Damien Elmes
9761e88ce5 ensure bottomWeb shown again when exiting resetRequired 2017-01-17 14:05:05 +10:00
Damien Elmes
c382a83395 stop forcing XP mode on windows
IIRC we were doing it to work around an issue in an older qt
2017-01-17 13:53:02 +10:00
Damien Elmes
a44dc7f174 prevent backspace key from going back a page 2017-01-17 13:39:38 +10:00
Damien Elmes
f68d5a4285 Merge pull request #154 from simgunz/editor-buttons
Editor buttons
2017-01-16 15:08:23 +10:00
Simone Gaiarin
b57ee28ae7 Add check on file existence 2017-01-14 21:16:50 +01:00
Damien Elmes
a76c6a1bcf use 'Library/Application Support' to match 2.0.x 2017-01-13 21:14:04 +10:00
Damien Elmes
864fbdf469 turn off buffering on crash log, and log gc start/finish 2017-01-13 20:56:24 +10:00
Damien Elmes
ed07a147f9 support for saving stats to a pdf 2017-01-13 17:36:26 +10:00
Damien Elmes
a05ebdbefb do GC on autosave
- ensures we're not called as part of the db progress callback
- minimises the chance of data loss if a gc causes a crash
2017-01-13 16:20:39 +10:00
Damien Elmes
7d1b894b45 add small bottom margin between "Fields"/"Cards" and field area 2017-01-10 19:02:29 +10:00
Damien Elmes
dd9acf0145 remove delete shortcut from More menu 2017-01-10 18:39:31 +10:00
Damien Elmes
6e933793f6 Merge branch 'master' of github.com:dae/anki 2017-01-10 18:35:31 +10:00
Damien Elmes
08747747bf prevent preview stealing focus in clayout
setHtml() steals focus due to webengine bug - fixes
https://anki.tenderapp.com/discussions/beta-testing/206-anki-210-alpha-7#comment_41700440
2017-01-10 18:32:48 +10:00
David Bailey
620db69544 Fix bug caused when deleting a card just added and clicking History 2017-01-09 10:55:30 +00:00
Damien Elmes
75c22c999b Merge branch 'master' of github.com:dae/anki 2017-01-09 14:35:15 +10:00
Damien Elmes
fb349a0a16 Merge pull request #150 from techdavid/fix-history
Show latest data under History in the Add dialog
2017-01-09 14:35:02 +10:00
David Bailey
4b83ba50f5 Show latest data under History in the Add dialog 2017-01-08 13:48:58 +00:00
Simone Gaiarin
a5c24aaca0 Add option to make button toggleable 2017-01-08 14:34:18 +01:00
Simone Gaiarin
67246f8c80 Add method to convert resource to data uri, add button image with this 2017-01-08 13:52:47 +01:00
Simone Gaiarin
81ed10faee Add id param name and fix typo on duperscript id 2017-01-08 13:52:47 +01:00
Damien Elmes
fe0954beba make it clear to use why anki's suggesting a download
avoid showing the upload button to prevent accidental data loss; user
can add a card if they want to upload
2017-01-08 22:21:58 +10:00
Damien Elmes
0dc08bbacc fix error appearing when undo shortcut pressed when nothing to undo 2017-01-08 20:47:26 +10:00
Damien Elmes
70e751f6ec disable the delete card shortcut
is being triggered when user has focus in text input due to webengine
 bug
2017-01-08 20:45:27 +10:00
Damien Elmes
e2573d6a1a fix error when writing to deleted.txt 2017-01-08 20:44:52 +10:00
Damien Elmes
9fbdca26a4 hack to preload images
this doesn't always work, presumably due to sibling burying
2017-01-08 20:37:20 +10:00
Damien Elmes
7ac1f6d3fe fix DEBUG=1
the errors.py code was overwriting the excepthook installed in qt.py
2017-01-08 20:30:34 +10:00
Damien Elmes
a172af11a1 use in-memory cache for webengine
no need to persist things to disk, as we have a local copy in most
cases anyway
2017-01-08 20:02:49 +10:00
Damien Elmes
1405cddc6e require qt5.7.1+ 2017-01-08 19:34:31 +10:00
Damien Elmes
259023f369 write backups in thread; remove strip html & compress options
we do the backup compression/writing in a separate thread so it
doesn't slow down profile switching/syncing, and remove the option
to write uncompressed backups

the strip html option is no longer used, so remove it from preferences
2017-01-08 19:29:57 +10:00
Damien Elmes
f6245cdfd1 use requests for http; add progress info back
- wrap request in AnkiRequestsClient so we can keep track of
upload/download bytes without having to monkey patch anything
- force a 64kB buffer size instead of the default 8kB
- show one decimal point in up/down so small requests still give
visual feedback
- update add-on downloading and update check to use requests
- remove the update throttling in aqt/sync.py, as it's not really
necessary anymore
2017-01-08 19:06:32 +10:00
Damien Elmes
147e09a6cb run the gc only in the main thread
if it fires in the mediasrv/sync thread it could cause a crash
2017-01-08 14:42:50 +10:00
Damien Elmes
9f28d5a638 set up fault handler 2017-01-08 13:39:57 +10:00
Simone Gaiarin
42ea7c53dd Add optional id in parameters 2017-01-06 16:43:05 +01:00
Simone Gaiarin
1c8c34b443 Add padding among buttons
For some reason after using the new _addButton method the padding among the buttons is not there any more. So I add it manually.
2017-01-06 16:43:05 +01:00
Simone Gaiarin
abc3224fe3 Remove old tooltips 2017-01-06 16:43:05 +01:00
Simone Gaiarin
4e4947bd92 Run filter on right buttons list 2017-01-06 16:43:05 +01:00
Simone Gaiarin
5051dcedb6 Add anki buttons using the new method
The html of each anki button is stored in a list that is joined in a string at the end. This make it easier to run the filter.

Drawback: Only buttons on the right side of the editor can be added using the filter.
2017-01-06 15:57:02 +01:00
Simone Gaiarin
37e345ffe8 Replace _addButton method with HTML based one
Support loading icon from anki qrc resource file or using the absolute path
2017-01-06 15:57:02 +01:00
Simone Gaiarin
5775c3f92e Add filter on topbuts to allow addons to add buttons 2017-01-05 12:42:19 +01:00
Simone Gaiarin
81b60c6dc4 Add css id to editor buttons div
This facilitate the processing with beutifulsoup or similar parser
2017-01-05 12:42:19 +01:00
Damien Elmes
5b71b720c2 Merge branch 'master' of github.com:dae/anki 2016-12-26 13:04:32 +10:00
Marcio Mazza
a1f29c2bd2 Remove editor dependency on ECMAScript 6
It seems that ES6 is not available on Qt 5.5.
2016-12-19 12:59:20 -02:00
Damien Elmes
7871949a6a fix window not resizing properly
#12 of https://anki.tenderapp.com/discussions/beta-testing/203-anki-210-alpha-5#comment_41542208
2016-12-19 10:18:47 +10:00
Damien Elmes
9c04ac6a8e fix opening of explorer folders on windows 2016-12-17 13:23:05 +10:00
Damien Elmes
b56ca60d2f remove mac setLibraryPaths() call 2016-12-16 21:20:08 +10:00
Damien Elmes
0bd79abe11 work around https://bugreports.qt.io/browse/QTBUG-54755 2016-12-15 21:12:51 +10:00
Damien Elmes
fb81f63fe3 work around broken debug console shortcut
this will likely break the shortcut on keyboards where : is not a
shifted ;. can revert when qt fixes the issue
2016-12-15 21:00:59 +10:00
Damien Elmes
9b6a21126d drag&drop support, and paste refactor
- insert resulting html directly into fields instead of relying on
fragile clipboard rewriting
- catch paste events in js and send them back to python so we cover
all possible ways of pasting
- use checksum in pasted image filenames instead of .cacheKey(),
which was not unique across runs
- try each _processX() in turn instead of having special cases inside
them
- rewrite the HTML filtering:
 - img rewriting and stripping of certain tags handled in bs4; other
 processing handled in js for easier sharing with other clients
 - use a whitelist of HTML tags and properties instead of focusing
 mainly on webkit cruft
 - don't run filter when focus lost, as it no longer seems to
 be necessary
 - the "strip html" option is currently ignored
2016-12-15 18:14:47 +10:00
Marcio Mazza
e7eaf5f378 Fix open addon folder
The open folder operation would break if the environment variable
LD_LIBRARY_PATH was not set
2016-11-28 18:02:30 -02:00
Damien Elmes
6131b149da Merge pull request #142 from goapunk/master
Fix the lambda function for changing the mapping of the fields
2016-10-20 17:16:09 +10:00
noobie
1a665cc185 Suppress the BeautifulSoup filename warning
Bs4 will raise a warning if the markup (field input) starts with '/'. Suppressing the warning is probably the easiest solution, as Bs4 will still process it (no disadvantages?).
2016-10-20 04:00:34 +02:00
noobie
90128cf2d5 Fix the lambda function for changing the mapping of the fields
The connect signal passes a bool to the given function by default, we need to ignore it.

use underscore for the sake of idiomology
2016-10-19 22:45:46 +02:00