Commit Graph

872 Commits

Author SHA1 Message Date
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
Damien Elmes
54ea891564 another fix for add-on downloading 2016-08-02 11:51:44 +10:00
Damien Elmes
6377dd161f fix mesa driver being loaded on nvidia driver machines 2016-08-01 12:16:06 +10:00
Damien Elmes
f465dbd8ad use helvetica on mac 2016-07-26 10:34:16 +10:00
Damien Elmes
adda80fc33 refuse to run on qt5.7.0 2016-07-18 13:59:45 +10:00
Damien Elmes
6a109caa7c dialogs.open() needs to un-minimize as well 2016-07-18 13:02:21 +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
3be25cf900 fix nautilus failing to load in linux build 2016-07-14 21:06:33 +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
Damien Elmes
37bac3979c select all shortcut in fields 2016-07-14 11:56:18 +10:00
Damien Elmes
8fdda2bb9c tweak win button size 2016-07-12 16:40:13 +10:00
Damien Elmes
74de1face7 specify font size again on osx
we lose the native button appearance, but the text is too small to
read on OSX otherwise
2016-07-12 16:28:14 +10:00
Damien Elmes
85215018a5 another approach to fixing modSchema bug
start the progress dialog immediately so that askUser()
becomes part of the progress dialog's modality

the problem with the previous approach was that beginReset() attempts
to save the note again, leading to schema mismatches
2016-07-12 13:53:59 +10:00
Damien Elmes
166c6f4b3c remove debug statement 2016-07-12 13:43:21 +10:00
Damien Elmes
3fa597ed1a wait until saveNow() is done
fixes content missing if typed right before save, and add window
complaining that fields aren't empty when they appear so
2016-07-12 13:30:10 +10:00
Damien Elmes
44457e78d2 fix import of media 2016-07-11 14:56:58 +10:00
Damien Elmes
5b10d7c45b fix change note type getting stuck
thanks to stvad for the report
2016-07-11 11:34:12 +10:00
Damien Elmes
46dae2507b tweaks to UI font on win/lin 2016-07-08 16:17:06 +10:00
Damien Elmes
53f7457d4c swallow http server errors 2016-07-08 13:22:36 +10:00
Damien Elmes
00111e4182 re-enable add-on downloading 2016-07-08 13:17:33 +10:00
Damien Elmes
3afef3edb0 fix edit & delete bugs in add-ons section 2016-07-08 13:10:19 +10:00
Damien Elmes
807b7382cb add missing runHook to deck options 2016-07-08 12:59:10 +10:00
Damien Elmes
d0fcf6a2ff debug webengine dll problems 2016-07-08 12:34:30 +10:00
Damien Elmes
a8e2f992c8 image support 2016-07-07 23:39:48 +10:00
Damien Elmes
7d0eb6dd39 ignore copy/paste shortcuts except on mac 2016-07-07 23:34:19 +10:00
Damien Elmes
eddef71f75 prevent field from collapsing 2016-07-07 17:41:47 +10:00
Damien Elmes
9c569ac35c fix onHeight error by not reloading toolbar each note 2016-07-07 17:29:53 +10:00
Damien Elmes
258a10edc7 add titles to various webviews to make them easy to locate 2016-07-07 17:23:13 +10:00
Damien Elmes
d94c011c88 fix clayout preview, js errors
.exec_() and webengineview don't seem to play nicely together
2016-07-07 12:32:27 +10:00
Damien Elmes
39a2ddac51 fix 'loading' message by removing old type answer code 2016-07-07 11:08:32 +10:00
Damien Elmes
d831bbee5f fix exporting & one bug in stats image export 2016-07-05 19:52:26 +10:00
Damien Elmes
06169de6cd fix type answer 2016-07-05 13:14:45 +10:00
Damien Elmes
2d5affd3f2 Revert "hack around broken qwebchannel behaviour"
This reverts commit 447718c605.
2016-07-05 12:26:08 +10:00
Damien Elmes
44bf02d872 quieten beautifulsoup warning 2016-07-04 18:06:08 +10:00
Damien Elmes
d025fddfb4 Merge pull request #109 from subfusc/master
[Addons] Make it possible to distribute addons in a directory.
2016-07-04 16:35:49 +10:00
Damien Elmes
058fc373bd Merge branch 'master' of github.com:dae/anki 2016-07-04 16:33:03 +10:00
Damien Elmes
dfa479607c hook for showDeckOptions 2016-07-04 16:32:30 +10:00
Damien Elmes
d824f178cc Merge pull request #133 from hssm/browser-recenter
Fix automatic horizontal scrolling in browser
2016-07-04 16:29:45 +10:00
Damien Elmes
447718c605 hack around broken qwebchannel behaviour
https://bugreports.qt.io/browse/QTBUG-53411
2016-07-04 16:25:24 +10:00
Damien Elmes
704610ef8f remove button styling
qt5.7 loses system styling when zoom applied
2016-07-04 16:24:43 +10:00
Damien Elmes
94463991bc basic sync support
currently no progress shown on large uploads/downloads
2016-07-04 15:45:53 +10:00
Damien Elmes
a1caa93054 fix mem leaks in dialogs
- ensure we're cleaning them up after they're rejected
- run the garbage collector afterwards so the qwebengineprocess
  instances get cleaned up
