mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-10-10 00:08:11 +03:00
Add shared Qt widgets
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
@@ -33,7 +33,9 @@ import functools
|
||||
|
||||
__all__ = [
|
||||
'moveToCenter',
|
||||
'AppQCheckBox',
|
||||
'AppQDialog',
|
||||
'AppQDialogButtonBox',
|
||||
'AppQGroupBox',
|
||||
'AppQHeaderView',
|
||||
'AppQLabel',
|
||||
@@ -67,6 +69,14 @@ def moveToCenter(widget, parent=None):
|
||||
widget.move(geometry.topLeft())
|
||||
|
||||
|
||||
class AppQCheckBox(QTranslatable, QCheckBox):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def retranslate(self):
|
||||
self.setText(_(self.text()))
|
||||
|
||||
|
||||
class AppQDialog(QTranslatable, SupportConnectedCallback, QDialog):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
@@ -105,7 +115,7 @@ class AppQDialog(QTranslatable, SupportConnectedCallback, QDialog):
|
||||
moveToCenter(self)
|
||||
|
||||
def retranslate(self):
|
||||
pass
|
||||
self.setWindowTitle(_(self.windowTitle()))
|
||||
|
||||
def disconnectedCallback(self):
|
||||
self.setWindowIcon(AppHue.disconnectedWindowIcon())
|
||||
@@ -114,6 +124,15 @@ class AppQDialog(QTranslatable, SupportConnectedCallback, QDialog):
|
||||
self.setWindowIcon(AppHue.connectedWindowIcon())
|
||||
|
||||
|
||||
class AppQDialogButtonBox(QTranslatable, QDialogButtonBox):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def retranslate(self):
|
||||
for button in self.buttons():
|
||||
button.setText(_(button.text()))
|
||||
|
||||
|
||||
class AppQGroupBox(QTranslatable, QGroupBox):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user