def list_items(widget: QListWidget, returnRow: bool = False) -> Tuple[int, QListWidgetItem]: """A generator to get items from list widget.""" for row in range(widget.count()): if returnRow: yield row, widget.item(row) else: yield widget.item(row)
def __init__(self, row: int, widget: QListWidget ): QUndoCommand.__init__(self) self.row = row self.widget = widget self.name = widget.item(row).text() self.mechanism = widget.item(row).expr
def list_texts( widget: QListWidget, return_row: bool = False) -> Iterator[Union[Tuple[int, str], str]]: """Generator to get the text from list widget.""" for row in range(widget.count()): if return_row: yield row, widget.item(row).text() else: yield widget.item(row).text()
def __init__(self, row: int, widget: QListWidget): super(DeleteVariable, self).__init__() self.item = widget.item(row) self.widget = widget
def __init__(self, row: int, widget: QListWidget): super(DeleteStorage, self).__init__() self.row = row self.widget = widget self.name = widget.item(row).text() self.mechanism = widget.item(row).expr
def __init__(self, row: int, widget: QListWidget): QUndoCommand.__init__(self) self.item = widget.item(row) self.widget = widget
def list_texts(widget: QListWidget) -> Iterator[str]: """Generator to get the text from list widget.""" for row in range(widget.count()): yield widget.item(row).text()