Skip to content

Commit b22fc99

Browse files
César Románpre-commit-ci[bot]
andauthored
feat(system): add new roster functions from 8.1.21 (#99)
* feat(system): add new roster functions from 8.1.21 getRoster getRosterNames add supporting classes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 94c639c commit b22fc99

File tree

10 files changed

+98
-6
lines changed

10 files changed

+98
-6
lines changed

src/com/inductiveautomation/ignition/alarming/__init__.py

Whitespace-only changes.

src/com/inductiveautomation/ignition/alarming/common/__init__.py

Whitespace-only changes.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from typing import List
2+
3+
from com.inductiveautomation.ignition.common.user import User
4+
from com.palantir.ptoss.cinch.core import DefaultBindableModel
5+
from java.lang import String
6+
7+
8+
class RosterModel(DefaultBindableModel):
9+
def getName(self):
10+
# type: () -> String
11+
pass
12+
13+
def getUsers(self):
14+
# type: () -> List[String]
15+
pass
16+
17+
def set(self, that):
18+
# type: (RosterModel) -> None
19+
pass
20+
21+
def setName(self, name):
22+
# type: (String) -> None
23+
pass
24+
25+
def setUsers(self, users):
26+
# type: (List[User]) -> None
27+
pass

src/com/inductiveautomation/ignition/client/util/gui/scheduling/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
__all__ = ["ScheduleModel"]
22

3-
from java.lang import Object
3+
from com.palantir.ptoss.cinch.core import DefaultBindableModel
44

55

6-
class ScheduleModel(Object):
6+
class ScheduleModel(DefaultBindableModel):
77
def deselectDayOfWeek(self, day):
88
pass
99

src/com/inductiveautomation/ignition/common/user/schedule/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
"ScheduleAdjustment",
77
]
88

9+
from com.palantir.ptoss.cinch.core import DefaultBindableModel
910
from java.lang import Object, String
1011
from java.util import Date
1112

1213

13-
class AbstractScheduleModel(Object):
14+
class AbstractScheduleModel(DefaultBindableModel):
1415
def getScheduleForDay(self, cal):
1516
pass
1617

@@ -172,7 +173,7 @@ def getModels(self):
172173
pass
173174

174175

175-
class HolidayModel(Object):
176+
class HolidayModel(DefaultBindableModel):
176177
date = None # type: Date
177178
name = None # type: String
178179
repeatAnnually = None # type: bool
@@ -212,7 +213,7 @@ def setRepeatAnnually(self, repeatAnnually):
212213
self.repeatAnnually = repeatAnnually
213214

214215

215-
class ScheduleAdjustment(Object):
216+
class ScheduleAdjustment(DefaultBindableModel):
216217
start = None # type: Date
217218
end = None # type: Date
218219
available = None # type: bool

src/com/palantir/__init__.py

Whitespace-only changes.

src/com/palantir/ptoss/__init__.py

Whitespace-only changes.

src/com/palantir/ptoss/cinch/__init__.py

Whitespace-only changes.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from typing import Any
2+
3+
from java.lang import Object
4+
5+
6+
class Binding(object):
7+
def update(self, *args):
8+
# type: (*Any) -> None
9+
raise NotImplementedError
10+
11+
12+
class DefaultBindableModel(Object):
13+
def bind(self, toBind):
14+
# type: (Binding) -> None
15+
pass
16+
17+
def modelUpdated(self, *args):
18+
# type: (*Any) -> None
19+
pass
20+
21+
def unbind(self, toUnbind):
22+
# type: (Binding) -> None
23+
pass
24+
25+
def unbindAll(self):
26+
# type: () -> None
27+
pass
28+
29+
def update(self):
30+
# type: () -> None
31+
pass

src/system/roster.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,19 @@
66

77
from __future__ import print_function
88

9-
__all__ = ["addUsers", "createRoster", "deleteRoster", "getRosters", "removeUsers"]
9+
__all__ = [
10+
"addUsers",
11+
"createRoster",
12+
"deleteRoster",
13+
"getRoster",
14+
"getRosterNames",
15+
"getRosters",
16+
"removeUsers",
17+
]
1018

1119
from typing import Dict, List
1220

21+
from com.inductiveautomation.ignition.alarming.common.rosters import RosterModel
1322
from com.inductiveautomation.ignition.common.user import PyUser
1423
from java.lang import String
1524

@@ -59,6 +68,30 @@ def deleteRoster(rosterName):
5968
print(rosterName)
6069

6170

71+
def getRoster(name):
72+
"""Returns the roster corresponding to the given name.
73+
74+
Args:
75+
name: The name of the roster to get the RosterModel object from.
76+
77+
Returns:
78+
A RosterModel Object. Call getUsers() to access a list of User
79+
objects in the RosterModel.
80+
"""
81+
print(name)
82+
return RosterModel()
83+
84+
85+
def getRosterNames():
86+
# type: () -> List[String]
87+
"""Returns a list of roster names.
88+
89+
Returns:
90+
A list of Strings representing the roster names
91+
"""
92+
return ["On-Call"]
93+
94+
6295
def getRosters():
6396
# type: () -> Dict[String, List[String]]
6497
"""Returns a dictionary of rosters, where the key is the name of the

0 commit comments

Comments
 (0)