Fixes: Manuskript crashes when a wrong locale is set. See #188.

This commit is contained in:
Olivier Keshavjee 2017-11-06 18:29:18 +01:00
parent 628ed42785
commit 0a0649a0db
4 changed files with 16 additions and 8 deletions

View file

@ -17,7 +17,12 @@ from lxml import etree as ET
from manuskript.enums import Outline
from manuskript.functions import mainWindow, toInt, wordCount, HTML2PlainText
locale.setlocale(locale.LC_ALL, '')
try:
locale.setlocale(locale.LC_ALL, '')
except:
# Invalid locale, but not really a big deal because it's used only for
# number formating
pass
import time, os

View file

@ -15,8 +15,10 @@ from manuskript.ui.editors.editorWidget import editorWidget
from manuskript.ui.editors.fullScreenEditor import fullScreenEditor
from manuskript.ui.editors.mainEditor_ui import Ui_mainEditor
locale.setlocale(locale.LC_ALL, '')
try:
locale.setlocale(locale.LC_ALL, '')
except:
pass
class mainEditor(QWidget, Ui_mainEditor):
"""

View file

@ -2,8 +2,7 @@
# Form implementation generated from reading ui file 'manuskript/ui/editors/mainEditor_ui.ui'
#
# Created: Sat Oct 14 21:30:36 2017
# by: PyQt5 UI code generator 5.2.1
# Created by: PyQt5 UI code generator 5.9
#
# WARNING! All changes made in this file will be lost!
@ -14,8 +13,8 @@ class Ui_mainEditor(object):
mainEditor.setObjectName("mainEditor")
mainEditor.resize(791, 319)
self.verticalLayout = QtWidgets.QVBoxLayout(mainEditor)
self.verticalLayout.setSpacing(0)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setSpacing(0)
self.verticalLayout.setObjectName("verticalLayout")
self.tabSplitter = tabSplitter(mainEditor)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)

View file

@ -21,8 +21,10 @@ from manuskript.models.plotModel import plotModel
from manuskript.models.worldModel import worldModel
from manuskript.ui.welcome_ui import Ui_welcome
locale.setlocale(locale.LC_ALL, '')
try:
locale.setlocale(locale.LC_ALL, '')
except:
pass
class welcome(QWidget, Ui_welcome):
def __init__(self, parent=None):