forked from openlp/openlp
Change uno import for exception form to remove excess uno import noise
bzr-revno: 2282
This commit is contained in:
commit
208e1c2e1e
@ -185,7 +185,7 @@ class OpenLP(QtGui.QApplication):
|
|||||||
"""
|
"""
|
||||||
log.exception(''.join(format_exception(exctype, value, traceback)))
|
log.exception(''.join(format_exception(exctype, value, traceback)))
|
||||||
if not hasattr(self, u'exception_form'):
|
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.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exctype, value, traceback)))
|
||||||
self.set_normal_cursor()
|
self.set_normal_cursor()
|
||||||
self.exception_form.exec_()
|
self.exception_form.exec_()
|
||||||
|
@ -37,6 +37,9 @@ import platform
|
|||||||
import bs4
|
import bs4
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
|
from openlp.core.lib import Registry
|
||||||
|
|
||||||
from PyQt4 import Qt, QtCore, QtGui, QtWebKit
|
from PyQt4 import Qt, QtCore, QtGui, QtWebKit
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -77,19 +80,7 @@ try:
|
|||||||
CHERRYPY_VERSION = cherrypy.__version__
|
CHERRYPY_VERSION = cherrypy.__version__
|
||||||
except ImportError:
|
except ImportError:
|
||||||
CHERRYPY_VERSION = u'-'
|
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:
|
try:
|
||||||
WEBKIT_VERSION = QtWebKit.qWebKitVersion()
|
WEBKIT_VERSION = QtWebKit.qWebKitVersion()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
@ -100,7 +91,6 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
VLC_VERSION = u'-'
|
VLC_VERSION = u'-'
|
||||||
|
|
||||||
|
|
||||||
from openlp.core.lib import UiStrings, Settings, translate
|
from openlp.core.lib import UiStrings, Settings, translate
|
||||||
from openlp.core.utils import get_application_version
|
from openlp.core.utils import get_application_version
|
||||||
|
|
||||||
@ -113,11 +103,11 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
|||||||
"""
|
"""
|
||||||
The exception dialog
|
The exception dialog
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent):
|
def __init__(self):
|
||||||
"""
|
"""
|
||||||
Constructor.
|
Constructor.
|
||||||
"""
|
"""
|
||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self, self.main_window)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.settings_section = u'crashreport'
|
self.settings_section = u'crashreport'
|
||||||
|
|
||||||
@ -152,7 +142,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
|||||||
u'Mako: %s\n' % MAKO_VERSION + \
|
u'Mako: %s\n' % MAKO_VERSION + \
|
||||||
u'CherryPy: %s\n' % CHERRYPY_VERSION + \
|
u'CherryPy: %s\n' % CHERRYPY_VERSION + \
|
||||||
u'pyICU: %s\n' % ICU_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
|
u'VLC: %s\n' % VLC_VERSION
|
||||||
if platform.system() == u'Linux':
|
if platform.system() == u'Linux':
|
||||||
if os.environ.get(u'KDE_FULL_SESSION') == u'true':
|
if os.environ.get(u'KDE_FULL_SESSION') == u'true':
|
||||||
@ -256,3 +246,34 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
|||||||
"""
|
"""
|
||||||
self.save_report_button.setEnabled(state)
|
self.save_report_button.setEnabled(state)
|
||||||
self.send_report_button.setEnabled(state)
|
self.send_report_button.setEnabled(state)
|
||||||
|
|
||||||
|
def _pyuno_import(self):
|
||||||
|
"""
|
||||||
|
Added here to define only when the form is actioned. The uno interface spits out lots of exception messages
|
||||||
|
if the import is at a file level. If uno import is changed this could be reverted.
|
||||||
|
This happens in other classes but there it is localised here it is across the whole system and hides real
|
||||||
|
errors.
|
||||||
|
"""
|
||||||
|
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)
|
@ -31,7 +31,7 @@ The :mod:`formattingtagform` provides an Tag Edit facility. The Base set are pro
|
|||||||
Custom tags can be defined and saved. The Custom Tag arrays are saved in a pickle so QSettings works on them. Base Tags
|
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.
|
cannot be changed.
|
||||||
"""
|
"""
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import FormattingTags, translate
|
from openlp.core.lib import FormattingTags, translate
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
|
Loading…
Reference in New Issue
Block a user