mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
more pyqt6 enum goodness
The stateChanged signal delivers ints instead of Qt.CheckState. Fixes #1981627 [Heuristic-Page greyed out](https://bugs.launchpad.net/calibre/+bug/1981627)
This commit is contained in:
parent
8a0df2820c
commit
59541e36a5
@ -97,8 +97,7 @@ class HeuristicsWidget(Widget, Ui_Form):
|
||||
gprefs['replace_scene_breaks_history'] = rssb_history
|
||||
|
||||
def enable_heuristics(self, state):
|
||||
state = state == Qt.CheckState.Checked
|
||||
self.heuristic_options.setEnabled(state)
|
||||
self.heuristic_options.setEnabled(self.opt_enable_heuristics.isChecked())
|
||||
|
||||
def enable_unwrap(self, state):
|
||||
if state == Qt.CheckState.Checked:
|
||||
|
@ -89,8 +89,7 @@ class ChooseMultiSort(Dialog):
|
||||
self.column_list.sortItems()
|
||||
|
||||
def item_double_clicked(self, item):
|
||||
cs = item.checkState()
|
||||
item.setCheckState(Qt.CheckState.Checked if cs == Qt.CheckState.Unchecked else Qt.CheckState.Unchecked)
|
||||
item.setCheckState(Qt.CheckState.Checked if item.checkState() == Qt.CheckState.Unchecked else Qt.CheckState.Unchecked)
|
||||
|
||||
def current_changed(self):
|
||||
self.update_order_label()
|
||||
|
@ -26,10 +26,10 @@ class PasswordDialog(QDialog, Ui_Dialog):
|
||||
self.gui_password.setText(pw)
|
||||
self.sname = name
|
||||
self.msg.setText(msg)
|
||||
self.show_password.stateChanged[(int)].connect(self.toggle_password)
|
||||
self.show_password.stateChanged.connect(self.toggle_password)
|
||||
|
||||
def toggle_password(self, state):
|
||||
if state == Qt.CheckState.Unchecked:
|
||||
if Qt.CheckState(state) == Qt.CheckState.Unchecked:
|
||||
self.gui_password.setEchoMode(QLineEdit.EchoMode.Password)
|
||||
else:
|
||||
self.gui_password.setEchoMode(QLineEdit.EchoMode.Normal)
|
||||
|
@ -377,7 +377,7 @@ class SchedulerDialog(QDialog):
|
||||
|
||||
def set_pw_echo_mode(self, state):
|
||||
self.password.setEchoMode(QLineEdit.EchoMode.Normal
|
||||
if state == Qt.CheckState.Checked else QLineEdit.EchoMode.Password)
|
||||
if Qt.CheckState(state) == Qt.CheckState.Checked else QLineEdit.EchoMode.Password)
|
||||
|
||||
def schedule_type_selected(self, *args):
|
||||
for i, st in enumerate(self.SCHEDULE_TYPES):
|
||||
|
@ -99,7 +99,7 @@ class SmartdeviceDialog(QDialog, Ui_Dialog):
|
||||
self.resize(self.sizeHint())
|
||||
|
||||
def use_fixed_port_changed(self, state):
|
||||
self.fixed_port.setEnabled(state == Qt.CheckState.Checked)
|
||||
self.fixed_port.setEnabled(Qt.CheckState(state) == Qt.CheckState.Checked)
|
||||
|
||||
def toggle_password(self, state):
|
||||
self.password_box.setEchoMode(QLineEdit.EchoMode.Password if state ==
|
||||
|
@ -1166,7 +1166,7 @@ class AddCover(Dialog):
|
||||
p.setVisible(self.container.book_type != 'azw3')
|
||||
|
||||
def on_state_change(s):
|
||||
tprefs.set('add_cover_preserve_aspect_ratio', s == Qt.CheckState.Checked)
|
||||
tprefs.set('add_cover_preserve_aspect_ratio', Qt.CheckState(s) == Qt.CheckState.Checked)
|
||||
|
||||
p.stateChanged.connect(on_state_change)
|
||||
self.info_label = il = QLabel('\xa0')
|
||||
|
Loading…
x
Reference in New Issue
Block a user