"""@package PySideWidgetCollection.confirmdialog.confirmdialog
@brief A PySide confirm dialog providing multiple ways of use.
@date 2014/11/20
@version 1.0
@author Paul Schweizer
@email [email protected]
"""
from PySide import QtCore, QtGui

from PySideWidgetCollection import utility
__all__ = ['WindowHeader', 'ConfirmDialog']

wh_base_class, wh_form_class = utility.load_ui_bases(__file__, 'WindowHeader')


class WindowHeader(wh_base_class, wh_form_class):
    """A header for the Confirm Dialog and other tools."""
    def __init__(self, title, subtitle=''):
        """Initialize the Header.

        @param title The title of the window
        @param subtitle An optional subtitle
        """
        super(WindowHeader, self).__init__()
        self.setupUi(self)
        self.title_lbl.setText(title)
        if subtitle != '':
            self.subtitle_lbl.setText(subtitle)
        else:
            self.subtitle_lbl.hide()
        # end if
                                 event.globalPos().x() - self._start_geo.x(),
                                 event.globalPos().y() - self._start_geo.y())
        # end if

    # end def dragMoveEvent

    def mouseReleaseEvent(self, event):
        """De-register the mouse press."""
        self._mouse_pressed = False

    # end def mouseReleaseEvent


# end class ResizeButton

tb_base_class, tb_form_class = utility.load_ui_bases(__file__, 'TitleBar')


class TitleBar(tb_base_class, tb_form_class):
    """The title bar reproduces the behavior of a normal title bar.

    It is specifically designed for frame less widgets.
    """
    def __init__(self, parent=None, title='', help_url=''):
        """Initialize the title bar widget.

        @param parent The parent widget
        @param title The title
        @param help_url An optional url to a help page.
        """
        super(TitleBar, self).__init__(parent=parent)
Esempio n. 3
0
"""@package PySideWidgetCollection.loadingdialog.loadingdialog
@brief A loading screen for time consuming processes.
@date 2016/02/05
@version 2.0
@author Paul Schweizer
@email [email protected]
"""
import os
import logging

from PySide import QtCore, QtGui

from PySideWidgetCollection import utility
__all__ = ['LoadingDialog']

base_class, form_class = utility.load_ui_bases(__file__, 'LoadingDialog')


class LoadingDialog(base_class, form_class):
    """Show a screen while running a background process.

    The dialog will be shown until the given callback has run.
    """
    def __init__(self, callback=lambda: None, text='Loading ...'):
        """Initialize the LoadingDialog."""
        super(LoadingDialog, self).__init__()
        self.setupUi(self)

        self.callback = callback
        self.return_value = None
        self.painted = False
Esempio n. 4
0
class NotifierTrayIcon(QtGui.QSystemTrayIcon):
    """The Icon for the Notifier."""
    def __init__(self, icon, parent=None):
        """Add an exit button to the menu."""
        super(NotifierTrayIcon, self).__init__(icon, parent)
        menu = QtGui.QMenu(parent)
        self.exit_action = menu.addAction('Exit')
        self.setContextMenu(menu)

    # end def __init__


# end class NotifierTrayIcon

form_class, base_class = utility.load_ui_bases(__file__, 'Notifier')


class Notifier(base_class, form_class):
    """A Widget blueprint for pop-up tray notifications.

    It collapses to a tray icon and pops up at a position near
    the tray icon.
    """
    def __init__(self):
        """Setup the tray icon and signals."""
        super(Notifier, self).__init__()
        self.setupUi(self)
        self.width = 150
        self.height = 100
        self._init_tray_icon()
"""@package PySideWidgetCollection.slidingmenubar.slidingmenubar
@brief A header including a slide in menu, a title and a help option.
@date 2016/04/01
@version 1.0
@author Paul Schweizer
@email [email protected]
"""
import webbrowser

from PySide import QtCore, QtGui

from PySideWidgetCollection import utility
__all__ = ['SlidingMenuBar']


sm_form_class, sm_base_class = utility.load_ui_bases(__file__, 'SlidingMenu')


class SlidingMenu(sm_form_class, sm_base_class):

    """The menu widget for the sliding menu bar."""

    def __init__(self, parent=None):
        """Initialize the menu.

        @param parent The parent widget of the menu
        """
        super(SlidingMenu, self).__init__(parent=None)
        self.setupUi(self)
        self.scrollAreaWidgetContents.setLayout(QtGui.QVBoxLayout())
        self.scrollAreaWidgetContents.layout().addStretch()