Skip to content

Commit

Permalink
Switch to using a regex validator for Libby setup code, ref #14
Browse files Browse the repository at this point in the history
  • Loading branch information
ping committed Oct 6, 2023
1 parent 093b71d commit e3a6397
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Unreleased
- New: Rename a card
- Fix: Use a regex validator instead of input mask for Libby setup code due to wonkiness, ref #14

Version 0.1.9 - 2023-09-19
- Fix: Error on launch for calibre <6.2.0
Expand Down
7 changes: 6 additions & 1 deletion calibre-plugin/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
QWidget,
Qt,
QTimer,
QRegularExpressionValidator,
QRegularExpression,
)

from . import DEMO_MODE, PLUGIN_NAME, PLUGINS_FOLDER_NAME, logger
Expand Down Expand Up @@ -227,7 +229,10 @@ def __init__(self, plugin_action):
self.libby_setup_code_txt.setPlaceholderText(
PreferenceTexts.LIBBY_SETUP_CODE_DESC
)
self.libby_setup_code_txt.setInputMask("99999999")
self.libby_setup_code_txt.setValidator(
QRegularExpressionValidator(QRegularExpression(r"\d{8}"))
)

if not DEMO_MODE:
self.libby_setup_code_txt.setText(PREFS[PreferenceKeys.LIBBY_SETUP_CODE])
libby_layout.addRow(self.libby_setup_code_lbl, self.libby_setup_code_txt)
Expand Down

0 comments on commit e3a6397

Please sign in to comment.