Commit Graph

18 Commits

Author SHA1 Message Date
Damien Elmes
c1587254f4 use isort to tidy up imports 2019-12-20 19:19:29 +10:00
Damien Elmes
35964fa55c reduce editcurrent width constraint
https://anki.tenderapp.com/discussions/ankidesktop/35724-bug-edit-window-not-resizable
2019-09-02 09:52:04 +10:00
Damien Elmes
f6b2135129 fix some warnings 2019-03-04 16:01:10 +10:00
Damien Elmes
da2ddcc6e2 explicitly import _ and ngettext 2019-03-04 11:58:34 +10:00
Damien Elmes
819d0bdaf3 fix editcurrent not freeing webview on close 2019-02-19 08:01:11 +10:00
Damien Elmes
288ab2f8bf focus web area after delay in editcurrent
if fired immediately, web area fails to gain focus, leading to
a jumping cursor when clicking on a field for the first time
https://anki.tenderapp.com/discussions/beta-testing/1348-anki-217-beta#comment_46821120
2019-02-06 10:09:05 +10:00
Damien Elmes
372d5ed6e8 update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
Arthur-Milchior
b8523944ff The note in curentEdit is not changed until the window is closed.
https://anki.tenderapp.com/discussions/ankidesktop/31105-reopening-an-edit-window
I added a «reopen» method, which I believe may be useful in other
cases too. I check whether the method exists before calling it, so
there should be no compatibility problem.
2018-11-28 10:24:59 +01:00
Damien Elmes
0fc0616ad1 select current card in card layout from edit current 2018-07-23 12:54:26 +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
1fb2c96d07 use a full window on non-Mac platforms as well 2017-08-11 21:06:15 +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
5ef1692c78 fix duplicate constructor call in editcurrent 2017-07-27 16:25:15 +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
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
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
0994bd332c cancel sync if user elects to keep unsaved card content (#705) 2013-04-11 19:23:32 +09:00
Damien Elmes
d477df8c28 merged libanki and ankiqt into single distro 2012-12-21 16:51:59 +09:00