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: Fixes to improve compatibility with PySide2 #22024

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 13 additions & 13 deletions spyder/plugins/explorer/widgets/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ def handle_reset():
@Slot()
def open(self, fnames=None):
"""Open files with the appropriate application"""
if fnames is None:
if fnames is None or isinstance(fnames, bool):
fnames = self.get_selected_filenames()
for fname in fnames:
if osp.isfile(fname) and encoding.is_text_file(fname):
Expand All @@ -1046,7 +1046,7 @@ def open_association(self, app_path):
@Slot()
def open_external(self, fnames=None):
"""Open files with default application"""
if fnames is None:
if fnames is None or isinstance(fnames, bool):
fnames = self.get_selected_filenames()
for fname in fnames:
self.open_outside_spyder([fname])
Expand Down Expand Up @@ -1116,7 +1116,7 @@ def delete_file(self, fname, multiple, yes_to_all):
@Slot()
def delete(self, fnames=None):
"""Delete files"""
if fnames is None:
if fnames is None or isinstance(fnames, bool):
fnames = self.get_selected_filenames()
multiple = len(fnames) > 1
yes_to_all = None
Expand Down Expand Up @@ -1170,14 +1170,14 @@ def rename_file(self, fname):
@Slot()
def show_in_external_file_explorer(self, fnames=None):
"""Show file in external file explorer"""
if fnames is None:
if fnames is None or isinstance(fnames, bool):
fnames = self.get_selected_filenames()
show_in_external_file_explorer(fnames)

@Slot()
def rename(self, fnames=None):
"""Rename files"""
if fnames is None:
if fnames is None or isinstance(fnames, bool):
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
Expand Down Expand Up @@ -1261,7 +1261,7 @@ def get_selected_dir(self):
def new_folder(self, basedir=None):
"""New folder."""

if basedir is None:
if basedir is None or isinstance(basedir, bool):
basedir = self.get_selected_dir()

title = _('New folder')
Expand Down Expand Up @@ -1293,7 +1293,7 @@ def create_new_file(self, current_path, title, filters, create_func):
def new_file(self, basedir=None):
"""New file"""

if basedir is None:
if basedir is None or isinstance(basedir, bool):
basedir = self.get_selected_dir()

title = _("New file")
Expand All @@ -1313,7 +1313,7 @@ def create_func(fname):
@Slot()
def run(self, fnames=None):
"""Run Python scripts"""
if fnames is None:
if fnames is None or isinstance(fnames, bool):
fnames = self.get_selected_filenames()
for fname in fnames:
self.sig_run_requested.emit(fname)
Expand Down Expand Up @@ -1367,7 +1367,7 @@ def copy_relative_path(self):
@Slot()
def copy_file_clipboard(self, fnames=None):
"""Copy file(s)/folders(s) to clipboard."""
if fnames is None:
if fnames is None or isinstance(fnames, bool):
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
Expand All @@ -1385,7 +1385,7 @@ def copy_file_clipboard(self, fnames=None):
@Slot()
def save_file_clipboard(self, fnames=None):
"""Paste file from clipboard into file/project explorer directory."""
if fnames is None:
if fnames is None or isinstance(fnames, bool):
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
Expand Down Expand Up @@ -1472,7 +1472,7 @@ def save_file_clipboard(self, fnames=None):
@Slot()
def open_interpreter(self, fnames=None):
"""Open interpreter"""
if fnames is None:
if fnames is None or isinstance(fnames, bool):
fnames = self.get_selected_filenames()
for path in sorted(fnames):
self.sig_open_interpreter_requested.emit(path)
Expand Down Expand Up @@ -1709,7 +1709,7 @@ def convert_notebooks(self):
def new_package(self, basedir=None):
"""New package"""

if basedir is None:
if basedir is None or isinstance(basedir, None):
basedir = self.get_selected_dir()

title = _('New package')
Expand All @@ -1720,7 +1720,7 @@ def new_package(self, basedir=None):
def new_module(self, basedir=None):
"""New module"""

if basedir is None:
if basedir is None or isinstance(basedir, bool):
basedir = self.get_selected_dir()

title = _("New module")
Expand Down
2 changes: 2 additions & 0 deletions spyder/widgets/collectionseditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,8 @@ def duplicate_item(self):
@Slot()
def rename_item(self, new_name=None):
"""Rename item"""
if isinstance(new_name, bool):
new_name = None
self.copy_item(erase_original=True, new_name=new_name)

@Slot()
Expand Down
Loading