def on_btns_toggled(self, idx, checked):
     if checked:
         if not self._csw_switch.select(idx):
             with qtx.BlockSignals(self._btns[idx]):
                 self._btns[idx].setChecked(False)
     else:
         if not self._csw_switch.unselect():
             with qtx.BlockSignals(self._btns[idx]):
                 self._btns[idx].setChecked(True)
Esempio n. 2
0
    def _on_csw_switch_selected(self, idx, choice):
        with qtx.BlockSignals(self._combobox):
            if idx is None:
                self._combobox.setCurrentIndex(0)
            else:
                if self._has_none_choice:
                    idx += 1

                self._combobox.setCurrentIndex(idx)
Esempio n. 3
0
    def _on_csw_paths(self, paths, prev_paths):
        if len(paths) == 0:
            text = None
        elif len(paths) == 1:
            text = str(paths[0])
        else:
            raise NotImplementedError()

        with qtx.BlockSignals(self._lineedit):
            self._lineedit.setText(text)
Esempio n. 4
0
 def _on_csw_idx_count(self, idx_count):
     #print('_on_csw_idx_count', idx_count)
     if idx_count is not None:
         with qtx.BlockSignals(
             [self._slider, self._spinbox_index, self._spinbox_count]):
             self._slider.setMinimum(1)
             self._slider.setMaximum(idx_count)
             self._spinbox_index.setMinimum(1)
             self._spinbox_index.setMaximum(idx_count)
             self._spinbox_count.setMaximum(idx_count)
             self._spinbox_count.setValue(idx_count)
Esempio n. 5
0
    def _on_csw_choices(self, choices, choices_names,
                        none_choice_name: Union[str, None]):
        idx = 0
        if self._combobox is not None:
            idx = self._combobox.currentIndex()
            self._main_l.removeWidget(self._combobox)
            self._combobox.deleteLater()

        self._choices_names = choices_names
        self._has_none_choice = none_choice_name is not None

        combobox = self._combobox = qtx.QXComboBox(
            font=QXFontDB.get_fixedwidth_font(),
            on_index_changed=self.on_combobox_index_changed)
        with qtx.BlockSignals(self._combobox):
            if none_choice_name is not None:
                combobox.addItem(qtx.QIcon(), L(none_choice_name))

            for choice_name in choices_names:
                combobox.addItem(qtx.QIcon(), L(choice_name))

            combobox.setCurrentIndex(idx)

        self._main_l.addWidget(combobox)
 def _on_csw_progress(self, progress):
     with qtx.BlockSignals(self._progressbar):
         self._progressbar.setValue(progress)
Esempio n. 7
0
 def _on_csw_idx(self, idx):
     #print('_on_csw_idx', idx)
     if idx is not None:
         with qtx.BlockSignals([self._slider, self._spinbox_index]):
             self._slider.setValue(idx + 1)
             self._spinbox_index.setValue(idx + 1)
Esempio n. 8
0
 def _on_csw_number(self, value):
     if value is not None:
         config = self._config
         value = (value - config.min) / config.step
         with qtx.BlockSignals([self._slider]):
             self._slider.setValue(value)
Esempio n. 9
0
    def _on_csw_text(self, text):

        with qtx.BlockSignals(self._lineedit):
            self._lineedit.setText(text)
Esempio n. 10
0
 def on_csw_flag(self, flag):
     with qtx.BlockSignals(self._chbox):
         self._chbox.setChecked(flag)
Esempio n. 11
0
 def _on_csw_number(self, number):
     with qtx.BlockSignals(self._spinbox):
         self._spinbox.setValue(number)
         self._btn_auto_update()
 def _on_csw_switch_selected(self, idx, choice):
     with qtx.BlockSignals(self._btns):
         for i, btn in enumerate(self._btns):
             btn.setChecked(i == idx)