Skip to content

Commit

Permalink
Add kbd shortcuts for "copy image to clipboard" & "apply transformation"
Browse files Browse the repository at this point in the history
  • Loading branch information
maoschanz committed Nov 11, 2020
1 parent c377a66 commit 37282cb
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/optionsbars/transform/optionsbar-crop.ui
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@

<child>
<object class="GtkButton" id="apply_btn">
<property name="action_name">win.apply_transform_tool</property>
<property name="action_name">win.apply_transform</property>
<property name="tooltip-text" translatable="yes">Apply</property>
<property name="visible">True</property>
<property name="valign">center</property>
Expand Down
2 changes: 1 addition & 1 deletion src/optionsbars/transform/optionsbar-filters.ui
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@

<child>
<object class="GtkButton" id="apply_btn">
<property name="action_name">win.apply_transform_tool</property>
<property name="action_name">win.apply_transform</property>
<property name="tooltip-text" translatable="yes">Apply</property>
<property name="visible">True</property>
<property name="valign">center</property>
Expand Down
2 changes: 1 addition & 1 deletion src/optionsbars/transform/optionsbar-rotate.ui
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@

<child>
<object class="GtkButton" id="apply_btn">
<property name="action_name">win.apply_transform_tool</property>
<property name="action_name">win.apply_transform</property>
<property name="tooltip-text" translatable="yes">Apply</property>
<property name="visible">True</property>
<property name="valign">center</property>
Expand Down
2 changes: 1 addition & 1 deletion src/optionsbars/transform/optionsbar-scale.ui
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

<child>
<object class="GtkButton" id="apply_btn">
<property name="action_name">win.apply_transform_tool</property>
<property name="action_name">win.apply_transform</property>
<property name="tooltip-text" translatable="yes">Apply</property>
<property name="visible">True</property>
<property name="valign">center</property>
Expand Down
2 changes: 1 addition & 1 deletion src/optionsbars/transform/optionsbar-skew.ui
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@

<child>
<object class="GtkButton" id="apply_btn">
<property name="action_name">win.apply_transform_tool</property>
<property name="action_name">win.apply_transform</property>
<property name="tooltip-text" translatable="yes">Apply</property>
<property name="visible">True</property>
<property name="valign">center</property>
Expand Down
3 changes: 3 additions & 0 deletions src/tools/abstract_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ def try_build_pane(self):
def build_bottom_pane(self):
return None

def on_apply_temp_pixbuf_tool_operation(self, *args):
pass # implemented only by transform tools

def add_item_to_menu(self, tools_menu):
tools_menu.append(self.label, 'win.active_tool::' + self.id)

Expand Down
2 changes: 1 addition & 1 deletion src/tools/ui/tool-crop.ui
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</item>
<item>
<attribute name="label" translatable="yes">Apply</attribute>
<attribute name="action">win.apply_transform_tool</attribute>
<attribute name="action">win.apply_transform</attribute>
</item>
</section>
</menu>
Expand Down
2 changes: 1 addition & 1 deletion src/tools/ui/tool-filters.ui
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
</item>
<item>
<attribute name="label" translatable="yes">Apply</attribute>
<attribute name="action">win.apply_transform_tool</attribute>
<attribute name="action">win.apply_transform</attribute>
</item>
</section>
</menu>
Expand Down
2 changes: 1 addition & 1 deletion src/tools/ui/tool-rotate.ui
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</item>
<item>
<attribute name="label" translatable="yes">Apply</attribute>
<attribute name="action">win.apply_transform_tool</attribute>
<attribute name="action">win.apply_transform</attribute>
</item>
</section>
</menu>
Expand Down
2 changes: 1 addition & 1 deletion src/tools/ui/tool-scale.ui
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</item>
<item>
<attribute name="label" translatable="yes">Apply</attribute>
<attribute name="action">win.apply_transform_tool</attribute>
<attribute name="action">win.apply_transform</attribute>
</item>
</section>
</menu>
Expand Down
2 changes: 1 addition & 1 deletion src/tools/ui/tool-skew.ui
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</item>
<item>
<attribute name="label" translatable="yes">Apply</attribute>
<attribute name="action">win.apply_transform_tool</attribute>
<attribute name="action">win.apply_transform</attribute>
</item>
</section>
</menu>
Expand Down
17 changes: 17 additions & 0 deletions src/ui/shortcuts.ui
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@
<property name="accelerator">&lt;Primary&gt;&lt;Shift&gt;s</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Copy to clipboard</property>
<property name="accelerator">&lt;Primary&gt;&lt;Shift&gt;c</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
Expand Down Expand Up @@ -183,6 +190,16 @@
<property name="accelerator">&lt;Primary&gt;&lt;Shift&gt;Down</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Apply a transformation</property>
<property name="accelerator">&lt;Primary&gt;Return</property>
</object>
</child>
<!-- The "cancel transformation" button is linked to a -->
<!-- "force_selection" action so it wouldn't be pertinent to add -->
<!-- a shortcut for it in my opinion -->
</object>
</child>
<child>
Expand Down
6 changes: 3 additions & 3 deletions src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def add_all_win_actions(self):
self.add_action_simple('save_alphaless', self.action_save_alphaless, None)
self.add_action_simple('save_as', self.action_save_as, ['<Ctrl><Shift>s'])
self.add_action_simple('export_as', self.action_export_as, None)
self.add_action_simple('to_clipboard', self.action_export_cb, None)
self.add_action_simple('to_clipboard', self.action_export_cb, ['<Ctrl><Shift>c'])
self.add_action_simple('print', self.action_print, None)

self.add_action_simple('import', self.action_import, ['<Ctrl>i'])
Expand All @@ -480,7 +480,7 @@ def add_all_win_actions(self):

self.add_action_simple('back_to_previous', self.back_to_previous, ['<Ctrl>b'])
self.add_action_simple('force_selection', self.force_selection, None)
self.add_action_simple('apply_transform_tool', self.action_apply_transformation, None)
self.add_action_simple('apply_transform', self.action_apply_transform, ['<Ctrl>Return'])

self.add_action_enum('active_tool', DEFAULT_TOOL_ID, self.on_change_active_tool)

Expand Down Expand Up @@ -1052,7 +1052,7 @@ def get_selection_tool(self):
def force_selection(self, *args):
self.get_selection_tool().row.set_active(True) # XXX not enable_tool?

def action_apply_transformation(self, *args):
def action_apply_transform(self, *args):
self.active_tool().on_apply_temp_pixbuf_tool_operation()

############################################################################
Expand Down

0 comments on commit 37282cb

Please sign in to comment.