mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-06-01 18:49:38 +12:00
Fixes a bug when entering non-digit values for item's goal in metadata
This commit is contained in:
parent
15ccaa513b
commit
bc70501373
|
@ -24,9 +24,12 @@ def wordCount(text):
|
||||||
|
|
||||||
def toInt(text):
|
def toInt(text):
|
||||||
if text:
|
if text:
|
||||||
return int(text)
|
try:
|
||||||
else:
|
return int(text)
|
||||||
return 0
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def toFloat(text):
|
def toFloat(text):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# --!-- coding: utf8 --!--
|
# --!-- coding: utf8 --!--
|
||||||
from PyQt5.QtWidgets import QWidget
|
from PyQt5.QtWidgets import QWidget
|
||||||
|
from PyQt5.QtGui import QIntValidator
|
||||||
|
|
||||||
from manuskript.enums import Outline
|
from manuskript.enums import Outline
|
||||||
from manuskript.ui.views.propertiesView_ui import Ui_propertiesView
|
from manuskript.ui.views.propertiesView_ui import Ui_propertiesView
|
||||||
|
@ -19,6 +20,7 @@ class propertiesView(QWidget, Ui_propertiesView):
|
||||||
self.chkCompile.setModel(mdlOutline)
|
self.chkCompile.setModel(mdlOutline)
|
||||||
self.txtTitle.setModel(mdlOutline)
|
self.txtTitle.setModel(mdlOutline)
|
||||||
self.txtGoal.setModel(mdlOutline)
|
self.txtGoal.setModel(mdlOutline)
|
||||||
|
self.txtGoal.setValidator(QIntValidator(0, 9999999))
|
||||||
|
|
||||||
def getIndexes(self, sourceView):
|
def getIndexes(self, sourceView):
|
||||||
"""Returns a list of indexes from list of QItemSelectionRange"""
|
"""Returns a list of indexes from list of QItemSelectionRange"""
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# Form implementation generated from reading ui file 'manuskript/ui/views/propertiesView_ui.ui'
|
# Form implementation generated from reading ui file 'manuskript/ui/views/propertiesView_ui.ui'
|
||||||
#
|
#
|
||||||
# Created by: PyQt5 UI code generator 5.4.2
|
# Created by: PyQt5 UI code generator 5.9
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue