@@ -9,6 +9,8 @@ class Table(QWidget):
99 pasteRequested = pyqtSignal (QModelIndex )
1010 cutRequested = pyqtSignal (QItemSelection )
1111 clearRequested = pyqtSignal (QItemSelection )
12+ skipRequested = pyqtSignal (list )
13+ unskipRequested = pyqtSignal (list )
1214
1315 def __init__ (self , model , undo_stack = None , delegate = None ):
1416 super ().__init__ ()
@@ -65,10 +67,22 @@ def show_context_menu(self, position):
6567 insert_row_action .setShortcut ("Ctrl+I" )
6668 menu .addAction (insert_row_action )
6769
68- delete_row_action = QAction ("Delete Rows" , self )
69- delete_row_action .triggered .connect (self .delete_rows )
70- delete_row_action .setShortcut ("Ctrl+D" )
71- menu .addAction (delete_row_action )
70+ remove_row_action = QAction ("Delete Rows" , self )
71+ remove_row_action .triggered .connect (self .remove_rows )
72+ remove_row_action .setShortcut ("Ctrl+D" )
73+ menu .addAction (remove_row_action )
74+
75+ menu .addSeparator ()
76+
77+ mark_skip_action = QAction ("Mark Skip" , self )
78+ mark_skip_action .triggered .connect (self .skip )
79+ mark_skip_action .setShortcut ("Ctrl+T" )
80+ menu .addAction (mark_skip_action )
81+
82+ mark_unskip_action = QAction ("Mark Unskip" , self )
83+ mark_unskip_action .triggered .connect (self .unskip )
84+ mark_unskip_action .setShortcut ("Ctrl+G" )
85+ menu .addAction (mark_unskip_action )
7286
7387 menu .addSeparator ()
7488
@@ -100,8 +114,14 @@ def setup_shortcuts(self):
100114 self .insert_shortcut = QShortcut (QKeySequence ("Ctrl+I" ), self )
101115 self .insert_shortcut .activated .connect (self .insert_rows )
102116
103- self .delete_shortcut = QShortcut (QKeySequence ("Ctrl+D" ), self )
104- self .delete_shortcut .activated .connect (self .delete_rows )
117+ self .remove_shortcut = QShortcut (QKeySequence ("Ctrl+D" ), self )
118+ self .remove_shortcut .activated .connect (self .remove_rows )
119+
120+ self .skip_shortcut = QShortcut (QKeySequence ("Ctrl+T" ), self )
121+ self .skip_shortcut .activated .connect (self .skip )
122+
123+ self .unskip_shortcut = QShortcut (QKeySequence ("Ctrl+G" ), self )
124+ self .unskip_shortcut .activated .connect (self .unskip )
105125
106126 self .copy_shortcut = QShortcut (QKeySequence ("Ctrl+C" ), self )
107127 self .copy_shortcut .activated .connect (self .copy_cells )
@@ -160,7 +180,7 @@ def insert_rows(self):
160180 else :
161181 return
162182
163- def delete_rows (self ):
183+ def remove_rows (self ):
164184 selection = self .table .selectionModel ().selection ()
165185 if not selection .isEmpty ():
166186 rows = sorted (list (set (index .row () for index in selection .indexes () if index .isValid ())))
@@ -216,6 +236,20 @@ def merge_cells(self):
216236 if span_size > 1 :
217237 self .table .setSpan (start , desc_col , span_size , 1 )
218238
239+ def skip (self ):
240+ selection = self .table .selectionModel ().selection ()
241+ if not selection .isEmpty ():
242+ rows = sorted (list (set (index .row () for index in selection .indexes () if index .isValid ())))
243+ if rows :
244+ self .skipRequested .emit (rows )
245+
246+ def unskip (self ):
247+ selection = self .table .selectionModel ().selection ()
248+ if not selection .isEmpty ():
249+ rows = sorted (list (set (index .row () for index in selection .indexes () if index .isValid ())))
250+ if rows :
251+ self .unskipRequested .emit (rows )
252+
219253 def _on_data_changed_commands (self , topLeft , bottomRight , roles ):
220254 command_col = 6
221255
0 commit comments