TestCenter Reference
NotificationCounter.py
Go to the documentation of this file.
1
#
2
# Copyright 2021, MeVis Medical Solutions AG
3
#
4
# The user may use this file in accordance with the license agreement provided with
5
# the Software or, alternatively, in accordance with the terms contained in a
6
# written agreement between the user and MeVis Medical Solutions AG.
7
#
8
# For further information use the contact form at https://www.mevislab.de/contact
9
#
10
11
class
NotificationCounter
:
12
def
__init__
(self, ctx, fieldName):
13
self.
counter
counter = 0
14
self.
validCounter
validCounter = 0
15
self.
fieldListener
fieldListener =
None
16
17
self.
setField
setField(ctx, fieldName)
18
19
def
reset
(self):
20
self.
counter
counter = 0
21
self.
validCounter
validCounter = 0
22
23
def
setField
(self, ctx, fieldName):
24
if
not
ctx.hasField(fieldName):
25
ctx.log(
"Error: Field '"
+ fieldName +
"' not found in parent network."
)
26
else
:
27
self.
fieldListener
fieldListener = ctx.addFieldListener(ctx.field(fieldName), self.
updateCounter
updateCounter,
False
)
28
29
def
updateCounter
(self, field):
30
self.
counter
counter += 1
31
if
callable(getattr(field,
'isValid'
,
None
))
and
field.isValid():
32
self.
validCounter
validCounter += 1
33
34
def
notifications
(self):
35
return
self.
counter
counter
36
37
def
validNotifications
(self):
38
return
self.
validCounter
validCounter
TestSupport.NotificationCounter.NotificationCounter
Definition:
NotificationCounter.py:11
TestSupport.NotificationCounter.NotificationCounter.notifications
def notifications(self)
Definition:
NotificationCounter.py:34
TestSupport.NotificationCounter.NotificationCounter.validNotifications
def validNotifications(self)
Definition:
NotificationCounter.py:37
TestSupport.NotificationCounter.NotificationCounter.validCounter
validCounter
Definition:
NotificationCounter.py:14
TestSupport.NotificationCounter.NotificationCounter.reset
def reset(self)
Definition:
NotificationCounter.py:19
TestSupport.NotificationCounter.NotificationCounter.setField
def setField(self, ctx, fieldName)
Definition:
NotificationCounter.py:23
TestSupport.NotificationCounter.NotificationCounter.updateCounter
def updateCounter(self, field)
Definition:
NotificationCounter.py:29
TestSupport.NotificationCounter.NotificationCounter.fieldListener
fieldListener
Definition:
NotificationCounter.py:15
TestSupport.NotificationCounter.NotificationCounter.counter
counter
Definition:
NotificationCounter.py:13
TestSupport.NotificationCounter.NotificationCounter.__init__
def __init__(self, ctx, fieldName)
Definition:
NotificationCounter.py:12
MeVisLab
Standard
Modules
Scripts
python
TestSupport
NotificationCounter.py
Generated by
1.9.1