2016-07-04 13:22:35 +10:00
Damien Elmes
eb3208e1e7 QKeySequence.Cancel is not in 5.5 2016-06-28 15:52:13 +10:00
Damien Elmes
a4cab1d8f2 remove setupFonts(), disable syncing 2016-06-23 12:06:16 +10:00
Damien Elmes
a001553f66 move the editor buttons into the webview
use new icons, which scale with dpi changes
2016-06-22 14:52:17 +10:00
Damien Elmes
8a7107ad8e tweak button appearance on osx 2016-06-22 14:43:59 +10:00
Damien Elmes
34b95514b5 import anki earlier so we can catch invalid python version 2016-06-22 14:42:41 +10:00
Houssam Salem
7a60482269 Fix automatic horizontal scrolling in browser 2016-06-07 16:32:19 +10:00
Damien Elmes
4e2bd3f739 resize toolbars to fit content 2016-06-07 14:27:33 +10:00
Damien Elmes
d7339d9a27 update editor, key handling in webview
keyPressEvent/etc no longer work with qwebengineview, so we need to
install an event filter to catch things like ctrl+c. drag & drop
doesn't seem to be supported until 5.7
2016-06-06 17:54:39 +10:00
Damien Elmes
9abc9fde9f use a channel for bridge
acceptNavRequest was not being called for rapid updates, so it's not
usable
2016-06-06 15:50:03 +10:00
Damien Elmes
de7e40537d port majority of code to qt5.5+
- a few issues to work out still, and editor changes not done yet
- for communication between webengine and python code, we set window
.location to 'http://anki/<something>' - the leading http is
necessary for qt to call the link handler, which was introduced
in qt5.5
- the designer files now use a promoted qobject to create instances
of AnkiWebView
- we use the css zoom property to alter webengine font size based on
system dpi
- prefs and addons folder stored in new location (at least for now)
2016-05-31 18:51:40 +10:00
Damien Elmes
15b349e3a8 start port to python 3
unit tests pass and main screens of GUI load
2016-05-12 14:45:35 +10:00
Damien Elmes
1dce3eaaff drop anki1 upgrade code 2016-05-12 14:20:59 +10:00
Damien Elmes
89a5777585 store profiles as blobs
the cPickle data may not be valid utf8, and even with
text_factory=str this seems to cause problems sometimes
2016-05-12 14:19:16 +10:00
Dmitry Mikheev
74e28058f7 sorry, a typo crept in 2016-05-05 03:26:13 +05:00
Dmitry Mikheev
692dcfd4e7 2 tooltips in Preview window and support Enter
Let's give the users tips over the arrow buttons
and provide passing Back Side / Next Card 
by pressing Enter key.
2016-05-05 03:21:04 +05:00
Damien Elmes
640d906230 fix bug in contributed patch 2016-05-01 13:32:17 +10:00
Dmitry Mikheev
75e574cb9f parameters to specify a desired title and size
Let's give authors of add-ons the ability to specify a desired title and minimum width and height of the message window.
2016-04-30 10:44:41 +05:00
Damien Elmes
80e45fee85 Revert "Deal with Internationalized Domain Name in URI"
This reverts commit a68af5f199.

Patch does not fix the issue on my machine, so reverting for now.
2016-04-27 20:43:11 +10:00
Roman Franchuk
a68af5f199 Deal with Internationalized Domain Name in URI
This fixes https://anki.tenderapp.com/discussions/ankidesktop/17132-anki-reports-an-error-when-pasting-an-image-from-non-ascii-url

