~suutari-olli/openlp/click-slide-to-go-live-from-blank

« back to all changes in this revision

Viewing changes to openlp/core/lib/dockwidget.py

Merged trunk on 28.4.16, removed broken test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: utf-8 -*-
2
 
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
3
 
 
4
 
###############################################################################
5
 
# OpenLP - Open Source Lyrics Projection                                      #
6
 
# --------------------------------------------------------------------------- #
7
 
# Copyright (c) 2008-2016 OpenLP Developers                                   #
8
 
# --------------------------------------------------------------------------- #
9
 
# This program is free software; you can redistribute it and/or modify it     #
10
 
# under the terms of the GNU General Public License as published by the Free  #
11
 
# Software Foundation; version 2 of the License.                              #
12
 
#                                                                             #
13
 
# This program is distributed in the hope that it will be useful, but WITHOUT #
14
 
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
15
 
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
16
 
# more details.                                                               #
17
 
#                                                                             #
18
 
# You should have received a copy of the GNU General Public License along     #
19
 
# with this program; if not, write to the Free Software Foundation, Inc., 59  #
20
 
# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
21
 
###############################################################################
22
 
 
23
 
"""
24
 
Provide additional functionality required by OpenLP from the inherited QDockWidget.
25
 
"""
26
 
 
27
 
import logging
28
 
 
29
 
from PyQt5 import QtWidgets
30
 
 
31
 
from openlp.core.lib import ScreenList, build_icon
32
 
 
33
 
log = logging.getLogger(__name__)
34
 
 
35
 
 
36
 
class OpenLPDockWidget(QtWidgets.QDockWidget):
37
 
    """
38
 
    Custom DockWidget class to handle events
39
 
    """
40
 
    def __init__(self, parent=None, name=None, icon=None):
41
 
        """
42
 
        Initialise the DockWidget
43
 
        """
44
 
        log.debug('Initialise the %s widget' % name)
45
 
        super(OpenLPDockWidget, self).__init__(parent)
46
 
        if name:
47
 
            self.setObjectName(name)
48
 
        if icon:
49
 
            self.setWindowIcon(build_icon(icon))
50
 
        # Sort out the minimum width.
51
 
        screens = ScreenList()
52
 
        main_window_docbars = screens.current['size'].width() // 5
53
 
        if main_window_docbars > 300:
54
 
            self.setMinimumWidth(300)
55
 
        else:
56
 
            self.setMinimumWidth(main_window_docbars)