diff --git a/designer/settings.ui b/designer/settings.ui
index 74a259f..ca0bb02 100644
--- a/designer/settings.ui
+++ b/designer/settings.ui
@@ -29,46 +29,87 @@
Pop-up Dictionary
-
- -
-
+
+
-
+
- Configure the dictionary used to look up words in the reviewing screen
+ Dictionary
- -
-
+
-
+
- Dictionary
+ Configure the dictionary used to look up words in the reviewing screen
- -
+
-
- -
+
-
+
+
+ 9999
+
+
+
+ -
Save
- -
+
-
+
+
+ -
+
+
+ 9999
+
+
+
+ -
+
+
+ Width
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
Shortcut
- -
-
+
-
+
+
+ Height
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ popupDictionaryComboBox
+ popupShortcut
+ popupWidthSpinBox
+ popupHeightSpinBox
+ saveButton
+
diff --git a/src/config.json b/src/config.json
index e08b450..ccff16d 100644
--- a/src/config.json
+++ b/src/config.json
@@ -3,6 +3,8 @@
"browser_shortcut": "Ctrl+W",
"popup_shortcut": "Alt+Shift+S",
"popup_dictionary": "",
+ "popup_width": 800,
+ "popup_height": 700,
"file_field": "",
"parser_field": "",
"word_field": "",
diff --git a/src/gui/settings.py b/src/gui/settings.py
index a3babc8..4a297d4 100644
--- a/src/gui/settings.py
+++ b/src/gui/settings.py
@@ -41,13 +41,21 @@ def setup_ui(self) -> None:
self.form.popupShortcut.setKeySequence(
QKeySequence(self.config["popup_shortcut"])
)
+ self.form.popupWidthSpinBox.setValue(int(self.config["popup_width"]))
+ self.form.popupHeightSpinBox.setValue(int(self.config["popup_height"]))
+
# TODO: make other shortcuts configurable from here too
def on_save(self) -> None:
popup_dictionary = self.form.popupDictionaryComboBox.currentText()
popup_shortcut = self.form.popupShortcut.keySequence().toString()
+ popup_width = self.form.popupWidthSpinBox.value()
+ popup_height = self.form.popupHeightSpinBox.value()
self.config["popup_dictionary"] = popup_dictionary
self.config["popup_shortcut"] = popup_shortcut
+ self.config["popup_width"] = popup_width
+ self.config["popup_height"] = popup_height
+
self.mw.addonManager.writeConfig(__name__, self.config)
popup.restart_server()
popup.reset_shortcut()
diff --git a/src/popup.py b/src/popup.py
index 46cb590..5bf84ab 100644
--- a/src/popup.py
+++ b/src/popup.py
@@ -52,11 +52,15 @@ def handle_popup_request(
return handled
subcmd, word = parts[1:3]
if subcmd == "popup":
- # TODO: make width and height configurable
- contents = f""
+ config = mw.addonManager.getConfig(__name__)
+ width = config["popup_width"]
+ height = config["popup_height"]
+ contents = f""
contents = json.dumps(contents)
web = get_webview_for_context(context)
- web.eval(f"globalThis.tippyInstance.setContent({contents});")
+ web.eval(
+ f"globalThis.tippyInstance.setContent({contents}); globalThis.tippyInstance.setProps({{maxWidth: {width}}});"
+ )
return (True, None)
diff --git a/src/web/popup.js b/src/web/popup.js
index 48e4c9b..a014708 100644
--- a/src/web/popup.js
+++ b/src/web/popup.js
@@ -17,8 +17,6 @@ function showTooltipForSelection() {
trigger: '',
animation: "scale-extreme",
appendTo: document.body,
- // TODO: maybe make configurable and make sure to update the value set on the iframe to match
- maxWidth: 600,
onHide() {
span.insertAdjacentHTML('afterend', span.innerHTML);
span.remove();