The problem is that urllib2 can't work with IDN. However, it's perfectly valid
to have such URIs in HTML, and Firefox, when copying image, generates exactly
this kind of HTML.
2016-04-17 15:49:28 +03:00
Glutanimate
df4b74f7bb Preserve identical fields when switching note types 2016-04-10 13:11:25 +02:00
Damien Elmes
864a9135dc allow language changing in prefs
avoided adding this in the past as on a multi user system it allows
one profile user to annoys others by changing the interface language,
but it comes at the expense of easily changing the language for users
who choose the wrong one on first startup
2016-04-05 11:02:01 +10:00
Damien Elmes
9baccec002 update credits 2016-03-23 09:07:33 +10:00
Damien Elmes
781e592339 don't set current dir in file selector if it doesn't exist
some users were reporting hangs
2016-03-21 09:57:45 +10:00
Glutanimate
ec401a6c23 Add keyboard shortcut for 'Add Note' action in Browser (Ctrl+E) 2016-03-04 20:21:58 +01:00
Damien Elmes
3bbd0bca7e zip64 support, and import/export improvements
- we now allow exports over 2gb/64k files - AnkiMobile and AnkiDroid
will need to be updated to support this
- avoid compressing media files in export, as in the common case of
jpg/mp3 it's much faster with no increase in size
- exports and imports now show # of files processed
- mw.progress.update() now limits # of updates per sec
2016-02-26 10:01:46 +10:00
Damien Elmes
216a68f656 add missing comma in received patch 2016-02-22 10:42:27 +10:00
Damien Elmes
97311e33d9 suspend note -> suspend card 2016-02-22 09:31:00 +10:00
Damien Elmes
d15aafa940 Merge pull request #118 from Glutanimate/master
Add keyboard shortcut for 'Suspend Note' in Browser
2016-02-22 09:30:20 +10:00
Glutanimate
4c9d176272 Add keyboard shortcut for 'Suspend Note' in Browser 2016-02-21 12:10:02 +01:00
Damien Elmes
ed04b4ce3d BadZipFile -> BadZipfile 2016-02-18 18:49:44 +10:00
bogdanteleaga
1f1220cf7c Limit tags in custom study dialog to those in the selected deck 2015-11-21 14:38:21 +02:00
Damien Elmes
52f8a4a75e missed deck browser arrow 2015-09-29 13:32:26 +10:00
Damien Elmes
6f95527758 use the larger arrow only on windows, and in other screens 2015-09-28 23:09:30 +10:00
Sindre Wetjen
69a0110422 [Addons] Make it possible to distribute addons in a directory.
with addons that are large and e.g. use git, it is very inconvenient to
have any files that is outside the addon directory. This patch makes it
possible to create an executable dir that is loaded as an addon.
2015-09-27 01:14:57 +02:00
Damien Elmes
96a18d2872 use a different unicode arrow
the smaller arrow doesn't appear to be supported on English W10 installs
2015-09-26 13:02:27 +10:00
Damien Elmes
147c9a02e1 fix star to top right 2015-08-11 19:02:59 +10:00
Damien Elmes
70b7dd88ca Merge pull request #106 from hssm/fav-tree-rebuild
Rebuild browser tree without reconnecting signals
2015-07-03 18:48:00 +10:00
Houssam Salem
98d98ad363 Rebuild browser tree without reconnecting signals
Fixes a bug where adding or removing a saved search triggers
multiple click events on tree items.
2015-06-30 21:41:16 +10:00
Christian Krause
a65c20b3ad Avoid exception on exit
Closing anki when the preferences dialog
is open will cause an exception since
self.mw.col in Preferences is not available
anymore.

