mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
pamhyr: Catch some table data type exception (crash Fix).
This commit is contained in:
1 parent
e8ae1c0631
commit
464209b6e5
21 files changed
+303
-190
No files matched your search
+20
-13
@@ -17,6 +17,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import time
|
||||
import logging
|
||||
import traceback
|
||||
|
||||
from tools import timer, trace
|
||||
|
||||
@@ -37,6 +39,7 @@ from Model.Geometry import Reach
|
||||
from Model.Geometry.ProfileXYZ import ProfileXYZ
|
||||
from View.Geometry.UndoCommand import *
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
_translate = QCoreApplication.translate
|
||||
|
||||
@@ -114,23 +117,27 @@ class TableEditableModel(QAbstractTableModel):
|
||||
column = index.column()
|
||||
|
||||
if role == Qt.EditRole and index.column() != 2:
|
||||
if index.column() == 0:
|
||||
self._undo_stack.push(
|
||||
SetNameCommand(
|
||||
self._reach, index.row(),
|
||||
self._reach.profile(index.row()).name,
|
||||
value
|
||||
try:
|
||||
if index.column() == 0:
|
||||
self._undo_stack.push(
|
||||
SetNameCommand(
|
||||
self._reach, index.row(),
|
||||
self._reach.profile(index.row()).name,
|
||||
value
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if index.column() == 1:
|
||||
self._undo_stack.push(
|
||||
SetKPCommand(
|
||||
self._reach, index.row(),
|
||||
self._reach.profile(index.row()).kp,
|
||||
if index.column() == 1:
|
||||
self._undo_stack.push(
|
||||
SetKPCommand(
|
||||
self._reach, index.row(),
|
||||
self._reach.profile(index.row()).kp,
|
||||
value
|
||||
)
|
||||
)
|
||||
)
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
logger.debug(traceback.format_exc())
|
||||
|
||||
self.dataChanged.emit(index, index)
|
||||
self.layoutChanged.emit()
|
||||
|
||||
Reference in new issue
Block a user