Esempio n. 1
0
    def initialize(self, data):
        """Initialize widget state from the data."""
        col_targets, row_targets = grouputils.group_candidates(data)
        modelitems = [guiutils.standarditem_from(obj)
                      for obj in col_targets + row_targets]

        model = QStandardItemModel()
        for item in modelitems:
            model.appendRow(item)

        self.label_selection_widget.setModel(model)

        self.targets = col_targets + row_targets
        # Default selections for all group keys
        # (the first value is selected)
        self.stored_selections = [[0] for _ in self.targets]
Esempio n. 2
0
    def initialize(self, data):
        """Initialize widget state from the data."""
        col_targets, row_targets = grouputils.group_candidates(data)
        modelitems = [guiutils.standarditem_from(obj)
                      for obj in col_targets + row_targets]

        model = QStandardItemModel()
        for item in modelitems:
            model.appendRow(item)

        self.label_selection_widget.setModel(model)

        self.targets = col_targets + row_targets
        # Default selections for all group keys
        # (the first value is selected)
        self.stored_selections = [[0] for _ in self.targets]
Esempio n. 3
0
    def init_from_data(self):
        """Initialize widget state after receiving new data.
        """
        if self.data is not None:
            column_groups, row_groups = grouputils.group_candidates(self.data)
            self.targets = column_groups + row_groups
            self.stored_selections = [[0] for _ in self.targets]

            targetitems = [guiutils.standarditem_from(desc)
                           for desc in self.targets]
            model = QStandardItemModel()
            for item in targetitems:
                model.appendRow(item)

            with blocked_signals(self.target_widget):
                self.target_widget.setModel(model)

        else:
            self.targets = []
            self.stored_selections = []
            with blocked_signals(self.target_widget):
                self.target_widget.setModel(None)
Esempio n. 4
0
    def init_from_data(self):
        """Initialize widget state after receiving new data.
        """
        if self.data is not None:
            column_groups, row_groups = grouputils.group_candidates(self.data)
            self.targets = column_groups + row_groups
            self.stored_selections = [[0] for _ in self.targets]

            targetitems = [
                guiutils.standarditem_from(desc) for desc in self.targets
            ]
            model = QStandardItemModel()
            for item in targetitems:
                model.appendRow(item)

            with blocked_signals(self.target_widget):
                self.target_widget.setModel(model)

        else:
            self.targets = []
            self.stored_selections = []
            with blocked_signals(self.target_widget):
                self.target_widget.setModel(None)