pyside6-overlay-busy-indicator


Namepyside6-overlay-busy-indicator JSON
Version 1.6 PyPI version JSON
download
home_pagehttps://github.com/pohemati/pyside6-overlay-busy-indicator
SummaryA customizable overlay busy indicator with a smooth fade animation for PySide6
upload_time2024-10-14 18:46:18
maintainerNone
docs_urlNone
authorPoria Hemati
requires_pythonNone
licenseMIT
keywords pyside6 overlay busy indicator progressbar loading
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# PySide6 Overlay Busy Indicator

A customizable overlay busy indicator with a smooth fade animation for PySide6

If you are using PyQt6, you can download the code in [PyQt6](https://github.com/pohemati/pyqt6-overlay-busy-indicator).

## Installation

Install package using pip

```python
  pip install pyside6-overlay-busy-indicator
```



## Screenshots

![App Screenshot](https://raw.githubusercontent.com/pohemati/pyside6-overlay-busy-indicator/main/qbusyindicator/assets/screenshot.gif)



## Usage/Examples

```python
from qbusyindicator import QOverlayBusyIndicator


class Dialog(QtWidgets.QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)
        # widgets and layouts
        self.busy_indicator = QOverlayBusyIndicator(self)
        
        # connecting signals
        self.busy_indicator.started.connect(lambda: print('started'))
        self.busy_indicator.stopped.connect(lambda: print('stopped'))

        # start the indicator
        self.busy_indicator.start()
        
        # stop the indicator
        self.busy_indicator.stop()

        # stop the indicator after 5 seconds
        self.busy_indicator.stopAfter(5000)

        # returns True if the indicator is currently busy
        self.busy_indicator.isBusy() 

        # returns True if the indicator is about to stop(e.g. returns true after calling stopAfter method)
        self.busy_indicator.isStopping()

        # returns True if the indicator is currently stopped
        self.busy_indicator.isStopped()

        # sets the busy gif animation/image path
        # you can use qt resources files too
        # for clearing image/gif animation you can call this method using an empty string
        self.busy_indicator.setImagePath('loading.gif') 

        # returns gif animation path
        self.busy_indicator.imagePath()

        # blocks keyboard input on dialog/window while busy. default is False
        self.busy_indicator.setBlockKeyboard(True) 

        # returns True if the keyboard input is blocked
        self.busy_indicator.keyboardBlocked()

        # blocks mouse input on dialog/window while busy. default is False
        self.busy_indicator.setBlockMouse(True) 

        # returns True if the mouse input is blocked
        self.busy_indicator.mouseBlocked()

        # sets the duration of fade in/out animations to 2 seconds. default is 400 msecs
        self.busy_indicator.setFadeDuration(2000) 

        # returns current fade duration
        self.busy_indicator.fadeDuratrion()

        # changing the label font
        self.busy_indicator.setLabelFont(QtGui.QFont('Calibri', 20))

        # returns current label font
        self.busy_indicator.labelFont()

        # changing the label text
        self.busy_indicator.setLabelText(self.tr('Loading...')) 

        # returns current label text
        self.busy_indicator.labelText()

        # changing the background color of overlay
        # default is rgba(204, 204, 204, 70)
        self.busy_indicator.setStyleSheet('background-color: rgba(204, 204, 204, 60);')
        
        # changing the color and style of the text
        # default is 'color: #808080; padding-top: 5px;'
        self.busy_indicator.label.setStyleSheet('color: #CCC; padding-top: 10px;')

    # never forget to override resizeEvent method of your dialog/window
    # to ensure that busy indicator will be automically resized with dialog
    def resizeEvent(self, event):
        self.busy_indicator.resize(event.size())
        return super().resizeEvent(event)
```

if you prefer snake-case syntax over camel-case, and you would like to use properties to access/customize widget's behavior you can use following example.

```python
from qbusyindicator import QOverlayBusyIndicator


class Dialog(QtWidgets.QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)
        # widgets and layouts
        self.busy_indicator = QOverlayBusyIndicator(self)
        
        # connecting signals
        self.busy_indicator.started.connect(lambda: print('started'))
        self.busy_indicator.stopped.connect(lambda: print('stopped'))

        # start the indicator
        self.busy_indicator.start()
        
        # stop the indicator
        self.busy_indicator.stop()

        # stop the indicator after 5 seconds
        self.busy_indicator.stop_after(5000)

        # returns true if the indicator is currently busy
        self.busy_indicator.is_busy() 

        # returns true if the indicator is about to stop(e.g. returns true after calling stop_after method)
        self.busy_indicator.is_stopping()

        # returns true if the indicator is currently stopped
        self.busy_indicator.is_stopped()

        # sets the busy gif animation/image path
        # you can use qt resources files too
        # for clearing gif animation/image you can assign this attribute an empty string
        self.busy_indicator.image_path = 'loading.gif'

        # blocks keyboard input on dialog/window while busy. default is False
        self.busy_indicator.block_keyboard = True

        # blocks mouse input on dialog/window while busy. default is False
        self.busy_indicator.block_mouse = True

        # sets the duration of fade in/out animations to 2 seconds. default is 400 msecs
        self.busy_indicator.fade_duration = 2000

        # changing the label font
        self.busy_indicator.label_font = QtGui.QFont('Calibri', 20)

        # changing the label text
        self.busy_indicator.label_text = self.tr('Loading...')
    
    # never forget to override resizeEvent method of your dialog/window
    # to ensure that busy indicator will be automically resized with dialog
    def resizeEvent(self, event):
        self.busy_indicator.resize(event.size())
        return super().resizeEvent(event)
```


## Demo

After installing qbusyindicator package using pip, you can run demo.py file in the examples directory, for example:

```
cd examples
python demo.py
```

![Demo Screenshot](https://raw.githubusercontent.com/pohemati/pyside6-overlay-busy-indicator/main/qbusyindicator/assets/demo-screenshot.png)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pohemati/pyside6-overlay-busy-indicator",
    "name": "pyside6-overlay-busy-indicator",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "pyside6, overlay, busy, indicator, progressbar, loading",
    "author": "Poria Hemati",
    "author_email": "poria.hemati@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/43/68/bc693e9ed41e48012e8063003ea0126301018e5da8ab2c21c399ef5f0d5f/pyside6-overlay-busy-indicator-1.6.tar.gz",
    "platform": null,
    "description": "\r\n# PySide6 Overlay Busy Indicator\r\n\r\nA customizable overlay busy indicator with a smooth fade animation for PySide6\r\n\r\nIf you are using PyQt6, you can download the code in [PyQt6](https://github.com/pohemati/pyqt6-overlay-busy-indicator).\r\n\r\n## Installation\r\n\r\nInstall package using pip\r\n\r\n```python\r\n  pip install pyside6-overlay-busy-indicator\r\n```\r\n\r\n\r\n\r\n## Screenshots\r\n\r\n![App Screenshot](https://raw.githubusercontent.com/pohemati/pyside6-overlay-busy-indicator/main/qbusyindicator/assets/screenshot.gif)\r\n\r\n\r\n\r\n## Usage/Examples\r\n\r\n```python\r\nfrom qbusyindicator import QOverlayBusyIndicator\r\n\r\n\r\nclass Dialog(QtWidgets.QDialog):\r\n    def __init__(self, parent=None):\r\n        super().__init__(parent)\r\n        # widgets and layouts\r\n        self.busy_indicator = QOverlayBusyIndicator(self)\r\n        \r\n        # connecting signals\r\n        self.busy_indicator.started.connect(lambda: print('started'))\r\n        self.busy_indicator.stopped.connect(lambda: print('stopped'))\r\n\r\n        # start the indicator\r\n        self.busy_indicator.start()\r\n        \r\n        # stop the indicator\r\n        self.busy_indicator.stop()\r\n\r\n        # stop the indicator after 5 seconds\r\n        self.busy_indicator.stopAfter(5000)\r\n\r\n        # returns True if the indicator is currently busy\r\n        self.busy_indicator.isBusy() \r\n\r\n        # returns True if the indicator is about to stop(e.g. returns true after calling stopAfter method)\r\n        self.busy_indicator.isStopping()\r\n\r\n        # returns True if the indicator is currently stopped\r\n        self.busy_indicator.isStopped()\r\n\r\n        # sets the busy gif animation/image path\r\n        # you can use qt resources files too\r\n        # for clearing image/gif animation you can call this method using an empty string\r\n        self.busy_indicator.setImagePath('loading.gif') \r\n\r\n        # returns gif animation path\r\n        self.busy_indicator.imagePath()\r\n\r\n        # blocks keyboard input on dialog/window while busy. default is False\r\n        self.busy_indicator.setBlockKeyboard(True) \r\n\r\n        # returns True if the keyboard input is blocked\r\n        self.busy_indicator.keyboardBlocked()\r\n\r\n        # blocks mouse input on dialog/window while busy. default is False\r\n        self.busy_indicator.setBlockMouse(True) \r\n\r\n        # returns True if the mouse input is blocked\r\n        self.busy_indicator.mouseBlocked()\r\n\r\n        # sets the duration of fade in/out animations to 2 seconds. default is 400 msecs\r\n        self.busy_indicator.setFadeDuration(2000) \r\n\r\n        # returns current fade duration\r\n        self.busy_indicator.fadeDuratrion()\r\n\r\n        # changing the label font\r\n        self.busy_indicator.setLabelFont(QtGui.QFont('Calibri', 20))\r\n\r\n        # returns current label font\r\n        self.busy_indicator.labelFont()\r\n\r\n        # changing the label text\r\n        self.busy_indicator.setLabelText(self.tr('Loading...')) \r\n\r\n        # returns current label text\r\n        self.busy_indicator.labelText()\r\n\r\n        # changing the background color of overlay\r\n        # default is rgba(204, 204, 204, 70)\r\n        self.busy_indicator.setStyleSheet('background-color: rgba(204, 204, 204, 60);')\r\n        \r\n        # changing the color and style of the text\r\n        # default is 'color: #808080; padding-top: 5px;'\r\n        self.busy_indicator.label.setStyleSheet('color: #CCC; padding-top: 10px;')\r\n\r\n    # never forget to override resizeEvent method of your dialog/window\r\n    # to ensure that busy indicator will be automically resized with dialog\r\n    def resizeEvent(self, event):\r\n        self.busy_indicator.resize(event.size())\r\n        return super().resizeEvent(event)\r\n```\r\n\r\nif you prefer snake-case syntax over camel-case, and you would like to use properties to access/customize widget's behavior you can use following example.\r\n\r\n```python\r\nfrom qbusyindicator import QOverlayBusyIndicator\r\n\r\n\r\nclass Dialog(QtWidgets.QDialog):\r\n    def __init__(self, parent=None):\r\n        super().__init__(parent)\r\n        # widgets and layouts\r\n        self.busy_indicator = QOverlayBusyIndicator(self)\r\n        \r\n        # connecting signals\r\n        self.busy_indicator.started.connect(lambda: print('started'))\r\n        self.busy_indicator.stopped.connect(lambda: print('stopped'))\r\n\r\n        # start the indicator\r\n        self.busy_indicator.start()\r\n        \r\n        # stop the indicator\r\n        self.busy_indicator.stop()\r\n\r\n        # stop the indicator after 5 seconds\r\n        self.busy_indicator.stop_after(5000)\r\n\r\n        # returns true if the indicator is currently busy\r\n        self.busy_indicator.is_busy() \r\n\r\n        # returns true if the indicator is about to stop(e.g. returns true after calling stop_after method)\r\n        self.busy_indicator.is_stopping()\r\n\r\n        # returns true if the indicator is currently stopped\r\n        self.busy_indicator.is_stopped()\r\n\r\n        # sets the busy gif animation/image path\r\n        # you can use qt resources files too\r\n        # for clearing gif animation/image you can assign this attribute an empty string\r\n        self.busy_indicator.image_path = 'loading.gif'\r\n\r\n        # blocks keyboard input on dialog/window while busy. default is False\r\n        self.busy_indicator.block_keyboard = True\r\n\r\n        # blocks mouse input on dialog/window while busy. default is False\r\n        self.busy_indicator.block_mouse = True\r\n\r\n        # sets the duration of fade in/out animations to 2 seconds. default is 400 msecs\r\n        self.busy_indicator.fade_duration = 2000\r\n\r\n        # changing the label font\r\n        self.busy_indicator.label_font = QtGui.QFont('Calibri', 20)\r\n\r\n        # changing the label text\r\n        self.busy_indicator.label_text = self.tr('Loading...')\r\n    \r\n    # never forget to override resizeEvent method of your dialog/window\r\n    # to ensure that busy indicator will be automically resized with dialog\r\n    def resizeEvent(self, event):\r\n        self.busy_indicator.resize(event.size())\r\n        return super().resizeEvent(event)\r\n```\r\n\r\n\r\n## Demo\r\n\r\nAfter installing qbusyindicator package using pip, you can run demo.py file in the examples directory, for example:\r\n\r\n```\r\ncd examples\r\npython demo.py\r\n```\r\n\r\n![Demo Screenshot](https://raw.githubusercontent.com/pohemati/pyside6-overlay-busy-indicator/main/qbusyindicator/assets/demo-screenshot.png)\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A customizable overlay busy indicator with a smooth fade animation for PySide6",
    "version": "1.6",
    "project_urls": {
        "Download": "https://github.com/pohemati/pyside6-overlay-busy-indicator/archive/refs/tags/v1.6.tar.gz",
        "Homepage": "https://github.com/pohemati/pyside6-overlay-busy-indicator"
    },
    "split_keywords": [
        "pyside6",
        " overlay",
        " busy",
        " indicator",
        " progressbar",
        " loading"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b7dac6f442c8aec58c9fcbed21ab56c2a2c1d2ad87a057c2b660d4934f5e6179",
                "md5": "75aaa78de0807f9d9ff14ad15dcab91a",
                "sha256": "5d7a66ffbb2dd4e734dbd0cbb1f31c9ca131d1647ad70b3c9dbc86141d71b61a"
            },
            "downloads": -1,
            "filename": "pyside6_overlay_busy_indicator-1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "75aaa78de0807f9d9ff14ad15dcab91a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 45748,
            "upload_time": "2024-10-14T18:46:15",
            "upload_time_iso_8601": "2024-10-14T18:46:15.814545Z",
            "url": "https://files.pythonhosted.org/packages/b7/da/c6f442c8aec58c9fcbed21ab56c2a2c1d2ad87a057c2b660d4934f5e6179/pyside6_overlay_busy_indicator-1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4368bc693e9ed41e48012e8063003ea0126301018e5da8ab2c21c399ef5f0d5f",
                "md5": "111e1be3004232bc226411988e5aa6ee",
                "sha256": "50cb160700761fb11f6c48f2e263d04b72ab91c65cf254d977937cc6c2ffa70c"
            },
            "downloads": -1,
            "filename": "pyside6-overlay-busy-indicator-1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "111e1be3004232bc226411988e5aa6ee",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 45711,
            "upload_time": "2024-10-14T18:46:18",
            "upload_time_iso_8601": "2024-10-14T18:46:18.596526Z",
            "url": "https://files.pythonhosted.org/packages/43/68/bc693e9ed41e48012e8063003ea0126301018e5da8ab2c21c399ef5f0d5f/pyside6-overlay-busy-indicator-1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-14 18:46:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pohemati",
    "github_project": "pyside6-overlay-busy-indicator",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pyside6-overlay-busy-indicator"
}
        
Elapsed time: 0.34686s