selecting row under the cursor at the dragging begin

This commit is contained in:
DYefremov
2018-09-22 21:08:28 +03:00
parent 40faa4029d
commit 1c0ca0dbeb
2 changed files with 7 additions and 0 deletions

View File

@@ -98,6 +98,7 @@ class MainAppWindow:
"on_delete": self.on_delete, "on_delete": self.on_delete,
"on_tool_edit": self.on_tool_edit, "on_tool_edit": self.on_tool_edit,
"on_to_fav_move": self.on_to_fav_move, "on_to_fav_move": self.on_to_fav_move,
"on_view_drag_begin": self.on_view_drag_begin,
"on_view_drag_data_get": self.on_view_drag_data_get, "on_view_drag_data_get": self.on_view_drag_data_get,
"on_view_drag_data_received": self.on_view_drag_data_received, "on_view_drag_data_received": self.on_view_drag_data_received,
"on_bq_view_drag_data_received": self.on_bq_view_drag_data_received, "on_bq_view_drag_data_received": self.on_bq_view_drag_data_received,
@@ -529,6 +530,11 @@ class MainAppWindow:
# ***************** Drag-and-drop *********************# # ***************** Drag-and-drop *********************#
def on_view_drag_begin(self, view, context):
""" Selects a row under the cursor in the view at the dragging beginning. """
if view.get_selection().selection.count_selected_rows() > 1:
view.do_toggle_cursor_row(view)
def on_view_drag_data_get(self, view, drag_context, data, info, time): def on_view_drag_data_get(self, view, drag_context, data, info, time):
selection = self.get_selection(view) selection = self.get_selection(view)
if selection: if selection:

View File

@@ -1417,6 +1417,7 @@ Author: Dmitriy Yefremov
<property name="activate_on_single_click">True</property> <property name="activate_on_single_click">True</property>
<signal name="button-press-event" handler="on_view_popup_menu" object="services_popup_menu" swapped="no"/> <signal name="button-press-event" handler="on_view_popup_menu" object="services_popup_menu" swapped="no"/>
<signal name="button-press-event" handler="on_view_press" swapped="no"/> <signal name="button-press-event" handler="on_view_press" swapped="no"/>
<signal name="drag-begin" handler="on_view_drag_begin" swapped="no"/>
<signal name="drag-data-get" handler="on_view_drag_data_get" swapped="no"/> <signal name="drag-data-get" handler="on_view_drag_data_get" swapped="no"/>
<signal name="focus-in-event" handler="on_view_focus" swapped="no"/> <signal name="focus-in-event" handler="on_view_focus" swapped="no"/>
<signal name="key-press-event" handler="on_tree_view_key_press" swapped="no"/> <signal name="key-press-event" handler="on_tree_view_key_press" swapped="no"/>