diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f51eb7..5374ede 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ All notable changes to this project will be documented in this file. It checks if a the file or folder exists. If it's a path to a file, it make sure that it's in a format supported by REAPER. You can specify a specific extension or a list of extensions and it will raise if the choosen file does not match - + - `Project.select_item()` method to select a specific item. ## [Unreleased] - 2020-12-30 ### Fixed diff --git a/reapy/core/project/project.py b/reapy/core/project/project.py index f735e0e..6a97fab 100644 --- a/reapy/core/project/project.py +++ b/reapy/core/project/project.py @@ -989,6 +989,18 @@ def select_all_items(self, selected=True): RPR.SelectAllMediaItems(self.id, selected) def select_item(self, item_obj, selected=True, makeUnique=False): + """ + Select or unselect an item, depending on `selected`. + + Parameters + ---------- + item_obj : reapy.Item + The item to select + selected : bool [optional] + Whether to select or unselect the item. + makeUnique : bool [optional] + If False the Item will be added to the current selection, if True it will become the only selected item + """ if makeUnique: self.select_all_items(selected=False) RPR.SetMediaItemSelected(item_obj.id, selected) diff --git a/reapy/core/project/project.pyi b/reapy/core/project/project.pyi index d6239e7..e5443df 100644 --- a/reapy/core/project/project.pyi +++ b/reapy/core/project/project.pyi @@ -790,6 +790,20 @@ class Project(ReapyObject): """ ... + def select_item(self, item_obj, selected:bool=True, makeUnique:bool=False) -> None: + """ + Select or unselect an item, depending on `selected`. + + Parameters + ---------- + item_obj : reapy.Item + The item to select + selected : bool [optional] + Whether to select or unselect the item. + makeUnique : bool [optional] + If False the Item will be added to the current selection, if True it will become the only selected item + """ + ... def select_all_tracks(self) -> None: """Select all tracks.""" ...