Merge fixes

This commit is contained in:
Tim Bentley 2013-02-10 16:05:52 +00:00
parent f669032fc9
commit 064a4bad20
5 changed files with 13 additions and 15 deletions

View File

@ -150,7 +150,7 @@ class OpenLP(QtGui.QApplication):
update_check = Settings().value(u'general/update check')
if update_check:
VersionThread(self.main_window).start()
self.main_window.blank_check()
self.main_window.is_display_blank()
self.main_window.app_startup()
return self.exec_()

View File

@ -60,10 +60,10 @@ class Registry(object):
registry = cls()
registry.service_list = {}
registry.functions_list = {}
registry.running_under_test = True
registry.running_under_test = False
# Allow the tests to remove Registry entries but not the live system
if u'openlp.py' in sys.argv[0]:
registry.running_under_test = False
if u'nose' in sys.argv[0]:
registry.running_under_test = True
return registry
def get(self, key):
@ -106,13 +106,12 @@ class Registry(object):
if self.running_under_test is False:
log.error(u'Invalid Method call for key %s' % key)
raise KeyError(u'Invalid Method call for key %s' % key)
return
if key in self.service_list:
del self.service_list[key]
def register_function(self, event, function):
"""
Register a function and a handler to be called later
Register an event and associated function to be called
``event``
The function description like "config_updated" or "live_display_hide" where a number of places in the
@ -122,14 +121,14 @@ class Registry(object):
``function``
The function to be called when the event happens.
"""
if not self.functions_list.has_key(event):
self.functions_list[event] = [function]
else:
if event in self.functions_list:
self.functions_list[event].append(function)
else:
self.functions_list[event] = [function]
def remove_function(self, event, function):
"""
Register a function and a handler to be called later
Remove an event and associated handler
``event``
The function description..
@ -140,13 +139,12 @@ class Registry(object):
if self.running_under_test is False:
log.error(u'Invalid Method call for key %s' % event)
raise KeyError(u'Invalid Method call for key %s' % event)
return
if event in self.functions_list:
self.functions_list[event].remove(function)
def execute(self, event, *args, **kwargs):
"""
Execute all the handlers registered passing the data to the handler and returning results
Execute all the handlers associated with the event and return an array of results.
``event``
The function to be processed
@ -170,4 +168,3 @@ class Registry(object):
log.debug(inspect.currentframe().f_back.f_locals)
log.exception(u'Exception for function %s', function)
return results

View File

@ -244,7 +244,7 @@ class ScreenList(object):
Loads the screen size and the monitor number from the settings.
"""
from openlp.core.lib import Settings
# Add the screen settings to the settings dict. This has to be done here due to crycle dependency.
# Add the screen settings to the settings dict. This has to be done here due to cyclic dependency.
# Do not do this anywhere else.
screen_settings = {
u'general/x position': self.current[u'size'].x(),

View File

@ -259,6 +259,7 @@ class Settings(QtCore.QSettings):
"""
Settings.__default_settings__ = dict(default_values.items() + Settings.__default_settings__.items())
@staticmethod
def set_filename(ini_file):
"""

View File

@ -695,7 +695,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
Registry().execute(u'bibles_load_list', True)
self.application.set_normal_cursor()
def blank_check(self):
def is_display_blank(self):
"""
Check and display message if screen blank on setup.
"""