~suutari-olli/openlp/escape-fixes-1294111-1497637

« back to all changes in this revision

Viewing changes to openlp/core/ui/shortcutlistdialog.py

  • Committer: suutari-olli
  • Date: 2016-01-07 02:53:59 UTC
  • mfrom: (2557.2.31 openlp)
  • Revision ID: suutari.olli@gmail.com-20160107025359-q2feybbwxaoihqxr
Merge to trunk on 1/7/2015.

I noticed this branch also seems to be fixing this bug:
https://bugs.launchpad.net/openlp/+bug/1531691

However, escape item still remains buggy with problems related to resuming
video and presentations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
###############################################################################
5
5
# OpenLP - Open Source Lyrics Projection                                      #
6
6
# --------------------------------------------------------------------------- #
7
 
# Copyright (c) 2008-2015 OpenLP Developers                                   #
 
7
# Copyright (c) 2008-2016 OpenLP Developers                                   #
8
8
# --------------------------------------------------------------------------- #
9
9
# This program is free software; you can redistribute it and/or modify it     #
10
10
# under the terms of the GNU General Public License as published by the Free  #
22
22
"""
23
23
The list of shortcuts within a dialog.
24
24
"""
25
 
from PyQt4 import QtCore, QtGui
 
25
from PyQt5 import QtCore, QtWidgets
26
26
 
27
27
from openlp.core.common import translate
28
28
from openlp.core.lib import build_icon
29
29
from openlp.core.lib.ui import create_button_box
30
30
 
31
31
 
32
 
class CaptureShortcutButton(QtGui.QPushButton):
 
32
class CaptureShortcutButton(QtWidgets.QPushButton):
33
33
    """
34
34
    A class to encapsulate a ``QPushButton``.
35
35
    """
50
50
            event.ignore()
51
51
 
52
52
 
 
53
class ShortcutTreeWidget(QtWidgets.QTreeWidget):
 
54
    def __init__(self, *args):
 
55
        super(ShortcutTreeWidget, self).__init__(*args)
 
56
 
 
57
    def keyboardSearch(self, search):
 
58
        """
 
59
        Ignore searches to prevent single letter searches from highlighting items.
 
60
 
 
61
        :param search: Search string
 
62
        """
 
63
        pass
 
64
 
 
65
 
