teaching-manager 0.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- teaching_manager/robot_var_manager.py +308 -0
- teaching_manager/teaching_controller.py +120 -0
- teaching_manager/teaching_model.py +314 -0
- teaching_manager-0.0.0.dist-info/METADATA +119 -0
- teaching_manager-0.0.0.dist-info/RECORD +8 -0
- teaching_manager-0.0.0.dist-info/WHEEL +5 -0
- teaching_manager-0.0.0.dist-info/licenses/LICENSE +201 -0
- teaching_manager-0.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
import json
|
|
3
|
+
from typing import Any, Optional, Set, Dict, List, Union, Tuple, Type, TypeVar
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class RobotVarManager:
|
|
7
|
+
"""
|
|
8
|
+
Cobotta だけではなく一般的な Robot 向けの座標マネージャ
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def __init__(
|
|
12
|
+
self,
|
|
13
|
+
robot_instance=None,
|
|
14
|
+
logger=None,
|
|
15
|
+
filename: Optional[str] = None,
|
|
16
|
+
autosave: bool = False,
|
|
17
|
+
autoload: bool = False,
|
|
18
|
+
):
|
|
19
|
+
self._robot_instance = robot_instance
|
|
20
|
+
self._vars = {} # ローカルキャッシュ: {"P10": [...], "F1": ...}
|
|
21
|
+
self._logger = logger
|
|
22
|
+
self._filename = filename
|
|
23
|
+
self._autosave = bool(autosave)
|
|
24
|
+
|
|
25
|
+
if autoload and filename is not None:
|
|
26
|
+
try:
|
|
27
|
+
self.load(filename)
|
|
28
|
+
except FileNotFoundError:
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
def _autosave_if_enabled(self):
|
|
32
|
+
"""autosave=True のときだけ現在のローカル変数を保存する。"""
|
|
33
|
+
if self._autosave and self._filename is not None:
|
|
34
|
+
self.save(self._filename)
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
def _make_key(kind_or_combined: str, num: Optional[Union[str, int]] = None) -> str:
|
|
38
|
+
"""("P", 10) と "P10" を同じキー表現へ正規化する。"""
|
|
39
|
+
if num is None:
|
|
40
|
+
return str(kind_or_combined).upper()
|
|
41
|
+
return f"{str(kind_or_combined).upper()}{int(num)}"
|
|
42
|
+
|
|
43
|
+
# --- プロパティアクセス(var.P10 = ...) ---
|
|
44
|
+
def __getattr__(self, name):
|
|
45
|
+
"""内部値を読む (cobotta値は読んでいない)"""
|
|
46
|
+
if name in self._vars:
|
|
47
|
+
return self._vars[name]
|
|
48
|
+
raise AttributeError(f"No such variable: {name}")
|
|
49
|
+
|
|
50
|
+
def __setattr__(
|
|
51
|
+
self,
|
|
52
|
+
name,
|
|
53
|
+
value,
|
|
54
|
+
):
|
|
55
|
+
"""内部値を書き換える (cobotta値は直接いじらない)"""
|
|
56
|
+
# 先頭が '_' の内部属性はそのまま属性として保持
|
|
57
|
+
if name.startswith("_"):
|
|
58
|
+
super().__setattr__(name, value)
|
|
59
|
+
else:
|
|
60
|
+
self._vars[str(name).upper()] = value
|
|
61
|
+
self._autosave_if_enabled()
|
|
62
|
+
|
|
63
|
+
# dict風アクセス(var["P10"]) ---
|
|
64
|
+
def __getitem__(self, key):
|
|
65
|
+
return self._vars[key]
|
|
66
|
+
|
|
67
|
+
def __setitem__(self, key, value):
|
|
68
|
+
self._vars[str(key).upper()] = value
|
|
69
|
+
self._autosave_if_enabled()
|
|
70
|
+
|
|
71
|
+
# ローカル変数一括/範囲セット ---
|
|
72
|
+
def set_vars(
|
|
73
|
+
self,
|
|
74
|
+
kind,
|
|
75
|
+
start,
|
|
76
|
+
end=None,
|
|
77
|
+
value=None,
|
|
78
|
+
):
|
|
79
|
+
"""
|
|
80
|
+
ローカル変数の一括/範囲セット(cobotta本体には影響しない)
|
|
81
|
+
|
|
82
|
+
例::
|
|
83
|
+
set_vars("P", 10, value=[1,2,3,4,5,6])
|
|
84
|
+
set_vars("P", 10, 12, value=[ [1,2,3,4,5,6], ... ])
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
kind:
|
|
88
|
+
start:
|
|
89
|
+
end:
|
|
90
|
+
value:
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
|
|
94
|
+
"""
|
|
95
|
+
if end is None:
|
|
96
|
+
keys = [f"{kind}{start}"]
|
|
97
|
+
values = [value]
|
|
98
|
+
else:
|
|
99
|
+
keys = [f"{kind}{i}" for i in range(start, end + 1)]
|
|
100
|
+
if not isinstance(value, (list, tuple)) or len(value) != len(keys):
|
|
101
|
+
raise ValueError("値リスト長と変数数が一致しません")
|
|
102
|
+
values = value
|
|
103
|
+
|
|
104
|
+
for k, v in zip(keys, values):
|
|
105
|
+
self._vars[str(k).upper()] = v
|
|
106
|
+
self._autosave_if_enabled()
|
|
107
|
+
|
|
108
|
+
def get_var(
|
|
109
|
+
self,
|
|
110
|
+
kind_or_combined: str,
|
|
111
|
+
num: Optional[Union[str, int]] = None,
|
|
112
|
+
default: Any = False,
|
|
113
|
+
):
|
|
114
|
+
"""単一ローカル変数を取得する。
|
|
115
|
+
|
|
116
|
+
`get_var("P", 10)` と `get_var("P10")` は同じ意味である。
|
|
117
|
+
変数が存在しない場合は CobottaCtrl 側の慣例に合わせて False を返す。
|
|
118
|
+
"""
|
|
119
|
+
key = self._make_key(kind_or_combined, num)
|
|
120
|
+
return self._vars.get(key, default)
|
|
121
|
+
|
|
122
|
+
def set_var(
|
|
123
|
+
self,
|
|
124
|
+
kind: str,
|
|
125
|
+
num: Union[str, int, Any],
|
|
126
|
+
value=None,
|
|
127
|
+
save: Optional[bool] = None,
|
|
128
|
+
):
|
|
129
|
+
"""単一ローカル変数のセット。
|
|
130
|
+
|
|
131
|
+
`set_var("P", 10, value)` と `set_var("P10", value)` の両方を受け付ける。
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
kind: 変数種別または結合済み変数名。例: `"P"`, `"P10"`。
|
|
135
|
+
num: 変数番号、または `kind` が結合済み変数名の場合の値。
|
|
136
|
+
value: 保存する値。
|
|
137
|
+
save: JSON保存制御。`None` の場合は `autosave` 設定に従う。
|
|
138
|
+
`True` の場合は即保存し、`False` の場合は保存しない。
|
|
139
|
+
"""
|
|
140
|
+
if value is None:
|
|
141
|
+
key = self._make_key(kind)
|
|
142
|
+
resolved = num
|
|
143
|
+
else:
|
|
144
|
+
key = self._make_key(kind, num)
|
|
145
|
+
resolved = value
|
|
146
|
+
self._vars[key] = resolved
|
|
147
|
+
if save is True:
|
|
148
|
+
self.save(self._filename)
|
|
149
|
+
elif save is None:
|
|
150
|
+
self._autosave_if_enabled()
|
|
151
|
+
|
|
152
|
+
#
|
|
153
|
+
# robot_instance
|
|
154
|
+
#
|
|
155
|
+
|
|
156
|
+
# --- cobottaインスタンス管理 ---
|
|
157
|
+
def attach_robot(self, cobotta):
|
|
158
|
+
self._robot_instance = cobotta
|
|
159
|
+
|
|
160
|
+
def add_robot(self, cobotta):
|
|
161
|
+
self._robot_instance = cobotta
|
|
162
|
+
|
|
163
|
+
# simple 版
|
|
164
|
+
def get_robot(self, varname: str):
|
|
165
|
+
"""Cobotta本体から値を取得し、managerにも反映"""
|
|
166
|
+
value = getattr(self._robot_instance, varname)
|
|
167
|
+
self._vars[varname] = value
|
|
168
|
+
return value
|
|
169
|
+
|
|
170
|
+
# ローカル変数一括/範囲取得(cobotta本体→ローカル) ---
|
|
171
|
+
def read_vars_from_robot(
|
|
172
|
+
self,
|
|
173
|
+
kind: str,
|
|
174
|
+
start: Union[str, int],
|
|
175
|
+
end=None,
|
|
176
|
+
):
|
|
177
|
+
"""
|
|
178
|
+
cobotta本体 --> managerに反映
|
|
179
|
+
"""
|
|
180
|
+
if self._robot_instance is None:
|
|
181
|
+
raise RuntimeError("No robot_instance attached")
|
|
182
|
+
|
|
183
|
+
if end is None:
|
|
184
|
+
keys = [f"{kind}{start}"]
|
|
185
|
+
else:
|
|
186
|
+
keys = [f"{kind}{i}" for i in range(start, end + 1)]
|
|
187
|
+
|
|
188
|
+
for key in keys:
|
|
189
|
+
self._vars[key] = getattr(self._robot_instance, key)
|
|
190
|
+
|
|
191
|
+
def read_var_from_robot(
|
|
192
|
+
self,
|
|
193
|
+
kind: str,
|
|
194
|
+
num: Union[str, int, None] = None,
|
|
195
|
+
):
|
|
196
|
+
"""
|
|
197
|
+
cobotta本体 --> managerに反映
|
|
198
|
+
"""
|
|
199
|
+
if self._robot_instance is None:
|
|
200
|
+
raise RuntimeError("No robot_instance attached")
|
|
201
|
+
|
|
202
|
+
if num is None:
|
|
203
|
+
# ex) kine = P10
|
|
204
|
+
key = f"{kind}"
|
|
205
|
+
else:
|
|
206
|
+
# ex) kine = P, num = 10
|
|
207
|
+
key = f"{kind}{num}"
|
|
208
|
+
|
|
209
|
+
self._vars[key] = getattr(self._robot_instance, key)
|
|
210
|
+
|
|
211
|
+
# ローカル変数一括/範囲書き込み(ローカル→cobotta本体、危険!) ---
|
|
212
|
+
def write_vars_to_cobotta(
|
|
213
|
+
self,
|
|
214
|
+
kind,
|
|
215
|
+
start,
|
|
216
|
+
end=None,
|
|
217
|
+
):
|
|
218
|
+
"""
|
|
219
|
+
end 省略で var のみ登録(一つだけ)
|
|
220
|
+
manager --> cobotta本体へ反映(危険!)
|
|
221
|
+
"""
|
|
222
|
+
if self._robot_instance is None:
|
|
223
|
+
raise RuntimeError("No robot_instance attached")
|
|
224
|
+
if end is None:
|
|
225
|
+
keys = [f"{kind}{start}"]
|
|
226
|
+
else:
|
|
227
|
+
keys = [f"{kind}{i}" for i in range(start, end + 1)]
|
|
228
|
+
|
|
229
|
+
for key in keys:
|
|
230
|
+
if key in self._vars:
|
|
231
|
+
setattr(self._robot_instance, key, self._vars[key])
|
|
232
|
+
else:
|
|
233
|
+
self._logger.warning(f"Warning: {key} not found in local vars. Skip.")
|
|
234
|
+
|
|
235
|
+
def write_var_to_robot(
|
|
236
|
+
self,
|
|
237
|
+
kind: str,
|
|
238
|
+
num: Union[str, int, None] = None,
|
|
239
|
+
):
|
|
240
|
+
"""
|
|
241
|
+
end 省略と同じ意味
|
|
242
|
+
manager --> cobotta本体へ反映(危険!)
|
|
243
|
+
"""
|
|
244
|
+
if self._robot_instance is None:
|
|
245
|
+
raise RuntimeError("No robot_instance attached")
|
|
246
|
+
|
|
247
|
+
if num is None:
|
|
248
|
+
key = f"{kind}"
|
|
249
|
+
else:
|
|
250
|
+
key = f"{kind}{num}"
|
|
251
|
+
|
|
252
|
+
if key in self._vars:
|
|
253
|
+
setattr(self._robot_instance, key, self._vars[key])
|
|
254
|
+
else:
|
|
255
|
+
self._logger.warning(f"Warning: {key} not found in local vars. Skip.")
|
|
256
|
+
|
|
257
|
+
# 全部一括で書き込み(ローカル→robot_instance、全壊注意) ---
|
|
258
|
+
def write_all_to_robot(self):
|
|
259
|
+
"""
|
|
260
|
+
Manager に存在する全変数を robot_instance 本体に一斉反映(超危険)
|
|
261
|
+
"""
|
|
262
|
+
if self._robot_instance is None:
|
|
263
|
+
raise RuntimeError("No robot_instance attached")
|
|
264
|
+
|
|
265
|
+
try:
|
|
266
|
+
for key, value in self._vars.items():
|
|
267
|
+
setattr(self._robot_instance, key, value)
|
|
268
|
+
except Exception as e:
|
|
269
|
+
pass
|
|
270
|
+
|
|
271
|
+
# JSON保存・ロード
|
|
272
|
+
def save(self, filename=None):
|
|
273
|
+
filename = filename or self._filename
|
|
274
|
+
if filename is None:
|
|
275
|
+
raise ValueError("filename is not specified")
|
|
276
|
+
with open(filename, "w", encoding="utf-8") as f:
|
|
277
|
+
json.dump(self._vars, f, indent=2, ensure_ascii=False)
|
|
278
|
+
self._filename = filename
|
|
279
|
+
|
|
280
|
+
def load(self, filename=None):
|
|
281
|
+
filename = filename or self._filename
|
|
282
|
+
if filename is None:
|
|
283
|
+
raise ValueError("filename is not specified")
|
|
284
|
+
with open(filename, "r", encoding="utf-8") as f:
|
|
285
|
+
self._vars = json.load(f)
|
|
286
|
+
self._filename = filename
|
|
287
|
+
|
|
288
|
+
# --- 現在のローカル変数リスト取得 ---
|
|
289
|
+
def list_vars(self):
|
|
290
|
+
return list(self._vars.keys())
|
|
291
|
+
|
|
292
|
+
def __repr__(self):
|
|
293
|
+
cls = self.__class__.__name__
|
|
294
|
+
robot_state = "attached" if self._robot_instance is not None else "none"
|
|
295
|
+
n = len(self._vars)
|
|
296
|
+
# 先頭3件だけプレビュー
|
|
297
|
+
preview_keys = list(self._vars.keys())[:3]
|
|
298
|
+
preview = ", ".join(f"{k}={self._vars[k]!r}" for k in preview_keys)
|
|
299
|
+
if n > 3:
|
|
300
|
+
preview += ", ..."
|
|
301
|
+
return f"{cls}(robot={robot_state}, vars={n}, preview=[{preview}])"
|
|
302
|
+
|
|
303
|
+
# 人間向けの詳細表示が欲しい場合
|
|
304
|
+
def __str__(self):
|
|
305
|
+
try:
|
|
306
|
+
return json.dumps(self._vars, ensure_ascii=False, indent=2)
|
|
307
|
+
except Exception:
|
|
308
|
+
return repr(self)
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"""ティーチング画面の操作を調整するController。
|
|
2
|
+
|
|
3
|
+
責務: 起動時の読込元の選択、現在位置取得、P変数の読書き、
|
|
4
|
+
クリア、ローカル削除、JSON保存のModelへの委譲。
|
|
5
|
+
責務外: Qtウィジェット、確認ダイアログ、ロボット固有APIの実装。
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import asyncio
|
|
9
|
+
import inspect
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
from .teaching_model import TeachingModel
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class TeachingController:
|
|
16
|
+
"""GUIからの操作をModelへ振り分ける。"""
|
|
17
|
+
|
|
18
|
+
def __init__(
|
|
19
|
+
self,
|
|
20
|
+
model: TeachingModel,
|
|
21
|
+
device_name: str,
|
|
22
|
+
logger=None,
|
|
23
|
+
) -> None:
|
|
24
|
+
"""DeviceProxyのデバイス名からP変数の保存先を決定する。
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
model: P変数と現在位置を管理するModel。
|
|
28
|
+
device_name: DeviceProxy生成時に指定したデバイス名。
|
|
29
|
+
CobottaCtrlのみロボット内部P変数を利用し、その他はJSONを利用する。
|
|
30
|
+
"""
|
|
31
|
+
self._model = model
|
|
32
|
+
self._device_name = device_name
|
|
33
|
+
self._uses_robot_memory = device_name == "CobottaCtrl"
|
|
34
|
+
self._model.set_storage_mode(self._uses_robot_memory)
|
|
35
|
+
self._logger = logger
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def uses_robot_memory(self) -> bool:
|
|
39
|
+
"""P変数の保存先がロボット内部メモリかどうかを返す。"""
|
|
40
|
+
return self._uses_robot_memory
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def model(self) -> TeachingModel:
|
|
44
|
+
"""表示状態を保持するModelを返す。"""
|
|
45
|
+
return self._model
|
|
46
|
+
|
|
47
|
+
def load_initial(
|
|
48
|
+
self,
|
|
49
|
+
start: int,
|
|
50
|
+
end: int,
|
|
51
|
+
) -> None:
|
|
52
|
+
"""明示設定に従って初期データを読み込む。"""
|
|
53
|
+
if self._uses_robot_memory:
|
|
54
|
+
self._model.read_robot(start, end)
|
|
55
|
+
else:
|
|
56
|
+
self._model.load_file()
|
|
57
|
+
|
|
58
|
+
def read_robot(
|
|
59
|
+
self,
|
|
60
|
+
start: int,
|
|
61
|
+
end: int,
|
|
62
|
+
) -> None:
|
|
63
|
+
"""指定範囲のP変数を実機から読み込む。"""
|
|
64
|
+
if not self._uses_robot_memory:
|
|
65
|
+
raise RuntimeError(
|
|
66
|
+
"このデバイスのP変数はJSON管理です。JSONから読み込んでください"
|
|
67
|
+
)
|
|
68
|
+
self._model.read_robot(start, end)
|
|
69
|
+
|
|
70
|
+
def load_file(self) -> None:
|
|
71
|
+
"""JSONを読み込む。"""
|
|
72
|
+
self._model.load_file()
|
|
73
|
+
|
|
74
|
+
def save_file(self) -> None:
|
|
75
|
+
"""表示中の一覧をJSONへ保存する。"""
|
|
76
|
+
self._model.save_file()
|
|
77
|
+
|
|
78
|
+
def read_current_position(self) -> Any:
|
|
79
|
+
"""現在位置を取得する。同期/非同期モードはModel設定に従う。"""
|
|
80
|
+
return self._model.read_current_position()
|
|
81
|
+
|
|
82
|
+
def teach_number(
|
|
83
|
+
self,
|
|
84
|
+
number: int,
|
|
85
|
+
) -> Any:
|
|
86
|
+
"""現在位置を指定P番号へ書き込む。"""
|
|
87
|
+
return self._model.teach_number(number)
|
|
88
|
+
|
|
89
|
+
def teach_first_unused(
|
|
90
|
+
self,
|
|
91
|
+
start: int,
|
|
92
|
+
end: int,
|
|
93
|
+
) -> None:
|
|
94
|
+
"""空き番号への登録をModelへ委譲する。"""
|
|
95
|
+
self._model.teach_first_unused(start, end)
|
|
96
|
+
|
|
97
|
+
def clear_numbers(
|
|
98
|
+
self,
|
|
99
|
+
numbers: list[int],
|
|
100
|
+
) -> list[int]:
|
|
101
|
+
"""選択したP変数を保存先に応じて順次クリアする。"""
|
|
102
|
+
completed: list[int] = []
|
|
103
|
+
for number in numbers:
|
|
104
|
+
self._model.clear_number(number)
|
|
105
|
+
completed.append(number)
|
|
106
|
+
return completed
|
|
107
|
+
|
|
108
|
+
def clear_number(
|
|
109
|
+
self,
|
|
110
|
+
number: int,
|
|
111
|
+
) -> Any:
|
|
112
|
+
"""指定P変数を未使用値に変更する。"""
|
|
113
|
+
return self._model.clear_number(number)
|
|
114
|
+
|
|
115
|
+
def delete_numbers(
|
|
116
|
+
self,
|
|
117
|
+
numbers: list[int],
|
|
118
|
+
) -> None:
|
|
119
|
+
"""一覧から削除する。JSON管理ではファイルにも反映する。"""
|
|
120
|
+
self._model.delete_numbers(numbers)
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"""ティーチングGUIのModel。
|
|
2
|
+
|
|
3
|
+
責務:
|
|
4
|
+
DeviceProxyの共通APIで指定範囲のP変数をロボットから取得し、
|
|
5
|
+
JSONから読み込んだP変数と現在位置を画面表示用に保持する。
|
|
6
|
+
|
|
7
|
+
責務外:
|
|
8
|
+
Qt画面の構築、DeviceProxyの生成、ロボット固有APIの変換、
|
|
9
|
+
Qt画面の構築とユーザーへの確認ダイアログ。
|
|
10
|
+
|
|
11
|
+
安全上の制約:
|
|
12
|
+
実機への書き込みは指定番号の明示操作に限る。
|
|
13
|
+
P変数の値から未使用かどうかを推測しない。
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
import asyncio
|
|
17
|
+
import inspect
|
|
18
|
+
import json
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
from typing import Any, Dict, Optional
|
|
21
|
+
|
|
22
|
+
from .robot_var_manager import RobotVarManager
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class TeachingModel:
|
|
26
|
+
"""ロボットとJSONから読み取ったP変数の表示状態を管理する。"""
|
|
27
|
+
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
manager: RobotVarManager,
|
|
31
|
+
filename: str,
|
|
32
|
+
logger: Any = None,
|
|
33
|
+
async_mode: bool = False,
|
|
34
|
+
) -> None:
|
|
35
|
+
"""既存の変数マネージャーとJSONファイルの場所を設定する。"""
|
|
36
|
+
self._manager = manager
|
|
37
|
+
self._filename = Path(filename)
|
|
38
|
+
self._logger = logger
|
|
39
|
+
self._async_mode = async_mode
|
|
40
|
+
self._source = "未読込"
|
|
41
|
+
self._positions: Dict[str, Any] = {}
|
|
42
|
+
self._current_position: Any = None
|
|
43
|
+
self._uses_robot_memory = True
|
|
44
|
+
|
|
45
|
+
def set_storage_mode(self, uses_robot_memory: bool) -> None:
|
|
46
|
+
"""P変数の保存先を設定する。Controllerがデバイス名から決定する。
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
uses_robot_memory: Trueなら実機P変数、FalseならJSONファイル。
|
|
50
|
+
"""
|
|
51
|
+
self._uses_robot_memory = uses_robot_memory
|
|
52
|
+
|
|
53
|
+
@property
|
|
54
|
+
def robot(self) -> Any:
|
|
55
|
+
"""マネージャーに接続済みのロボットインスタンスを返す。"""
|
|
56
|
+
return self._manager._robot_instance
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def source(self) -> str:
|
|
60
|
+
"""現在表示しているP変数の取得元を返す。"""
|
|
61
|
+
return self._source
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def positions(self) -> Dict[str, Any]:
|
|
65
|
+
"""表示用のP変数一覧のコピーを返す。"""
|
|
66
|
+
return self._positions.copy()
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def current_position(self) -> Any:
|
|
70
|
+
"""最後に読み取ったロボットの現在位置を返す。"""
|
|
71
|
+
return self._current_position
|
|
72
|
+
|
|
73
|
+
@staticmethod
|
|
74
|
+
def _only_p(data: Dict[str, Any]) -> Dict[str, Any]:
|
|
75
|
+
"""Pに続いて数字がある変数名だけを抽出する。"""
|
|
76
|
+
return {
|
|
77
|
+
key: value
|
|
78
|
+
for key, value in data.items()
|
|
79
|
+
if isinstance(key, str) and key.startswith("P") and key[1:].isdigit()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
def load_file(self) -> None:
|
|
83
|
+
"""JSONを読み取って表示状態を更新する。ロボットへは書き込まない。"""
|
|
84
|
+
if not self._filename.exists():
|
|
85
|
+
self._positions = {}
|
|
86
|
+
self._source = "JSON(ファイルなし)"
|
|
87
|
+
return
|
|
88
|
+
with self._filename.open(encoding="utf-8") as stream:
|
|
89
|
+
data = json.load(stream)
|
|
90
|
+
if not isinstance(data, dict):
|
|
91
|
+
raise ValueError("JSONのルートは辞書である必要があります")
|
|
92
|
+
self._positions = self._only_p(data)
|
|
93
|
+
self._source = "JSON"
|
|
94
|
+
|
|
95
|
+
def read_robot(self, start: int, end: int) -> None:
|
|
96
|
+
"""指定したP番号範囲を実機から読み取る。
|
|
97
|
+
|
|
98
|
+
DeviceProxyの共通API get_var("P", 番号) を利用する。
|
|
99
|
+
get_all_var()は変数名一覧を返すため使用しない。
|
|
100
|
+
読み取った値はRobotVarManagerのローカルキャッシュにも反映する。
|
|
101
|
+
読み取った結果は表示に反映するが、JSONには保存しない。
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
start: 読み取り開始P番号(両端を含む)。
|
|
105
|
+
end: 読み取り終了P番号(両端を含む)。
|
|
106
|
+
|
|
107
|
+
Raises:
|
|
108
|
+
RuntimeError: ロボット未接続の場合。
|
|
109
|
+
ValueError: 番号範囲が不正な場合。
|
|
110
|
+
Exception: 実機からの読み取りに失敗した場合、その例外を伝播する。
|
|
111
|
+
"""
|
|
112
|
+
if self.robot is None:
|
|
113
|
+
raise RuntimeError("ロボットが接続されていません")
|
|
114
|
+
if start < 0 or end < start:
|
|
115
|
+
raise ValueError("P番号の範囲が不正です")
|
|
116
|
+
|
|
117
|
+
# DeviceProxyではP0等の動的属性アクセスではなく、共通APIの
|
|
118
|
+
# get_var("P", 番号) を使う。既存の通信ログでもこのAPIの成功を確認済み。
|
|
119
|
+
# 全件の取得に成功するまでは表示状態・マネージャーを更新しない。
|
|
120
|
+
result: Dict[str, Any] = {}
|
|
121
|
+
for number in range(start, end + 1):
|
|
122
|
+
value = self.robot.get_var("P", number)
|
|
123
|
+
if inspect.isawaitable(value):
|
|
124
|
+
raise RuntimeError(
|
|
125
|
+
"P変数の読み取りには同期DeviceProxyが必要です。"
|
|
126
|
+
"DeviceProxyをasync_mode=Falseで生成してください。"
|
|
127
|
+
)
|
|
128
|
+
result[f"P{number}"] = value
|
|
129
|
+
|
|
130
|
+
for key, value in result.items():
|
|
131
|
+
self._manager.set_var(key, value, save=False)
|
|
132
|
+
self._positions = result
|
|
133
|
+
self._source = f"ロボット(P{start}~P{end})"
|
|
134
|
+
|
|
135
|
+
@property
|
|
136
|
+
def async_mode(self) -> bool:
|
|
137
|
+
"""現在位置取得APIを非同期で公開する設定を返す。"""
|
|
138
|
+
return self._async_mode
|
|
139
|
+
|
|
140
|
+
async def _read_current_position_async(self) -> Any:
|
|
141
|
+
"""現在位置を取得して保持する。同期・非同期のDeviceProxyを受け付ける。"""
|
|
142
|
+
if self.robot is None:
|
|
143
|
+
raise RuntimeError("ロボットが接続されていません")
|
|
144
|
+
result = self.robot.get_current_position()
|
|
145
|
+
if inspect.isawaitable(result):
|
|
146
|
+
result = await result
|
|
147
|
+
if result is False or result is None:
|
|
148
|
+
raise RuntimeError("現在位置の取得に失敗しました")
|
|
149
|
+
self._current_position = result
|
|
150
|
+
return result
|
|
151
|
+
|
|
152
|
+
def read_current_position(self) -> Any:
|
|
153
|
+
"""現在位置を取得する。
|
|
154
|
+
|
|
155
|
+
async_mode=False: 同期実行し、座標を返す。
|
|
156
|
+
async_mode=True: コルーチンを返す。呼び出し側でawaitする。
|
|
157
|
+
|
|
158
|
+
ロボット内部変数およびJSONへの書き込みは行わない。
|
|
159
|
+
"""
|
|
160
|
+
operation = self._read_current_position_async()
|
|
161
|
+
if self._async_mode:
|
|
162
|
+
return operation
|
|
163
|
+
return asyncio.run(operation)
|
|
164
|
+
|
|
165
|
+
def first_unused(self, start: int, end: int) -> Optional[int]:
|
|
166
|
+
"""未使用判定の仕様が未確定のため、常にNoneを返す。
|
|
167
|
+
|
|
168
|
+
取得できなかった番号や値だけを根拠に空き番号を判定しない。
|
|
169
|
+
"""
|
|
170
|
+
return None
|
|
171
|
+
|
|
172
|
+
def save_file(
|
|
173
|
+
self,
|
|
174
|
+
allow_empty: bool = False,
|
|
175
|
+
) -> None:
|
|
176
|
+
"""現在画面に表示しているP変数をJSONへ保存する。
|
|
177
|
+
|
|
178
|
+
ロボットには書き込まない。読み取り結果がない場合は既存ファイルを
|
|
179
|
+
空のデータで上書きしない。保存成功後にだけ表示元を更新する。
|
|
180
|
+
"""
|
|
181
|
+
if not self._positions and not allow_empty:
|
|
182
|
+
raise ValueError(
|
|
183
|
+
"保存対象のP変数がありません。先にロボットから読み込んでください"
|
|
184
|
+
)
|
|
185
|
+
self._filename.parent.mkdir(parents=True, exist_ok=True)
|
|
186
|
+
# JSONへ書く内容は表示中のP変数だけ。マネージャーの他種変数は含めない。
|
|
187
|
+
import os
|
|
188
|
+
import tempfile
|
|
189
|
+
|
|
190
|
+
temporary_name = None
|
|
191
|
+
try:
|
|
192
|
+
with tempfile.NamedTemporaryFile(
|
|
193
|
+
mode="w",
|
|
194
|
+
encoding="utf-8",
|
|
195
|
+
dir=self._filename.parent,
|
|
196
|
+
prefix=f".{self._filename.name}.",
|
|
197
|
+
suffix=".tmp",
|
|
198
|
+
delete=False,
|
|
199
|
+
) as stream:
|
|
200
|
+
temporary_name = stream.name
|
|
201
|
+
json.dump(self._positions, stream, ensure_ascii=False, indent=2)
|
|
202
|
+
stream.flush()
|
|
203
|
+
os.fsync(stream.fileno())
|
|
204
|
+
os.replace(temporary_name, self._filename)
|
|
205
|
+
finally:
|
|
206
|
+
if temporary_name is not None and os.path.exists(temporary_name):
|
|
207
|
+
os.unlink(temporary_name)
|
|
208
|
+
|
|
209
|
+
def teach_number(
|
|
210
|
+
self,
|
|
211
|
+
number: int,
|
|
212
|
+
) -> Any:
|
|
213
|
+
"""現在位置を指定P番号へ書き込み、実機から読み戻す。
|
|
214
|
+
|
|
215
|
+
明示的な上書き操作専用。GUI側で番号と上書き確認を行う。
|
|
216
|
+
読み戻し成功後、画面表示とローカルキャッシュを更新する。
|
|
217
|
+
JSONへの保存は別ボタンで明示的に行う。
|
|
218
|
+
"""
|
|
219
|
+
if number < 0:
|
|
220
|
+
raise ValueError("P番号は0以上を指定してください")
|
|
221
|
+
if self._current_position is None:
|
|
222
|
+
raise RuntimeError("先に現在位置を取得してください")
|
|
223
|
+
if not self._uses_robot_memory:
|
|
224
|
+
key = f"P{number}"
|
|
225
|
+
self._positions[key] = self._current_position
|
|
226
|
+
self._manager.set_var(key, self._current_position, save=False)
|
|
227
|
+
self.save_file()
|
|
228
|
+
self._source = "JSON(現在位置の登録後)"
|
|
229
|
+
return self._current_position
|
|
230
|
+
if self.robot is None:
|
|
231
|
+
raise RuntimeError("ロボットが接続されていません")
|
|
232
|
+
result = self.robot.set_var("P", number, self._current_position)
|
|
233
|
+
if inspect.isawaitable(result):
|
|
234
|
+
raise RuntimeError("書き込みには同期DeviceProxyが必要です")
|
|
235
|
+
if result is False:
|
|
236
|
+
raise RuntimeError(f"P{number}への書き込みが失敗しました")
|
|
237
|
+
readback = self.robot.get_var("P", number)
|
|
238
|
+
if inspect.isawaitable(readback):
|
|
239
|
+
raise RuntimeError("読み戻しには同期DeviceProxyが必要です")
|
|
240
|
+
if readback is False or readback is None:
|
|
241
|
+
raise RuntimeError(
|
|
242
|
+
f"P{number}の読み戻しに失敗しました。実機の状態を確認してください"
|
|
243
|
+
)
|
|
244
|
+
self._manager.set_var(f"P{number}", readback, save=False)
|
|
245
|
+
self._positions[f"P{number}"] = readback
|
|
246
|
+
self._source = "ロボット(書き込み後)"
|
|
247
|
+
return readback
|
|
248
|
+
|
|
249
|
+
def clear_number(
|
|
250
|
+
self,
|
|
251
|
+
number: int,
|
|
252
|
+
) -> Any:
|
|
253
|
+
"""指定P番号を未使用値に変更し、実機から読み戻して反映する。
|
|
254
|
+
|
|
255
|
+
実機のP変数を変更する操作であり、JSONファイルは変更しない。
|
|
256
|
+
"""
|
|
257
|
+
if number < 0:
|
|
258
|
+
raise ValueError("P番号は0以上を指定してください")
|
|
259
|
+
empty = [0, 0, 0, 0, 0, 0, -1]
|
|
260
|
+
if not self._uses_robot_memory:
|
|
261
|
+
key = f"P{number}"
|
|
262
|
+
self._positions[key] = empty.copy()
|
|
263
|
+
self._manager.set_var(key, empty.copy(), save=False)
|
|
264
|
+
self.save_file()
|
|
265
|
+
self._source = "JSON(クリア後)"
|
|
266
|
+
return empty
|
|
267
|
+
if self.robot is None:
|
|
268
|
+
raise RuntimeError("ロボットが接続されていません")
|
|
269
|
+
result = self.robot.set_var("P", number, empty)
|
|
270
|
+
if inspect.isawaitable(result):
|
|
271
|
+
raise RuntimeError("書き込みには同期DeviceProxyが必要です")
|
|
272
|
+
if result is False:
|
|
273
|
+
raise RuntimeError(f"P{number}のクリアに失敗しました")
|
|
274
|
+
readback = self.robot.get_var("P", number)
|
|
275
|
+
if inspect.isawaitable(readback):
|
|
276
|
+
raise RuntimeError("読み戻しには同期DeviceProxyが必要です")
|
|
277
|
+
if readback is False or readback is None:
|
|
278
|
+
raise RuntimeError(f"P{number}の読み戻しに失敗しました")
|
|
279
|
+
if list(readback) != empty:
|
|
280
|
+
raise RuntimeError(f"P{number}のクリア値が一致しません: {readback!r}")
|
|
281
|
+
self._manager.set_var(f"P{number}", readback, save=False)
|
|
282
|
+
self._positions[f"P{number}"] = readback
|
|
283
|
+
self._source = "ロボット(クリア後)"
|
|
284
|
+
return readback
|
|
285
|
+
|
|
286
|
+
def delete_numbers(
|
|
287
|
+
self,
|
|
288
|
+
numbers: list[int],
|
|
289
|
+
) -> None:
|
|
290
|
+
"""選択P番号を表示一覧とローカルキャッシュから削除する。
|
|
291
|
+
|
|
292
|
+
ロボット内部のP変数とJSONファイルには一切書き込まない。
|
|
293
|
+
JSONへの削除反映は別途「JSONに保存」を実行した場合のみ行う。
|
|
294
|
+
"""
|
|
295
|
+
for number in numbers:
|
|
296
|
+
key = f"P{number}"
|
|
297
|
+
self._positions.pop(key, None)
|
|
298
|
+
self._manager._vars.pop(key, None)
|
|
299
|
+
if not self._uses_robot_memory:
|
|
300
|
+
self.save_file(allow_empty=True)
|
|
301
|
+
self._source = "JSON(削除後)"
|
|
302
|
+
else:
|
|
303
|
+
self._source = "一覧(ローカル削除後)"
|
|
304
|
+
|
|
305
|
+
def teach_first_unused(
|
|
306
|
+
self,
|
|
307
|
+
start: int,
|
|
308
|
+
end: int,
|
|
309
|
+
) -> None:
|
|
310
|
+
"""空き番号への自動登録。未使用判定が未確定の間は書き込まない。"""
|
|
311
|
+
raise RuntimeError(
|
|
312
|
+
"未使用P番号の判定条件が未確認です。"
|
|
313
|
+
"既存値を保護するため自動登録は実行できません"
|
|
314
|
+
)
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: teaching-manager
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: teaching manager
|
|
5
|
+
Author-email: Kengo NAKADA <kengo.nakada@email.com>
|
|
6
|
+
Requires-Python: >=3.7
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: xlogger-py
|
|
10
|
+
Requires-Dist: pyside6
|
|
11
|
+
Requires-Dist: setuptools
|
|
12
|
+
Requires-Dist: python-dotenv
|
|
13
|
+
Requires-Dist: fastapi
|
|
14
|
+
Requires-Dist: fastapi-utils
|
|
15
|
+
Requires-Dist: uvicorn
|
|
16
|
+
Requires-Dist: pydantic
|
|
17
|
+
Requires-Dist: starlette
|
|
18
|
+
Requires-Dist: requests
|
|
19
|
+
Requires-Dist: aiohttp
|
|
20
|
+
Requires-Dist: httpx
|
|
21
|
+
Requires-Dist: pywin32; sys_platform == "win32"
|
|
22
|
+
Requires-Dist: pygame; sys_platform == "win32"
|
|
23
|
+
Requires-Dist: coloredlogs
|
|
24
|
+
Requires-Dist: colorlog
|
|
25
|
+
Requires-Dist: pytest
|
|
26
|
+
Requires-Dist: pytest-asyncio
|
|
27
|
+
Requires-Dist: pyyaml
|
|
28
|
+
Requires-Dist: toml
|
|
29
|
+
Requires-Dist: tomli; python_version < "3.11"
|
|
30
|
+
Requires-Dist: importlib-metadata>=4.0; python_version < "3.8"
|
|
31
|
+
Requires-Dist: nest_asyncio
|
|
32
|
+
Requires-Dist: sphinx
|
|
33
|
+
Requires-Dist: myst-parser
|
|
34
|
+
Requires-Dist: sphinx-autobuild
|
|
35
|
+
Requires-Dist: sphinx-rtd-theme
|
|
36
|
+
Requires-Dist: sphinxcontrib-napoleon
|
|
37
|
+
Requires-Dist: linkify-it-py
|
|
38
|
+
Requires-Dist: grpcio
|
|
39
|
+
Requires-Dist: grpcio-tools
|
|
40
|
+
Requires-Dist: google
|
|
41
|
+
Requires-Dist: pygame
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# Robot Teaching Manager
|
|
45
|
+
|
|
46
|
+
[](https://github.com/ohara-lab-su/teaching_manager/blob/main/README.en.md)
|
|
47
|
+
[](https://github.com/ohara-lab-su/teaching_manager/blob/main/README.md)
|
|
48
|
+
|
|
49
|
+
ロボットの現在位置を P 変数として登録・確認し、JSON ファイルで管理する Qt ベースのティーチング GUI です。
|
|
50
|
+
|
|
51
|
+
**バージョン: 0.0.0(初期版)**
|
|
52
|
+
|
|
53
|
+
## 主な機能
|
|
54
|
+
|
|
55
|
+
- ロボットの現在位置を取得して表示します。
|
|
56
|
+
- P 番号と座標の一覧を表示します。P 番号範囲を指定して読み込めます(Cobotta)。
|
|
57
|
+
- 指定した P 番号、または一覧で選択した P 番号に **取得済みの現在位置**を書き込みます。書き込み前に確認します。
|
|
58
|
+
- 一覧の右クリックメニューから、現在位置の書き込み、 **0 クリア**、 **一覧から削除**を実行できます。
|
|
59
|
+
- Ctrl/Command による複数行選択と Shift による範囲選択に対応します。0 クリアと一覧から削除は複数行をまとめて操作できます。
|
|
60
|
+
- 0 クリアは対象 P 番号を `[0, 0, 0, 0, 0, 0, -1]` に設定します。
|
|
61
|
+
- JSON ファイルからの読み込み、表示中の一覧の JSON 保存に対応します。
|
|
62
|
+
|
|
63
|
+
**注意:** 「空き番号にティーチング」ボタンはありますが、未使用番号の判定仕様が未確定のため、自動登録は実行できません。
|
|
64
|
+
|
|
65
|
+
## デバイスごとの保存先
|
|
66
|
+
|
|
67
|
+
`DeviceProxy` に渡す `device_name` で自動的に切り替わります。名前の比較は **`CobottaCtrl` と完全一致**です。
|
|
68
|
+
|
|
69
|
+
| 操作 | `CobottaCtrl` | その他のデバイス名 |
|
|
70
|
+
|----------------------|----------------------------------|------------------------|
|
|
71
|
+
| 起動時の P 変数読込 | ロボット内部 P 変数 | JSON ファイル |
|
|
72
|
+
| 現在位置の取得 | ロボット API | ロボット API |
|
|
73
|
+
| 現在位置の登録 | ロボット内部 P 変数 | JSON に自動保存 |
|
|
74
|
+
| 0 クリア | ロボット内部 P 変数 | JSON に自動保存 |
|
|
75
|
+
| 一覧から削除 | 表示一覧のみ(実機は変更しない) | 表示一覧と JSON |
|
|
76
|
+
| 「JSONに保存」ボタン | 表示一覧を JSON に保存 | 表示一覧を JSON に保存 |
|
|
77
|
+
|
|
78
|
+
Cobotta の実機 P 変数の変更は JSON に自動保存されません。その他のデバイスでは、P 変数をロボット内部メモリに保存せず、JSON
|
|
79
|
+
を利用します。 **現在位置の取得には、どちらの場合も接続済みのロボットが必要です。**
|
|
80
|
+
|
|
81
|
+
## 構成
|
|
82
|
+
|
|
83
|
+
| ファイル | 役割 |
|
|
84
|
+
|-----------------------------------------------|---------------------------------------------|
|
|
85
|
+
| `example/teaching_gui.py` | PySide6 の画面・操作・確認ダイアログ |
|
|
86
|
+
| `src/teaching_manager/teaching_controller.py` | デバイス名による保存先選択と操作の振り分け |
|
|
87
|
+
| `src/teaching_manager/teaching_model.py` | P 変数・現在位置・ロボット API・JSON の処理 |
|
|
88
|
+
| `src/teaching_manager/robot_var_manager.py` | ローカル変数管理 |
|
|
89
|
+
|
|
90
|
+
GUI、Controller、Model を分離した MVC 構成です。
|
|
91
|
+
|
|
92
|
+
## 起動と設定
|
|
93
|
+
|
|
94
|
+
現行の `example/teaching_gui.py` は `PySide6`、`x_logger`、`cobotta2` を import
|
|
95
|
+
します。これらのパッケージと接続先の設定ファイルを、使用環境に合わせて用意してください。依存関係を宣言するパッケージ設定ファイルは今回の確認対象に含まれていないため、対応バージョンはここでは規定しません。
|
|
96
|
+
|
|
97
|
+
`example/teaching_gui.py` の `main()` で、`Config("config_cobotta3_server5.yaml")`、`device_name = "CobottaCtrl"`、
|
|
98
|
+
`DeviceProxy(...)` を設定します。JSON の保存先は同ファイル内の `JSON_FILE` で、初期値はプロジェクトルートの
|
|
99
|
+
`robot_positions.json` です。P 番号の GUI 入力範囲は 0〜999、起動時の読込範囲の初期値は P0〜P20 です。
|
|
100
|
+
|
|
101
|
+
プロジェクトルートからの実行例:
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
python example/teaching_gui.py
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
ロボット通信が必要な操作は、対応する DeviceProxy とサーバーが利用可能な状態で実行してください。
|
|
108
|
+
|
|
109
|
+
## 操作上の注意
|
|
110
|
+
|
|
111
|
+
- 書き込み・0 クリアは既存の座標を上書きします。確認ダイアログで対象を確認してください。
|
|
112
|
+
- Cobotta の「一覧から削除」はロボット内部 P 変数を消去しません。0 クリアとは別操作です。
|
|
113
|
+
- JSON 管理モードの「一覧から削除」は JSON にも反映されます。
|
|
114
|
+
- ロボットへの書き込み後は P 変数を読み戻して検証します。
|
|
115
|
+
- 現在位置の取得中に画面を閉じると、通信スレッドの終了待ちが発生する場合があります。
|
|
116
|
+
|
|
117
|
+
## 更新履歴
|
|
118
|
+
|
|
119
|
+
[CHANGELOG.md](CHANGELOG.md) / [CHANGELOG.en.md](CHANGELOG.en.md)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
teaching_manager/robot_var_manager.py,sha256=6g8iOErePQ7N5rhekQTwQe0daZ88wzifIAM9IIQwmZM,9817
|
|
2
|
+
teaching_manager/teaching_controller.py,sha256=sF1kD5GqpjcjSYtkKeeSN8AJnJzZRFDntBE7SAERLQo,3771
|
|
3
|
+
teaching_manager/teaching_model.py,sha256=kQ7bYBKr3FMqVMAlgs27EhehRYrger5naO4n9g1Iteg,13148
|
|
4
|
+
teaching_manager-0.0.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
|
+
teaching_manager-0.0.0.dist-info/METADATA,sha256=joS2E4htNQJupUp1shK4jxxz_vFx404kGx9BzXedgbk,6398
|
|
6
|
+
teaching_manager-0.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
7
|
+
teaching_manager-0.0.0.dist-info/top_level.txt,sha256=QNoEUBfnMZ4FD5DYUx9zm-O-CZOjGMy902wNDeYo3t4,17
|
|
8
|
+
teaching_manager-0.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
teaching_manager
|