From ca2397932e5d2bd9cd51121bece09bb6694d59f1 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Fri, 14 Jul 2017 22:38:47 -0500 Subject: [PATCH 1/2] Working dir: Remove startup options because they are conflicting with the console ones --- spyder/config/main.py | 3 +-- spyder/plugins/workingdirectory.py | 42 +++--------------------------- 2 files changed, 4 insertions(+), 41 deletions(-) diff --git a/spyder/config/main.py b/spyder/config/main.py index b5ad1b8effa..e6771c160a3 100755 --- a/spyder/config/main.py +++ b/spyder/config/main.py @@ -281,7 +281,6 @@ { 'working_dir_adjusttocontents': False, 'working_dir_history': 20, - 'startup/use_project_or_home_directory': True, 'console/use_project_or_home_directory': True, 'console/use_cwd': False, 'console/use_fixed_directory': False, @@ -633,7 +632,7 @@ # or if you want to *rename* options, then you need to do a MAJOR update in # version, e.g. from 3.0.0 to 4.0.0 # 3. You don't need to touch this value if you're just adding a new option -CONF_VERSION = '39.0.0' +CONF_VERSION = '40.0.0' # Main configuration instance try: diff --git a/spyder/plugins/workingdirectory.py b/spyder/plugins/workingdirectory.py index 35fef4788b2..d6c781dd352 100644 --- a/spyder/plugins/workingdirectory.py +++ b/spyder/plugins/workingdirectory.py @@ -40,41 +40,6 @@ def setup_page(self): "and the current directory for the File Explorer.")) about_label.setWordWrap(True) - startup_group = QGroupBox(_("Startup")) - startup_bg = QButtonGroup(startup_group) - startup_label = QLabel(_("At startup, the current working " - "directory is:")) - startup_label.setWordWrap(True) - lastdir_radio = self.create_radiobutton( - _("The current project directory " - "or user home directory " - "(if no project is active)"), - 'startup/use_project_or_home_directory', - True, - _("At startup,"), # TODO - button_group=startup_bg) - thisdir_radio = self.create_radiobutton( - _("the following directory:"), - 'startup/use_fixed_directory', False, - _("At startup, the current working " - "directory will be the specified path"), - button_group=startup_bg) - thisdir_bd = self.create_browsedir("", 'startup/fixed_directory', - getcwd()) - thisdir_radio.toggled.connect(thisdir_bd.setEnabled) - lastdir_radio.toggled.connect(thisdir_bd.setDisabled) - thisdir_layout = QHBoxLayout() - thisdir_layout.addWidget(thisdir_radio) - thisdir_layout.addWidget(thisdir_bd) - - startup_layout = QVBoxLayout() - startup_layout.addWidget(startup_label) - startup_layout.addWidget(lastdir_radio) - startup_layout.addLayout(thisdir_layout) - startup_group.setLayout(startup_layout) - - # Console Directory - console_group = QGroupBox(_("Console directory")) console_label = QLabel(_("The working directory for new consoles is:")) console_label.setWordWrap(True) @@ -117,7 +82,6 @@ def setup_page(self): vlayout = QVBoxLayout() vlayout.addWidget(about_label) vlayout.addSpacing(10) - vlayout.addWidget(startup_group) vlayout.addWidget(console_group) vlayout.addStretch(1) self.setLayout(vlayout) @@ -185,12 +149,12 @@ def __init__(self, parent, workdir=None, **kwds): self.pathedit.setMaxCount(self.get_option('working_dir_history')) wdhistory = self.load_wdhistory(workdir) if workdir is None: - if self.get_option('startup/use_project_or_home_directory'): + if self.get_option('console/use_project_or_home_directory'): workdir = get_home_dir() else: - workdir = self.get_option('startup/fixed_directory', ".") + workdir = self.get_option('console/fixed_directory') if not osp.isdir(workdir): - workdir = "." + workdir = get_home_dir() self.chdir(workdir) self.pathedit.addItems(wdhistory) self.pathedit.selected_text = self.pathedit.currentText() From aaf88a65aafa02f6a8622c2378f9e1be0aa1f784 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Sun, 23 Jul 2017 18:57:29 -0500 Subject: [PATCH 2/2] Working directory: Use cwd when opening new consoles because that was the old behavior We should change this for Spyder 4, but not now. --- spyder/config/main.py | 4 ++-- spyder/plugins/workingdirectory.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spyder/config/main.py b/spyder/config/main.py index e6771c160a3..25f4580c487 100755 --- a/spyder/config/main.py +++ b/spyder/config/main.py @@ -281,8 +281,8 @@ { 'working_dir_adjusttocontents': False, 'working_dir_history': 20, - 'console/use_project_or_home_directory': True, - 'console/use_cwd': False, + 'console/use_project_or_home_directory': False, + 'console/use_cwd': True, 'console/use_fixed_directory': False, }), ('shortcuts', diff --git a/spyder/plugins/workingdirectory.py b/spyder/plugins/workingdirectory.py index d6c781dd352..c2d7ea99a50 100644 --- a/spyder/plugins/workingdirectory.py +++ b/spyder/plugins/workingdirectory.py @@ -152,7 +152,7 @@ def __init__(self, parent, workdir=None, **kwds): if self.get_option('console/use_project_or_home_directory'): workdir = get_home_dir() else: - workdir = self.get_option('console/fixed_directory') + workdir = self.get_option('console/fixed_directory', default='') if not osp.isdir(workdir): workdir = get_home_dir() self.chdir(workdir)