forked from openlp/openlp
Fixed issue where screens were being loaded twice; Fixed an issue where an underlying C++ object was being deleted before the Python object was finished with it
This commit is contained in:
parent
aa3b0c4bcc
commit
e45be1a50f
@ -49,7 +49,7 @@ class Screen(object):
|
|||||||
:param bool is_primary: Whether or not this screen is the primary screen
|
:param bool is_primary: Whether or not this screen is the primary screen
|
||||||
:param bool is_display: Whether or not this screen should be used to display lyrics
|
:param bool is_display: Whether or not this screen should be used to display lyrics
|
||||||
"""
|
"""
|
||||||
self.number = number
|
self.number = int(number)
|
||||||
self.geometry = geometry
|
self.geometry = geometry
|
||||||
self.custom_geometry = None
|
self.custom_geometry = None
|
||||||
self.is_primary = is_primary
|
self.is_primary = is_primary
|
||||||
@ -66,6 +66,12 @@ class Screen(object):
|
|||||||
name = '{name} ({primary})'.format(name=name, primary=translate('OpenLP.ScreenList', 'primary'))
|
name = '{name} ({primary})'.format(name=name, primary=translate('OpenLP.ScreenList', 'primary'))
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
"""
|
||||||
|
Return a string representation of the object
|
||||||
|
"""
|
||||||
|
return '<{screen}>'.format(screen=self)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def display_geometry(self):
|
def display_geometry(self):
|
||||||
"""
|
"""
|
||||||
@ -124,12 +130,16 @@ class Screen(object):
|
|||||||
|
|
||||||
:param dict screen_dict: The dictionary which we want to apply to the screen
|
:param dict screen_dict: The dictionary which we want to apply to the screen
|
||||||
"""
|
"""
|
||||||
self.number = screen_dict['number']
|
self.number = int(screen_dict['number'])
|
||||||
self.is_display = screen_dict['is_display']
|
self.is_display = screen_dict['is_display']
|
||||||
self.is_primary = screen_dict['is_primary']
|
self.is_primary = screen_dict['is_primary']
|
||||||
self.geometry = QtCore.QRect(**screen_dict['geometry'])
|
self.geometry = QtCore.QRect(screen_dict['geometry']['x'], screen_dict['geometry']['y'],
|
||||||
|
screen_dict['geometry']['width'], screen_dict['geometry']['height'])
|
||||||
if 'display_geometry' in screen_dict:
|
if 'display_geometry' in screen_dict:
|
||||||
self.display_geometry = QtCore.QRect(**screen_dict['display_geometry'])
|
self.display_geometry = QtCore.QRect(screen_dict['display_geometry']['x'],
|
||||||
|
screen_dict['display_geometry']['y'],
|
||||||
|
screen_dict['display_geometry']['width'],
|
||||||
|
screen_dict['display_geometry']['height'])
|
||||||
|
|
||||||
|
|
||||||
class ScreenList(object):
|
class ScreenList(object):
|
||||||
@ -222,6 +232,8 @@ class ScreenList(object):
|
|||||||
Settings.extend_default_settings(screen_settings)
|
Settings.extend_default_settings(screen_settings)
|
||||||
screen_settings = Settings().value('core/screens')
|
screen_settings = Settings().value('core/screens')
|
||||||
for number, screen_dict in screen_settings.items():
|
for number, screen_dict in screen_settings.items():
|
||||||
|
# Sometimes this loads as a string instead of an int
|
||||||
|
number = int(number)
|
||||||
if self.has_screen(number):
|
if self.has_screen(number):
|
||||||
self[number].update(screen_dict)
|
self[number].update(screen_dict)
|
||||||
else:
|
else:
|
||||||
|
@ -81,6 +81,7 @@ class ScreensTab(SettingsTab):
|
|||||||
super(ScreensTab, self).__init__(parent, 'Screens', screens_translated)
|
super(ScreensTab, self).__init__(parent, 'Screens', screens_translated)
|
||||||
self.settings_section = 'core'
|
self.settings_section = 'core'
|
||||||
self.current_screen = None
|
self.current_screen = None
|
||||||
|
self.identify_labels = []
|
||||||
|
|
||||||
def setup_ui(self):
|
def setup_ui(self):
|
||||||
"""
|
"""
|
||||||
@ -262,11 +263,18 @@ class ScreensTab(SettingsTab):
|
|||||||
# On save update the screens as well
|
# On save update the screens as well
|
||||||
self.settings_form.register_post_process('config_screen_changed')
|
self.settings_form.register_post_process('config_screen_changed')
|
||||||
|
|
||||||
|
@QtCore.pyqtSlot()
|
||||||
|
def _on_identify_timer_shot(self):
|
||||||
|
for label in self.identify_labels:
|
||||||
|
label.hide()
|
||||||
|
label.setParent(None)
|
||||||
|
label.deleteLater()
|
||||||
|
self.identify_labels = []
|
||||||
|
|
||||||
def on_identify_button_clicked(self):
|
def on_identify_button_clicked(self):
|
||||||
"""
|
"""
|
||||||
Display a widget on every screen for 5 seconds
|
Display a widget on every screen for 5 seconds
|
||||||
"""
|
"""
|
||||||
labels = []
|
|
||||||
for screen in self.screens:
|
for screen in self.screens:
|
||||||
label = QtWidgets.QLabel(None)
|
label = QtWidgets.QLabel(None)
|
||||||
label.setAlignment(QtCore.Qt.AlignCenter)
|
label.setAlignment(QtCore.Qt.AlignCenter)
|
||||||
@ -278,17 +286,9 @@ class ScreensTab(SettingsTab):
|
|||||||
label.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | QtCore.Qt.WindowStaysOnTopHint |
|
label.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | QtCore.Qt.WindowStaysOnTopHint |
|
||||||
QtCore.Qt.WindowDoesNotAcceptFocus)
|
QtCore.Qt.WindowDoesNotAcceptFocus)
|
||||||
label.show()
|
label.show()
|
||||||
labels.append(label)
|
self.identify_labels.append(label)
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
QtCore.QTimer.singleShot(3000, self._on_identify_timer_shot)
|
||||||
def _close_label():
|
|
||||||
label.hide()
|
|
||||||
if label in labels:
|
|
||||||
labels.remove(label)
|
|
||||||
label.setParent(None)
|
|
||||||
label.deleteLater()
|
|
||||||
|
|
||||||
QtCore.QTimer.singleShot(3000, _close_label)
|
|
||||||
|
|
||||||
def on_screen_button_clicked(self):
|
def on_screen_button_clicked(self):
|
||||||
"""
|
"""
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
[pep8]
|
[pep8]
|
||||||
exclude=resources.py,vlc.py
|
exclude=resources.py,vlc.py
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
ignore = E402
|
ignore = E402,E722,W503,W504
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
exclude=resources.py,vlc.py
|
exclude=resources.py,vlc.py
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
ignore = E402
|
ignore = E402,E722,W503,W504
|
||||||
|
|
||||||
[pycodestyle]
|
[pycodestyle]
|
||||||
exclude = resources.py,vlc.py
|
exclude = resources.py,vlc.py
|
||||||
|
Loading…
Reference in New Issue
Block a user