from PyQt5.QtWidgets import QAbstractItemView
from ui.editor import Editor


class Recipe_Spec_Editor(Editor):
    def __init__(self, action=None,  cell_widget=None):
        super().__init__(action=action, cell_widget=cell_widget)
        self.spec.update({
            "steps": self.steps_lw,
        })
        self.steps_lw.setDragDropMode(QAbstractItemView.InternalMove)

    def set_readonly(self, readonly=True):
        super().set_readonly(readonly=readonly)
        self.steps_lw.setDisabled(readonly)
        self.remove_step_b.setDisabled(readonly)
        self.steps_available_lw.setDisabled(readonly)
        self.add_step_b.setDisabled(readonly)
