mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Merge branch 'main' into editor-3830
This commit is contained in:
commit
b13a1d1639
5 changed files with 23 additions and 17 deletions
|
@ -230,7 +230,7 @@ KolbyML <https://github.com/KolbyML>
|
||||||
Adnane Taghi <dev@soleuniverse.me>
|
Adnane Taghi <dev@soleuniverse.me>
|
||||||
Spiritual Father <https://github.com/spiritualfather>
|
Spiritual Father <https://github.com/spiritualfather>
|
||||||
Emmanuel Ferdman <https://github.com/emmanuel-ferdman>
|
Emmanuel Ferdman <https://github.com/emmanuel-ferdman>
|
||||||
|
Marvin Kopf <marvinkopf@outlook.com>
|
||||||
********************
|
********************
|
||||||
|
|
||||||
The text of the 3 clause BSD license follows:
|
The text of the 3 clause BSD license follows:
|
||||||
|
|
|
@ -53,6 +53,7 @@ from aqt.operations.tag import (
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
from aqt.sound import av_player
|
from aqt.sound import av_player
|
||||||
from aqt.switch import Switch
|
from aqt.switch import Switch
|
||||||
|
from aqt.theme import WidgetStyle
|
||||||
from aqt.undo import UndoActionsInfo
|
from aqt.undo import UndoActionsInfo
|
||||||
from aqt.utils import (
|
from aqt.utils import (
|
||||||
HelpPage,
|
HelpPage,
|
||||||
|
@ -170,6 +171,7 @@ class Browser(QMainWindow):
|
||||||
if self.height() != 0:
|
if self.height() != 0:
|
||||||
self.aspect_ratio = self.width() / self.height()
|
self.aspect_ratio = self.width() / self.height()
|
||||||
self.set_layout(self.mw.pm.browser_layout(), True)
|
self.set_layout(self.mw.pm.browser_layout(), True)
|
||||||
|
self.onSidebarVisibilityChange(not self.sidebarDockWidget.isHidden())
|
||||||
# disable undo/redo
|
# disable undo/redo
|
||||||
self.on_undo_state_change(mw.undo_actions_info())
|
self.on_undo_state_change(mw.undo_actions_info())
|
||||||
# legacy alias
|
# legacy alias
|
||||||
|
@ -726,6 +728,7 @@ class Browser(QMainWindow):
|
||||||
self.form.actionSidebarFilter.triggered,
|
self.form.actionSidebarFilter.triggered,
|
||||||
self.focusSidebarSearchBar,
|
self.focusSidebarSearchBar,
|
||||||
)
|
)
|
||||||
|
qconnect(dw.visibilityChanged, self.onSidebarVisibilityChange)
|
||||||
grid = QGridLayout()
|
grid = QGridLayout()
|
||||||
grid.addWidget(self.sidebar.searchBar, 0, 0)
|
grid.addWidget(self.sidebar.searchBar, 0, 0)
|
||||||
grid.addWidget(self.sidebar.toolbar, 0, 1)
|
grid.addWidget(self.sidebar.toolbar, 0, 1)
|
||||||
|
@ -745,9 +748,17 @@ class Browser(QMainWindow):
|
||||||
self.mw.progress.timer(10, self.sidebar.refresh, False, parent=self.sidebar)
|
self.mw.progress.timer(10, self.sidebar.refresh, False, parent=self.sidebar)
|
||||||
|
|
||||||
def showSidebar(self, show: bool = True) -> None:
|
def showSidebar(self, show: bool = True) -> None:
|
||||||
want_visible = not self.sidebarDockWidget.isVisible()
|
|
||||||
self.sidebarDockWidget.setVisible(show)
|
self.sidebarDockWidget.setVisible(show)
|
||||||
if want_visible and show:
|
|
||||||
|
def onSidebarVisibilityChange(self, visible):
|
||||||
|
margins = self.form.verticalLayout_3.contentsMargins()
|
||||||
|
skip_left_margin = visible and not (
|
||||||
|
is_mac and aqt.mw.pm.get_widget_style() == WidgetStyle.NATIVE
|
||||||
|
)
|
||||||
|
margins.setLeft(0 if skip_left_margin else margins.right())
|
||||||
|
self.form.verticalLayout_3.setContentsMargins(margins)
|
||||||
|
|
||||||
|
if visible:
|
||||||
self.sidebar.refresh()
|
self.sidebar.refresh()
|
||||||
|
|
||||||
def focusSidebar(self) -> None:
|
def focusSidebar(self) -> None:
|
||||||
|
|
|
@ -7,9 +7,8 @@ import enum
|
||||||
import logging
|
import logging
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import os
|
import os
|
||||||
import random
|
|
||||||
import re
|
import re
|
||||||
import string
|
import secrets
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import traceback
|
import traceback
|
||||||
|
@ -843,7 +842,7 @@ def legacy_page_data() -> Response:
|
||||||
return _text_response(HTTPStatus.NOT_FOUND, "page not found")
|
return _text_response(HTTPStatus.NOT_FOUND, "page not found")
|
||||||
|
|
||||||
|
|
||||||
_APIKEY = "".join(random.choices(string.ascii_letters + string.digits, k=32))
|
_APIKEY = secrets.token_urlsafe(32)
|
||||||
|
|
||||||
|
|
||||||
def _have_api_access() -> bool:
|
def _have_api_access() -> bool:
|
||||||
|
|
|
@ -41,6 +41,7 @@ import time
|
||||||
from queue import Empty, Full, Queue
|
from queue import Empty, Full, Queue
|
||||||
from shutil import which
|
from shutil import which
|
||||||
|
|
||||||
|
import aqt
|
||||||
from anki.utils import is_mac, is_win
|
from anki.utils import is_mac, is_win
|
||||||
|
|
||||||
|
|
||||||
|
@ -444,7 +445,7 @@ class MPV(MPVBase):
|
||||||
|
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
self._register_callbacks()
|
aqt.mw.taskman.run_in_background(self._register_callbacks, None)
|
||||||
|
|
||||||
def _register_callbacks(self):
|
def _register_callbacks(self):
|
||||||
self._callbacks = {}
|
self._callbacks = {}
|
||||||
|
|
|
@ -20,16 +20,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
export let disabledChoices: T[] = [];
|
export let disabledChoices: T[] = [];
|
||||||
|
|
||||||
$: label = choices.find((c) => c.value === value)?.label;
|
$: label = choices.find((c) => c.value === value)?.label;
|
||||||
</script>
|
$: parser = (item) => ({
|
||||||
|
|
||||||
<Select
|
|
||||||
bind:value
|
|
||||||
{label}
|
|
||||||
{disabled}
|
|
||||||
list={choices}
|
|
||||||
parser={(item) => ({
|
|
||||||
content: item.label,
|
content: item.label,
|
||||||
value: item.value,
|
value: item.value,
|
||||||
disabled: disabledChoices.includes(item.value),
|
disabled: disabledChoices.includes(item.value),
|
||||||
})}
|
});
|
||||||
/>
|
</script>
|
||||||
|
|
||||||
|
<Select bind:value {label} {disabled} list={choices} {parser} />
|
||||||
|
|
Loading…
Reference in a new issue