Fix a problem with the incorrect parent module for QSize

This commit is contained in:
Raoul Snyman 2016-12-10 22:59:06 +02:00
parent 04fe94e533
commit 7931eb1d17
3 changed files with 65 additions and 14 deletions

View File

@ -61,9 +61,8 @@ def source_group(inputs, source_text):
"""
groupdict = {}
keydict = {}
checklist = inputs
key = checklist[0][0]
for item in checklist:
key = inputs[0][0]
for item in inputs:
if item[0] == key:
groupdict[item] = source_text[item]
continue
@ -75,7 +74,7 @@ def source_group(inputs, source_text):
return keydict
def Build_Tab(group, source_key, default, projector, projectordb, edit=False):
def build_tab(group, source_key, default, projector, projectordb, edit=False):
"""
Create the radio button page for a tab.
Dictionary will be a 1-key entry where key=tab to setup, val=list of inputs.
@ -275,7 +274,7 @@ class SourceSelectTabs(QtWidgets.QDialog):
keys.sort()
if self.edit:
for key in keys:
(tab, button_count, buttonchecked) = Build_Tab(group=self.button_group,
(tab, button_count, buttonchecked) = build_tab(group=self.button_group,
source_key={key: self.source_group[key]},
default=self.projector.source,
projector=self.projector,
@ -290,7 +289,7 @@ class SourceSelectTabs(QtWidgets.QDialog):
QtWidgets.QDialogButtonBox.Cancel)
else:
for key in keys:
(tab, button_count, buttonchecked) = Build_Tab(group=self.button_group,
(tab, button_count, buttonchecked) = build_tab(group=self.button_group,
source_key={key: self.source_group[key]},
default=self.projector.source,
projector=self.projector,

View File

@ -0,0 +1,54 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
:mod: `tests.functional.openlp_core_ui.test_projectorsourceform` module
Tests for the Projector Source Select form.
"""
from openlp.core.ui.projector.sourceselectform import source_group
def test_source_group():
"""
Test the source_group() method
"""
# GIVEN: A list of inputs and source text
inputs = [
'vga1', 'vga2',
'hdmi1', 'hdmi2'
]
source_text = {
'vga1': 'VGA 1',
'vga2': 'VGA 2',
'hdmi1': 'HDMI 1',
'hdmi2': 'HDMI 2'
}
# WHEN: source_group() is called
result = source_group(inputs, source_text)
# THEN: the resultant dictionary should be correct
expected_dict = {
'v': {'vga1': 'VGA 1', 'vga2': 'VGA 2'},
'h': {'hdmi1': 'HDMI 1', 'hdmi2': 'HDMI 2'}
}
assert result == expected_dict, result

View File

@ -24,19 +24,17 @@
Tests for the Projector Source Select form.
"""
import logging
log = logging.getLogger(__name__)
log.debug('test_projectorsourceform loaded')
import os
import time
from unittest import TestCase
from unittest.mock import patch
from PyQt5.QtWidgets import QDialog
from tests.functional import patch
from tests.helpers.testmixin import TestMixin
from tests.resources.projector.data import TEST_DB, TEST1_DATA
from openlp.core.common import Registry, Settings
from openlp.core.common import Registry
from openlp.core.lib.projector.db import ProjectorDB, Projector
from openlp.core.lib.projector.constants import PJLINK_DEFAULT_CODES, PJLINK_DEFAULT_SOURCES
from openlp.core.ui.projector.sourceselectform import source_group, SourceSelectSingle
@ -49,7 +47,7 @@ def build_source_dict():
:returns: dictionary of valid PJLink source codes grouped by PJLink source group
"""
test_group = {}
for group in PJLINK_DEFAULT_SOURCES.keys():
for group in PJLINK_DEFAULT_SOURCES:
test_group[group] = {}
for key in PJLINK_DEFAULT_CODES:
test_group[key[0]][key] = PJLINK_DEFAULT_CODES[key]
@ -86,8 +84,8 @@ class ProjectorSourceFormTest(TestCase, TestMixin):
Delete all C++ objects at end so we don't segfault.
"""
self.projectordb.session.close()
del(self.projectordb)
del(self.projector)
del self.projectordb
del self.projector
retries = 0
while retries < 5:
try: