Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix QPushButton Bug, upgrade to Qt6, and add multiple indent support. #34

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

adithyabsk
Copy link

Hello! First time contributor here. I haven't really worked with Anki extensions in the past but I think I got everything working.

The three core changes

  • Add multiple indent handling (i.e. two tabs means two nested indent spans are generated)
  • Upgrade to Qt6 (seems like other anki addons are doing this)
  • Fix Pushbutton bug

Full changes

Major changes:

  • Add multiple indent handling in _normalize_blank_lines
  • Update technical.rst with information about how multiple indents are handled
  • Add unit test to test_gen_notes.py to determine how a code snippet would render
  • Update Makefile to handle qt5 and qt6 file generation
  • Update lcpg_dialog.py
    • Now works with Qt5 and Qt6
    • Calls deckChoser.cleanup() to address QPushButton deletion bug

Minor changes:

  • Add import_dialog* to .gitignore
  • Consolidate requirements.txt and requirements_dev.txt
  • Fix misconfiguration of language in conf.py

* Fix misconfiguration of language in `conf.py`
* Update `technical.rst` with information about how multiple indents
are handled
* Add multiple indent handling in `_normalize_blank_lines`
* Add unit test to `test_gen_notes.py` to determine how a code snippet
would render
* Add import_dialog* to `.gitignore`
* Update `Makefile` to handle qt5 and qt6 file generation
* Consolidate `requirements.txt` and `requirements_dev.txt`
* Update `lcpg_dialog.py`
  * Now works with Qt5 and Qt6
  * Calls `deckChoser.cleanup()` to address `QPushButton` deletion bug
@sobjornstad
Copy link
Owner

sobjornstad commented Jun 15, 2022

Welcome and thanks for the contributions!

LPCG actually fully supports Qt6 already in the live version on AnkiWeb. Unfortunately I forgot to upload the commits here when I published last time, sorry! I'll push them out soon and we can reconcile (I'm assuming they're basically the same, but possible one of us missed something).

I'm not sure whether multiple indent handling is the right behavior here. I intentionally designed it to treat all indents the same because people who aren't used to whitespace-significant tools tend to find getting the exact right number of tabs/spaces/etc quite tricky, and nobody has ever objected to this (while there's the odd poem that has a complicated indent structure, it's not common). Is this something you need yourself?

Can you explain the purpose of commenting out the language option in the docs? Why is it wrong as-is?

@adithyabsk
Copy link
Author

adithyabsk commented Jun 15, 2022

LPCG actually fully supports Qt6 already in the live version on AnkiWeb.

Ah okay, that makes sense as to why it works in the most recent versions of Anki

I'll push them out soon and we can reconcile

Sounds good.

Is this something you need yourself?

I'm actually using it to memorize pseudocode snippets rather than for poems. (I use the extension for poems as well). I also added a test case to demonstrate my use case.

purpose of commenting out the language option in the docs

The default language is en. I initially got an error when running make with a fresh repo due to the old version of Sphinx and some dependency they had not pinned. I updated the Sphinx versions, and it output that language could not be set to None.

@sobjornstad
Copy link
Owner

sobjornstad commented Jun 16, 2022 via email

@adithyabsk
Copy link
Author

adithyabsk commented Jun 16, 2022

It’s possible there’s a newer one available up there now though.

You might be right. But, I just checked both the preview doc build which on first glance doesn't seem to have any errors and the Sphinx RTD theme docs which suggests the latest version is supported. Never mind, I was wrong. The theme only supports up to 4.2, I'll adjust the PR when I get to a computer.

If you catch an issue--happy to remove those changes from the PR.

@adithyabsk
Copy link
Author

adithyabsk commented Jun 22, 2022

@sobjornstad Totally understand if you still have some reservations about other aspects of the PR. Happy to break this PR up into 3 if that will help expedite getting at least the bug fix merged.

  1. QPushButton Bug fix
  2. Qt upgrades
  3. Multiple indentation feature

Screen Shot 2022-06-15 at 4 18 56 PM

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