Skip to content

Commit

Permalink
Update sensitivity of new actions/options to avoid unexpected behaviors
Browse files Browse the repository at this point in the history
issues #332 #369
  • Loading branch information
maoschanz committed May 29, 2021
1 parent e54c970 commit c8bde67
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ def update_actions_state(self):
self.set_action_sensitivity('selection_delete', state)
self.set_action_sensitivity('selection_export', state)
self.set_action_sensitivity('new_tab_selection', state)
self.set_action_sensitivity('selection-replace-canvas', state)
self.set_action_sensitivity('selection-expand-canvas', state)
self.active_tool().update_actions_state()

def active_tool(self):
Expand Down
2 changes: 1 addition & 1 deletion src/tools/classic_tools/brushes/abstract_brush.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __init__(self, brush_id, brush_tool, *args):
self._id = brush_id
self._tool = brush_tool

def _get_status(self, use_pressure):
def _get_status(self, use_pressure, brush_direction):
return _("Brush")

############################################################################
Expand Down
2 changes: 1 addition & 1 deletion src/tools/classic_tools/brushes/brush_airbrush.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class BrushAirbrush(AbstractBrush):
__gtype_name__ = 'BrushAirbrush'

def _get_status(self, use_pressure):
def _get_status(self, use_pressure, brush_direction):
label = _("Airbrush") + " - "
if use_pressure:
label += _("Density depends on the stylus pressure")
Expand Down
2 changes: 1 addition & 1 deletion src/tools/classic_tools/brushes/brush_hairy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class BrushHairy(AbstractBrush):
__gtype_name__ = 'BrushHairy'

def _get_status(self, use_pressure):
def _get_status(self, use_pressure, brush_direction):
label = _("Hairy brush")
if use_pressure:
label += " - " + _("Width depends on the stylus pressure")
Expand Down
3 changes: 2 additions & 1 deletion src/tools/classic_tools/brushes/brush_nip.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
class BrushNip(AbstractBrush):
__gtype_name__ = 'BrushNip'

def _get_status(self, use_pressure):
def _get_status(self, use_pressure, brush_direction):
label = _("Calligraphic nib") + " - "
if use_pressure:
label += _("Width depends on the stylus pressure")
else:
label += _("Width depends on the line orientation")
# XXX do something from the `brush_direction` data
return label

def draw_preview(self, operation, cairo_context):
Expand Down
2 changes: 1 addition & 1 deletion src/tools/classic_tools/brushes/brush_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class BrushSimple(AbstractBrush):
__gtype_name__ = 'BrushSimple'

def _get_status(self, use_pressure):
def _get_status(self, use_pressure, brush_direction):
label = _("Simple brush") + " - "
if use_pressure:
label += _("Width depends on the stylus pressure")
Expand Down
5 changes: 4 additions & 1 deletion src/tools/classic_tools/tool_brush.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ def get_edition_status(self):
self._brush_type = self.get_option_value('brush-type')
self._brush_dir = self.get_option_value('brush-dir')

enable_direction = self._brush_type == 'calligraphic'
self.set_action_sensitivity('brush-dir', enable_direction)

active_brush = self._brushes_dict[self._brush_type]
return active_brush._get_status(self._last_use_pressure)
return active_brush._get_status(self._last_use_pressure, self._brush_dir)

############################################################################

Expand Down

0 comments on commit c8bde67

Please sign in to comment.