Commit fe399d98 authored by Andoni Jimenez's avatar Andoni Jimenez
Browse files

Reapair not working shorcuts

parent 2c7dd5ce
Loading
Loading
Loading
Loading
+9 −14
Original line number Diff line number Diff line
@@ -223,8 +223,7 @@ class Ui(QtWidgets.QMainWindow):
        # 6 - what if multiple same named widgets? add groupid to widgetid?
        # 7 - multiple commentBox not supported (yes, but events need to be solved)
        # 8 - If filename not in input file, detect images (currently fails)
        # 9 - Shortcuts not working
        
        # DONE 9 - Shortcuts not working
        
        # Find checkboxes:
        # self.cbColumns = utils.getCheckBoxesColumns()
@@ -579,31 +578,27 @@ def addToolTip(widget: QtWidgets.QWidget, element:dict) -> None:
def addCheckBoxTexts(widget: QtWidgets.QCheckBox, element:dict) -> None:
    id, name, shortcut = None, None, None
    try:
        id = element['id']
        name = element['name']
        shortcut = element['shortcut']
        id, name, shortcut = element['id'], element['name'], element['shortcut']
    except KeyError as e:
        if name is None:
            name = id.capitalize()
        print(f"KeyError: {e}")
    finally:
        text = name
        if shortcut is not None:
        if shortcut is None:
            widget.setText(name)
        else:
            widget.setText(f"[{shortcut}] {name}")
            widget.setShortcut(shortcut)
            text = f"[{shortcut}] {name}"
        widget.setText(text)
        
def addRadioButtonTexts(widget: QtWidgets.QRadioButton, element:dict) -> None:
    id, name, shortcut = None, None, None
    try:
        id = element['id']
        name = element['name']
        shortcut = element['shortcut']
        id, name, shortcut = element['id'], element['name'], element['shortcut']
    except KeyError as e:
        if name is None:
            name = id.capitalize()
        print(f"KeyError: {e}")
    finally:
        widget.setText(name)
        if shortcut is not None:
            widget.setShortcut(shortcut)
 No newline at end of file
        widget.setText(name)
 No newline at end of file