diff --git a/README.md b/README.md index 904b503f..8f7193d3 100644 --- a/README.md +++ b/README.md @@ -175,7 +175,8 @@ spin_icon = qta.icon('mdi.loading', color='red', spin_widget.setIcon(spin_icon) # Simple icon widget -simple_widget = qta.IconWidget('mdi.web', color='blue') +simple_widget = qta.IconWidget('mdi.web', color='blue', + size=QtCore.QSize(16, 16)) ``` - Screenshot diff --git a/docs/environment.yml b/docs/environment.yml index 34e94eb8..005ef1c6 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -6,3 +6,4 @@ channels: dependencies: - pyqt - qtpy +- sphinx_rtd_theme diff --git a/docs/source/conf.py b/docs/source/conf.py index e6196af0..ce2f9c99 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -43,6 +43,7 @@ 'sphinx.ext.autosummary', 'sphinx.ext.viewcode', 'sphinx.ext.napoleon', + 'sphinx_rtd_theme', ] autosummary_generate = True @@ -72,8 +73,8 @@ # General information about the project. project = u'qtawesome' -copyright = u'2015, The Spyder Development Team' -author = u'The Spyder Development Team' +copyright = u'2015-, The Spyder Development Team' +author = u'Sylvain Corlay and the Spyder Development Team' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -89,7 +90,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: @@ -133,7 +134,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -# html_theme = 'alabaster' +html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -310,4 +311,4 @@ # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'https://docs.python.org/': None} +intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} diff --git a/docs/source/usage.rst b/docs/source/usage.rst index a7608340..b7e0f135 100644 --- a/docs/source/usage.rst +++ b/docs/source/usage.rst @@ -206,14 +206,15 @@ Examples .. code:: python - # Spining icon widget + # Spinning icon widget spin_widget = qta.IconWidget() spin_icon = qta.icon('mdi.loading', color='red', animation=qta.Spin(spin_widget)) spin_widget.setIcon(spin_icon) # simple widget - simple_widget = qta.IconWidget('mdi.web', color='blue') + simple_widget = qta.IconWidget('mdi.web', color='blue', + size=QtCore.QSize(16, 16)) Screenshot ~~~~~~~~~~ diff --git a/example.py b/example.py index 34b0e34d..9d4db7be 100644 --- a/example.py +++ b/example.py @@ -96,7 +96,7 @@ def __init__(self): lo.addWidget(iconwidget) lo.addWidget(QtWidgets.QLabel('IconWidget')) iconwidgetholder.setLayout(lo) - iconwidget2 = qta.IconWidget('mdi.web', color='blue') + iconwidget2 = qta.IconWidget('mdi.web', color='blue', size=QtCore.QSize(16, 16)) # Icon drawn with the `image` option drawn_image_icon = qta.icon('ri.truck-fill', diff --git a/qtawesome/__init__.py b/qtawesome/__init__.py index d1b28999..2cb680f9 100644 --- a/qtawesome/__init__.py +++ b/qtawesome/__init__.py @@ -334,19 +334,23 @@ class IconWidget(QtWidgets.QLabel): """ IconWidget gives the ability to display an icon as a widget - if supports the same arguments as icon() - for example - music_icon = qta.IconWidget('fa5s.music', - color='blue', - color_active='orange') + It supports the same arguments as `icon()`, + for example, - it also have setIcon() and setIconSize() functions + music_icon = qta.IconWidget('fa5s.music', + color='blue', + color_active='orange') + + The exceptions are `parent` and `size` keyword-only arguments, + which allow setting the widget parent and initial size, correspondingly. + + It also has `setIcon()` and `setIconSize()` functions. """ def __init__(self, *names, **kwargs): super().__init__(parent=kwargs.get('parent')) self._icon = None - self._size = QtCore.QSize(16, 16) + self._size = kwargs.get('size', QtCore.QSize(16, 16)) self.setIcon(icon(*names, **kwargs)) def setIcon(self, _icon): diff --git a/readthedocs.yml b/readthedocs.yml index 9d944f16..23e47fc8 100644 --- a/readthedocs.yml +++ b/readthedocs.yml @@ -1,5 +1,19 @@ +version: 2 + +build: + os: "ubuntu-22.04" + tools: + python: "mambaforge-22.9" + conda: - file: docs/environment.yml + environment: docs/environment.yml + python: - version: 3 - setup_py_install: true + install: + - method: pip + path: . + +sphinx: + builder: html + configuration: docs/source/conf.py + fail_on_warning: true \ No newline at end of file