Python PyQt5.QtWidgets.QGraphicsDropShadowEffect() Examples

The following are 9 code examples for showing how to use PyQt5.QtWidgets.QGraphicsDropShadowEffect(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .

Example 1
Project: imperialism-remake   Author: Trilarion   File: graphics.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, path, z_left=1, z_entered=2):
        """
        Adds a QGraphicsDropShadowEffect when hovering over the item. Otherwise it is just a clickable
        QGraphicsPathItem.
        """
        super().__init__(path)

        self.z_entered = z_entered
        self.z_left = z_left

        self.signaller.entered.connect(self.entered_item)
        self.signaller.left.connect(self.left_item)

        self.hover_effect = QtWidgets.QGraphicsDropShadowEffect()
        self.hover_effect.setOffset(4, 4)
        self.setGraphicsEffect(self.hover_effect)

        # the graphics effect is enabled initially, disable by calling left_item
        self.left_item() 
Example 2
Project: parsec-cloud   Author: Scille   File: devices_widget.py    License: GNU Affero General Public License v3.0 6 votes vote down vote up
def __init__(self, device_name, is_current_device, certified_on):
        super().__init__()
        self.setupUi(self)
        self.is_current_device = is_current_device
        self.label_icon.apply_style()
        self.device_name = device_name
        self.certified_on = certified_on
        self.label_device_name.setText(self.device_name)
        if self.is_current_device:
            self.label_is_current.setText("({})".format(_("TEXT_DEVICE_IS_CURRENT")))
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.show_context_menu)
        effect = QGraphicsDropShadowEffect(self)
        effect.setColor(QColor(0x99, 0x99, 0x99))
        effect.setBlurRadius(10)
        effect.setXOffset(2)
        effect.setYOffset(2)
        self.setGraphicsEffect(effect) 
Example 3
Project: parsec-cloud   Author: Scille   File: users_widget.py    License: GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(
        self,
        user_id,
        user_display,
        is_current_user,
        is_admin,
        certified_on,
        is_revoked,
        current_user_is_admin,
    ):
        super().__init__()
        self.setupUi(self)
        self.current_user_is_admin = current_user_is_admin
        self.is_admin = is_admin
        self.is_revoked = is_revoked
        self._is_revoked = is_revoked
        self.certified_on = certified_on
        self.is_current_user = is_current_user
        self.user_id = user_id
        self.user_display = user_display
        self.label_username.setText(user_display)
        self.user_icon.apply_style()
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.show_context_menu)
        self.label_created_on.setText(format_datetime(self.certified_on, full=True))
        self.label_role.setText(
            _("TEXT_USER_ROLE_ADMIN") if self.is_admin else _("TEXT_USER_ROLE_CONTRIBUTOR")
        )
        if self.is_current_user:
            self.label_user_is_current.setText("({})".format(_("TEXT_USER_IS_CURRENT")))
        effect = QGraphicsDropShadowEffect(self)
        effect.setColor(QColor(0x99, 0x99, 0x99))
        effect.setBlurRadius(10)
        effect.setXOffset(2)
        effect.setYOffset(2)
        self.setGraphicsEffect(effect) 
Example 4
Project: CvStudio   Author: haruiz   File: main_window.py    License: MIT License 5 votes vote down vote up
def __init__(self, window: QMainWindow, parent=None):
        super(MainWindowContainer, self).__init__(parent)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
        self.resize(1024, 580)
        layout = QVBoxLayout(self)
        layout.addWidget(window)
        layout.setContentsMargins(0, 0, 6, 6)
        self.shadow = QGraphicsDropShadowEffect(self)
        self.shadow.setBlurRadius(50)
        self.shadow.setColor(QtGui.QColor(138, 145, 140))
        self.shadow.setOffset(8)
        window.setGraphicsEffect(self.shadow) 
Example 5
Project: CvStudio   Author: haruiz   File: switch_button.py    License: MIT License 5 votes vote down vote up
def enterEvent(self, evt: QtCore.QEvent) -> None:
        shadow = QGraphicsDropShadowEffect(self)
        shadow.setBlurRadius(8)
        shadow.setColor(QtGui.QColor(76, 35, 45).lighter())
        shadow.setOffset(4)
        self.setGraphicsEffect(shadow)
        super(SwitchButton, self).enterEvent(evt) 
