Commit Graph

184 Commits

Author SHA1 Message Date
Damien Elmes
b1eccd67f7 fix lint 2019-10-22 12:22:30 +10:00
Aqueminivan
cba7c8a57b Moved number inside ngettext() 2019-10-19 19:39:43 -04:00
Aqueminivan
2b2afe899a Fixed code style issue (column width) 2019-10-19 18:10:59 -04:00
Aqueminivan
01f2fda214 Fixed translation issues for media counts 2019-10-19 18:03:59 -04:00
Aqueminivan
d669659e88 Added file counts when deleting media 2019-10-18 03:51:54 -04:00
Damien Elmes
888d8b5dee add progress dialog for media delete 2019-08-17 18:32:39 +10:00
Lovac42
a803f4afee added runHooks for reverted cards and state. 2019-05-17 20:17:36 -04:00
Damien Elmes
b2cfba367e fix bug caused by user creating profile with trailing space
Caught exception:
  File "aqt\main.py", line 237, in onOpenBackup
  File "aqt\profiles.py", line 264, in backupFolder
  File "aqt\profiles.py", line 274, in _ensureExists
  File "os.py", line 220, in makedirs
<class 'FileNotFoundError'>: [WinError 3] The system cannot find the path specified: 'C:\\Users\\xxx\\AppData\\Roaming\\Anki2\\xxx \\backups'
2019-04-25 09:37:58 +10:00
Damien Elmes
9cc99cdced possible fix for " super-class ... Preferences was never called"
Can't reproduce the issue, but it seems the user was able to open the
preferences screen when no collection was loaded. If an error was
caught in loadCollection() the main window was not being hidden, so
perhaps a timing issue was preventing the profiles screen from taking
modal focus.

Removed the check in the prefs init - it is hopefully no longer
necessary, and returning before QDialog.__init__() was called was
causing the problem.

Caught exception:
  File "aqt/webview.py", line 27, in cmd
  File "aqt/webview.py", line 85, in _onCmd
  File "aqt/webview.py", line 360, in _onBridgeCmd
  File "aqt/toolbar.py", line 56, in _linkHandler
  File "aqt/toolbar.py", line 80, in _syncLinkHandler
  File "aqt/main.py", line 669, in onSync
  File "aqt/main.py", line 365, in unloadCollection
  File "aqt/main.py", line 611, in closeAllWindows
  File "aqt/__init__.py", line 110, in closeAll
<class 'RuntimeError'>: super-class __init__() of type Preferences was never called
2019-04-21 19:02:03 +10:00
Damien Elmes
623926e8f9 fix some timers failing to fire 2019-04-21 18:56:30 +10:00
Damien Elmes
015bb71cca fix race condition in webview load on Windows
- don't require collection for initial blank content
- defer profile load until initial blank content loaded
- use plain text for blank content to prevent initial flash of white
2019-04-16 13:24:38 +10:00
Damien Elmes
380d59f775 fix race condition in webview startup on windows
use _setHtml so that _domDone is set to false
2019-04-10 17:31:55 +10:00
Damien Elmes
df4aad50e1 avoid popups for some non-serious warnings 2019-04-10 12:44:01 +10:00
Damien Elmes
478ee66d0e fix issue preventing profile rename/delete
qtwebengineprocess.exe inherits the current working directory, so if
it is started after the profile is loaded, it prevents the profile
media folder from being renamed/deleted

also, load profile on first run at the same point we normally load
the profile
2019-04-09 18:48:50 +10:00
Damien Elmes
cc335a15e4 make sure card counts are updated when undoing reviews 2019-04-08 15:47:49 +10:00
Glutanimate
324370497e Set QTWEBENGINE_DICTIONARIES_PATH
This introduces the possibility for add-ons to supply spell checking
support in web views.
2019-03-06 18:59:38 +01:00
Damien Elmes
7d65594944
Merge pull request #288 from glutanimate/mediasrv-addon-support
Extend mediasrv to also serve media files in addons directory
2019-03-04 18:03:48 +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
3721cc4604 silence some spurious errors and remove some unused code 2019-03-04 11:22:40 +10:00
Glutanimate
5e90758f39 Allow add-on authors to set a whitelist of webview-accessible files
Extends the AddonManager API with two new methods, setWebExports and
getWebExports. setWebExports expects an add-on module name and a
valid RegEx pattern to match subpaths in the add-on folder against.

Any matching subpaths will be accessible in Anki's web views by
referencing them with /_addons/{addon_id}/{subpath}.

For instance, to allow access to .css and .png files in your add-on's
user_files directory you would call:

> mw.addonManager.setWebExports(__name__, r"user_files/.+(\.png|\.css)")

You could then reference these files in web views as such:

> <img src="/_addons/{addon_id}/user_files/test.png">

