Skip to content

Commit 96279c9

Browse files
committed
Add an option to change the button labels
1 parent 8b1d55d commit 96279c9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

qtapputils/widgets/configdialog.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ class ConfDialog(QDialog):
8181
"""
8282

8383
def __init__(self, main, icon: QIcon = None, resizable: bool = True,
84-
min_height: int = None, sup_message: str = None):
84+
min_height: int = None, sup_message: str = None,
85+
btn_labels: dict = None):
8586
super().__init__(main)
8687
self.main = main
8788

@@ -100,13 +101,15 @@ def __init__(self, main, icon: QIcon = None, resizable: bool = True,
100101
self._confpages = {}
101102

102103
# Setup the dialog button box.
103-
self.ok_button = QPushButton('OK')
104+
btn_labels = {} if btn_labels is None else btn_labels
105+
106+
self.ok_button = QPushButton(btn_labels.get('ok', 'OK'))
104107
self.ok_button.setDefault(False)
105108
self.ok_button.setAutoDefault(False)
106-
self.apply_button = QPushButton('Apply')
109+
self.apply_button = QPushButton(btn_labels.get('apply', 'Apply'))
107110
self.apply_button.setDefault(True)
108111
self.apply_button.setEnabled(False)
109-
self.cancel_button = QPushButton('Cancel')
112+
self.cancel_button = QPushButton(btn_labels.get('cancel', 'Cancel'))
110113
self.cancel_button.setDefault(False)
111114
self.cancel_button.setAutoDefault(False)
112115

0 commit comments

Comments
 (0)