Skip to content

Commit

Permalink
Merge pull request #2585 from goanpeca/update-inspector
Browse files Browse the repository at this point in the history
Homogenize Object inspector UI
  • Loading branch information
ccordoba12 committed Aug 5, 2015
2 parents acac447 + 9f7c219 commit 31ef876
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 7 deletions.
4 changes: 2 additions & 2 deletions spyderlib/plugins/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from spyderlib.widgets.comboboxes import EditableComboBox
from spyderlib.widgets.sourcecode import codeeditor
from spyderlib.widgets.findreplace import FindReplace
from spyderlib.widgets.browser import WebView
from spyderlib.widgets.browser import FrameWebView
from spyderlib.widgets.externalshell.pythonshell import ExtPythonShellWidget
from spyderlib.plugins import SpyderPluginWidget, PluginConfigPage
from spyderlib.py3compat import to_text_string, get_meth_class_inst
Expand Down Expand Up @@ -206,7 +206,7 @@ class RichText(QWidget):
def __init__(self, parent):
QWidget.__init__(self, parent)

self.webview = WebView(self)
self.webview = FrameWebView(self)
self.find_widget = FindReplace(self)
self.find_widget.set_editor(self.webview)
self.find_widget.hide()
Expand Down
47 changes: 42 additions & 5 deletions spyderlib/widgets/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@

"""Simple web browser widget"""

import sys

from spyderlib.qt.QtCore import QUrl, Slot, Signal
from spyderlib.qt.QtGui import (QHBoxLayout, QWidget, QVBoxLayout,
QProgressBar, QLabel, QMenu)
QProgressBar, QLabel, QMenu, QFrame)
from spyderlib.qt.QtWebKit import QWebView, QWebPage, QWebSettings
from spyderlib.qt.QtCore import QUrl, Slot
import spyderlib.utils.icon_manager as ima
import sys

# Local imports
from spyderlib.baseconfig import DEV, _
from spyderlib.utils.qthelpers import (create_action, add_actions,
create_toolbutton, action2button)
from spyderlib.baseconfig import DEV, _
from spyderlib.utils import icon_manager as ima
from spyderlib.widgets.comboboxes import UrlComboBox
from spyderlib.widgets.findreplace import FindReplace
from spyderlib.py3compat import to_text_string, is_text_string
Expand Down Expand Up @@ -239,6 +240,42 @@ def toggle_find_widget(self, state):
self.find_widget.hide()


class FrameWebView(QFrame):
"""
Framed QWebView for UI consistency in Spyder.
"""
linkClicked = Signal(QUrl)

def __init__(self, parent):
QFrame.__init__(self, parent)

self._webview = WebView(self)

layout = QHBoxLayout()
layout.addWidget(self._webview)
layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)

self.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken)

self._webview.linkClicked.connect(self.linkClicked)

def set_font(self, font, fixed_font=None):
self._webview.set_font(font, fixed_font=fixed_font)

def setHtml(self, html_text, base_url):
self._webview.setHtml(html_text, base_url)

def url(self):
return self._webview.url()

def load(self, url):
self._webview.load(url)

def page(self):
return self._webview.page()


def main():
"""Run web browser"""
from spyderlib.utils.qthelpers import qapplication
Expand Down

0 comments on commit 31ef876

Please sign in to comment.