mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Slight improvements on control enabling and sequencing in GUI
This commit is contained in:
parent
bb97bd6cab
commit
a8630df0f7
@ -78,6 +78,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
self.ok_button.clicked.connect(self.ok_clicked)
|
self.ok_button.clicked.connect(self.ok_clicked)
|
||||||
self.del_button.clicked.connect(self.del_clicked)
|
self.del_button.clicked.connect(self.del_clicked)
|
||||||
|
|
||||||
|
self.refilling = False
|
||||||
self.refill_all_boxes()
|
self.refill_all_boxes()
|
||||||
|
|
||||||
def clear_fields(self, edit_boxes=False, new_boxes=False):
|
def clear_fields(self, edit_boxes=False, new_boxes=False):
|
||||||
@ -108,8 +109,9 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
self.dest_widgets[i].setCurrentIndex(idx)
|
self.dest_widgets[i].setCurrentIndex(idx)
|
||||||
|
|
||||||
def edit_device_changed(self, txt):
|
def edit_device_changed(self, txt):
|
||||||
if txt == '':
|
|
||||||
self.current_device = None
|
self.current_device = None
|
||||||
|
if txt == '':
|
||||||
|
self.clear_fields(new_boxes=False)
|
||||||
return
|
return
|
||||||
self.clear_fields(new_boxes=True)
|
self.clear_fields(new_boxes=True)
|
||||||
self.current_device = unicode(txt)
|
self.current_device = unicode(txt)
|
||||||
@ -128,10 +130,11 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
self.del_button.setEnabled(True)
|
self.del_button.setEnabled(True)
|
||||||
|
|
||||||
def edit_format_changed(self, txt):
|
def edit_format_changed(self, txt):
|
||||||
if txt == '':
|
|
||||||
self.edit_device.setCurrentIndex(0)
|
self.edit_device.setCurrentIndex(0)
|
||||||
self.current_format = None
|
|
||||||
self.current_device = None
|
self.current_device = None
|
||||||
|
self.current_format = None
|
||||||
|
if txt == '':
|
||||||
|
self.clear_fields(new_boxes=False)
|
||||||
return
|
return
|
||||||
self.clear_fields(new_boxes=True)
|
self.clear_fields(new_boxes=True)
|
||||||
txt = unicode(txt)
|
txt = unicode(txt)
|
||||||
@ -145,11 +148,11 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
devices.append(d)
|
devices.append(d)
|
||||||
self.edit_device.clear()
|
self.edit_device.clear()
|
||||||
self.edit_device.addItems(devices)
|
self.edit_device.addItems(devices)
|
||||||
self.edit_device.setCurrentIndex(0)
|
|
||||||
|
|
||||||
def new_device_changed(self, txt):
|
def new_device_changed(self, txt):
|
||||||
if txt == '':
|
|
||||||
self.current_device = None
|
self.current_device = None
|
||||||
|
if txt == '':
|
||||||
|
self.clear_fields(edit_boxes=False)
|
||||||
return
|
return
|
||||||
self.clear_fields(edit_boxes=True)
|
self.clear_fields(edit_boxes=True)
|
||||||
self.current_device = unicode(txt)
|
self.current_device = unicode(txt)
|
||||||
@ -200,13 +203,14 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
self.set_fields()
|
self.set_fields()
|
||||||
|
|
||||||
def new_format_changed(self, txt):
|
def new_format_changed(self, txt):
|
||||||
if txt == '':
|
|
||||||
self.current_format = None
|
self.current_format = None
|
||||||
self.current_device = None
|
self.current_device = None
|
||||||
return
|
self.new_device.setCurrentIndex(0)
|
||||||
|
if txt:
|
||||||
self.clear_fields(edit_boxes=True)
|
self.clear_fields(edit_boxes=True)
|
||||||
self.current_format = unicode(txt)
|
self.current_format = unicode(txt)
|
||||||
self.new_device.setCurrentIndex(0)
|
else:
|
||||||
|
self.clear_fields(edit_boxes=False)
|
||||||
|
|
||||||
def ok_clicked(self):
|
def ok_clicked(self):
|
||||||
pb = []
|
pb = []
|
||||||
@ -254,6 +258,9 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
self.refill_all_boxes()
|
self.refill_all_boxes()
|
||||||
|
|
||||||
def refill_all_boxes(self):
|
def refill_all_boxes(self):
|
||||||
|
if self.refilling:
|
||||||
|
return
|
||||||
|
self.refilling = True
|
||||||
self.current_device = None
|
self.current_device = None
|
||||||
self.current_format = None
|
self.current_format = None
|
||||||
self.clear_fields(new_boxes=True)
|
self.clear_fields(new_boxes=True)
|
||||||
@ -277,6 +284,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
ops.append('[' + op[0] + '] -> ' + op[1])
|
ops.append('[' + op[0] + '] -> ' + op[1])
|
||||||
txt += '%s:%s %s\n'%(f, d, ', '.join(ops))
|
txt += '%s:%s %s\n'%(f, d, ', '.join(ops))
|
||||||
self.existing_plugboards.setPlainText(txt)
|
self.existing_plugboards.setPlainText(txt)
|
||||||
|
self.refilling = False
|
||||||
|
|
||||||
def restore_defaults(self):
|
def restore_defaults(self):
|
||||||
ConfigWidgetBase.restore_defaults(self)
|
ConfigWidgetBase.restore_defaults(self)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user