mbu-dev-shared-components 4.4.1__tar.gz → 4.4.2__tar.gz
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.
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/PKG-INFO +1 -1
- mbu_dev_shared_components-4.4.2/mbu_dev_shared_components/solteqtand/application/event.py +111 -0
- mbu_dev_shared_components-4.4.2/mbu_dev_shared_components/solteqtand/application/journal_note.py +212 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components.egg-info/PKG-INFO +1 -1
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/pyproject.toml +1 -1
- mbu_dev_shared_components-4.4.1/mbu_dev_shared_components/solteqtand/application/event.py +0 -51
- mbu_dev_shared_components-4.4.1/mbu_dev_shared_components/solteqtand/application/journal_note.py +0 -38
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/LICENSE +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/README.md +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/database/__init__.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/database/connection.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/database/constants.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/database/logging.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/database/utility.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/getorganized/__init__.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/getorganized/api.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/getorganized/auth.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/getorganized/cases.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/getorganized/contacts.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/getorganized/documents.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/getorganized/objects.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/google/__init__.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/google/api/__init__.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/google/api/auth.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/google/workspace/__init__.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/google/workspace/alerts.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/msoffice365/__init__.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/msoffice365/excel/__init__.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/msoffice365/excel/excel_reader.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/msoffice365/sharepoint_api/__init__.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/msoffice365/sharepoint_api/files.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/os2forms/__init__.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/os2forms/documents.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/os2forms/forms.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/romexis/__init__.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/romexis/db_handler.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/romexis/helper_functions.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/sap/__init__.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/sap/create_invoice.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/solteqtand/__init__.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/solteqtand/application/__init__.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/solteqtand/application/aftalebog.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/solteqtand/application/app_handler.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/solteqtand/application/appointment.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/solteqtand/application/base_ui.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/solteqtand/application/clinic.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/solteqtand/application/document.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/solteqtand/application/edi_portal.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/solteqtand/application/exceptions.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/solteqtand/application/handler_base.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/solteqtand/application/patient.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/solteqtand/database/__init__.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/solteqtand/database/db_handler.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/utils/__init__.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/utils/db_stored_procedure_executor.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/utils/fernet_encryptor.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/utils/file_handler.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components/utils/json_handler.py +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components.egg-info/SOURCES.txt +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components.egg-info/dependency_links.txt +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components.egg-info/requires.txt +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/mbu_dev_shared_components.egg-info/top_level.txt +0 -0
- {mbu_dev_shared_components-4.4.1 → mbu_dev_shared_components-4.4.2}/setup.cfg +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"""Module for handling events in the Solteq Tand application."""
|
|
2
|
+
|
|
3
|
+
import time
|
|
4
|
+
|
|
5
|
+
import uiautomation as auto
|
|
6
|
+
|
|
7
|
+
from .handler_base import HandlerBase
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class EventHandler(HandlerBase):
|
|
11
|
+
"""
|
|
12
|
+
Handles “Hændelser” under “Stamkort”—specifically processes “Afgang til klinik 751”.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def process_event(self):
|
|
16
|
+
"""
|
|
17
|
+
Processes the event 'Afgang til klinik 751' under the 'Stamkort' tab.
|
|
18
|
+
"""
|
|
19
|
+
try:
|
|
20
|
+
self.open_tab("Stamkort")
|
|
21
|
+
self.open_sub_tab("Hændelser")
|
|
22
|
+
|
|
23
|
+
list_view = self.wait_for_control(
|
|
24
|
+
auto.ListControl, {"AutomationId": "ListView1"}, search_depth=9
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
target_values = {"Afgang til klinik 751", "Stamklinik afgang", "Nej"}
|
|
28
|
+
for item in list_view.GetChildren():
|
|
29
|
+
if item.ControlType == auto.ControlType.ListItemControl:
|
|
30
|
+
sub_items = [sub.Name for sub in item.GetChildren()]
|
|
31
|
+
if target_values.issubset(set(sub_items)):
|
|
32
|
+
matching_row = item
|
|
33
|
+
break
|
|
34
|
+
|
|
35
|
+
if matching_row:
|
|
36
|
+
if (
|
|
37
|
+
matching_row.GetPattern(auto.PatternId.TogglePattern).ToggleState
|
|
38
|
+
== 0
|
|
39
|
+
):
|
|
40
|
+
matching_row.GetPattern(auto.PatternId.TogglePattern).Toggle()
|
|
41
|
+
process_button = self.wait_for_control(
|
|
42
|
+
auto.ButtonControl, {"Name": "Afvikl"}, search_depth=10
|
|
43
|
+
)
|
|
44
|
+
process_button.GetLegacyIAccessiblePattern().DoDefaultAction()
|
|
45
|
+
create_administrative_note_popup = self.wait_for_control(
|
|
46
|
+
auto.WindowControl,
|
|
47
|
+
{"Name": "Opret administrativt notat"},
|
|
48
|
+
search_depth=3,
|
|
49
|
+
)
|
|
50
|
+
create_administrative_note_popup.ButtonControl(
|
|
51
|
+
Name="Nej"
|
|
52
|
+
).GetLegacyIAccessiblePattern().DoDefaultAction()
|
|
53
|
+
print("Event processed")
|
|
54
|
+
except Exception as e:
|
|
55
|
+
print(f"Error while processing event: {e}")
|
|
56
|
+
raise
|
|
57
|
+
|
|
58
|
+
def create_new_event(self, clinic_name: str, event_text: str):
|
|
59
|
+
"""
|
|
60
|
+
Opens and creates a new event for the patient
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
try:
|
|
64
|
+
functions_button = self.find_element_by_property(
|
|
65
|
+
control=self.app_window,
|
|
66
|
+
control_type=auto.ControlType.MenuItemControl,
|
|
67
|
+
name="Funktioner",
|
|
68
|
+
)
|
|
69
|
+
functions_button.Click(simulateMove=False, waitTime=0)
|
|
70
|
+
|
|
71
|
+
henvis_patient_button = self.find_element_by_property(
|
|
72
|
+
control=self.app_window,
|
|
73
|
+
control_type=auto.ControlType.MenuItemControl,
|
|
74
|
+
name="Henvis patient",
|
|
75
|
+
)
|
|
76
|
+
henvis_patient_button.Click(simulateMove=False, waitTime=0)
|
|
77
|
+
|
|
78
|
+
time.sleep(1)
|
|
79
|
+
|
|
80
|
+
# --- Wait for Find Klinik window ---
|
|
81
|
+
clinic_window = self.wait_for_control(
|
|
82
|
+
auto.WindowControl, {"AutomationId": "FormFindClinics"}, search_depth=5
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
time.sleep(1)
|
|
86
|
+
|
|
87
|
+
# --- Focus the clinic list ---
|
|
88
|
+
list_control = clinic_window.ListControl(AutomationId="ListClinics")
|
|
89
|
+
list_control.SetFocus()
|
|
90
|
+
|
|
91
|
+
# Small delay to avoid sending keys too early
|
|
92
|
+
time.sleep(2)
|
|
93
|
+
|
|
94
|
+
# --- Fast selection: type name + ENTER ---
|
|
95
|
+
list_control.SendKeys(clinic_name + "{ENTER}")
|
|
96
|
+
|
|
97
|
+
# Optional: wait a moment to ensure dialog closes
|
|
98
|
+
time.sleep(1)
|
|
99
|
+
|
|
100
|
+
# --- Fast selection: type name + ENTER ---
|
|
101
|
+
list_control.SendKeys(event_text + "{ENTER}")
|
|
102
|
+
|
|
103
|
+
dialog_ok_button = self.wait_for_control(
|
|
104
|
+
auto.ButtonControl, {"Name": "OK"}, search_depth=50
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
dialog_ok_button.GetInvokePattern().Invoke()
|
|
108
|
+
|
|
109
|
+
except Exception as e:
|
|
110
|
+
print(f"Error while opening EDI Portal: {e}")
|
|
111
|
+
raise e
|
mbu_dev_shared_components-4.4.2/mbu_dev_shared_components/solteqtand/application/journal_note.py
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"""Module for handling journal notes in the Solteq Tand application."""
|
|
2
|
+
|
|
3
|
+
import time
|
|
4
|
+
|
|
5
|
+
import uiautomation as auto
|
|
6
|
+
|
|
7
|
+
from .handler_base import HandlerBase
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class JournalNoteHandler(HandlerBase):
|
|
11
|
+
"""
|
|
12
|
+
Handles the processing of journal notes in the Solteq Tand application.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def create_journal_note(self, note_message: str, checkmark_in_complete: bool):
|
|
16
|
+
"""
|
|
17
|
+
Creates a journal note for the given patient.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
note_message (str): The note message.
|
|
21
|
+
checkmark_in_complete (bool): Checks the checkmark in 'Afslut'.
|
|
22
|
+
"""
|
|
23
|
+
self.open_tab("Journal")
|
|
24
|
+
|
|
25
|
+
self.wait_for_control(
|
|
26
|
+
auto.DocumentControl, {"AutomationId": "RichTextBoxInput"}, search_depth=21
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
input_box = self.app_window.DocumentControl(AutomationId="RichTextBoxInput")
|
|
30
|
+
input_box_value_pattern = input_box.GetValuePattern()
|
|
31
|
+
input_box_value_pattern.SetValue(value=note_message, waitTime=0)
|
|
32
|
+
|
|
33
|
+
if checkmark_in_complete:
|
|
34
|
+
checkbox = self.app_window.CheckBoxControl(
|
|
35
|
+
AutomationId="CheckBoxAssignCompletionStatus"
|
|
36
|
+
)
|
|
37
|
+
checkbox.SetFocus()
|
|
38
|
+
checkbox.Click(simulateMove=False, waitTime=0)
|
|
39
|
+
|
|
40
|
+
save_button = self.app_window.PaneControl(AutomationId="buttonSave")
|
|
41
|
+
save_button.SetFocus()
|
|
42
|
+
save_button.Click(simulateMove=False, waitTime=0)
|
|
43
|
+
|
|
44
|
+
def _set_checkbox_state(self, checkbox_control, target_state: int) -> None:
|
|
45
|
+
"""Ensures checkbox toggle state is exactly 0 (off) or 1 (on)."""
|
|
46
|
+
if target_state not in (0, 1):
|
|
47
|
+
raise ValueError(f"Invalid target_state={target_state!r}, expected 0 or 1")
|
|
48
|
+
|
|
49
|
+
toggle_pattern = checkbox_control.GetPattern(auto.PatternId.TogglePattern)
|
|
50
|
+
if toggle_pattern is None:
|
|
51
|
+
raise RuntimeError("TogglePattern is not available on checkbox control")
|
|
52
|
+
|
|
53
|
+
for _ in range(3):
|
|
54
|
+
current_state = toggle_pattern.ToggleState
|
|
55
|
+
if current_state == target_state:
|
|
56
|
+
return
|
|
57
|
+
toggle_pattern.Toggle()
|
|
58
|
+
time.sleep(0.05)
|
|
59
|
+
|
|
60
|
+
final_state = toggle_pattern.ToggleState
|
|
61
|
+
if final_state != target_state:
|
|
62
|
+
raise RuntimeError(
|
|
63
|
+
f"Failed to set checkbox state to {target_state}, current={final_state}"
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
def _activate_journal_row(self, row_item, list_control) -> None:
|
|
67
|
+
"""Attempts multiple UIA strategies to bring a row into view and select it."""
|
|
68
|
+
row_item.SetFocus()
|
|
69
|
+
|
|
70
|
+
# Try ScrollItemPattern if available.
|
|
71
|
+
try:
|
|
72
|
+
scroll_item_pattern = row_item.GetScrollItemPattern()
|
|
73
|
+
if scroll_item_pattern is not None:
|
|
74
|
+
scroll_item_pattern.ScrollIntoView()
|
|
75
|
+
except Exception:
|
|
76
|
+
pass
|
|
77
|
+
|
|
78
|
+
# Fallback for controls exposing an explicit ScrollIntoView method.
|
|
79
|
+
if hasattr(row_item, "ScrollIntoView"):
|
|
80
|
+
try:
|
|
81
|
+
row_item.ScrollIntoView()
|
|
82
|
+
except Exception:
|
|
83
|
+
pass
|
|
84
|
+
|
|
85
|
+
# Try SelectionItemPattern to select the row, which may also scroll it into view.
|
|
86
|
+
try:
|
|
87
|
+
selection_item_pattern = row_item.GetSelectionItemPattern()
|
|
88
|
+
if selection_item_pattern is not None:
|
|
89
|
+
selection_item_pattern.Select()
|
|
90
|
+
except Exception:
|
|
91
|
+
pass
|
|
92
|
+
|
|
93
|
+
# Ensure list focus before click fallback.
|
|
94
|
+
try:
|
|
95
|
+
list_control.SetFocus()
|
|
96
|
+
except Exception:
|
|
97
|
+
pass
|
|
98
|
+
|
|
99
|
+
row_item.DoubleClick(simulateMove=False, waitTime=0)
|
|
100
|
+
|
|
101
|
+
def create_journal_sub_note(
|
|
102
|
+
self,
|
|
103
|
+
parent_note_type: str,
|
|
104
|
+
parent_note_message: str,
|
|
105
|
+
note_message: str,
|
|
106
|
+
checkmark_in_complete: bool,
|
|
107
|
+
):
|
|
108
|
+
"""Creates a sub note to an existing journal note in SolteqTand."""
|
|
109
|
+
self.open_tab("Journal")
|
|
110
|
+
|
|
111
|
+
self.wait_for_control(
|
|
112
|
+
auto.ListControl, {"AutomationId": "listViewTasks"}, search_depth=21
|
|
113
|
+
)
|
|
114
|
+
journal_note_list = self.app_window.ListControl(AutomationId="listViewTasks")
|
|
115
|
+
journal_note_list.SetFocus()
|
|
116
|
+
|
|
117
|
+
def _norm(value: str) -> str:
|
|
118
|
+
normalized = (value or "").strip().casefold()
|
|
119
|
+
normalized = normalized.strip("'\"`´")
|
|
120
|
+
normalized = " ".join(normalized.split())
|
|
121
|
+
return normalized
|
|
122
|
+
|
|
123
|
+
wanted_type = _norm(parent_note_type)
|
|
124
|
+
wanted_text = _norm(parent_note_message)
|
|
125
|
+
|
|
126
|
+
parent_note_item = None
|
|
127
|
+
timeout_seconds = 30
|
|
128
|
+
poll_seconds = 0.5
|
|
129
|
+
deadline = time.monotonic() + timeout_seconds
|
|
130
|
+
|
|
131
|
+
while time.monotonic() < deadline and parent_note_item is None:
|
|
132
|
+
for item in journal_note_list.GetChildren():
|
|
133
|
+
try:
|
|
134
|
+
note_type_raw = ""
|
|
135
|
+
sub_note_col_raw = ""
|
|
136
|
+
note_text_raw = ""
|
|
137
|
+
|
|
138
|
+
grid_pattern = None
|
|
139
|
+
try:
|
|
140
|
+
grid_pattern = item.GetGridPattern()
|
|
141
|
+
except AttributeError:
|
|
142
|
+
pass
|
|
143
|
+
|
|
144
|
+
if grid_pattern is not None:
|
|
145
|
+
note_type_raw = grid_pattern.GetItem(0, 3).Name
|
|
146
|
+
sub_note_col_raw = grid_pattern.GetItem(0, 5).Name
|
|
147
|
+
note_text_raw = grid_pattern.GetItem(0, 7).Name
|
|
148
|
+
else:
|
|
149
|
+
child_cells = [
|
|
150
|
+
(getattr(child, "Name", "") or "").strip()
|
|
151
|
+
for child in item.GetChildren()
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
if len(child_cells) > 7:
|
|
155
|
+
note_type_raw = child_cells[3]
|
|
156
|
+
sub_note_col_raw = child_cells[5]
|
|
157
|
+
note_text_raw = child_cells[7]
|
|
158
|
+
else:
|
|
159
|
+
continue
|
|
160
|
+
|
|
161
|
+
note_type = _norm(note_type_raw)
|
|
162
|
+
sub_note_col = _norm(sub_note_col_raw)
|
|
163
|
+
note_text = _norm(note_text_raw)
|
|
164
|
+
|
|
165
|
+
except Exception:
|
|
166
|
+
continue
|
|
167
|
+
|
|
168
|
+
if (
|
|
169
|
+
note_type == wanted_type
|
|
170
|
+
and sub_note_col in ("", "-")
|
|
171
|
+
and note_text == wanted_text
|
|
172
|
+
):
|
|
173
|
+
parent_note_item = item
|
|
174
|
+
break
|
|
175
|
+
|
|
176
|
+
if parent_note_item is None:
|
|
177
|
+
time.sleep(poll_seconds)
|
|
178
|
+
|
|
179
|
+
if parent_note_item is None:
|
|
180
|
+
raise ValueError(
|
|
181
|
+
f"Parent note not found within {timeout_seconds}s "
|
|
182
|
+
f"(type='{parent_note_type}', message='{parent_note_message}')"
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
self._activate_journal_row(parent_note_item, journal_note_list)
|
|
186
|
+
|
|
187
|
+
pop_up_window = self.wait_for_control(
|
|
188
|
+
auto.WindowControl,
|
|
189
|
+
{"AutomationId": "ToolContextWrapperUI"},
|
|
190
|
+
search_depth=50,
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
input_box = pop_up_window.DocumentControl(AutomationId="RichTextBoxInput")
|
|
194
|
+
input_box_value_pattern = input_box.GetValuePattern()
|
|
195
|
+
input_box_value_pattern.SetValue(value=f"{note_message}", waitTime=0)
|
|
196
|
+
|
|
197
|
+
checkbox = pop_up_window.CheckBoxControl(
|
|
198
|
+
AutomationId="CheckBoxAssignCompletionStatus"
|
|
199
|
+
)
|
|
200
|
+
self._set_checkbox_state(
|
|
201
|
+
checkbox, target_state=1 if checkmark_in_complete else 0
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
save_button = pop_up_window.PaneControl(AutomationId="&Gem")
|
|
205
|
+
if not save_button.IsEnabled:
|
|
206
|
+
raise RuntimeError("Save button is not enabled")
|
|
207
|
+
save_button.Click(simulateMove=False, waitTime=0)
|
|
208
|
+
|
|
209
|
+
close_button = pop_up_window.PaneControl(AutomationId="&Luk")
|
|
210
|
+
if not close_button.IsEnabled:
|
|
211
|
+
raise RuntimeError("Close button is not enabled")
|
|
212
|
+
close_button.Click(simulateMove=False, waitTime=0)
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import uiautomation as auto
|
|
2
|
-
|
|
3
|
-
from .handler_base import HandlerBase
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class EventHandler(HandlerBase):
|
|
7
|
-
"""
|
|
8
|
-
Handles “Hændelser” under “Stamkort”—specifically processes “Afgang til klinik 751”.
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
def process_event(self):
|
|
12
|
-
"""
|
|
13
|
-
Processes the event 'Afgang til klinik 751' under the 'Stamkort' tab.
|
|
14
|
-
"""
|
|
15
|
-
try:
|
|
16
|
-
self.open_tab("Stamkort")
|
|
17
|
-
self.open_sub_tab("Hændelser")
|
|
18
|
-
|
|
19
|
-
list_view = self.wait_for_control(
|
|
20
|
-
auto.ListControl,
|
|
21
|
-
{"AutomationId": "ListView1"},
|
|
22
|
-
search_depth=9
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
target_values = {"Afgang til klinik 751", "Stamklinik afgang", "Nej"}
|
|
26
|
-
for item in list_view.GetChildren():
|
|
27
|
-
if item.ControlType == auto.ControlType.ListItemControl:
|
|
28
|
-
sub_items = [sub.Name for sub in item.GetChildren()]
|
|
29
|
-
if target_values.issubset(set(sub_items)):
|
|
30
|
-
matching_row = item
|
|
31
|
-
break
|
|
32
|
-
|
|
33
|
-
if matching_row:
|
|
34
|
-
if matching_row.GetPattern(auto.PatternId.TogglePattern).ToggleState == 0:
|
|
35
|
-
matching_row.GetPattern(auto.PatternId.TogglePattern).Toggle()
|
|
36
|
-
process_button = self.wait_for_control(
|
|
37
|
-
auto.ButtonControl,
|
|
38
|
-
{"Name": "Afvikl"},
|
|
39
|
-
search_depth=10
|
|
40
|
-
)
|
|
41
|
-
process_button.GetLegacyIAccessiblePattern().DoDefaultAction()
|
|
42
|
-
create_administrative_note_popup = self.wait_for_control(
|
|
43
|
-
auto.WindowControl,
|
|
44
|
-
{"Name": "Opret administrativt notat"},
|
|
45
|
-
search_depth=3
|
|
46
|
-
)
|
|
47
|
-
create_administrative_note_popup.ButtonControl(Name="Nej").GetLegacyIAccessiblePattern().DoDefaultAction()
|
|
48
|
-
print("Event processed")
|
|
49
|
-
except Exception as e:
|
|
50
|
-
print(f"Error while processing event: {e}")
|
|
51
|
-
raise
|
mbu_dev_shared_components-4.4.1/mbu_dev_shared_components/solteqtand/application/journal_note.py
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import uiautomation as auto
|
|
2
|
-
|
|
3
|
-
from .handler_base import HandlerBase
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class JournalNoteHandler(HandlerBase):
|
|
7
|
-
"""
|
|
8
|
-
Handles the processing of journal notes in the Solteq Tand application.
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
def create_journal_note(self, note_message: str, checkmark_in_complete: bool):
|
|
12
|
-
"""
|
|
13
|
-
Creates a journal note for the given patient.
|
|
14
|
-
|
|
15
|
-
Args:
|
|
16
|
-
note_message (str): The note message.
|
|
17
|
-
checkmark_in_complete (bool): Checks the checkmark in 'Afslut'.
|
|
18
|
-
"""
|
|
19
|
-
self.open_tab("Journal")
|
|
20
|
-
|
|
21
|
-
self.wait_for_control(
|
|
22
|
-
auto.DocumentControl,
|
|
23
|
-
{"AutomationId": "RichTextBoxInput"},
|
|
24
|
-
search_depth=21
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
input_box = self.app_window.DocumentControl(AutomationId="RichTextBoxInput")
|
|
28
|
-
input_box_value_pattern = input_box.GetValuePattern()
|
|
29
|
-
input_box_value_pattern.SetValue(value=note_message, waitTime=0)
|
|
30
|
-
|
|
31
|
-
if checkmark_in_complete:
|
|
32
|
-
checkbox = self.app_window.CheckBoxControl(AutomationId="CheckBoxAssignCompletionStatus")
|
|
33
|
-
checkbox.SetFocus()
|
|
34
|
-
checkbox.Click(simulateMove=False, waitTime=0)
|
|
35
|
-
|
|
36
|
-
save_button = self.app_window.PaneControl(AutomationId="buttonSave")
|
|
37
|
-
save_button.SetFocus()
|
|
38
|
-
save_button.Click(simulateMove=False, waitTime=0)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|