@@ -1193,7 +1193,7 @@ def _margin_resize_ctid(self, code): # <- L
11931193 h_end .move (rect_end .x () - 6 , rect_end .y () + 2 )
11941194 self .active_handles .append (h_end )
11951195
1196- def _toggle_margin_visibility_only (self ): # <- L
1196+ def _toggle_margin_visibility_only (self ):
11971197 """ Independent visibility toggle (does NOT alter highlight_style). """
11981198
11991199 self .show_margin_stripes = not self .show_margin_stripes
@@ -2695,7 +2695,7 @@ def file_memo(self, file_):
26952695 items [0 ].setToolTip (new_tt )
26962696 self .app .delete_backup = False
26972697
2698- def coded_text_memo (self , position = None ):
2698+ def coded_text_memo (self , position : None | int = None ):
26992699 """ Add or edit a memo for this coded text.
27002700 Args:
27012701 position : Current text cursor position
@@ -2866,10 +2866,12 @@ def tree_menu(self, position):
28662866 action_color = None
28672867 action_show_coded_media = None
28682868 action_move_code = None
2869+ action_move_codes = None
28692870 if selected is not None and selected .text (1 )[0 :3 ] == 'cid' :
28702871 action_color = modify_menu .addAction (_ ("Change code color" ))
28712872 action_show_coded_media = menu .addAction (_ ("Show coded files" ))
28722873 action_move_code = modify_menu .addAction (_ ("Move code to" ))
2874+ action_move_codes = modify_menu .addAction (_ ("Move multiple codes" ))
28732875 filter_menu = menu .addMenu (_ ("Filter" ))
28742876 action_show_codes_like = filter_menu .addAction (_ ("Show codes like" ) + ": " + self .show_codes_like_filter )
28752877 action_show_codes_colour = filter_menu .addAction (_ ("Show codes of colour" ) + f": { self .show_codes_colour_filter } " )
@@ -2925,6 +2927,9 @@ def tree_menu(self, position):
29252927 if selected is not None and action == action_move_code :
29262928 self .move_code (selected )
29272929 return
2930+ if action == action_move_codes :
2931+ self .move_multiple_codes ()
2932+ return
29282933 if action == action_expand_collapse :
29292934 expand_toggle = not selected .isExpanded ()
29302935 self .recursive_expand_collapse_branch (selected , expand_toggle )
@@ -3101,6 +3106,11 @@ def merge_category(self, catid: int):
31013106 raise
31023107 self .update_dialog_codes_and_categories (["code_cat" , "code_name" ])
31033108
3109+ def move_multiple_codes (self ):
3110+ """ Move multiple codes """
3111+
3112+ print ("TODO Move multiple codes" )
3113+
31043114 def move_code (self , selected ):
31053115 """ Move code to another category or to no category.
31063116 Uses a list selection.
@@ -3183,7 +3193,7 @@ def show_important_coded(self):
31833193 self .ui .pushButton_important .setIcon (qta .icon ('mdi6.star-outline' ))
31843194 self .get_coded_text_update_eventfilter_tooltips ()
31853195
3186- def show_codes_like (self , preset = None ):
3196+ def show_codes_like (self , preset : str | None = None ):
31873197 """ Show all codes if text is empty.
31883198 Show selected codes that contain entered text.
31893199 The input dialog is too narrow, so it is re-created.
@@ -3318,27 +3328,29 @@ def recursive_traverse(self, item, text_: str = "", case_sensitive: bool = False
33183328
33193329 def keyPressEvent (self , event ):
33203330 """
3321- Ctrl Z Undo last unmarking
3322- Ctrl F jump to search box
33233331 A annotate - for current selection
3324- Q Quick Mark with code - for current selection
33253332 B Create bookmark - at clicked position
3333+ Shift B - go to bookmark
3334+ C New category
3335+ Ctrl F jump to search box
33263336 H Hide / Unhide top groupbox
33273337 I Tag important
33283338 L Show codes like
33293339 M memo code - at clicked position
33303340 N new code
33313341 O Shortcut to cycle through overlapping codes - at clicked position
3332- S search text - may include current selection
3342+ Q Quick Mark with code - for current selection
33333343 R opens a context menu for recently used codes for marking text
33343344 Ctrl R - Reverse from left to right to right to left
3345+ S search text - may include current selection
33353346 U Unmark at selected location
33363347 V assign 'in vivo' code to selected text
3348+ Ctrl Z Undo last unmarking
3349+
33373350 Ctrl 0 to Ctrl 9 - button presses
33383351 ! Display Clicked character position
33393352 ^ Alt key. Shift code positions. May be needed after the text is edited
33403353 (added or deleted) to shift subsequent codings.
3341-
33423354 F2 Rename code or category
33433355 """
33443356
@@ -3349,7 +3361,7 @@ def keyPressEvent(self, event):
33493361 if key == QtCore .Qt .Key .Key_F and mods == QtCore .Qt .KeyboardModifier .ControlModifier :
33503362 self .ui .lineEdit_search .setFocus ()
33513363 return
3352- # Ctrl Z undo last unmarked coding
3364+ # Ctrl Z undo last unmarked coding # TODO expand function
33533365 if key == QtCore .Qt .Key .Key_Z and mods == QtCore .Qt .KeyboardModifier .ControlModifier :
33543366 self .undo_last_unmarked_code ()
33553367 return
@@ -3432,13 +3444,22 @@ def keyPressEvent(self, event):
34323444 if key == QtCore .Qt .Key .Key_A and selected_text != "" :
34333445 self .annotate ()
34343446 return
3447+ # Go to bookmark
3448+ if key == QtCore .Qt .Key .Key_B and mods == QtCore .Qt .KeyboardModifier .ShiftModifier and self .file_ is not None :
3449+ self .go_to_bookmark ()
3450+ return
34353451 # Bookmark
34363452 if key == QtCore .Qt .Key .Key_B and self .file_ is not None :
34373453 text_pos = self .ui .plainTextEdit .textCursor ().position () + self .file_ ['start' ]
34383454 cur = self .app .conn .cursor ()
34393455 cur .execute ("update project set bookmarkfile=?, bookmarkpos=?" , [self .file_ ['id' ], text_pos ])
34403456 self .app .conn .commit ()
34413457 return
3458+ # New category
3459+ if key == QtCore .Qt .Key .Key_C :
3460+ # TODO if already category selected, add category to that
3461+ self .add_category ()
3462+ return
34423463 # Hide unHide top groupbox
34433464 if key == QtCore .Qt .Key .Key_H :
34443465 self .ui .groupBox .setHidden (not (self .ui .groupBox .isHidden ()))
@@ -3581,7 +3602,7 @@ def export_option_selected(self):
35813602 self .export_codebook ()
35823603 self .ui .comboBox_export .setCurrentIndex (0 )
35833604
3584- def export_odt_file (self , mode = "highlight" ):
3605+ def export_odt_file (self , mode : str = "highlight" ):
35853606 """ Export text to open file format with .odt ending.
35863607 Args:
35873608 mode: String - 'highlight', 'comment', or 'report'
@@ -4755,7 +4776,7 @@ def merge_codes(self, item, parent):
47554776 self .update_dialog_codes_and_categories (["code_name" , "code_text" , "code_av" , "code_image" ])
47564777 self .get_coded_text_update_eventfilter_tooltips ()
47574778
4758- def add_code (self , catid = None , code_name = "" ):
4779+ def add_code (self , catid : int | None = None , code_name : str = "" ):
47594780 """ Use add_item dialog to get new code text. Add_code_name dialog checks for
47604781 duplicate code name. A random color is selected for the code, or a color has been pre-set by the user.
47614782 New code is added to data and database.
@@ -4839,8 +4860,8 @@ def _on_project_data_changed(self, tables, source):
48394860 self .fill_tree ()
48404861 self .get_coded_text_update_eventfilter_tooltips ()
48414862
4842- def add_category (self , supercatid = None ):
4843- """ When button pressed, add a new category.
4863+ def add_category (self , supercatid : int | None = None ):
4864+ """ Add a new category.
48444865 Note: the addItem dialog does the checking for duplicate category names
48454866 Args:
48464867 supercatid : None to add without category, supercatid to add to category. """
@@ -7720,7 +7741,6 @@ def get_overlapping_ai_search_result(self):
77207741
77217742 return best_doc
77227743
7723- # --- handles experimental
77247744 def display_handles_for_code (self , position ):
77257745 """ Display interactive drag handles to resize a code's boundaries. """
77267746
0 commit comments