Skip to content

Commit

Permalink
try RTD fix: try on_rtd check to redefine QWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
jborbely committed Aug 31, 2017
1 parent bf2395f commit ada4182
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 1 addition & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,15 @@
if on_rtd:
html_theme = 'default'

sys.path.insert(0, os.path.abspath('.'))

from unittest.mock import MagicMock
import mock_qtwidgets

class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return MagicMock()

MOCK_MODULES = ['PyQt5', 'PyQt5.QtCore', 'PyQt5.QtGui']
MOCK_MODULES = ['PyQt5', 'PyQt5.QtWidgets', 'PyQt5.QtCore', 'PyQt5.QtGui']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
sys.modules.update((('PyQt5.QtWidgets', mock_qtwidgets),))

else:
html_theme = 'sphinx_rtd_theme'
Expand Down
7 changes: 6 additions & 1 deletion msl/qt/logger.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
"""
A :class:`QWidget` to display :mod:`logging` messages.
"""
import os
import logging

from PyQt5 import QtWidgets, QtGui, Qt

on_rtd = os.environ.get('READTHEDOCS') == 'True'
if on_rtd:
QtWidgets = object

from msl.qt import prompt
from msl.qt.io import get_icon


class Logger(logging.Handler):#, QtWidgets.QWidget):
class Logger(logging.Handler, QtWidgets.QWidget):

def __init__(self,
level=logging.INFO,
Expand Down

0 comments on commit ada4182

Please sign in to comment.