diff --git a/src/tools/transform_tools/tool_scale.py b/src/tools/transform_tools/tool_scale.py index 196225b0..afb0c397 100644 --- a/src/tools/transform_tools/tool_scale.py +++ b/src/tools/transform_tools/tool_scale.py @@ -74,19 +74,6 @@ def get_options_label(self): return _("Scaling options") def get_editing_tips(self): - # The current method is called when options change, so i use it to: - - # 1) update the visibility of the spinbuttons depending on which ones - # the user wants to use. - self._update_to_wanted_unit() - - # 2) update the bullshit around ratio preservation actions - ratio_option = self.get_option_value('scale-proportions') - if not ratio_option == 'corners': - action = self.window.lookup_action('scale-ratio-spinbtns') - action.set_state(GLib.Variant.new_boolean(ratio_option == 'always')) - self.set_action_sensitivity('scale-ratio-spinbtns', ratio_option == 'corners') - if self.apply_to_selection: label_action = _("Scaling the selection") label_confirm = None @@ -107,6 +94,28 @@ def get_editing_tips(self): full_list = [label_action, label_confirm, label_modifier_shift] return list(filter(None, full_list)) + def on_options_changed(self): + # 1) update the visibility of the spinbuttons depending on which ones + # the user wants to use. + want_pixels = self.get_option_value('scale-unit') == 'pixels' + if want_pixels: + self._width_btn.set_visible(True) + self._height_btn.set_visible(True) + self._w100_btn.set_visible(False) + self._h100_btn.set_visible(False) + else: + self._width_btn.set_visible(False) + self._height_btn.set_visible(False) + self._w100_btn.set_visible(True) + self._h100_btn.set_visible(True) + + # 2) update the bullshit around ratio preservation actions + ratio_option = self.get_option_value('scale-proportions') + if not ratio_option == 'corners': + action = self.window.lookup_action('scale-ratio-spinbtns') + action.set_state(GLib.Variant.new_boolean(ratio_option == 'always')) + self.set_action_sensitivity('scale-ratio-spinbtns', ratio_option == 'corners') + def on_tool_selected(self, *args): super().on_tool_selected() self._x = 0 @@ -133,19 +142,6 @@ def _get_original_size(self): ############################################################################ - def _update_to_wanted_unit(self): - want_pixels = self.get_option_value('scale-unit') == 'pixels' - if want_pixels: - self._width_btn.set_visible(True) - self._height_btn.set_visible(True) - self._w100_btn.set_visible(False) - self._h100_btn.set_visible(False) - else: - self._width_btn.set_visible(False) - self._height_btn.set_visible(False) - self._w100_btn.set_visible(True) - self._h100_btn.set_visible(True) - def set_preserve_ratio(self, for_spinbtns=False): """Set whether or not `self._preserve_ratio` should be true. If it is, AND that wasn't already the case before, this method sets the value of