Skip to content

Commit

Permalink
Refresh the canvas after editing the selection
Browse files Browse the repository at this point in the history
  • Loading branch information
maoschanz committed Mar 7, 2020
1 parent ef0ae17 commit 7da5129
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 19 deletions.
6 changes: 3 additions & 3 deletions deb_package.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 9 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -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. <[email protected]> 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
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project(
'drawing',
version: '0.4.12',
version: '0.4.13',
meson_version: '>= 0.45.0',
)

Expand Down
2 changes: 0 additions & 2 deletions src/headerbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion src/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/tools/classic_tools/tool_polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
19 changes: 14 additions & 5 deletions src/tools/selection_tools/tool_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 #######################################################
Expand Down Expand Up @@ -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 ?
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ##########################################################

Expand Down
12 changes: 6 additions & 6 deletions src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 7da5129

Please sign in to comment.