mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
add SaveCustomColours rpc method
This commit is contained in:
parent
539054c34d
commit
2e466285f0
2 changed files with 16 additions and 0 deletions
|
@ -27,6 +27,9 @@ service FrontendService {
|
|||
rpc deckOptionsRequireClose(generic.Empty) returns (generic.Empty);
|
||||
// Warns python that the deck option web view is ready to receive requests.
|
||||
rpc deckOptionsReady(generic.Empty) returns (generic.Empty);
|
||||
|
||||
// Save colour picker's custom colour palette
|
||||
rpc SaveCustomColours(generic.Empty) returns (generic.Empty);
|
||||
}
|
||||
|
||||
service BackendFrontendService {}
|
||||
|
|
|
@ -599,6 +599,18 @@ def deck_options_ready() -> bytes:
|
|||
return b""
|
||||
|
||||
|
||||
def save_custom_colours() -> bytes:
|
||||
colours = ",".join(
|
||||
[
|
||||
QColorDialog.customColor(i).name(QColor.NameFormat.HexArgb)
|
||||
for i in range(QColorDialog.customCount())
|
||||
]
|
||||
)
|
||||
assert aqt.mw.pm.profile is not None
|
||||
aqt.mw.pm.profile["customColorPickerPalette"] = colours
|
||||
return b""
|
||||
|
||||
|
||||
post_handler_list = [
|
||||
congrats_info,
|
||||
get_deck_configs_for_update,
|
||||
|
@ -614,6 +626,7 @@ post_handler_list = [
|
|||
search_in_browser,
|
||||
deck_options_require_close,
|
||||
deck_options_ready,
|
||||
save_custom_colours,
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue