Commit Graph

50 Commits

Author SHA1 Message Date
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
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
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
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
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
70db1035b1 catch another ssl error 2014-09-01 21:06:41 +09:00
Damien Elmes
cf801e4fb4 display more feedback when syncing media
deletes in particular take some time for the server to process, but
don't require much bandwidth, leading to the progress appearing to
have pause when content is actually being processed

this also gives the user an idea of how long the process will take to
complete
2014-07-28 17:00:26 +09:00
Damien Elmes
1e34696c5b Merge branch 'master' of git://github.com/sobjornstad/anki into sobjornstad-master
Conflicts:
	anki/exporting.py
2014-06-29 04:07:00 +09:00
dae
2aa7714f87 new media syncing protocol
- media syncing no longer locks the account, so it can be done
  in the background in the future, and multiple clients can safely
  sync media at the same time
- all operations are now idempotent, so they can be repeatedly safely
  in the event of a connection error
- whether it's a normal incremental sync, an initial sync,
  or the media database has been deleted, no files will be uploaded
  or downloaded if they already exist on the other side
- file removals are now chunked like additions & updates, preventing
  timeouts due to large requests
- if the server can't process a chunk in time, it will return a count
  of what it did process, so the client can retry the rest

Notes for AnkiDroid:

- when porting this, recommend you pick a different name for the
.media.db2 file, so users don't accidentally copy the AD version to
the desktop or vice versa
- please make sure filenames are added to the zip in NFC form
2014-06-26 09:00:38 +09:00
Soren I. Bjornstad
88c36af987 don't try to log in if user cancels login dialog 2014-06-24 15:04:23 -05:00
Damien Elmes
2ec399a009 catch ssl error 2014-02-06 06:50:41 +09:00
Damien Elmes
1e1e1f6f95 catch broken pipe error 2014-01-24 03:10:04 +09:00
Damien Elmes
8769a6daf0 catch err 10054 2014-01-14 14:12:49 +09:00
Damien Elmes
9b02f71abf friendly msg for 10053 error 2013-11-27 23:02:03 +09:00
Damien Elmes
6ed971cb6b we need to retry when we get BadStatusLine
this is caused by the http keep alive being closed by the server
2013-11-26 02:43:59 +09:00
Damien Elmes
0389eebc43 ask people to check media when media sanity occurs 2013-11-14 12:12:37 +09:00
Damien Elmes
8812472b53 catch "no such file or directory" error when connecting with no net
soren reports it happening on his computer; can't repro it here

also make sure exception is always converted to string in reliable way
2013-11-14 11:14:21 +09:00
Damien Elmes
ef9157a8ee don't open log for export or upgrade, only regular+sync 2013-11-13 16:48:22 +09:00
Damien Elmes
9c678c32ad further simplify augmented httplib2 conn_request 2013-11-13 15:15:03 +09:00
Damien Elmes
3dbc6fa0dd strip out buggy retry code
it assumed there'd be at least one retry, and was trying to return
response that was initialized
2013-11-08 01:14:49 +09:00
Damien Elmes
82a54c780f catch invalid temp folder and other tweaks
- tweak sync code so that a failure in loading the collection
  won't leave the app with an unopen collection
- don't show corrupt collection message when the error is not
  a db error
- catch the temp folder issue when loading the collection. i suspect
  this was the issue that was causing some people to end up with
  an open anki instance with no collection loaded
2013-10-22 15:30:53 +09:00
Damien Elmes
bab63de768 silly me, we were overriding retries in the aqt monkeypatch 2013-10-20 10:25:25 +09:00
Damien Elmes
5bf0a31c51 catch 413 error and don't trigger on file line numbers
fixes spurious proxy auth required msg
2013-10-14 11:18:52 +09:00
Damien Elmes
2f3f285528 clarify 409 msg 2013-10-10 11:48:38 +09:00
Damien Elmes
f29a04ae29 bump sync ver to 7 and change meta return value
- /sync/meta now returns a dictionary
- it includes the following extra fields
- msg: if non-empty, show this message at the end of the sync
- cont: if false, show above message and abort sync
- uname: the user's email address, so it can be stored by the local client to
  show users who have forgotten which email address they used. in the future
  this will be saved only when logging in, so do a conditional access on it
2013-10-04 06:09:28 +09:00
Damien Elmes
a1ca03ee17 allow urllib2 to be passed unicode data to send (#923) 2013-07-03 04:48:52 +09:00
Damien Elmes
e7ec4edf92 fix sync error message bug 2013-06-14 13:06:56 +09:00
Damien Elmes
be78c3f9e3 better msg when media sanity fails 2013-05-30 10:54:55 +09:00
Damien Elmes
ff8b58de21 include full traceback on sync error 2013-05-29 09:32:49 +09:00
Damien Elmes
273cb74e3d separate messages for 50x errors 2013-05-17 13:58:38 +09:00
Damien Elmes
ab198c46be unify pre-check, sanity-check and upload error messages 2013-05-14 15:41:18 +09:00
Damien Elmes
79d4451299 move full sync into preferences, and remove maintenance menu 2013-05-14 15:27:40 +09:00
Damien Elmes
e913c75fd7 perform basic check prior to syncing 2013-05-14 15:10:58 +09:00
Damien Elmes
d2535fd6cb run basic integrity check prior to full up 2013-05-13 19:36:09 +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
e64d825730 fix some sync issues
- better error message when upload fails
- don't show success message on error
- fix 'unable to find server' accidentally being catchall
2013-03-01 01:36:14 +09:00
ospalh
6a93767f80 The longer full sync explanation was missing a backslash.
The "automatically" appeared on a line by itself.
2013-02-27 11:36:15 +01:00
Damien Elmes
ab5d521512 tweak sync conflict msg 2013-02-27 14:07:11 +09:00
Damien Elmes
45ae2cbbfb another firewall error 2013-02-12 02:06:03 +09:00
Damien Elmes
8ce6bd8b79 catch another firewall error 2013-02-07 19:58:17 +09:00
Damien Elmes
073f129ab8 fix media sanity fail being identified as normal sanity error 2013-01-29 09:05:55 +09:00
Damien Elmes
8d66578d43 move sanity check to server and automatically force full sync
- server will log mismatches so we don't require people to post on the forums
  anymore or manually force a full sync
- if we find problems like missing notes, report that in the sanity check so
  the server can keep track of problems
- when the server detects a conflict it can immediately abort the sync, so a
  subsequent sync will no longer report a conflict
2013-01-18 09:17:12 +09:00
Damien Elmes
ce2581269b make sure we always turn error into unicode (#488) 2013-01-15 07:28:48 +09:00
Damien Elmes
c6adf1dda8 set auth dialog to window modal 2013-01-08 10:36:04 +09:00
Damien Elmes
b2457811a2 optimize imports 2012-12-22 09:17:10 +09:00
Damien Elmes
d477df8c28 merged libanki and ankiqt into single distro 2012-12-21 16:51:59 +09:00