← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/junefixes into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/junefixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1196926 in OpenLP: "Zero division error when display size set to zero"
  https://bugs.launchpad.net/openlp/+bug/1196926
  Bug #1197376 in OpenLP: "Typing a path for a theme background causes a key error"
  https://bugs.launchpad.net/openlp/+bug/1197376

For more details, see:
https://code.launchpad.net/~trb143/openlp/junefixes/+merge/175948

In testing python3 there is alot of import noise with uno.
This is caused by the exceptionform so only request the uno details if the form is being displayed.  This removes all the import noise!
-- 
https://code.launchpad.net/~trb143/openlp/junefixes/+merge/175948
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/junefixes into lp:openlp.
=== modified file 'openlp/core/__init__.py'
--- openlp/core/__init__.py	2013-03-26 11:45:18 +0000
+++ openlp/core/__init__.py	2013-07-19 20:59:29 +0000
@@ -185,7 +185,7 @@
         """
         log.exception(''.join(format_exception(exctype, value, traceback)))
         if not hasattr(self, u'exception_form'):
-            self.exception_form = ExceptionForm(self.main_window)
+            self.exception_form = ExceptionForm()
         self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exctype, value, traceback)))
         self.set_normal_cursor()
         self.exception_form.exec_()

=== modified file 'openlp/core/ui/exceptionform.py'
--- openlp/core/ui/exceptionform.py	2013-06-26 18:54:21 +0000
+++ openlp/core/ui/exceptionform.py	2013-07-19 20:59:29 +0000
@@ -37,6 +37,8 @@
 import bs4
 import sqlalchemy
 from lxml import etree
+
+from openlp.core.lib import Registry
 from PyQt4 import Qt, QtCore, QtGui, QtWebKit
 
 try:
@@ -77,19 +79,7 @@
     CHERRYPY_VERSION = cherrypy.__version__
 except ImportError:
     CHERRYPY_VERSION = u'-'
-try:
-    import uno
-    arg = uno.createUnoStruct(u'com.sun.star.beans.PropertyValue')
-    arg.Name = u'nodepath'
-    arg.Value = u'/org.openoffice.Setup/Product'
-    context = uno.getComponentContext()
-    provider = context.ServiceManager.createInstance(u'com.sun.star.configuration.ConfigurationProvider')
-    node = provider.createInstanceWithArguments(u'com.sun.star.configuration.ConfigurationAccess', (arg,))
-    UNO_VERSION = node.getByName(u'ooSetupVersion')
-except ImportError:
-    UNO_VERSION = u'-'
-except:
-    UNO_VERSION = u'- (Possible non-standard UNO installation)'
+
 try:
     WEBKIT_VERSION = QtWebKit.qWebKitVersion()
 except AttributeError:
@@ -100,7 +90,6 @@
 except ImportError:
     VLC_VERSION = u'-'
 
-
 from openlp.core.lib import UiStrings, Settings, translate
 from openlp.core.utils import get_application_version
 
@@ -113,11 +102,11 @@
     """
     The exception dialog
     """
-    def __init__(self, parent):
+    def __init__(self):
         """
         Constructor.
         """
-        QtGui.QDialog.__init__(self, parent)
+        QtGui.QDialog.__init__(self, self.main_window)
         self.setupUi(self)
         self.settings_section = u'crashreport'
 
@@ -152,7 +141,7 @@
             u'Mako: %s\n' % MAKO_VERSION + \
             u'CherryPy: %s\n' % CHERRYPY_VERSION + \
             u'pyICU: %s\n' % ICU_VERSION + \
-            u'pyUNO bridge: %s\n' % UNO_VERSION + \
+            u'pyUNO bridge: %s\n' % self._pyuno_import() + \
             u'VLC: %s\n' % VLC_VERSION
         if platform.system() == u'Linux':
             if os.environ.get(u'KDE_FULL_SESSION') == u'true':
@@ -256,3 +245,28 @@
         """
         self.save_report_button.setEnabled(state)
         self.send_report_button.setEnabled(state)
+
+    def _pyuno_import(self):
+        try:
+            import uno
+            arg = uno.createUnoStruct(u'com.sun.star.beans.PropertyValue')
+            arg.Name = u'nodepath'
+            arg.Value = u'/org.openoffice.Setup/Product'
+            context = uno.getComponentContext()
+            provider = context.ServiceManager.createInstance(u'com.sun.star.configuration.ConfigurationProvider')
+            node = provider.createInstanceWithArguments(u'com.sun.star.configuration.ConfigurationAccess', (arg,))
+            return node.getByName(u'ooSetupVersion')
+        except ImportError:
+            return u'-'
+        except:
+            return u'- (Possible non-standard UNO installation)'
+
+    def _get_main_window(self):
+        """
+        Adds the main window to the class dynamically
+        """
+        if not hasattr(self, u'_main_window'):
+            self._main_window = Registry().get(u'main_window')
+        return self._main_window
+
+    main_window = property(_get_main_window)
\ No newline at end of file

=== modified file 'openlp/core/ui/formattingtagform.py'
--- openlp/core/ui/formattingtagform.py	2013-03-06 22:42:52 +0000
+++ openlp/core/ui/formattingtagform.py	2013-07-19 20:59:29 +0000
@@ -31,7 +31,7 @@
 Custom tags can be defined and saved. The Custom Tag arrays are saved in a pickle so QSettings works on them. Base Tags
 cannot be changed.
 """
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
 
 from openlp.core.lib import FormattingTags, translate
 from openlp.core.lib.ui import critical_error_message_box


Follow ups