53
66
class Ui_ShortcutListDialog(object):
54
67
    """
55
68
    The UI widgets for the shortcut dialog.
61
74
        shortcutListDialog.setObjectName('shortcutListDialog')
62
75
        shortcutListDialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
63
76
        shortcutListDialog.resize(500, 438)
64
 
        self.shortcut_list_layout = QtGui.QVBoxLayout(shortcutListDialog)
 
77
        self.shortcut_list_layout = QtWidgets.QVBoxLayout(shortcutListDialog)
65
78
        self.shortcut_list_layout.setObjectName('shortcut_list_layout')
66
 
        self.description_label = QtGui.QLabel(shortcutListDialog)
 
79
        self.description_label = QtWidgets.QLabel(shortcutListDialog)
67
80
        self.description_label.setObjectName('description_label')
68
81
        self.description_label.setWordWrap(True)
69
82
        self.shortcut_list_layout.addWidget(self.description_label)
70
 
        self.tree_widget = QtGui.QTreeWidget(shortcutListDialog)
 
83
        self.tree_widget = ShortcutTreeWidget(shortcutListDialog)
71
84
        self.tree_widget.setObjectName('tree_widget')
72
85
        self.tree_widget.setAlternatingRowColors(True)
73
86
        self.tree_widget.setColumnCount(3)
74
87
        self.tree_widget.setColumnWidth(0, 250)
75
88
        self.shortcut_list_layout.addWidget(self.tree_widget)
76
 
        self.details_layout = QtGui.QGridLayout()
 
89
        self.details_layout = QtWidgets.QGridLayout()
77
90
        self.details_layout.setObjectName('details_layout')
78
91
        self.details_layout.setContentsMargins(-1, 0, -1, -1)
79
 
        self.default_radio_button = QtGui.QRadioButton(shortcutListDialog)
 
92
        self.default_radio_button = QtWidgets.QRadioButton(shortcutListDialog)
80
93
        self.default_radio_button.setObjectName('default_radio_button')
81
94
        self.default_radio_button.setChecked(True)
82
95
        self.details_layout.addWidget(self.default_radio_button, 0, 0, 1, 1)
83
 
        self.custom_radio_button = QtGui.QRadioButton(shortcutListDialog)
 
96
        self.custom_radio_button = QtWidgets.QRadioButton(shortcutListDialog)
84
97
        self.custom_radio_button.setObjectName('custom_radio_button')
85
98
        self.details_layout.addWidget(self.custom_radio_button, 1, 0, 1, 1)
86
 
        self.primary_layout = QtGui.QHBoxLayout()
 
99
        self.primary_layout = QtWidgets.QHBoxLayout()
87
100
        self.primary_layout.setObjectName('primary_layout')
88
101
        self.primary_push_button = CaptureShortcutButton(shortcutListDialog)
89
102
        self.primary_push_button.setObjectName('primary_push_button')
90
103
        self.primary_push_button.setMinimumSize(QtCore.QSize(84, 0))
91
104
        self.primary_push_button.setIcon(build_icon(':/system/system_configure_shortcuts.png'))
92
105
        self.primary_layout.addWidget(self.primary_push_button)
93
 
        self.clear_primary_button = QtGui.QToolButton(shortcutListDialog)
 
106
        self.clear_primary_button = QtWidgets.QToolButton(shortcutListDialog)
94
107
        self.clear_primary_button.setObjectName('clear_primary_button')
95
108
        self.clear_primary_button.setMinimumSize(QtCore.QSize(0, 16))
96
109
        self.clear_primary_button.setIcon(build_icon(':/system/clear_shortcut.png'))
97
110
        self.primary_layout.addWidget(self.clear_primary_button)
98
111
        self.details_layout.addLayout(self.primary_layout, 1, 1, 1, 1)
99
 
        self.alternate_layout = QtGui.QHBoxLayout()
 
112
        self.alternate_layout = QtWidgets.QHBoxLayout()
100
113
        self.alternate_layout.setObjectName('alternate_layout')
101
114
        self.alternate_push_button = CaptureShortcutButton(shortcutListDialog)
102
115
        self.alternate_push_button.setObjectName('alternate_push_button')
103
116
        self.alternate_push_button.setIcon(build_icon(':/system/system_configure_shortcuts.png'))
104
117
        self.alternate_layout.addWidget(self.alternate_push_button)
105
 
        self.clear_alternate_button = QtGui.QToolButton(shortcutListDialog)
 
118
        self.clear_alternate_button = QtWidgets.QToolButton(shortcutListDialog)
106
119
        self.clear_alternate_button.setObjectName('clear_alternate_button')
107
120
        self.clear_alternate_button.setIcon(build_icon(':/system/clear_shortcut.png'))
108
121
        self.alternate_layout.addWidget(self.clear_alternate_button)
109
122
        self.details_layout.addLayout(self.alternate_layout, 1, 2, 1, 1)
110
 
        self.primary_label = QtGui.QLabel(shortcutListDialog)
 
123
        self.primary_label = QtWidgets.QLabel(shortcutListDialog)
111
124
        self.primary_label.setObjectName('primary_label')
112
125
        self.details_layout.addWidget(self.primary_label, 0, 1, 1, 1)
113
 
        self.alternate_label = QtGui.QLabel(shortcutListDialog)
 
126
        self.alternate_label = QtWidgets.QLabel(shortcutListDialog)
114
127
        self.alternate_label.setObjectName('alternate_label')
115
128
        self.details_layout.addWidget(self.alternate_label, 0, 2, 1, 1)
116
129
        self.shortcut_list_layout.addLayout(self.details_layout)