From 4c81e328e0cb5d3e3cf952405f73f737a07b1be7 Mon Sep 17 00:00:00 2001 From: "Wallas Linux Deepin 15.03 Machine" Date: Tue, 29 Nov 2016 15:50:19 -0500 Subject: [PATCH 1/4] Repair default file extension for saveas feature in spyder editor --- spyder/config/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spyder/config/utils.py b/spyder/config/utils.py index 963a55f33a5..7d836b5531f 100644 --- a/spyder/config/utils.py +++ b/spyder/config/utils.py @@ -119,7 +119,7 @@ def get_edit_filetypes(): other_exts = ['.ipynb', '.md'] all_exts = tuple(pygments_exts + other_exts) text_filetypes = (_("Supported text files"), all_exts) - return [text_filetypes] + EDIT_FILETYPES + return EDIT_FILETYPES + [text_filetypes] def get_edit_filters(): From 041d5cd1223b911905aa7257d05c7b52a1b64099 Mon Sep 17 00:00:00 2001 From: "Wallas Linux Deepin 15.03 Machine" Date: Tue, 29 Nov 2016 16:37:04 -0500 Subject: [PATCH 2/4] suggest favorite extensions at begin of combobox in save_as feature --- spyder/config/utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spyder/config/utils.py b/spyder/config/utils.py index 7d836b5531f..a83c89756b6 100644 --- a/spyder/config/utils.py +++ b/spyder/config/utils.py @@ -116,10 +116,12 @@ def get_filter(filetypes, ext): def get_edit_filetypes(): """Get all file types supported by the Editor""" pygments_exts = _get_pygments_extensions() - other_exts = ['.ipynb', '.md'] - all_exts = tuple(pygments_exts + other_exts) + favorite_exts = ['.py', '.R', '.jl', '.pyw', '.pyx', '.C', '.CPP'] + other_exts = ['.ipynb', '.md'] + [ext for ext in pygments_exts if ext not in favorite_exts] + all_exts = tuple(favorite_exts + other_exts) + print(all_exts) text_filetypes = (_("Supported text files"), all_exts) - return EDIT_FILETYPES + [text_filetypes] + return [text_filetypes] + EDIT_FILETYPES def get_edit_filters(): From 13cac64ffe9126e1680b6c50e8a1684aec24158b Mon Sep 17 00:00:00 2001 From: "Wallas Linux Deepin 15.03 Machine" Date: Tue, 29 Nov 2016 17:25:18 -0500 Subject: [PATCH 3/4] remove unnecessary print call --- spyder/config/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/spyder/config/utils.py b/spyder/config/utils.py index a83c89756b6..d2cdb0a230c 100644 --- a/spyder/config/utils.py +++ b/spyder/config/utils.py @@ -119,7 +119,6 @@ def get_edit_filetypes(): favorite_exts = ['.py', '.R', '.jl', '.pyw', '.pyx', '.C', '.CPP'] other_exts = ['.ipynb', '.md'] + [ext for ext in pygments_exts if ext not in favorite_exts] all_exts = tuple(favorite_exts + other_exts) - print(all_exts) text_filetypes = (_("Supported text files"), all_exts) return [text_filetypes] + EDIT_FILETYPES From de31ba352f810edd6fe571aaa282272b6a71fece Mon Sep 17 00:00:00 2001 From: "Wallas Linux Deepin 15.03 Machine" Date: Tue, 29 Nov 2016 17:34:01 -0500 Subject: [PATCH 4/4] add .ipynb and .md to favorite_exts --- spyder/config/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spyder/config/utils.py b/spyder/config/utils.py index d2cdb0a230c..d3953b82739 100644 --- a/spyder/config/utils.py +++ b/spyder/config/utils.py @@ -116,8 +116,8 @@ def get_filter(filetypes, ext): def get_edit_filetypes(): """Get all file types supported by the Editor""" pygments_exts = _get_pygments_extensions() - favorite_exts = ['.py', '.R', '.jl', '.pyw', '.pyx', '.C', '.CPP'] - other_exts = ['.ipynb', '.md'] + [ext for ext in pygments_exts if ext not in favorite_exts] + favorite_exts = ['.py', '.R', '.jl', '.ipynb', '.md', '.pyw', '.pyx', '.C', '.CPP'] + other_exts = [ext for ext in pygments_exts if ext not in favorite_exts] all_exts = tuple(favorite_exts + other_exts) text_filetypes = (_("Supported text files"), all_exts) return [text_filetypes] + EDIT_FILETYPES