Skip to content

Commit c89cde3

Browse files
mrclaryccordoba12
andauthored
Apply suggestions from code review
Co-authored-by: Carlos Cordoba <[email protected]>
1 parent 8e9e657 commit c89cde3

File tree

7 files changed

+71
-23
lines changed

7 files changed

+71
-23
lines changed

spyder/plugins/ipythonconsole/widgets/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,15 @@ def _create_loading_page(self, env=False):
245245
if os.name == 'nt':
246246
loading_img = loading_img.replace('\\', '/')
247247
message = _("Connecting to kernel...")
248+
248249
if env:
249250
message = _("Retrieving environment variables...")
250251
page = loading_template.substitute(
251252
css_path=self.css_path,
252253
loading_img=loading_img,
253254
message=message
254255
)
256+
255257
return page
256258

257259
def _create_blank_page(self):

spyder/plugins/ipythonconsole/widgets/main_widget.py

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,8 +1817,13 @@ def get_current_shellwidget(self) -> ShellWidget | None:
18171817
@Slot(bool, bool)
18181818
@Slot(bool, str, bool)
18191819
def create_new_client(
1820-
self, give_focus=True, filename='', special=None,
1821-
given_name=None, cache=True, initial_cwd=None,
1820+
self,
1821+
give_focus=True,
1822+
filename='',
1823+
special=None,
1824+
given_name=None,
1825+
cache=True,
1826+
initial_cwd=None,
18221827
path_to_custom_interpreter=None
18231828
):
18241829
"""
@@ -2542,21 +2547,36 @@ def run_script(self, filename, wdir, args, post_mortem, current_client,
25422547
)
25432548
return
25442549

2545-
def _rs():
2550+
def _run():
25462551
# Freeze parameters for use in signal connect
25472552
self._run_script(
2548-
filename, wdir, args, post_mortem, clear_variables,
2549-
console_namespace, method, client, current_client
2553+
filename,
2554+
wdir,
2555+
args,
2556+
post_mortem,
2557+
clear_variables,
2558+
console_namespace,
2559+
method,
2560+
client,
2561+
current_client
25502562
)
25512563

25522564
if client.shellwidget.spyder_kernel_ready:
2553-
_rs()
2565+
_run()
25542566
else:
2555-
client.shellwidget.sig_prompt_ready.connect(_rs)
2567+
client.shellwidget.sig_prompt_ready.connect(_run)
25562568

25572569
def _run_script(
2558-
self, filename, wdir, args, post_mortem, clear_variables,
2559-
console_namespace, method, client, current_client
2570+
self,
2571+
filename,
2572+
wdir,
2573+
args,
2574+
post_mortem,
2575+
clear_variables,
2576+
console_namespace,
2577+
method,
2578+
client,
2579+
current_client
25602580
):
25612581
if method is None:
25622582
method = "runfile"
@@ -2588,7 +2608,6 @@ def norm(text):
25882608
magic_arguments.append("--current-namespace")
25892609

25902610
line = "%{} {}".format(method, shlex.join(magic_arguments))
2591-
25922611
elif method in ["runfile", "debugfile"]:
25932612
# External, non spyder-kernels, use %run
25942613
magic_arguments = []
@@ -2601,9 +2620,11 @@ def norm(text):
26012620
line = "%run " + shlex.join(magic_arguments)
26022621
else:
26032622
client.shellwidget.append_html_message(
2604-
_("The console is not running a Spyder-kernel, so it "
2605-
"can't execute <b>{}</b>.<br><br>"
2606-
"Please use a Spyder-kernel for this.").format(method),
2623+
_(
2624+
"The console is not running a Spyder-kernel, so it can't "
2625+
"execute <b>{}</b>.<br><br>"
2626+
"Please use a Spyder-kernel for this."
2627+
).format(method),
26072628
before_prompt=True
26082629
)
26092630
return

spyder/plugins/ipythonconsole/widgets/shell.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,9 +749,11 @@ def set_color_scheme(self, color_scheme, reset=True):
749749
self.set_bracket_matcher_color_scheme(color_scheme)
750750
self.style_sheet, dark_color = create_qss_style(color_scheme)
751751
self.syntax_style = color_scheme
752+
752753
if not self.spyder_kernel_ready:
753754
# Will be sent later
754755
return
756+
755757
if reset:
756758
# Don't clear console and show a message instead to prevent
757759
# removing important content from users' consoles.

spyder/plugins/pythonpath/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"""
88
Pythonpath manager utils.
99
"""
10+
1011
# Standard library imports
1112
import os
1213
import os.path as osp

spyder/plugins/pythonpath/widgets/pathmanager.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,15 @@
1818
from qtpy.QtCore import QSize, Qt, Signal, Slot
1919
from qtpy.QtGui import QFontMetrics
2020
from qtpy.QtWidgets import (
21-
QDialog, QDialogButtonBox, QHBoxLayout, QLabel, QListWidget,
22-
QListWidgetItem, QMessageBox, QStackedWidget, QVBoxLayout
21+
QDialog,
22+
QDialogButtonBox,
23+
QHBoxLayout,
24+
QLabel,
25+
QListWidget,
26+
QListWidgetItem,
27+
QMessageBox,
28+
QStackedWidget,
29+
QVBoxLayout,
2330
)
2431

2532
# Local imports
@@ -29,7 +36,9 @@
2936
from spyder.config.base import _
3037
from spyder.plugins.pythonpath.utils import check_path, get_system_pythonpath
3138
from spyder.utils.environ import (
32-
get_user_environment_variables, get_user_env, set_user_env
39+
get_user_environment_variables,
40+
get_user_env,
41+
set_user_env,
3342
)
3443
from spyder.utils.misc import getcwd_or_home
3544
from spyder.utils.stylesheet import (
@@ -100,7 +109,6 @@ def __init__(self, parent, sync=True):
100109
# Create a loading message
101110
self.loading_pane = EmptyMessageWidget(
102111
parent=self,
103-
icon_filename="dependencies",
104112
text=_("Retrieving environment variables..."),
105113
bottom_stretch=1,
106114
spinner=True,

spyder/utils/environ.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ def __init__(self, parent=None):
305305
if os.name == 'nt':
306306
title = _(r"User environment variables in Windows registry")
307307
readonly = False
308+
308309
super().__init__(parent=parent, title=title, readonly=readonly)
309310

310311
if os.name == 'nt':

spyder/widgets/collectionseditor.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@
3131
# Third party imports
3232
from qtpy.compat import getsavefilename, to_qvariant
3333
from qtpy.QtCore import (
34-
QAbstractTableModel, QItemSelectionModel, QModelIndex, Qt, QTimer,
35-
Signal, Slot
34+
QAbstractTableModel,
35+
QItemSelectionModel,
36+
QModelIndex,
37+
Qt,
38+
QTimer,
39+
Signal,
40+
Slot
3641
)
3742
from qtpy.QtGui import QColor, QKeySequence
3843
from qtpy.QtWidgets import (
@@ -1939,7 +1944,9 @@ class CollectionsEditor(BaseDialog):
19391944
"""Collections Editor Dialog"""
19401945

19411946
def __init__(
1942-
self, parent=None, namespacebrowser=None,
1947+
self,
1948+
parent=None,
1949+
namespacebrowser=None,
19431950
data_function: Optional[Callable[[], Any]] = None,
19441951
):
19451952
super().__init__(parent)
@@ -1960,8 +1967,15 @@ def __init__(
19601967
self.loading_pane = None
19611968

19621969
def setup(
1963-
self, data, title='', readonly=False, remote=False,
1964-
icon=None, parent=None, loading_msg=None, loading_img=None
1970+
self,
1971+
data,
1972+
title='',
1973+
readonly=False,
1974+
remote=False,
1975+
icon=None,
1976+
parent=None,
1977+
loading_msg=None,
1978+
loading_img=None,
19651979
):
19661980
"""Setup editor."""
19671981
if isinstance(data, (dict, set, frozenset)):
@@ -2012,7 +2026,6 @@ def setup(
20122026

20132027
# Create a QStackedWidget
20142028
self.stacked_widget = QStackedWidget()
2015-
20162029
self.stacked_widget.addWidget(self.widget)
20172030

20182031
# Create a loading message

0 commit comments

Comments
 (0)