smartlab-studio-ctrl 0.2.9__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.
- smartlab_studio_ctrl/__init__.py +11 -0
- smartlab_studio_ctrl/config.py +37 -0
- smartlab_studio_ctrl/desktop_capture.py +215 -0
- smartlab_studio_ctrl/server_grpc/__init__.py +1 -0
- smartlab_studio_ctrl/server_grpc/client.py +230 -0
- smartlab_studio_ctrl/server_grpc/server.py +282 -0
- smartlab_studio_ctrl/smartlab_config.py +231 -0
- smartlab_studio_ctrl/smartlab_ctrl.py +329 -0
- smartlab_studio_ctrl/smartlab_uia.py +1239 -0
- smartlab_studio_ctrl/snipping_config.py +59 -0
- smartlab_studio_ctrl/snipping_uia.py +325 -0
- smartlab_studio_ctrl-0.2.9.dist-info/METADATA +12 -0
- smartlab_studio_ctrl-0.2.9.dist-info/RECORD +16 -0
- smartlab_studio_ctrl-0.2.9.dist-info/WHEEL +5 -0
- smartlab_studio_ctrl-0.2.9.dist-info/licenses/LICENSE +201 -0
- smartlab_studio_ctrl-0.2.9.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""SmartLab Studio II gRPCサーバー。通信境界の差分のみ実装する。"""
|
|
3
|
+
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from tempfile import TemporaryDirectory
|
|
6
|
+
import time
|
|
7
|
+
from typing import Any, Iterator, Optional
|
|
8
|
+
|
|
9
|
+
from grpc_frame.grpc_com import ComExecutionRunner, ThreadSafeCtrlProxy
|
|
10
|
+
from grpc_frame.grpc_server import create_grpc_server
|
|
11
|
+
from smartlab_studio_ctrl.smartlab_ctrl import SmartLabCtrl
|
|
12
|
+
|
|
13
|
+
_GRPC_OPTIONS = (
|
|
14
|
+
("grpc.max_receive_message_length", 64 * 1024 * 1024),
|
|
15
|
+
("grpc.max_send_message_length", 64 * 1024 * 1024),
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# ===== 一時調査: サーバー起動以降のロガー出力を蓄積(削除対象) =====
|
|
20
|
+
from datetime import datetime
|
|
21
|
+
from threading import Lock
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class _ExportDiagnosticLog:
|
|
25
|
+
def __init__(self, logger):
|
|
26
|
+
self._target = logger
|
|
27
|
+
self._lines = []
|
|
28
|
+
self._lock = Lock()
|
|
29
|
+
|
|
30
|
+
def __getattr__(self, name):
|
|
31
|
+
return getattr(self._target, name)
|
|
32
|
+
|
|
33
|
+
def _record(self, level, message):
|
|
34
|
+
line = f"{datetime.now().isoformat(timespec='milliseconds')} {level} {message}"
|
|
35
|
+
with self._lock:
|
|
36
|
+
self._lines.append(line)
|
|
37
|
+
if self._target is not None:
|
|
38
|
+
getattr(self._target, level.lower())(message)
|
|
39
|
+
else:
|
|
40
|
+
print(line, flush=True)
|
|
41
|
+
|
|
42
|
+
def info(self, message):
|
|
43
|
+
self._record("INFO", message)
|
|
44
|
+
|
|
45
|
+
def debug(self, message):
|
|
46
|
+
self._record("DEBUG", message)
|
|
47
|
+
|
|
48
|
+
def warning(self, message):
|
|
49
|
+
self._record("WARNING", message)
|
|
50
|
+
|
|
51
|
+
def error(self, message):
|
|
52
|
+
self._record("ERROR", message)
|
|
53
|
+
|
|
54
|
+
def snapshot(self):
|
|
55
|
+
with self._lock:
|
|
56
|
+
return "\n".join(self._lines)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# ===== 一時調査ここまで =====
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class SmartLabGrpcCtrl(SmartLabCtrl):
|
|
63
|
+
"""ファイル保存の通信境界のみ変更し、他のAPIはそのまま継承する。"""
|
|
64
|
+
|
|
65
|
+
def __init__(
|
|
66
|
+
self,
|
|
67
|
+
logger: Optional[Any] = None,
|
|
68
|
+
log_level: Optional[str] = None,
|
|
69
|
+
) -> None:
|
|
70
|
+
if logger is None:
|
|
71
|
+
import logging
|
|
72
|
+
|
|
73
|
+
level = log_level or "INFO"
|
|
74
|
+
logging.basicConfig(level=level.upper())
|
|
75
|
+
logger = logging.getLogger(__name__)
|
|
76
|
+
|
|
77
|
+
self._logger = logger
|
|
78
|
+
super().__init__(logger=logger, log_level=log_level)
|
|
79
|
+
|
|
80
|
+
def capture_screenshot(self) -> bytes:
|
|
81
|
+
"""既存の撮影処理を呼び出し、追加の保存先を指定せずにPNGを取得する。"""
|
|
82
|
+
return super().capture_screenshot()
|
|
83
|
+
|
|
84
|
+
def export_data(
|
|
85
|
+
self,
|
|
86
|
+
filename: Optional[str] = None,
|
|
87
|
+
save: bool = False,
|
|
88
|
+
server_filename: Optional[str] = None,
|
|
89
|
+
graph: str = "2theta",
|
|
90
|
+
file_timeout_sec: float = 120.0,
|
|
91
|
+
server_overwrite: bool = False,
|
|
92
|
+
):
|
|
93
|
+
"""装置PCに保存したファイルをバイナリで返す。
|
|
94
|
+
|
|
95
|
+
filename は既存APIとの互換用。保存先は server_filename で指定する。
|
|
96
|
+
"""
|
|
97
|
+
if file_timeout_sec <= 0:
|
|
98
|
+
raise ValueError("file_timeout_secは正の数を指定してください")
|
|
99
|
+
if not save:
|
|
100
|
+
return super().export_data(filename=server_filename, save=False, graph=graph)
|
|
101
|
+
if server_filename is not None and not server_filename.strip():
|
|
102
|
+
raise ValueError("server_filenameが空です")
|
|
103
|
+
|
|
104
|
+
self._logger.info(
|
|
105
|
+
f"gRPC export_data開始: server_filename={server_filename!r}, graph={graph!r}, save={save}, server_overwrite={server_overwrite}"
|
|
106
|
+
)
|
|
107
|
+
try:
|
|
108
|
+
if server_filename is None:
|
|
109
|
+
with TemporaryDirectory(prefix="smartlab_export_") as directory:
|
|
110
|
+
requested = Path(directory) / "smartlab_export"
|
|
111
|
+
return self._export_data_read_file(
|
|
112
|
+
requested, graph, file_timeout_sec, server_overwrite
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
requested = Path(server_filename)
|
|
116
|
+
if not requested.parent.is_dir():
|
|
117
|
+
raise FileNotFoundError(
|
|
118
|
+
f"サーバー側保存ディレクトリがありません: {requested.parent}"
|
|
119
|
+
)
|
|
120
|
+
if requested.exists() and not requested.is_file():
|
|
121
|
+
raise IsADirectoryError(f"保存先が通常ファイルではありません: {requested}")
|
|
122
|
+
return self._export_data_read_file(
|
|
123
|
+
requested, graph, file_timeout_sec, server_overwrite
|
|
124
|
+
)
|
|
125
|
+
except Exception as exc:
|
|
126
|
+
self._logger.error(f"gRPC export_data失敗: {type(exc).__name__}: {exc}")
|
|
127
|
+
raise
|
|
128
|
+
|
|
129
|
+
def _export_data_read_file(
|
|
130
|
+
self, requested: Path, graph: str, file_timeout_sec: float, overwrite: bool
|
|
131
|
+
):
|
|
132
|
+
"""保存ダイアログが確定したファイルを特定し、バイナリで読み込む。"""
|
|
133
|
+
folder = requested.parent
|
|
134
|
+
before = {}
|
|
135
|
+
for path in folder.iterdir():
|
|
136
|
+
if path.is_file():
|
|
137
|
+
before[path.name] = (path.stat().st_size, path.stat().st_mtime_ns)
|
|
138
|
+
|
|
139
|
+
selected = super().export_data(
|
|
140
|
+
filename=str(requested), save=True, graph=graph, overwrite=overwrite
|
|
141
|
+
)
|
|
142
|
+
# ===== 一時調査: UIA調査時は起動以来のログをクライアントへ返す =====
|
|
143
|
+
if isinstance(selected, dict) and selected.get("_export_data_rightclick_diagnostic"):
|
|
144
|
+
self._logger.info("[右クリック調査] gRPC応答を作成")
|
|
145
|
+
return {
|
|
146
|
+
"_export_data_rightclick_diagnostic": True,
|
|
147
|
+
"server_log": self._logger.snapshot(),
|
|
148
|
+
}
|
|
149
|
+
# ===== 一時調査ここまで =====
|
|
150
|
+
self._logger.info(f"gRPC export_data: ローカルAPI戻り値={selected!r} (type={type(selected).__name__})")
|
|
151
|
+
if selected is False:
|
|
152
|
+
self._logger.info("gRPC export_data結果: False(GUIキャンセル。ファイル転送なし)")
|
|
153
|
+
return False
|
|
154
|
+
if selected is not True:
|
|
155
|
+
raise RuntimeError(f"ローカルexport_dataの戻り値が不正です: {selected!r}")
|
|
156
|
+
deadline = time.monotonic() + file_timeout_sec
|
|
157
|
+
self._logger.info(
|
|
158
|
+
f"エクスポートファイル生成待ち: timeout={file_timeout_sec}秒"
|
|
159
|
+
)
|
|
160
|
+
last_state = None
|
|
161
|
+
stable_since = None
|
|
162
|
+
while time.monotonic() < deadline:
|
|
163
|
+
candidates = []
|
|
164
|
+
for path in folder.iterdir():
|
|
165
|
+
if not path.is_file():
|
|
166
|
+
continue
|
|
167
|
+
if path.name != requested.name and path.stem != requested.stem:
|
|
168
|
+
continue
|
|
169
|
+
stat = path.stat()
|
|
170
|
+
state = (stat.st_size, stat.st_mtime_ns)
|
|
171
|
+
if before.get(path.name) == state:
|
|
172
|
+
continue
|
|
173
|
+
candidates.append((path, state))
|
|
174
|
+
if len(candidates) > 1:
|
|
175
|
+
raise RuntimeError("エクスポートファイルを一意に特定できません")
|
|
176
|
+
if candidates:
|
|
177
|
+
path, state = candidates[0]
|
|
178
|
+
current_state = (path.name, state)
|
|
179
|
+
if current_state == last_state:
|
|
180
|
+
if time.monotonic() - stable_since >= 2.0:
|
|
181
|
+
data = path.read_bytes()
|
|
182
|
+
# 読込中に更新された場合は完了とみなさず再待機する。
|
|
183
|
+
check = path.stat()
|
|
184
|
+
if (check.st_size, check.st_mtime_ns) != state:
|
|
185
|
+
last_state = None
|
|
186
|
+
stable_since = None
|
|
187
|
+
continue
|
|
188
|
+
self._logger.info(
|
|
189
|
+
f"gRPC export_data読込完了: {path} ({len(data)} bytes)"
|
|
190
|
+
)
|
|
191
|
+
return {"filename": path.name, "data": data}
|
|
192
|
+
else:
|
|
193
|
+
last_state = current_state
|
|
194
|
+
stable_since = time.monotonic()
|
|
195
|
+
time.sleep(0.1)
|
|
196
|
+
raise TimeoutError(
|
|
197
|
+
f"エクスポートファイルの生成を確認できません: {selected!r}"
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
class _ScreenshotStream:
|
|
203
|
+
"""COMスレッドで取得したPNGをgRPCワーカースレッドで分割する。"""
|
|
204
|
+
|
|
205
|
+
_CHUNK_SIZE = 256 * 1024
|
|
206
|
+
|
|
207
|
+
def __init__(self, ctrl: ThreadSafeCtrlProxy) -> None:
|
|
208
|
+
self._ctrl = ctrl
|
|
209
|
+
|
|
210
|
+
def capture_screenshot(self) -> Iterator[bytes]:
|
|
211
|
+
"""一度だけ撮影し、PNGのバイト列を順に送る。"""
|
|
212
|
+
data = self._ctrl.capture_screenshot()
|
|
213
|
+
for offset in range(0, len(data), self._CHUNK_SIZE):
|
|
214
|
+
yield data[offset : offset + self._CHUNK_SIZE]
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def smartlab_grpc_server(
|
|
218
|
+
*,
|
|
219
|
+
grpc_host: str,
|
|
220
|
+
grpc_port: int,
|
|
221
|
+
logger: Optional[Any] = None,
|
|
222
|
+
log_level: Optional[str] = None,
|
|
223
|
+
) -> None:
|
|
224
|
+
"""SmartLab Studio II の COM 対応 gRPC サーバーを起動する。"""
|
|
225
|
+
|
|
226
|
+
# ===== 一時調査: 起動時からのログ蓄積(削除対象) =====
|
|
227
|
+
if logger is None:
|
|
228
|
+
import logging
|
|
229
|
+
|
|
230
|
+
logging.basicConfig(level=(log_level or "INFO").upper())
|
|
231
|
+
logger = logging.getLogger(__name__)
|
|
232
|
+
logger = _ExportDiagnosticLog(logger)
|
|
233
|
+
# ===== 一時調査ここまで =====
|
|
234
|
+
|
|
235
|
+
def create_ctrl():
|
|
236
|
+
return SmartLabGrpcCtrl(logger=logger, log_level=log_level)
|
|
237
|
+
|
|
238
|
+
# grpc_frameのCOM用ファクトリにはstream_obj引数がないため、
|
|
239
|
+
# 同じCOMランナーとプロキシを使ってストリームを明示登録する。
|
|
240
|
+
runner = ComExecutionRunner(
|
|
241
|
+
ctrl_factory=create_ctrl,
|
|
242
|
+
logger=logger,
|
|
243
|
+
log_level=log_level,
|
|
244
|
+
)
|
|
245
|
+
address = str(grpc_host) + ":" + str(grpc_port)
|
|
246
|
+
server = None
|
|
247
|
+
try:
|
|
248
|
+
if not runner.wait_ready(timeout=10.0):
|
|
249
|
+
startup_error = runner.get_startup_error()
|
|
250
|
+
if startup_error:
|
|
251
|
+
raise RuntimeError(startup_error)
|
|
252
|
+
raise TimeoutError("ComExecutionRunner initialization timed out")
|
|
253
|
+
proxy = ThreadSafeCtrlProxy(runner)
|
|
254
|
+
|
|
255
|
+
server = create_grpc_server(
|
|
256
|
+
ctrl_obj=proxy,
|
|
257
|
+
stream_obj=_ScreenshotStream(proxy),
|
|
258
|
+
grpc_options=_GRPC_OPTIONS,
|
|
259
|
+
logger=logger,
|
|
260
|
+
log_level=log_level,
|
|
261
|
+
)
|
|
262
|
+
bound_port = server.add_insecure_port(address)
|
|
263
|
+
if bound_port == 0:
|
|
264
|
+
raise RuntimeError("gRPC server bind failed: " + address)
|
|
265
|
+
|
|
266
|
+
if logger is not None:
|
|
267
|
+
logger.info(f"SmartLab gRPC server listening: {address}")
|
|
268
|
+
|
|
269
|
+
server.start()
|
|
270
|
+
try:
|
|
271
|
+
server.wait_for_termination()
|
|
272
|
+
except KeyboardInterrupt:
|
|
273
|
+
if logger is not None:
|
|
274
|
+
logger.info("SmartLab gRPC server stop requested")
|
|
275
|
+
finally:
|
|
276
|
+
try:
|
|
277
|
+
if server is not None:
|
|
278
|
+
server.stop(grace=2)
|
|
279
|
+
finally:
|
|
280
|
+
runner.stop()
|
|
281
|
+
if logger is not None:
|
|
282
|
+
logger.info("SmartLab gRPC server shutdown completed")
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""SmartLab Studio II のGUI階層パスと要素識別子を保持する。"""
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
from typing import Dict, List, Tuple
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class SmartLabConfig:
|
|
10
|
+
"""UIA操作に使用するGUI構造の定義。UIAインスタンスは保持しない。"""
|
|
11
|
+
|
|
12
|
+
TARGET_TITLE: str = field(init=False)
|
|
13
|
+
ROOT_ID: str = field(init=False)
|
|
14
|
+
SCAN_ID: str = field(init=False)
|
|
15
|
+
SCAN_NAME: str = field(init=False)
|
|
16
|
+
BASIC_PATH: List[Tuple[str, str]] = field(init=False)
|
|
17
|
+
SCAN_GROUP_PATH: List[Tuple[str, str]] = field(init=False)
|
|
18
|
+
MOVE_GROUP_PATH: List[Tuple[str, str]] = field(init=False)
|
|
19
|
+
SLIT_GROUP_PATH: List[Tuple[str, str]] = field(init=False)
|
|
20
|
+
PATHS: Dict[str, Dict[str, Dict[str, List[Tuple[str, str]]]]] = field(init=False)
|
|
21
|
+
EXPORT_DATA_GRAPH_PATH: List[Tuple[str, str]] = field(init=False)
|
|
22
|
+
DIALOG_NAME: str = field(init=False)
|
|
23
|
+
STOP_ID: str = field(init=False)
|
|
24
|
+
PARAMETER_PATH_KEYS: Dict[str, Tuple[str, str]] = field(init=False)
|
|
25
|
+
|
|
26
|
+
def __post_init__(self) -> None:
|
|
27
|
+
"""確認済みのGUI階層定義を構築する。"""
|
|
28
|
+
self.TARGET_TITLE = "SmartLab Studio II"
|
|
29
|
+
self.ROOT_ID = "mainShellWindow"
|
|
30
|
+
self.SCAN_ID = "Manual_ButtonScan"
|
|
31
|
+
self.SCAN_NAME = "スキャン"
|
|
32
|
+
|
|
33
|
+
# Z軸選択時の「基本」タブ内 ScrollViewer までの共通経路。
|
|
34
|
+
# ここからスキャン条件・軸移動条件・スリット条件に分岐する。
|
|
35
|
+
# AutomationId が空の ScrollViewer のみ ClassName で検索する。
|
|
36
|
+
self.BASIC_PATH = [
|
|
37
|
+
("AutomationId", "barManager1"),
|
|
38
|
+
("AutomationId", "dockManager"),
|
|
39
|
+
("AutomationId", "layoutGroup"),
|
|
40
|
+
("AutomationId", "documentContainer"),
|
|
41
|
+
("AutomationId", "XRD_Measurement"),
|
|
42
|
+
("AutomationId", "icPluginModule"),
|
|
43
|
+
("AutomationId", "DXTabControlICPluginSubTabs"),
|
|
44
|
+
("AutomationId", "DXTabItemMeasurement"),
|
|
45
|
+
("AutomationId", "DockContainer"),
|
|
46
|
+
("AutomationId", "dockItem1"),
|
|
47
|
+
("AutomationId", "dockItem3"),
|
|
48
|
+
("AutomationId", "dockItem4"),
|
|
49
|
+
("AutomationId", "manualTab"),
|
|
50
|
+
("AutomationId", "proControl"),
|
|
51
|
+
("AutomationId", "DXTabControlManualtab"),
|
|
52
|
+
("AutomationId", "DXTabItemManual_LabelStandardBar"),
|
|
53
|
+
("AutomationId", "basicCtrl"),
|
|
54
|
+
("ClassName", "ScrollViewer"),
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
# UIAパスの末尾を画面上の条件グループ単位で定義する。
|
|
58
|
+
# 末尾の要素名は、19.py の調査で取得した AutomationId に対応する。
|
|
59
|
+
self.SCAN_GROUP_PATH = self.BASIC_PATH + [("AutomationId", "Manual_LabelScanBar")]
|
|
60
|
+
self.MOVE_GROUP_PATH = self.BASIC_PATH + [("AutomationId", "Manual_LabelMoveBar")]
|
|
61
|
+
self.SLIT_GROUP_PATH = self.BASIC_PATH + [("AutomationId", "Manual_LabelSlitBar")]
|
|
62
|
+
|
|
63
|
+
# 各公開 getter / setter が参照する要素への確認済み経路。
|
|
64
|
+
# UIAの階層構造をここに集約し、操作メソッドからパスを分離する。
|
|
65
|
+
self.PATHS = {
|
|
66
|
+
"Z": {
|
|
67
|
+
"scan": {
|
|
68
|
+
# 「スキャン条件」の「スキャン」ボタン
|
|
69
|
+
"button": (self.SCAN_GROUP_PATH + [("AutomationId", "Manual_ButtonScan")]),
|
|
70
|
+
# 「スキャン条件」の「絶対指定」
|
|
71
|
+
"absolute_scan": (
|
|
72
|
+
self.SCAN_GROUP_PATH
|
|
73
|
+
+ [("AutomationId", "Manual_RadioButtonAbsoluteScan")]
|
|
74
|
+
),
|
|
75
|
+
# 「スキャン条件」の「相対指定」
|
|
76
|
+
"relative_scan": (
|
|
77
|
+
self.SCAN_GROUP_PATH
|
|
78
|
+
+ [("AutomationId", "Manual_RadioButtonRelativeScan")]
|
|
79
|
+
),
|
|
80
|
+
# 「スキャン条件」の「スキャンモード」
|
|
81
|
+
"scan_mode": (
|
|
82
|
+
self.SCAN_GROUP_PATH + [("AutomationId", "Manual_ComboBoxScanMode")]
|
|
83
|
+
),
|
|
84
|
+
# 「スキャン条件」の「開始」
|
|
85
|
+
"start": (self.SCAN_GROUP_PATH + [("AutomationId", "Manual_TextBoxStart")]),
|
|
86
|
+
# 「スキャン条件」の「終了」
|
|
87
|
+
"stop_position": (
|
|
88
|
+
self.SCAN_GROUP_PATH + [("AutomationId", "Manual_TextBoxStop")]
|
|
89
|
+
),
|
|
90
|
+
# 「スキャン条件」の「ステップ」
|
|
91
|
+
"step": (self.SCAN_GROUP_PATH + [("AutomationId", "Manual_TextBoxStep")]),
|
|
92
|
+
# 「スキャン条件」の「スピード」
|
|
93
|
+
"speed": (
|
|
94
|
+
self.SCAN_GROUP_PATH + [("AutomationId", "Manual_TextBoxSpeedTimeCount")]
|
|
95
|
+
),
|
|
96
|
+
},
|
|
97
|
+
"move": {
|
|
98
|
+
# 「軸移動条件」の「移動先」
|
|
99
|
+
"move_to": (
|
|
100
|
+
self.MOVE_GROUP_PATH + [("AutomationId", "Manual_TextBoxMoveTo")]
|
|
101
|
+
),
|
|
102
|
+
# 「軸移動条件」の「ステップ」
|
|
103
|
+
"move_step": (
|
|
104
|
+
self.MOVE_GROUP_PATH + [("AutomationId", "Manual_TextBoxMoveStep")]
|
|
105
|
+
),
|
|
106
|
+
},
|
|
107
|
+
"slit": {
|
|
108
|
+
# 「スリット条件」の「スリット」
|
|
109
|
+
"slit": (self.SLIT_GROUP_PATH + [("AutomationId", "Manual_ComboBoxSlit")]),
|
|
110
|
+
# 「スリット条件」の「リストから選択」
|
|
111
|
+
"slit_list": (
|
|
112
|
+
self.SLIT_GROUP_PATH + [("AutomationId", "Manual_ComboBoxSlitList")]
|
|
113
|
+
),
|
|
114
|
+
# 「スリット条件」の「数値を入力」
|
|
115
|
+
"slit_width": (
|
|
116
|
+
self.SLIT_GROUP_PATH + [("AutomationId", "Manual_TextBoxSlitWidth")]
|
|
117
|
+
),
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
# 24番のUIA調査で確認したディスプレイエリア内の2θ/θグラフ経路。
|
|
123
|
+
self.EXPORT_DATA_GRAPH_PATH = [
|
|
124
|
+
("AutomationId", "barManager1"),
|
|
125
|
+
("AutomationId", "dockManager"),
|
|
126
|
+
("AutomationId", "layoutGroup"),
|
|
127
|
+
("AutomationId", "documentContainer"),
|
|
128
|
+
("AutomationId", "XRD_Measurement"),
|
|
129
|
+
("AutomationId", "icPluginModule"),
|
|
130
|
+
("AutomationId", "DXTabControlICPluginSubTabs"),
|
|
131
|
+
("AutomationId", "DXTabItemMeasurement"),
|
|
132
|
+
("AutomationId", "DockContainer"),
|
|
133
|
+
("AutomationId", "dockItem1"),
|
|
134
|
+
("AutomationId", "dockItem3"),
|
|
135
|
+
("AutomationId", "DisplayAreaPanel"),
|
|
136
|
+
("ClassName", "DisplayArea"),
|
|
137
|
+
("AutomationId", "dockManager"),
|
|
138
|
+
("AutomationId", "documentLayoutGroup"),
|
|
139
|
+
("AutomationId", "documentContainer"),
|
|
140
|
+
("AutomationId", "TwoThetaTheta"),
|
|
141
|
+
("ClassName", "ScrollViewer"),
|
|
142
|
+
("AutomationId", "graphCtrl"),
|
|
143
|
+
("AutomationId", "chartControl"),
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
# 26番のタブ切り替え調査で確認した、両グラフとタブの固定階層。
|
|
147
|
+
self.EXPORT_DATA_GRAPH_PATHS = {
|
|
148
|
+
"2theta": self.EXPORT_DATA_GRAPH_PATH[:16] + [
|
|
149
|
+
("AutomationId", "TwoTheta"),
|
|
150
|
+
("ClassName", "ScrollViewer"),
|
|
151
|
+
("AutomationId", "graphCtrl"),
|
|
152
|
+
("AutomationId", "chartControl"),
|
|
153
|
+
],
|
|
154
|
+
"2theta/theta": self.EXPORT_DATA_GRAPH_PATH,
|
|
155
|
+
}
|
|
156
|
+
self.EXPORT_DATA_TAB_PATHS = {
|
|
157
|
+
"2theta": self.EXPORT_DATA_GRAPH_PATH[:16] + [
|
|
158
|
+
("AutomationId", "TabHeadersPanel"),
|
|
159
|
+
("AutomationId", "TwoThetaTabId"),
|
|
160
|
+
],
|
|
161
|
+
"2theta/theta": self.EXPORT_DATA_GRAPH_PATH[:16] + [
|
|
162
|
+
("AutomationId", "TabHeadersPanel"),
|
|
163
|
+
("AutomationId", "TwoThetaThetaTabId"),
|
|
164
|
+
],
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
# 2026-11-20の右クリックUIA調査で確認した第1段階メニューの固定階層。
|
|
168
|
+
# mainShellWindowを起点とする。第2段階は現行の探索方式を維持する。
|
|
169
|
+
self.EXPORT_DATA_MENU_PATH = [
|
|
170
|
+
("ClassName", "Popup"),
|
|
171
|
+
("AutomationId", "contextMenu"),
|
|
172
|
+
("AutomationId", "contextMenuItem_Export"),
|
|
173
|
+
]
|
|
174
|
+
|
|
175
|
+
# 20・27・28・29番のUIA調査で確認したダイアログ内の固定階層。
|
|
176
|
+
# 各経路は exportDataWindow を起点とする(ルート直下ではない)。
|
|
177
|
+
self.EXPORT_DATA_DIALOG_PATHS = {
|
|
178
|
+
"export_button": [("AutomationId", "exportBtn")],
|
|
179
|
+
"save_dialog": [("ClassName", "#32770")],
|
|
180
|
+
"filename_edit": [
|
|
181
|
+
("ClassName", "#32770"),
|
|
182
|
+
("ClassName", "DUIViewWndClassName"),
|
|
183
|
+
("AutomationId", "FileNameControlHost"),
|
|
184
|
+
("AutomationId", "1001"),
|
|
185
|
+
],
|
|
186
|
+
"save_button": [
|
|
187
|
+
("ClassName", "#32770"), ("AutomationId", "1")
|
|
188
|
+
],
|
|
189
|
+
"confirmation": [
|
|
190
|
+
("ClassName", "#32770"), ("ClassName", "#32770")
|
|
191
|
+
],
|
|
192
|
+
"confirmation_message": [
|
|
193
|
+
("ClassName", "#32770"), ("ClassName", "#32770"),
|
|
194
|
+
("AutomationId", "65535"),
|
|
195
|
+
],
|
|
196
|
+
"confirmation_yes": [
|
|
197
|
+
("ClassName", "#32770"), ("ClassName", "#32770"),
|
|
198
|
+
("AutomationId", "6"),
|
|
199
|
+
],
|
|
200
|
+
"confirmation_no": [
|
|
201
|
+
("ClassName", "#32770"), ("ClassName", "#32770"),
|
|
202
|
+
("AutomationId", "7"),
|
|
203
|
+
],
|
|
204
|
+
"save_cancel": [
|
|
205
|
+
("ClassName", "#32770"), ("AutomationId", "2")
|
|
206
|
+
],
|
|
207
|
+
"export_close": [("AutomationId", "PART_CloseButton")],
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
# 測定中ダイアログはメイン画面内の見出しから探索する。
|
|
211
|
+
# スキャン条件の入力欄とは異なり、固定階層パスでは管理しない。
|
|
212
|
+
self.DIALOG_NAME = "装置制御中"
|
|
213
|
+
self.STOP_ID = "HWStatus_ButtonStop"
|
|
214
|
+
|
|
215
|
+
# AutomationId と PATHS 内の (条件グループ, フィールド名) の対応表。
|
|
216
|
+
# 取得・設定処理が同じ定義を参照し、二重管理を防ぐ。
|
|
217
|
+
self.PARAMETER_PATH_KEYS = {
|
|
218
|
+
"Manual_RadioButtonAbsoluteScan": ("scan", "absolute_scan"),
|
|
219
|
+
"Manual_RadioButtonRelativeScan": ("scan", "relative_scan"),
|
|
220
|
+
"Manual_ComboBoxScanMode": ("scan", "scan_mode"),
|
|
221
|
+
"Manual_TextBoxStart": ("scan", "start"),
|
|
222
|
+
"Manual_TextBoxStop": ("scan", "stop_position"),
|
|
223
|
+
"Manual_TextBoxStep": ("scan", "step"),
|
|
224
|
+
"Manual_TextBoxSpeedTimeCount": ("scan", "speed"),
|
|
225
|
+
"Manual_TextBoxMoveTo": ("move", "move_to"),
|
|
226
|
+
"Manual_TextBoxMoveStep": ("move", "move_step"),
|
|
227
|
+
"Manual_ComboBoxSlit": ("slit", "slit"),
|
|
228
|
+
"Manual_ComboBoxSlitList": ("slit", "slit_list"),
|
|
229
|
+
"Manual_TextBoxSlitWidth": ("slit", "slit_width"),
|
|
230
|
+
}
|
|
231
|
+
|