Checker: Add base of checker list view.

This commit is contained in:
Pierre-Antoine Rouby committed 2023-06-16 11:43:58 +02:00
1 parent 768a743f0f
commit fe9eada0ba
8 files changed
+312 -31

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
from PyQt5.QtCore import QCoreApplication
from Checker.Checker import AbstractModelChecker, STATUS
_translate = QCoreApplication.translate
class StudyNetworkReachChecker(AbstractModelChecker):
def __init__(self):
super(StudyNetworkReachChecker, self).__init__()
self._name = _translate("Checker", "Study network reach checker")
self._description = _translate("Checker", "Check if exists at least one reach for study")
def run(self, study):
if study is None:
self._status = STATUS.ERROR
self._summary = "invalid_study"
return False
river = study.river
if river is None:
self._status = STATUS.ERROR
self._summary = "no_river_found"
return False
if len(river.edges()) == 0:
self._status = STATUS.ERROR
self._summary = "no_reach_defined"
return False
self._summary = "ok"
self._status = STATUS.OK
return True