Ejemplo n.º 1
0
        def target_list_changed_callback(
                item: QtWidgets.QListWidgetItem) -> None:

            # check for current point
            if self.current_point not in self.settings.keys():
                if item.checkState():
                    item.setCheckState(False)
                return

            if item.checkState():
                # prevent channel plot select double population
                if self.channelPlotSelect.findText(
                        item.text(), QtCore.Qt.MatchExactly) >= 0:
                    return

                # populate channel plot select dropdown w/ sort
                all_items_sorted = sorted([
                    self.channelPlotSelect.itemText(i)
                    for i in range(self.channelPlotSelect.count())
                ] + [item.text()])
                self.channelPlotSelect.insertItem(
                    all_items_sorted.index(item.text()), item.text())

                # init settings and refocus plot
                self.settings[self.current_point][
                    item.text()] = self.get_params()
            else:
                # remove channel from dropdown
                item_index = self.channelPlotSelect.findText(
                    item.text(), QtCore.Qt.MatchExactly)
                self.channelPlotSelect.removeItem(item_index)

                # clean up removal settings
                for point in self.settings.keys():
                    self.settings[point].pop(item.text())
Ejemplo n.º 2
0
 def display_connection_list(self):
     self.lstConns.clear()
     for cfg in self.connections_current:
         item = QListWidgetItem(cfg.get_description())
         item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
         item.setCheckState(Qt.Checked if cfg.enabled else Qt.Unchecked)
         item.checkState()
         self.lstConns.addItem(item)
Ejemplo n.º 3
0
 def displayConnsConfigs(self):
     # display all connection configs
     self.lstConns.clear()
     for cfg in self.local_config.dash_net_configs:
         item = QListWidgetItem(cfg.get_description())
         item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
         item.setCheckState(Qt.Checked if cfg.enabled else Qt.Unchecked)
         item.checkState()
         self.lstConns.addItem(item)
Ejemplo n.º 4
0
    def on_actNewConn_triggered(self):
        cfg = DashNetworkConnectionCfg('rpc')
        self.local_config.dash_net_configs.append(cfg)

        # add config to the connections list:
        item = QListWidgetItem(cfg.get_description())
        item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
        item.setCheckState(Qt.Checked if cfg.enabled else Qt.Unchecked)
        item.checkState()
        self.lstConns.addItem(item)
        self.lstConns.setCurrentItem(item)
        self.set_modified()
Ejemplo n.º 5
0
    def on_action_new_connection_triggered(self):
        cfg = FixNetworkConnectionCfg('rpc')
        cfg.testnet = True if self.cboFixNetwork.currentIndex() == 1 else False
        self.connections_current.append(cfg)

        # add config to the connections list:
        item = QListWidgetItem(cfg.get_description())
        item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
        item.setCheckState(Qt.Checked if cfg.enabled else Qt.Unchecked)
        item.checkState()
        self.lstConns.addItem(item)
        self.lstConns.setCurrentItem(item)
        self.set_modified()
Ejemplo n.º 6
0
 def check_item(self, item: QListWidgetItem):
     if not item.text():
         return  # FIXME: make textless items uncheckable
     if item.checkState() == Qt.Checked:
         item.setCheckState(Qt.Unchecked)
     else:
         item.setCheckState(Qt.Checked)
Ejemplo n.º 7
0
        def target_list_clicked_callback(item: QtWidgets.QListWidgetItem,
                                         settings=self.settings) -> None:
            if self.prevent_plotting:
                return

            if item.checkState():
                # load settings if they exist
                if channel in settings.keys():
                    if item.text() in settings[channel].keys():
                        self.set_params(settings[channel][item.text()])
                if item.text(
                ) != self.current_target or channel != self.current_source:
                    self.refocus_plots()
                    self.current_target = item.text()
                    self.current_source = channel
Ejemplo n.º 8
0
        def target_list_changed_callback(
                item: QtWidgets.QListWidgetItem) -> None:
            if self.prevent_plotting:
                return

            if item.checkState():
                # init settings and refocus plots
                self.settings[channel][item.text()] = self.get_params()
                if item.text(
                ) != self.current_target or channel != self.current_source:
                    # set item to current
                    item.listWidget().setCurrentItem(item)
                    self.refocus_plots()
                    self.current_target = item.text()
                    self.current_source = channel

            else:
                # clean up removal settings
                self.settings[channel].pop(item.text())
                self.current_target = item.text()
                self.current_source = channel
Ejemplo n.º 9
0
    def modeSelectorClickHandler(self, item: QListWidgetItem):
        INDEX_ALL = 0
        INDEX_NONE = 1
        index = self.ModeSelectorComboBox.indexFromItem(item)
        if index.row() == INDEX_ALL:
            self.ModeSelectorComboBox\
                .itemFromIndex(index.siblingAtRow(INDEX_ALL))\
                .setCheckState(Qt.Checked)
            self.ModeSelectorComboBox\
                .itemFromIndex(index.siblingAtRow(INDEX_NONE))\
                .setCheckState(Qt.Unchecked)
            for i in range(2, self.ModeSelectorComboBox.count()):
                item = self.ModeSelectorComboBox.itemFromIndex(
                    index.siblingAtRow(i))
                item.setCheckState(Qt.Checked)
        elif index.row() == INDEX_NONE:
            self.ModeSelectorComboBox\
                .itemFromIndex(index.siblingAtRow(INDEX_NONE))\
                .setCheckState(Qt.Checked)
            self.ModeSelectorComboBox\
                .itemFromIndex(index.siblingAtRow(INDEX_ALL))\
                .setCheckState(Qt.Unchecked)
            for i in range(2, self.ModeSelectorComboBox.count()):
                item = self.ModeSelectorComboBox.itemFromIndex(
                    index.siblingAtRow(i))
                item.setCheckState(False)

        else:
            self.ModeSelectorComboBox\
                .itemFromIndex(index.siblingAtRow(INDEX_NONE))\
                .setCheckState(Qt.Unchecked)
            self.ModeSelectorComboBox\
                .itemFromIndex(index.siblingAtRow(INDEX_ALL))\
                .setCheckState(Qt.Unchecked)
            if item.checkState():
                item.setCheckState(Qt.Unchecked)
            else:
                item.setCheckState(Qt.Checked)
        self.updateHiddenReplays()
        self.setModeSelectorButtonText()
Ejemplo n.º 10
0
 def item_clicked_slot(self, item: QListWidgetItem):
     index = self.ui.itemsList.row(item)
     is_checked = bool(item.checkState())
     items_list[index].is_checked = is_checked
Ejemplo n.º 11
0
 def _onoffCheck(self, click_item: QtWidgets.QListWidgetItem):
     state = 2 if int(click_item.checkState()) == 0 else 0
     click_item.setCheckState(Qt.CheckState(state))
     return True
Ejemplo n.º 12
0
 def onItemChanged(self, item: QListWidgetItem):
     self.filterChanged.emit(item.data(Qt.UserRole),
                             item.checkState() == Qt.Checked)
Ejemplo n.º 13
0
 def on_lw_changed(self, item: QListWidgetItem):
     self.list_data = list(
         map(
             lambda each: dict(check_state=item.checkState(),
                               text=item.text())
             if each['text'] == item.text() else each, self.list_data))
Ejemplo n.º 14
0
    def _log_client_changed(self, item: QtWidgets.QListWidgetItem):
        """Update log filter."""

        # update proxy
        self.log_proxy.filter_source(str(item.text()),
                                     item.checkState() == QtCore.Qt.Checked)