supervertaler 1.9.190__py3-none-any.whl → 1.9.194__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of supervertaler might be problematic. Click here for more details.

@@ -5,16 +5,85 @@ Provides UI for viewing, editing, and managing keyboard shortcuts
5
5
 
6
6
  from pathlib import Path
7
7
  from PyQt6.QtWidgets import (
8
- QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QTableWidget,
9
- QTableWidgetItem, QHeaderView, QLineEdit, QLabel, QDialog,
10
- QDialogButtonBox, QMessageBox, QFileDialog, QGroupBox, QCheckBox
8
+ QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QTableWidget,
9
+ QTableWidgetItem, QHeaderView, QLineEdit, QLabel, QDialog,
10
+ QDialogButtonBox, QMessageBox, QFileDialog, QGroupBox, QCheckBox,
11
+ QStyleOptionButton
11
12
  )
12
- from PyQt6.QtCore import Qt, QEvent
13
- from PyQt6.QtGui import QKeySequence, QKeyEvent, QFont
13
+ from PyQt6.QtCore import Qt, QEvent, QPointF, QRect
14
+ from PyQt6.QtGui import QKeySequence, QKeyEvent, QFont, QPainter, QPen, QColor
14
15
 
15
16
  from modules.shortcut_manager import ShortcutManager
16
17
 
17
18
 
19
+ class CheckmarkCheckBox(QCheckBox):
20
+ """Custom checkbox with green background and white checkmark when checked"""
21
+
22
+ def __init__(self, text="", parent=None):
23
+ super().__init__(text, parent)
24
+ self.setCheckable(True)
25
+ self.setEnabled(True)
26
+ self.setStyleSheet("""
27
+ QCheckBox {
28
+ font-size: 9pt;
29
+ spacing: 6px;
30
+ }
31
+ QCheckBox::indicator {
32
+ width: 16px;
33
+ height: 16px;
34
+ border: 2px solid #999;
35
+ border-radius: 3px;
36
+ background-color: white;
37
+ }
38
+ QCheckBox::indicator:checked {
39
+ background-color: #4CAF50;
40
+ border-color: #4CAF50;
41
+ }
42
+ QCheckBox::indicator:hover {
43
+ border-color: #666;
44
+ }
45
+ QCheckBox::indicator:checked:hover {
46
+ background-color: #45a049;
47
+ border-color: #45a049;
48
+ }
49
+ """)
50
+
51
+ def paintEvent(self, event):
52
+ """Override paint event to draw white checkmark when checked"""
53
+ super().paintEvent(event)
54
+
55
+ if self.isChecked():
56
+ opt = QStyleOptionButton()
57
+ self.initStyleOption(opt)
58
+ indicator_rect = self.style().subElementRect(
59
+ self.style().SubElement.SE_CheckBoxIndicator,
60
+ opt,
61
+ self
62
+ )
63
+
64
+ if indicator_rect.isValid():
65
+ # Draw white checkmark
66
+ painter = QPainter(self)
67
+ painter.setRenderHint(QPainter.RenderHint.Antialiasing)
68
+ pen_width = max(2.0, min(indicator_rect.width(), indicator_rect.height()) * 0.12)
69
+ painter.setPen(QPen(QColor(255, 255, 255), pen_width, Qt.PenStyle.SolidLine, Qt.PenCapStyle.RoundCap, Qt.PenJoinStyle.RoundJoin))
70
+
71
+ # Draw checkmark (✓ shape)
72
+ x = indicator_rect.x()
73
+ y = indicator_rect.y()
74
+ w = indicator_rect.width()
75
+ h = indicator_rect.height()
76
+
77
+ # Checkmark coordinates (relative to indicator)
78
+ p1 = QPointF(x + w * 0.20, y + h * 0.50) # Start left
79
+ p2 = QPointF(x + w * 0.40, y + h * 0.70) # Bottom middle
80
+ p3 = QPointF(x + w * 0.80, y + h * 0.30) # End right-top
81
+
82
+ painter.drawLine(p1, p2)
83
+ painter.drawLine(p2, p3)
84
+ painter.end()
85
+
86
+
18
87
  class KeySequenceEdit(QLineEdit):
19
88
  """Custom widget for capturing keyboard shortcuts"""
20
89
 
@@ -317,10 +386,9 @@ class KeyboardShortcutsWidget(QWidget):
317
386
  for shortcut_id, data in sorted(shortcuts, key=lambda x: x[1]["description"]):
318
387
  self.table.insertRow(row)
319
388
 
320
- # Enabled checkbox (column 0)
321
- checkbox = QCheckBox()
389
+ # Enabled checkbox (column 0) - using green checkmark style
390
+ checkbox = CheckmarkCheckBox()
322
391
  checkbox.setChecked(data.get("is_enabled", True))
323
- checkbox.setStyleSheet("margin-left: 10px;")
324
392
  checkbox.setToolTip("Enable or disable this shortcut")
325
393
  # Store shortcut_id in checkbox for reference
326
394
  checkbox.setProperty("shortcut_id", shortcut_id)