Skip to content

Feature: Initial visibility config, default pen selection, and tag-based auto-toggle#57

Open
wasubu wants to merge 4 commits intoRytisgit:masterfrom
wasubu:master
Open

Feature: Initial visibility config, default pen selection, and tag-based auto-toggle#57
wasubu wants to merge 4 commits intoRytisgit:masterfrom
wasubu:master

Conversation

@wasubu
Copy link

@wasubu wasubu commented Jan 31, 2026

This pull request introduces new configuration options and logic to better control the initial state of the drawing canvas.

Changes:

  • Configuration:
    start_visible: Boolean option to determine if the canvas should be open by default when reviewing.
    default_pen_index: Integer option to set the active pen when the card loads.
  • Tag-based Logic:
    Added a check for the tag "draw" on the current note.
    If the "draw" tag is present, the canvas is forced to show regardless of the default configuration.
    If the tag is absent, it respects the specific hide/show logic defined in the configuration.
  • JavaScript & Hooks:
    Implemented forceShowCanvas() and forceHideCanvas() functions to programmatically control display states.
    Added a Python hook to showQuestion (with a slight QTimer delay) to evaluate tags and trigger the Javascript state changes.

Known Issues:

  • There is currently a bug regarding the UI synchronization when starting a deck. The visibility toggle button may require a double-click to register the first interaction/state change properly.


ts_profile_loaded = False

saved_value_defaults = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new config fields items should go here, and be editable in the menu. Here is an example of an option being added https://github.com/Rytisgit/Anki-StylusDraw/pull/48/changes

@@ -0,0 +1,4 @@
{
"start_visible": true,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding the separate config.json here is not correct as mentioned in the previous comment


from aqt.qt import QTimer

def apply_visibility_logic():
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does this work for people who would like to keep the current behaviour, it looks like apply_visibility_logic will run even if start_visible is true and disable the visibility if no tag is present

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants