Commit Graph

50 Commits

Author SHA1 Message Date
Damien Elmes
a3bdd04d42 set bgcol in ankiwebview 2017-06-23 13:07:59 +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
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
Illia Volochii
13b7e01044 Stop inheriting from object
It is not needed in Python 3.
2017-02-07 00:21:33 +02:00
Damien Elmes
dd9acf0145 remove delete shortcut from More menu 2017-01-10 18:39:31 +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
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
a8e2f992c8 image support 2016-07-07 23:39:48 +10:00
Damien Elmes
39a2ddac51 fix 'loading' message by removing old type answer code 2016-07-07 11:08:32 +10:00
Damien Elmes
06169de6cd fix type answer 2016-07-05 13:14:45 +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
6f95527758 use the larger arrow only on windows, and in other screens 2015-09-28 23:09:30 +10:00
Damien Elmes
147c9a02e1 fix star to top right 2015-08-11 19:02:59 +10:00
Soren I. Bjornstad
186641ad8c add css id to the star used for marking
Can't automatically prevent the star from being affected by image resize
and other CSS properties, as even weirder things happen to it when we
try. However, this will give users the ability to fix it themselves.
2014-06-28 09:17:36 -05:00
Soren I. Bjornstad
d659d9cff7 add 'replay audio' button to previewer 2014-06-21 15:35:45 -05:00
Damien Elmes
7dc26ed31d only collapse cloze in type answer if single unique phrase 2014-03-28 07:25:27 +09:00
Damien Elmes
5044089d42 Revert "tweak heights and font sizes"
This reverts commit 9beed20dc0.

beta testers all seem to prefer the original smaller size
2014-03-27 14:02:55 +09:00
Damien Elmes
fe2c94b819 use different way of scrolling to answer to fix qt5 bug 2014-03-07 10:21:38 +09:00
Damien Elmes
9beed20dc0 tweak heights and font sizes 2014-03-07 10:16:38 +09:00
Damien Elmes
3b20de173f preserve order in multi cloze type answer; bump version 2014-01-30 00:34:42 +09:00
Damien Elmes
92eb4e71d4 ignore duplicates in cloze+type answer 2014-01-17 14:30:40 +09:00
Damien Elmes
a9c9452271 bury card option 2013-10-22 14:28:45 +09:00
Damien Elmes
fe3ce87020 make sure we escape html chars after type ans comp. (#960) 2013-09-20 14:57:05 +09:00
Damien Elmes
f6c19ca0b4 don't die if autojunk unavailable (#952) 2013-08-08 10:56:44 +09:00
steveaw
e5bc1650f9 Add hooks for context menus 2013-07-16 17:42:50 +10:00
Soren Bjornstad
b5521af059 fix incorrect instructions to "maintenance" menu
(on finding an empty card, tells user to go to old location of the empty
cards tool)
2013-06-25 10:59:00 -05:00
Damien Elmes
c0e061a9f4 make sure we show correct version when nothing typed in 2013-06-12 11:22:13 +09:00
Damien Elmes
51121f6e86 escape image links in clayout and preview as well (#903) 2013-06-10 15:28:34 +09:00
Damien Elmes
daca1af693 compare typed answer in nfc form 2013-06-05 18:39:42 +09:00
Damien Elmes
8b0fc36b29 turn timebox into confirmation dialog (#883) 2013-05-24 12:53:41 +09:00
Damien Elmes
e6ecbfd086 allow multiple spaces in type answer 2013-05-24 11:01:24 +09:00
Damien Elmes
b34404aa08 turn off autojunking
seems to give better results on long passages, eg
https://anki.tenderapp.com/discussions/ankidesktop/1108-the-typing-diffs-are-sometimes-less-than-helpful
2013-05-20 19:21:08 +09:00
Damien Elmes
d90652d0d6 a hack to ensure hr falls before answer comparsion 2013-05-20 17:56:01 +09:00
Damien Elmes
c3b0ae37aa experimental type answer refactor
- when answer not correct, show both the given and correct string in separate
  markup. we use red/green for the given string to indicate what was correct,
  but we use grey rather than red on the correct string to indicate what was
  missing, as red is misleading
- colours can now be customized in css with .typeGood, .typeBad and
  .typeMissing
- answer now shown in monospace so given/correct lines up; can be customized
  with code#typeans
- do away with 'correct answer was' text that people didn't like
2013-05-20 17:46:42 +09:00
Damien Elmes
dd4bae6e8d disable dragging of images in review window (#420)
webkit's default behaviour is to remove them from the media folder otherwise,
which we don't want
2013-05-17 15:01:01 +09:00
Damien Elmes
79d4451299 move full sync into preferences, and remove maintenance menu 2013-05-14 15:27:40 +09:00
Damien Elmes
c8fd2e2f87 future imports must go at top 2013-05-07 18:30:17 +09:00
Damien Elmes
13cbade4a3 use future division in those aqt files too 2013-05-07 15:27:35 +09:00
Mike Blume
dcf097b55f use futuristic division
Python used to use C-style division, where division of two ints was
truncated, and division involving a float resulted in a float.

This is confusing, because you often can't tell from looking at a
line of code in isolation what sort of division it's supposed to do.

With 'from __future__ import division' Python ensures that division is
always explicit.

// means (floored) integer division
/ means float division

regardless of argument types.

This should make the source a bit clearer now, as well as removing one
obstacle if Anki is ever ported to Python 3.
2013-05-05 11:09:16 -07:00
Damien Elmes
5951ccb09e preliminary preview support 2013-05-04 15:45:57 +09:00
ospalh
9239c62a42 Check for self.typedAnswer only after it has been set. 2013-04-27 16:12:03 +02:00
Damien Elmes
872cca14e9 tolerate html-commented type answer field (#599) 2013-04-11 16:55:24 +09:00
Damien Elmes
b1d9a39e36 suspend card option in reviewer 2013-01-29 09:46:17 +09:00
Damien Elmes
b2457811a2 optimize imports 2012-12-22 09:17:10 +09:00
Damien Elmes
551c1cf662 don't autorepeat delete key during review 2012-12-22 08:51:21 +09:00
Damien Elmes
d477df8c28 merged libanki and ankiqt into single distro 2012-12-21 16:51:59 +09:00