コード例 #1
0
ファイル: model_bind.py プロジェクト: corrscope/corrscope
    def cfg2gui(self) -> None:
        """Update the widget without triggering signals.

        When the presentation pmodel updates dependent widget 1,
        the pmodel (not widget 1) is responsible for updating other
        dependent widgets.
        TODO add option to send signals
        """
        with qc.QSignalBlocker(self):
            self.set_gui(self.pmodel[self.path])
コード例 #2
0
ファイル: model_bind.py プロジェクト: corrscope/corrscope
    def set_gui(self, value: Optional[str]):
        """model2gui"""

        if self.optional and not value:
            value = ""
        else:
            value = color2hex(value)  # raises CorrError if invalid.

        # Don't write back to model immediately.
        # Loading is a const process, only editing the GUI should change the model.
        with qc.QSignalBlocker(self):
            self.setText(value)

        # Write to other GUI widgets immediately.
        self.hex_color.emit(value)  # calls button.set_color()
コード例 #3
0
ファイル: model_bind.py プロジェクト: corrscope/corrscope
 def set_color(self, hex_color: str):
     with qc.QSignalBlocker(self):
         self.setChecked(bool(hex_color))