Example 6
Project: CvStudio   Author: haruiz   File: video_dialog.py    License: MIT License 5 votes vote down vote up
def __init__(self, window: QDialog, parent=None):
        super(VideoViewerContainer, self).__init__(parent)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
        self.resize(1024, 580)
        layout = QVBoxLayout(self)
        layout.addWidget(window)
        layout.setContentsMargins(0, 0, 6, 6)
        self.shadow = QGraphicsDropShadowEffect(self)
        self.shadow.setBlurRadius(50)
        self.shadow.setColor(QColor(138, 145, 140))
        self.shadow.setOffset(8)
        window.setGraphicsEffect(self.shadow) 
Example 7
Project: CvStudio   Author: haruiz   File: image_button.py    License: MIT License 5 votes vote down vote up
def enterEvent(self, evt: QtCore.QEvent) -> None:
        # self.setIconSize(QSize(math.floor(self._size.width() * 1.2),math.floor(self._size.height() * 1.2)))
        shadow = QGraphicsDropShadowEffect(self)
        shadow.setBlurRadius(8)
        # shadow.setColor(QtGui.QColor(76,35,45).lighter())
        shadow.setColor(QtGui.QColor(76, 35, 45).lighter())
        shadow.setOffset(4)
        self.setGraphicsEffect(shadow)
        super(ImageButton, self).enterEvent(evt) 
Example 8
Project: tinydecred   Author: decred   File: qutilities.py    License: ISC License 5 votes vote down vote up
def addDropShadow(wgt):
    """
    Add a white background and a drop shadow for the given widget.
    """
    effect = QtWidgets.QGraphicsDropShadowEffect()
    effect.setBlurRadius(5)
    effect.setXOffset(0)
    effect.setYOffset(0)
    effect.setColor(QtGui.QColor("#a1a1a1"))
    setBackgroundColor(wgt, "white")
    wgt.setGraphicsEffect(effect) 
Example 9
Project: parsec-cloud   Author: Scille   File: central_widget.py    License: GNU Affero General Public License v3.0 4 votes vote down vote up
def __init__(self, core, jobs_ctx, event_bus, **kwargs):
        super().__init__(**kwargs)
        self.setupUi(self)

        self.jobs_ctx = jobs_ctx
        self.core = core
        self.event_bus = event_bus

        self.menu = MenuWidget(parent=self)
        self.widget_menu.layout().addWidget(self.menu)

        for e in self.NOTIFICATION_EVENTS:
            self.event_bus.connect(e, self.handle_event)

        self.menu.organization = self.core.device.organization_addr.organization_id
        self.menu.username = self.core.device.user_id
        self.menu.device = self.core.device.device_name
        self.menu.organization_url = str(self.core.device.organization_addr)

        self.new_notification.connect(self.on_new_notification)
        self.menu.files_clicked.connect(self.show_mount_widget)
        self.menu.users_clicked.connect(self.show_users_widget)
        self.menu.devices_clicked.connect(self.show_devices_widget)
        self.menu.logout_clicked.connect(self.logout_requested.emit)
        self.connection_state_changed.connect(self._on_connection_state_changed)

        self.widget_title2.hide()
        self.widget_title3.hide()
        self.title2_icon.apply_style()
        self.title3_icon.apply_style()

        effect = QGraphicsDropShadowEffect(self)
        effect.setColor(QColor(100, 100, 100))
        effect.setBlurRadius(4)
        effect.setXOffset(-2)
        effect.setYOffset(2)
        self.widget_notif.setGraphicsEffect(effect)

        self.mount_widget = MountWidget(self.core, self.jobs_ctx, self.event_bus, parent=self)
        self.widget_central.layout().insertWidget(0, self.mount_widget)
        self.mount_widget.folder_changed.connect(self._on_folder_changed)

        self.users_widget = UsersWidget(self.core, self.jobs_ctx, self.event_bus, parent=self)
        self.widget_central.layout().insertWidget(0, self.users_widget)

        self.devices_widget = DevicesWidget(self.core, self.jobs_ctx, self.event_bus, parent=self)
        self.widget_central.layout().insertWidget(0, self.devices_widget)

        self._on_connection_state_changed(self.core.backend_status, self.core.backend_status_exc)
        self.show_mount_widget()