예제 #1
0
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)
예제 #2
0
 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
예제 #3
0
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()
예제 #4
0
 def __init__(self, row: int, widget: QListWidget):
     super(DeleteVariable, self).__init__()
     self.item = widget.item(row)
     self.widget = widget
예제 #5
0
 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
예제 #6
0
 def __init__(self, row: int, widget: QListWidget):
     QUndoCommand.__init__(self)
     self.item = widget.item(row)
     self.widget = widget
예제 #7
0
def get_list(item: QListWidget) -> List[str]:
    """A generator to get symbols from list widget."""
    if not item:
        return []
    for e in item.text().split(", "):
        yield e
예제 #8
0
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()