Please note that this bypasses the default security policies used
in Anki webviews. You should take care to construct your RegEx
patterns specific enough so that they do not match any sensitive
files of our add-on.
2019-03-02 18:57:51 +01:00
Glutanimate
1fb6123f5a Extend mediasrv to also serve media files in addons directory
RequestsHandler now rewrites "/_addons" references to addons folder.
2019-02-26 13:08:15 +01:00
Glutanimate
fd4b5c1169 Print-wrap current line rather than the entire field
Also: Avoid duplicate wraps, retain cursor position, and preserve
undo history.
2019-02-16 12:23:31 +01:00
Glutanimate
0b2869660e Add hotkeys to clear debug log and entry (Ctrl+L / Ctrl+Shift+L) 2019-02-16 12:21:52 +01:00
Glutanimate
d629ceb3b5 Use system-default fixed font for debug entry and log 2019-02-16 10:26:49 +01:00
Damien Elmes
b06b70f721 avoid running timers after collection unload
fixes:
- onRefreshTimer() firing when collection is in the process of
unloading
- saveNow() in the no changes case, which fires a timer 10ms later
2019-02-06 12:03:14 +10:00
Damien Elmes
372d5ed6e8 update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
Damien Elmes
6b24b61999 skip the webview reload when undoing reviews 2019-01-29 09:35:46 +10:00
Damien Elmes
a6c34fd79f ignore broken reset hooks in database check
ideally the original code should be correctly cleaning up the hooks,
but if it does not, then we don't want to repeatedly present the user
with confusing errors when they try to check their database is ok.
2018-12-15 13:14:33 +10:00
Damien Elmes
0769bf7ac9 apply stylesheet app wide, and add border to win10 menu
the night mode add-on may need updating with this change, but with
a global stylesheet it may be easier to style widgets in the future

menu bar issue:

https://anki.tenderapp.com/discussions/beta-testing/1313-anki-216-beta-1#comment_46664932
2018-12-14 20:35:12 +10:00
zandimna
3b70c6ff26
Change the order of elements on the window title
The application name typically comes at the end of the title. As such, many tools grabs the final string as the application name. What Anki does currently causes the profile name to be grabbed, producing unexpected results.
2018-11-12 20:23:47 +08:00
Damien Elmes
098434ff38 we can use the old undo shortcut on 5.11
webviews no longer propagate the captured shortcut
2018-10-23 18:40:58 +10:00
Damien Elmes
504ee75c8e fix deck list getting stuck when building filtered deck
issue is trying to move to the overview screen before the callbacks
on the deck overview screen complete - "fix" it for now by remaining
on the deck list
2018-09-05 20:02:40 +10:00
Damien Elmes
df280783b3 don't repeat shortcuts when key held down
https://anki.tenderapp.com/discussions/ankidesktop/29405-space-bar-repeat-problem
2018-08-29 10:07:33 +10:00
Damien Elmes
fbeade1f23 fixes for mpv focus switching
- avoid changing focus if an Anki window is already focused
- only try to restore focus when playing videos
2018-07-23 13:57:09 +10:00
Damien Elmes
e6fcfb7379 need to record active window prior to playing in mpv 2018-05-31 13:22:17 +10:00
Damien Elmes
9b7c701f25 new stats shortcut 2018-05-31 13:05:37 +10:00
Damien Elmes
32b32bb881 don't try to use mpv on Windows
some users had mpv lying around from previous installs, and the Windows
implementation seems to hang with the idle hook introduced in the
previous build
2018-05-10 14:50:23 +10:00
Damien Elmes
4b28151b61 add space to 'waiting for editing' screen 2018-05-01 13:35:28 +10:00
Damien Elmes
47370af7c3 work around video focus stealing
https://anki.tenderapp.com/discussions/ankidesktop/27401-bug-when-playing-a-video-on-anki-for-mac-anki-lanches-mplayer-and-doesnt-quit-it-or-return-to-anki
2018-04-30 17:12:26 +10:00
Glutanimate
410d1226bc Revert debug console shortcut workaround
Seems like the assignment to "Ctrl+:" is working again

cf. fb81f63fe3
2018-03-18 15:50:50 +01:00
Damien Elmes
724513ca91 clarify 'delete unused' button, and don't show when n/a 2018-03-01 14:00:05 +10:00
Damien Elmes
275af7e9b5 catch more problems with corrupt collections
if collapseTime is missing from col.conf, the initial load was
succeeding, but then the UI was getting stuck in moveToState()
2018-02-05 12:34:31 +10:00
Damien Elmes
1b7a7df4f0 raise profile window on macos
otherwise profile manager opens without focus
2018-02-01 12:14:04 +10:00
Damien Elmes
118326df1e remove format literals so we can support python 3.5 2018-01-16 16:07:30 +10:00
Damien Elmes
81d4b77ee1 more open() and regex strings 2017-12-11 17:25:51 +10:00
Damien Elmes
880243c361 disable main window while collection unloaded
fixes error when pressing y then d in rapid succession
2017-11-01 12:38:43 +10:00
Damien Elmes
d8d6430ec7 fall back to mplayer if mpv not found or too old
ubuntu 14.04 looks to be using an ancient mpv version
2017-10-05 17:24:55 +10:00
Damien Elmes
3840f012be catch errors caused by old mpv versions 2017-10-05 15:46:20 +10:00
Damien Elmes
7b844d12cb increase default number of backups; don't put in trash 2017-10-05 14:39:47 +10:00