Revert some changes - functional Ok. Interfaces mess

This commit is contained in:
Tim Bentley 2013-02-17 20:11:37 +00:00
parent 62b1653c46
commit 5c0fa26289
6 changed files with 13 additions and 8 deletions

View File

@ -7,3 +7,7 @@ sip.setapi(u'QTime', 2)
sip.setapi(u'QUrl', 2) sip.setapi(u'QUrl', 2)
sip.setapi(u'QVariant', 2) sip.setapi(u'QVariant', 2)
from PyQt4 import QtGui
# Only one QApplication can be created. Use QtGui.QApplication.instance() when you need to "create" a QApplication.
application = QtGui.QApplication([])

View File

@ -26,7 +26,7 @@ class TestPluginManager(TestCase):
Settings().set_filename(self.ini_file) Settings().set_filename(self.ini_file)
Registry.create() Registry.create()
Registry().register(u'service_list', MagicMock()) Registry().register(u'service_list', MagicMock())
self.app = QtGui.QApplication([]) self.app = QtGui.QApplication.instance()
self.main_window = QtGui.QMainWindow() self.main_window = QtGui.QMainWindow()
Registry().register(u'main_window', self.main_window) Registry().register(u'main_window', self.main_window)
self.plugins_dir = os.path.abspath(os.path.join(os.path.basename(__file__), u'..', u'openlp', u'plugins')) self.plugins_dir = os.path.abspath(os.path.join(os.path.basename(__file__), u'..', u'openlp', u'plugins'))

View File

@ -15,7 +15,7 @@ class TestStartFileRenameForm(TestCase):
Create the UI Create the UI
""" """
Registry.create() Registry.create()
self.app = QtGui.QApplication([]) self.app = QtGui.QApplication.instance()
self.main_window = QtGui.QMainWindow() self.main_window = QtGui.QMainWindow()
Registry().register(u'main_window', self.main_window) Registry().register(u'main_window', self.main_window)
self.form = filerenameform.FileRenameForm() self.form = filerenameform.FileRenameForm()

View File

@ -3,7 +3,7 @@
""" """
from unittest import TestCase from unittest import TestCase
from mock import MagicMock from mock import MagicMock, patch
from PyQt4 import QtGui from PyQt4 import QtGui
@ -11,17 +11,18 @@ from openlp.core.lib import Registry, ScreenList
from openlp.core.ui.mainwindow import MainWindow from openlp.core.ui.mainwindow import MainWindow
class TestStartNoteDialog(TestCase): class TestServiceManager(TestCase):
def setUp(self): def setUp(self):
""" """
Create the UI Create the UI
""" """
Registry.create() Registry.create()
self.app = QtGui.QApplication([]) self.app = QtGui.QApplication.instance()
ScreenList.create(self.app.desktop()) ScreenList.create(self.app.desktop())
Registry().register(u'application', MagicMock()) Registry().register(u'application', MagicMock())
self.main_window = MainWindow() with patch(u'openlp.core.lib.PluginManager'):
self.main_window = MainWindow()
self.service_manager = Registry().get(u'service_manager') self.service_manager = Registry().get(u'service_manager')
def tearDown(self): def tearDown(self):

View File

@ -17,7 +17,7 @@ class TestStartNoteDialog(TestCase):
Create the UI Create the UI
""" """
Registry.create() Registry.create()
self.app = QtGui.QApplication([]) self.app = QtGui.QApplication.instance()
self.main_window = QtGui.QMainWindow() self.main_window = QtGui.QMainWindow()
Registry().register(u'main_window', self.main_window) Registry().register(u'main_window', self.main_window)
self.form = servicenoteform.ServiceNoteForm() self.form = servicenoteform.ServiceNoteForm()

View File

@ -17,7 +17,7 @@ class TestStartTimeDialog(TestCase):
Create the UI Create the UI
""" """
Registry.create() Registry.create()
self.app = QtGui.QApplication([]) self.app = QtGui.QApplication.instance()
self.main_window = QtGui.QMainWindow() self.main_window = QtGui.QMainWindow()
Registry().register(u'main_window', self.main_window) Registry().register(u'main_window', self.main_window)
self.form = starttimeform.StartTimeForm() self.form = starttimeform.StartTimeForm()