Exemplo n.º 1
0
    def initialize(self):
        self._setting = SETTINGS.get(self._setting_name)
        if self._setting is not None:
            self.setDisplayChecked(self._setting.getValue())

            self._setting.notify(self.setDisplayChecked)
            self.toggled.connect(self._setting.setValue)
Exemplo n.º 2
0
    def textFormat(self, text_fmt):
        if self._setting_name is not "":
            setting = SETTINGS.get(self._setting_name)
            try:
                str = text_fmt.format(setting.getValue())
            except ValueError:
                return

        self._text_format = text_fmt
Exemplo n.º 3
0
    def terminate(self):
        LOG.debug("Saving persistent settings to %s", self.persistence_file)
        settings = {}
        for key, obj in SETTINGS.items():
            if obj.persistent == True:
                value = obj.getValue()
                if obj.default_value != value:
                    settings[key] = value

        with open(self.persistence_file, 'w') as fh:
            fh.write(json.dumps(settings, indent=4, sort_keys=True))
Exemplo n.º 4
0
    def initialize(self):
        self._setting = SETTINGS.get(self._setting_name)
        if self._setting is not None:
            if self._setting.max_value is not None:
                self.setMaximum(self._setting.max_value)
            if self._setting.min_value is not None:
                self.setMinimum(self._setting.min_value)

            self.setDisplayValue(self._setting.getValue())
            self._setting.notify(self.setDisplayValue)
            self.valueChanged.connect(self._setting.setValue)
Exemplo n.º 5
0
    def initialize(self):
        self._setting = SETTINGS.get(self._setting_name)
        if self._setting is not None:

            value = self._setting.getValue()

            options = self._setting.enum_options
            if isinstance(options, list):
                for option in options:
                    self.addItem(option)

            self.setDisplayIndex(value)
            self.currentIndexChanged.emit(value)

            self._setting.notify(self.setDisplayIndex)
            self.currentIndexChanged.connect(self._setting.setValue)
Exemplo n.º 6
0
 def updateHalPinsWithCurrentSettings(self):
     self.comp.getPin(MindOverCncHalPins.TOOL_PROBE_X).value = SETTINGS.get(
         "tool-setter-probe.x-coordinate").getValue()
     self.comp.getPin(MindOverCncHalPins.TOOL_PROBE_Y).value = SETTINGS.get(
         "tool-setter-probe.y-coordinate").getValue()
     self.comp.getPin(MindOverCncHalPins.TOOL_PROBE_Z).value = SETTINGS.get(
         "tool-setter-probe.z-coordinate").getValue()
     self.comp.getPin(MindOverCncHalPins.MAX_Z_TRAVEL).value = SETTINGS.get(
         "tool-setter-probe.z-max-travel").getValue()
     self.comp.getPin(
         MindOverCncHalPins.SPINDLE_NOSE_HEIGHT).value = SETTINGS.get(
             "tool-setter-probe.spindle-nose-height").getValue()
     self.comp.getPin(
         MindOverCncHalPins.FAST_PROBE_RATE).value = SETTINGS.get(
             "tool-setter-probe.fast-probe-fr").getValue()
     self.comp.getPin(
         MindOverCncHalPins.RETRACT_DISTANCE).value = SETTINGS.get(
             "tool-setter-probe.retract-distance").getValue()
     self.comp.getPin(
         MindOverCncHalPins.SLOW_PROBE_RATE).value = SETTINGS.get(
             "tool-setter-probe.slow-probe-fr").getValue()
Exemplo n.º 7
0
    def initialize(self):
        self._setting = SETTINGS.get(self._setting_name)
        if self._setting is not None:

            val = self._setting.getValue()

            validator = None
            if type(val) == int:
                validator = QIntValidator()
            elif type(val) == float:
                validator = QDoubleValidator()

            self.setValidator(validator)

            if self._tmp_value:
                self.setDisplayValue(self._tmp_value)
                self._setting.setValue(self._tmp_value)
            else:
                self.setDisplayValue(self._setting.getValue())

            self._setting.notify(self.setDisplayValue)

            self.editingFinished.connect(self.onEditingFinished)
Exemplo n.º 8
0
 def initialize(self):
     self._setting = SETTINGS.get(self._setting_name)
     if self._setting is not None:
         self.setDisplayValue(self._setting.getValue())
Exemplo n.º 9
0
def getSetting(id, default=None):
    return SETTINGS.get(id, default)