Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Compute Projects switcher results in a worker to avoid freezes #21275

Merged
merged 26 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0cf2757
Utils: Don't use threads when starting ProcessWorkers in WorkerManager
ccordoba12 Aug 15, 2023
6bfa0e0
Utils: Add some logging to WorkerManager
ccordoba12 Aug 15, 2023
47a9d37
Projects: Remove unnecessary method
ccordoba12 Aug 15, 2023
071e163
Projects: Call fzf in a worker to not block the interface
ccordoba12 Aug 15, 2023
79bbc04
Projects: Detect if fzf is present in the system before trying to use it
ccordoba12 Aug 15, 2023
a81d5b2
Projects: Call switcher setup method after adding project items
ccordoba12 Aug 18, 2023
7a9d7b1
Projects: Remove repeated code in several places
ccordoba12 Aug 18, 2023
3aa2b35
Switcher: Remove items_data of sig_search_text_available signal
ccordoba12 Aug 18, 2023
ed7d6fa
Remove lower case path names in the Switcher
ccordoba12 Aug 18, 2023
df972f4
Projects: Remove binary files from the results returned by fzf
ccordoba12 Aug 18, 2023
4840e17
Switcher: Detect when a project is active
ccordoba12 Aug 19, 2023
d96203f
Switcher: Fix searching when no project is active
ccordoba12 Aug 19, 2023
6ee0ef3
Switcher: Fix showing sections when a project is active
ccordoba12 Aug 19, 2023
5099dfe
Switcher: Remove hard-coded projects section
ccordoba12 Aug 20, 2023
db685ef
Projects: Update default switcher paths on files creation, deletion a…
ccordoba12 Aug 20, 2023
e932b7f
Testing: Fix test_switcher_project_files
ccordoba12 Aug 20, 2023
843535f
App: Set app and monospace interface fonts when running single tests
ccordoba12 Aug 20, 2023
3843986
Projects: Filter switcher files according to their extension
ccordoba12 Aug 22, 2023
e5483ae
Projects: Prevent showing project path when fzf results are empty
ccordoba12 Aug 23, 2023
b3624fe
Switcher: Prevent to populate the switcher when closing it
ccordoba12 Aug 23, 2023
36a39c7
Switcher: Add a new public method to remove all items in a section
ccordoba12 Aug 25, 2023
60466aa
Editor: Connect to the Switcher's sig_search_text_available signal
ccordoba12 Aug 25, 2023
5480966
Switcher: Add attribute to items to check if their score can be changed
ccordoba12 Aug 25, 2023
e6140b1
Switcher: Remove direct dependency on Projects
ccordoba12 Aug 25, 2023
a36cc6f
Projects: Fix clearing the switcher when fzf can't find any match
ccordoba12 Aug 26, 2023
d51c98d
Testing: Expand test that checks Switcher/Projects integration
ccordoba12 Aug 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Switcher: Detect when a project is active
This is necessary to make some adjustments in the switcher when that's
the case.
  • Loading branch information
ccordoba12 committed Aug 19, 2023
commit 4840e174cffed4bdc20f836b0a64d4fc029c9296
27 changes: 23 additions & 4 deletions spyder/plugins/switcher/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Switcher(SpyderPluginV2):
"""

NAME = "switcher"
OPTIONAL = [Plugins.MainMenu]
OPTIONAL = [Plugins.MainMenu, Plugins.Projects]
CONTAINER_CLASS = SwitcherContainer
CONF_SECTION = NAME
CONF_FILE = False
Expand Down Expand Up @@ -160,16 +160,27 @@ def on_main_menu_teardown(self):
menu_id=ApplicationMenus.File
)

# --- Public API
# ------------------------------------------------------------------------
@on_plugin_available(plugin=Plugins.Projects)
def on_projects_available(self):
projects = self.get_plugin(Plugins.Projects)
projects.sig_project_loaded.connect(self._set_project_dir)
projects.sig_project_closed.connect(self._unset_project_dir)

@on_plugin_teardown(plugin=Plugins.Projects)
def on_projects_teardown(self):
projects = self.get_plugin(Plugins.Projects)
projects.sig_project_loaded.disconnect(self._set_project_dir)
projects.sig_project_closed.connect(self._unset_project_dir)

# ---- Public API
# -------------------------------------------------------------------------
# Switcher methods
def set_placeholder_text(self, text):
"""Set the text appearing on the empty line edit."""
self._switcher.set_placeholder_text(text)

def setup(self):
"""Set-up list widget content based on the filtering."""
"""Setup list widget content based on filtering."""
self._switcher.setup()

def open_switcher(self, symbol=False):
Expand Down Expand Up @@ -247,3 +258,11 @@ def clear_modes(self):
def set_search_text(self, string):
"""Set the content of the search text."""
self._switcher.set_search_text(string)

# ---- Private API
# -------------------------------------------------------------------------
def _set_project_dir(self, path):
self._switcher.current_project = path

def _unset_project_dir(self, path):
self._switcher.current_project = None
1 change: 1 addition & 0 deletions spyder/plugins/switcher/widgets/switcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def __init__(self, parent, help_text=None, item_styles=ITEM_STYLES,
self._mode_on = ''
self._item_styles = item_styles
self._item_separator_styles = item_separator_styles
self.current_project = None

# Widgets
self.edit = QLineEdit(self)
Expand Down