1
# -*- coding: utf-8 -*-
2
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
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. #
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 #
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
###############################################################################
24
Provide additional functionality required by OpenLP from the inherited QDockWidget.
29
from PyQt5 import QtWidgets
31
from openlp.core.lib import ScreenList, build_icon
33
log = logging.getLogger(__name__)
36
class OpenLPDockWidget(QtWidgets.QDockWidget):
38
Custom DockWidget class to handle events
40
def __init__(self, parent=None, name=None, icon=None):
42
Initialise the DockWidget
44
log.debug('Initialise the %s widget' % name)
45
super(OpenLPDockWidget, self).__init__(parent)
47
self.setObjectName(name)
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)
56
self.setMinimumWidth(main_window_docbars)