Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Carlos Cordoba <[email protected]>
  • Loading branch information
hmaarrfk and ccordoba12 committed Jun 26, 2024
1 parent ee2bdd4 commit 57f64ec
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
11 changes: 7 additions & 4 deletions spyder/plugins/help/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
from qtpy import PYQT5, PYQT6
from qtpy.QtCore import Qt, QUrl, Signal, Slot, QPoint
from qtpy.QtGui import QColor
try:
from qtpy.QtWebEngineWidgets import WEBENGINE
except ImportError:
WEBENGINE = False
from qtpy.QtWidgets import (QActionGroup, QLabel, QLineEdit,
QMessageBox, QSizePolicy, QStackedWidget,
QVBoxLayout, QWidget)
Expand All @@ -44,6 +40,12 @@
from spyder.widgets.findreplace import FindReplace
from spyder.widgets.simplecodeeditor import SimpleCodeEditor

# In case WebEngine is not available (e.g. in Conda-forge)
try:
from qtpy.QtWebEngineWidgets import WEBENGINE
except ImportError:
WEBENGINE = False


# --- Constants
# ----------------------------------------------------------------------------
Expand Down Expand Up @@ -159,6 +161,7 @@ def __init__(self, parent):
else:
QWidget.__init__(self, parent)
SpyderWidgetMixin.__init__(self, class_parent=parent)

from qtpy.QtWebEngineWidgets import QWebEnginePage
from spyder.widgets.browser import FrameWebView

Expand Down
10 changes: 6 additions & 4 deletions spyder/plugins/ipythonconsole/widgets/main_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
from qtpy.QtCore import Signal, Slot
from qtpy.QtGui import QColor, QKeySequence
from qtpy.QtPrintSupport import QPrintDialog, QPrinter
try:
from qtpy.QtWebEngineWidgets import WEBENGINE
except ImportError:
WEBENGINE = False
from qtpy.QtWidgets import (
QApplication, QHBoxLayout, QLabel, QMessageBox, QVBoxLayout, QWidget)
from traitlets.config.loader import Config, load_pyconfig_files
Expand Down Expand Up @@ -65,6 +61,12 @@
from spyder.widgets.tabs import Tabs
from spyder.widgets.printer import SpyderPrinter

# In case WebEngine is not available (e.g. in Conda-forge)
try:
from qtpy.QtWebEngineWidgets import WEBENGINE
except ImportError:
WEBENGINE = False


# Logging
logger = logging.getLogger(__name__)
Expand Down
12 changes: 8 additions & 4 deletions spyder/plugins/onlinehelp/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
# Third party imports
from qtpy.QtCore import Qt, QThread, QUrl, Signal, Slot
from qtpy.QtGui import QCursor
try:
from qtpy.QtWebEngineWidgets import WEBENGINE
except ImportError:
WEBENGINE = False
from qtpy.QtWidgets import QApplication, QLabel, QVBoxLayout

# Local imports
Expand All @@ -30,6 +26,12 @@
from spyder.widgets.comboboxes import UrlComboBox
from spyder.widgets.findreplace import FindReplace

# In case WebEngine is not available (e.g. in Conda-forge)
try:
from qtpy.QtWebEngineWidgets import WEBENGINE
except ImportError:
WEBENGINE = False


# --- Constants
# ----------------------------------------------------------------------------
Expand Down Expand Up @@ -248,6 +250,7 @@ def setup(self):

def update_actions(self):
from spyder.widgets.browser import WebViewActions

stop_action = self.get_action(WebViewActions.Stop)
refresh_action = self.get_action(WebViewActions.Refresh)

Expand Down Expand Up @@ -277,6 +280,7 @@ def _continue_initialization(self):
def _handle_url_combo_activation(self):
"""Load URL from combo box first item."""
from spyder.widgets.browser import WebViewActions

if not self._is_running:
text = str(self.url_combo.currentText())
self.go_to(self.text_to_url(text))
Expand Down

0 comments on commit 57f64ec

Please sign in to comment.