Avoid the exception by checking self.mw.col
again on accept().
2015-04-26 12:31:54 +02:00
Jonathan Hall
6f77eed9bf Recognize a couple new media formats.
Adding 'webp' was necessary for Anki to recognize WebP images
(https://developers.google.com/speed/webp/?csw=1) as images rather than
audio.  The addition of the audio formats was incidental, as it appears Anki
assumes audio files if a file is not an image file.
2015-03-15 17:33:48 -05:00
Damien Elmes
cdb1cb06a0 prevent sync error being shown twice when aborting 2015-03-13 16:03:52 +11:00
Damien Elmes
7024fed002 fix cont=False handling in sync 2015-03-02 21:09:12 +11:00
Damien Elmes
0262da2700 catch corrupt add-on downloads 2015-01-05 11:49:29 +10:00
Thomas TEMPÉ
3d81ef2c68 Avoid calling checkValid on an empty note
Fix error message when editFocusLost is called after editor destruction

https://anki.tenderapp.com/discussions/ankidesktop/11175-bug-in-browser-revealed-by-add-on?unresolve=true
To reproduce:
1. Install the attached add-on. (All it does is register a function on the editFocusLost hook, and set the flag to 1 to signify that a field has been updated).
2. Run Anki. Enter the Browse window. Press Enter to display your deck.
3. Select one card.
4. Click inside one of the fields for that card. Now, when you leave that field, the editFocusLost hook will be called.
5. Now, select 2 notes from the browser, with your mouse, without clicking anywhere else before.

You will observe this error message:

Traceback (most recent call last):
File "aqt/progress.pyc", line 69, in handler 
File "aqt/editor.pyc", line 467, in onUpdate 
File "aqt/editor.pyc", line 572, in checkValid AttributeError: 'NoneType' object has no attribute 'fields'
2014-12-31 22:36:12 +08:00
Houssam Salem
6e20bf7013 Load saved searches list in sorted order 2014-11-11 10:13:29 +11:00
Damien Elmes
6e7e08ebd0 be explicit about modSchema()'s check flag
- remove gui code that adds exceptions for syncing
- use check=False for all syncing and upgrade code
2014-11-03 16:28:12 +09:00
Soren I. Bjornstad
44425ab9d5 Merge branch 'master' of https://github.com/dae/anki 2014-10-23 14:23:14 -05:00
Damien Elmes
1f178b869f remove backspace to delete shortcut on macs
too many people activating it accidentally
2014-10-10 17:59:18 +09:00
Houssam Salem
9eaacf8977 Bump mod time when editing saved searches
Fixes saved searches not getting synced when modified.
2014-10-05 20:37:09 +11:00
Soren I. Bjornstad
9ec91724bf catch more invalid zip file errors 2014-09-27 10:19:43 -05:00
Damien Elmes
6b65cfc08f disable embedded fonts on osx 2014-09-27 10:26:14 +09:00
Damien Elmes
ece78a7d11 allow all ankiwebview instances to take focus
the canFocus/canCopy separate variables was silly, as we ended up
with text that could be copied from the context menu but not with
a shortcut key. also we default to allowing focus now, since that's
the more sensible default. fixes copy issues with card info dialog and
some addons
2014-09-15 15:04:14 +09:00
Damien Elmes
70db1035b1 catch another ssl error 2014-09-01 21:06:41 +09:00
Damien Elmes
8420fa02d1 Merge branch 'master' of https://github.com/sobjornstad/anki 2014-09-01 15:03:00 +09:00
Soren I. Bjornstad
a0e736ef39 accept Ctrl-Enter to close the edit current dialog
Esc already works, but since the Add dialog accepts it it's nice to have
as well.
2014-08-31 14:41:08 -05:00
Damien Elmes
3ce77fd25e Merge branch 'master' of github.com:dae/anki 2014-08-28 09:40:14 +09:00
Derbeth
8dedcdf6ac allow better translations of '1 note deleted' browser tooltip 2014-08-26 09:31:32 +02:00
Damien Elmes
346dfe1c7f start new instance if existing instance hung 2014-08-26 15:25:22 +09:00
Damien Elmes
591015417b Merge branch 'master' of https://github.com/sobjornstad/anki 2014-08-22 22:06:13 +09:00
Soren I. Bjornstad
f9f007e5c4 add C. van Rooyen to contributors 2014-08-17 13:46:08 -05:00
Soren I. Bjornstad
b19a1707fb put selection in a sensible place after deleting several cards
If the last selection was at the top, the new selection will be right
above the last-selected item; otherwise, it will be right below it.
2014-08-11 14:32:59 -05:00
Soren I. Bjornstad
a479bc7c48 change "discard field" to "ignore" in text importer
A user pointed out that once selected it said "ignore" and that
"discard" threatened that the information might be deleted.
2014-08-11 10:31:48 -05:00
Soren I. Bjornstad
9bb217f198 reduce tab width in template editor
The previous one was ridiculously wide; reduced to 30 pixels.
2014-08-10 14:36:13 -05:00