From 7da5129600b0192bd8ac3620e1f94bd6354647eb Mon Sep 17 00:00:00 2001 From: "Romain F. T" Date: Sat, 7 Mar 2020 15:34:33 +0100 Subject: [PATCH] Refresh the canvas after editing the selection --- deb_package.sh | 6 +++--- debian/changelog | 9 +++++++++ meson.build | 2 +- src/headerbar.py | 2 -- src/properties.py | 1 - src/tools/classic_tools/tool_polygon.py | 2 +- src/tools/selection_tools/tool_select.py | 19 ++++++++++++++----- src/window.py | 12 ++++++------ 8 files changed, 34 insertions(+), 19 deletions(-) diff --git a/deb_package.sh b/deb_package.sh index 19bb5db1..2099d000 100755 --- a/deb_package.sh +++ b/deb_package.sh @@ -1,14 +1,14 @@ #!/bin/bash DISTRO="unstable" # TODO lister les valeurs possibles (debian ? ubuntu ? elementary ?) -PACKAGE_NAME="drawing" # TODO et pour elementary ? -VERSION="0.4.12" +PACKAGE_NAME="drawing" # et pour elementary ? +VERSION="0.4.13" echo "targeted distribution: $DISTRO" echo "package name: $PACKAGE_NAME" echo "package version: $VERSION" echo "" -echo "Is it correct? [Return/^C]" # XXX ptêt écrasé dans la suite des opérations ? +echo "Is it correct? [Return/^C]" # écrasé dans la suite des opérations ? read confirmation # se souvenir du dossier courant (qui est la racine du projet) pour y amener le paquet à la fin diff --git a/debian/changelog b/debian/changelog index 2af20b4c..b8d87059 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +drawing (0.4.13) unstable; urgency=low + + * Disable a broken feature concerning the save dialog (sandboxed package formats only) (#202) + * Remove dead code + * Update polish and german translations + * Fix minor issue with the selection + + -- Romain F. T. Sat, 07 Mar 2020 20:00:00 +0100 + drawing (0.4.12) unstable; urgency=low * The preferences dialog now looks better with Cinnamon, Xfce and MATE diff --git a/meson.build b/meson.build index 4e0423cb..b55388d6 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project( 'drawing', - version: '0.4.12', + version: '0.4.13', meson_version: '>= 0.45.0', ) diff --git a/src/headerbar.py b/src/headerbar.py index 04e48ae8..fcc85ba4 100644 --- a/src/headerbar.py +++ b/src/headerbar.py @@ -82,8 +82,6 @@ def adapt_to_window_size(self): def set_compact(self, state): """Set the compactness of the headerbar: if the parameter is True, wide widgets will be hidden in favor of narrow ones. Else, the opposite.""" - # XXX Instead of a boolean, `state` could be an integer, which would be - # far more complex to handle, but would allow thinner granularity. if state: self.main_menu_btn.set_menu_model(self.long_main_menu) else: diff --git a/src/properties.py b/src/properties.py index 4af195d2..1f41f701 100644 --- a/src/properties.py +++ b/src/properties.py @@ -66,7 +66,6 @@ def build_ui(self): btn_cm = builder.get_object('units_cm') btn_in.join_group(btn_px) btn_cm.join_group(btn_px) - # TODO translatable units btn_px.connect('toggled', self.set_unit, ' px') btn_cm.connect('toggled', self.set_unit, ' cm') btn_in.connect('toggled', self.set_unit, ' in') diff --git a/src/tools/classic_tools/tool_polygon.py b/src/tools/classic_tools/tool_polygon.py index f7191a19..10e33862 100644 --- a/src/tools/classic_tools/tool_polygon.py +++ b/src/tools/classic_tools/tool_polygon.py @@ -60,7 +60,7 @@ def draw_polygon(self, event_x, event_y, is_preview): self.continue_polygon(cairo_context, event_x, event_y) return False - def init_polygon(self, cairo_context): # TODO simplfiable depuis que c'est split en 2 outils + def init_polygon(self, cairo_context): # TODO simplifiable ? (self.past_x, self.past_y) = (self.x_press, self.y_press) cairo_context.move_to(self.x_press, self.y_press) self._path = cairo_context.copy_path() diff --git a/src/tools/selection_tools/tool_select.py b/src/tools/selection_tools/tool_select.py index 30cc7e98..a136d705 100644 --- a/src/tools/selection_tools/tool_select.py +++ b/src/tools/selection_tools/tool_select.py @@ -43,8 +43,7 @@ def __init__(self, window, **kwargs): self.minimap_icon = builder.get_object('minimap_icon') self.window.bottom_panel_box.add(self.bottom_panel) self.implements_panel = True - # self.needed_width_for_long = XXX TODO currently harcoded - self.needed_width_for_long = 450 + self.needed_width_for_long = 450 # TODO it's bad to hardcode this ############################################################################ # UI implementations ####################################################### @@ -97,8 +96,9 @@ def give_back_control(self, preserve_selection): if not preserve_selection: self.unselect_and_apply() - # def on_tool_selected(self, *args): - # XXX rien, vraiment ? + def on_tool_selected(self, *args): + if self.selection_is_active(): + self.refresh() # def on_tool_unselected(self, *args): # XXX rien, vraiment ? @@ -155,7 +155,8 @@ def on_motion_on_area(self, event, surface, event_x, event_y): self.draw_polygon(event_x, event_y) elif self.behavior == 'drag': # self.drag_to(event_x, event_y) - pass # on modifie réellement les coordonnées, c'est pas une "vraie" preview + pass # XXX ça modifie réellement les coordonnées, c'est pas une + # "vraie" preview, refactoring nécessaire def on_unclicked_motion_on_area(self, event, surface): x = event.x + self.get_image().scroll_x @@ -210,6 +211,14 @@ def drag_to(self, event_x, event_y): self.do_tool_operation(operation) self.operation_type = 'op-define' + def refresh(self): + self.future_x = self.get_selection().selection_x + self.future_y = self.get_selection().selection_y + self.operation_type = 'op-drag' + operation = self.build_operation() + self.do_tool_operation(operation) + self.operation_type = 'op-define' + ############################################################################ # Path management ########################################################## diff --git a/src/window.py b/src/window.py index 2dfda1db..035b9916 100644 --- a/src/window.py +++ b/src/window.py @@ -255,13 +255,13 @@ def build_new_tab(self, gfile=None, pixbuf=None, \ def on_active_tab_changed(self, *args): self.switch_to(self.active_tool_id, args[1]) - # On devrait être moins bourrin et conserver la sélection #FIXME + # On devrait être moins bourrin et conserver la sélection # TODO self.set_picture_title(args[1].update_title()) def update_tabs_menu_section(self, *args): action = self.lookup_action('active_tab') section = self.app.get_menubar().get_item_link(2, \ - Gio.MENU_LINK_SUBMENU).get_item_link(6, Gio.MENU_LINK_SECTION) + Gio.MENU_LINK_SUBMENU).get_item_link(4, Gio.MENU_LINK_SECTION) section.remove_all() for page in self.notebook.get_children(): tab_title = page.update_title() @@ -681,7 +681,6 @@ def set_tools_labels_visibility(self, visible): self.tools_flowbox.set_max_children_per_line(nb_tools) def on_show_labels_setting_changed(self, *args): - # TODO https://lazka.github.io/pgi-docs/Gio-2.0/classes/Settings.html#Gio.Settings.create_action self.set_tools_labels_visibility(self._settings.get_boolean('show-labels')) def on_show_labels_action_changed(self, *args): @@ -1003,11 +1002,12 @@ def action_selection_export(self, *args): pixbuf = self.get_active_image().selection.get_pixbuf() utilities_save_pixbuf_to(pixbuf, gfile.get_path(), self) - def get_selection_tool(self): # XXX réellement utile ? + def get_selection_tool(self): if 'select' in self.tools: return self.tools['select'] else: - self.prompt_message(True, 'Required tool is not available') + self.prompt_message(True, _("Required tool is not available")) + # Never happens in versions 0.4.x return self.active_tool() def force_selection(self, *args): @@ -1041,7 +1041,7 @@ def action_restore(self, *args): self.get_active_image().use_stable_pixbuf() self.get_active_image().update() - def action_rebuild(self, *args): # XXX image method ? + def action_rebuild(self, *args): """Rebuild the image according to the history content.""" self.get_active_image().restore_first_pixbuf() h = self.get_active_image().undo_history.copy()