mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Checker: Add base of checker list view.
This commit is contained in:
1 parent
768a743f0f
commit
fe9eada0ba
8 files changed
+312
-31
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user