diff --git a/data/ui/image_options_view.blp b/data/ui/image_options_view.blp index 667c394..08a9bac 100644 --- a/data/ui/image_options_view.blp +++ b/data/ui/image_options_view.blp @@ -100,58 +100,11 @@ template $HalftoneImageOptionsView : Adw.Bin { }; output => $on_image_width_changed(); } - - // TODO: Remove option completely if there's no user feedback to bring it back - Adw.SwitchRow aspect_ratio_toggle { - visible: false; - title: _("Keep aspect ratio"); - - [suffix] - Gtk.MenuButton aspect_ratio_button { - valign: center; - popover: aspect_ratio_explanation_popover; - icon-name: "help-about-symbolic"; - tooltip-text: _("Explanation"); - - styles [ - "flat" - ] - } - } - - // TODO: Remove option completely if there's no user feedback to bring it back - Adw.SpinRow image_height_row { - visible: false; - title: _("Height"); - subtitle: _("In pixels"); - adjustment: Gtk.Adjustment image_height_adjustment { - lower: 1; - upper: 8192; - step-increment: 1; - page-increment: 5; - }; - output => $on_image_height_changed(); - } } }; }; } -Gtk.Popover aspect_ratio_explanation_popover { - Gtk.Label aspect_ratio_explanation_label { - max-width-chars: 30; - justify: center; - wrap: true; - - margin-top: 6; - margin-bottom: 6; - margin-start: 6; - margin-end: 6; - - label: _("This option allows you to preserve original aspect ratio when resizing an image."); - } -} - Gtk.Popover convert_to_explanation_popover { Gtk.Label convert_to_explanation_label { max-width-chars: 30; diff --git a/halftone/views/dither_page.py b/halftone/views/dither_page.py index 9999c5d..47907ed 100644 --- a/halftone/views/dither_page.py +++ b/halftone/views/dither_page.py @@ -324,9 +324,9 @@ def _get_output_format_suffix(self) -> str: return format_string.lower() + # TODO: Remove this method, as the image_height_row doesn't exist def _set_size_spins(self, width: int, height: int) -> None: self.image_options_view.image_width_row.set_value(width) - self.image_options_view.image_height_row.set_value(height) def _start_task(self, task: Callable, *args) -> None: logging.debug("Starting new async task") diff --git a/halftone/views/image_options_view.py b/halftone/views/image_options_view.py index 23b105d..03bdffc 100644 --- a/halftone/views/image_options_view.py +++ b/halftone/views/image_options_view.py @@ -19,8 +19,6 @@ class HalftoneImageOptionsView(Adw.Bin): dither_algorithms_combo: Adw.ComboRow = Gtk.Template.Child() image_width_row: Adw.SpinRow = Gtk.Template.Child() - aspect_ratio_toggle: Adw.SwitchRow = Gtk.Template.Child() - image_height_row: Adw.SpinRow = Gtk.Template.Child() image_formats_stringlist: Gtk.StringList = Gtk.Template.Child() @@ -56,9 +54,6 @@ def __init__( """ def _setup_signals(self) -> None: - self.aspect_ratio_toggle.connect("notify::active", - self.on_aspect_ratio_toggled) - self.dither_algorithms_combo.connect("notify::selected", self.on_dither_algorithm_selected) @@ -69,10 +64,6 @@ def _setup(self) -> None: # Workaround: Set default values for SpinRows self.color_amount_row.set_value(10) self.image_width_row.set_value(1) - self.image_height_row.set_value(1) - - # By default keep image aspect ratio - self.aspect_ratio_toggle.set_active(True) self._setup_save_formats() @@ -132,38 +123,8 @@ def on_image_width_changed(self, widget: Adw.SpinRow) -> None: self.output_options.width = new_width if self.original_texture: - img_height = self.original_texture.get_height() - img_width = self.original_texture.get_width() - - if self.aspect_ratio_toggle.get_active() is True: - new_height = calculate_height(img_width, img_height, new_width) - self.output_options.height = new_height - self.image_height_row.set_value(new_height) - self.update_image_callback(True) - @Gtk.Template.Callback() - def on_image_height_changed(self, widget: Adw.SpinRow) -> None: - new_height = int(widget.props.value) - - if new_height == self.output_options.height: - return - - self.output_options.height = new_height - - if self.original_texture: - if not self.keep_aspect_ratio: - self.update_image_callback(True) - - def on_aspect_ratio_toggled(self, widget: Adw.SwitchRow, *args) -> None: - if widget.props.active is True: - self.keep_aspect_ratio = True - self.image_height_row.set_sensitive(False) - - if widget.props.active is False: - self.keep_aspect_ratio = False - self.image_height_row.set_sensitive(True) - def on_dither_algorithm_selected(self, widget: Adw.ComboRow, *args) -> None: algorithm_string = self._get_dither_algorithm_selected_string(widget)