mbu-dev-shared-components 0.0.53__tar.gz → 0.0.54__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.
Files changed (42) hide show
  1. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/PKG-INFO +1 -1
  2. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/solteqtand/app_handler.py +107 -11
  3. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components.egg-info/PKG-INFO +1 -1
  4. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/.github/workflows/pylint.yml +0 -0
  5. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/.gitignore +0 -0
  6. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/.pylintrc +0 -0
  7. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/LICENSE +0 -0
  8. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/README.md +0 -0
  9. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/getorganized/__init__.py +0 -0
  10. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/getorganized/auth.py +0 -0
  11. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/getorganized/cases.py +0 -0
  12. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/getorganized/contacts.py +0 -0
  13. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/getorganized/documents.py +0 -0
  14. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/getorganized/objects.py +0 -0
  15. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/google/__init__.py +0 -0
  16. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/google/api/__init__.py +0 -0
  17. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/google/api/auth.py +0 -0
  18. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/google/workspace/__init__.py +0 -0
  19. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/google/workspace/alerts.py +0 -0
  20. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/msoffice365/__init__.py +0 -0
  21. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/msoffice365/excel/__init__.py +0 -0
  22. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/msoffice365/excel/excel_reader.py +0 -0
  23. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/msoffice365/sharepoint_api/__init__.py +0 -0
  24. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/msoffice365/sharepoint_api/files.py +0 -0
  25. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/os2forms/__init__.py +0 -0
  26. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/os2forms/documents.py +0 -0
  27. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/os2forms/forms.py +0 -0
  28. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/sap/__init__.py +0 -0
  29. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/sap/create_invoice.py +0 -0
  30. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/solteqtand/__init__.py +0 -0
  31. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/solteqtand/db_handler.py +0 -0
  32. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/utils/__init__.py +0 -0
  33. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/utils/db_stored_procedure_executor.py +0 -0
  34. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/utils/fernet_encryptor.py +0 -0
  35. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/utils/file_handler.py +0 -0
  36. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components/utils/json_handler.py +0 -0
  37. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components.egg-info/SOURCES.txt +0 -0
  38. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components.egg-info/dependency_links.txt +0 -0
  39. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components.egg-info/requires.txt +0 -0
  40. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/mbu_dev_shared_components.egg-info/top_level.txt +0 -0
  41. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/pyproject.toml +0 -0
  42. {mbu_dev_shared_components-0.0.53 → mbu_dev_shared_components-0.0.54}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mbu_dev_shared_components
3
- Version: 0.0.53
3
+ Version: 0.0.54
4
4
  Summary: Shared components to use in RPA projects
5
5
  Author-email: MBU <rpa@mbu.aarhus.dk>
6
6
  Classifier: Programming Language :: Python :: 3
@@ -6,11 +6,19 @@ import time
6
6
  import uiautomation as auto
7
7
 
8
8
 
9
+ class ManualProcessingRequiredError(Exception):
10
+ """
11
+ Custom exception raised when the patient cannot be opened due incorrect SSN.
12
+ """
13
+ def __init__(self, message="Error occurred while opening the patient. There is no patient with the provided CPR number."):
14
+ super().__init__(message)
15
+
16
+
9
17
  class SolteqTandApp:
10
18
  """
11
19
  A class to automate interactions with the SolteqTand application.
12
20
  """
13
- def __init__(self, app_path, username, password, ssn):
21
+ def __init__(self, app_path, username, password):
14
22
  """
15
23
  Initializes the SolteqTandApp object.
16
24
 
@@ -23,7 +31,6 @@ class SolteqTandApp:
23
31
  self.app_path = app_path
24
32
  self.username = username
25
33
  self.password = password
26
- self.ssn = ssn
27
34
  self.app_window = None
28
35
 
29
36
  def find_element_by_property(self, control, control_type=None, automation_id=None, name=None, class_name=None) -> auto.Control:
@@ -77,6 +84,28 @@ class SolteqTandApp:
77
84
  time.sleep(0.5)
78
85
  raise TimeoutError(f"Control with parameters {search_params} was not found within the timeout period.")
79
86
 
87
+ def wait_for_control_to_disappear(self, control_type, search_params, search_depth=1, timeout=30):
88
+ """
89
+ Waits for a given control type to disappear with the specified search parameters.
90
+
91
+ Args:
92
+ control_type: The type of control, e.g., auto.WindowControl, auto.ButtonControl, etc.
93
+ search_params (dict): Search parameters used to identify the control.
94
+ The keys must match the properties used in the control type, e.g., 'AutomationId', 'Name'.
95
+ search_depth (int): How deep to search in the user interface.
96
+ timeout (int): How long to wait, in seconds.
97
+
98
+ Returns:
99
+ bool: True if the control disappeared within the timeout period, otherwise False.
100
+ """
101
+ end_time = time.time() + timeout
102
+ while time.time() < end_time:
103
+ control = control_type(searchDepth=search_depth, **search_params)
104
+ if not control.Exists(0, 0):
105
+ return True
106
+ time.sleep(0.5)
107
+ raise TimeoutError(f"Control with parameters {search_params} did not disappear within the timeout period.")
108
+
80
109
  def start_application(self):
81
110
  """
82
111
  Starts the application using the specified path.
@@ -114,11 +143,18 @@ class SolteqTandApp:
114
143
  timeout=60
115
144
  )
116
145
 
117
- def open_patient(self):
146
+ def open_patient(self, ssn):
118
147
  """
119
148
  When the main window is open, presses Ctrl + O to open the 'Open Patient' window,
120
149
  searches for the SSN, and opens the patient.
121
150
  """
151
+ self.app_window = self.wait_for_control(
152
+ auto.WindowControl,
153
+ {'AutomationId': 'FormFront'},
154
+ search_depth=2,
155
+ timeout=5
156
+ )
157
+
122
158
  self.app_window.SetFocus()
123
159
  self.app_window.SendKeys('{Ctrl}o', waitTime=0)
124
160
 
@@ -132,14 +168,34 @@ class SolteqTandApp:
132
168
  ssn_input = open_patient_window.EditControl(AutomationId="TextBoxCpr")
133
169
  search_button = open_patient_window.PaneControl(AutomationId="ButtonOk")
134
170
 
135
- ssn_input.SendKeys(text=self.ssn)
171
+ ssn_input.SendKeys(text=ssn)
136
172
  search_button.SetFocus()
137
173
  search_button.SendKeys('{ENTER}')
138
174
 
175
+ try:
176
+ error_window = self.wait_for_control(
177
+ auto.WindowControl,
178
+ {'Name': 'TMT - Åbn patient'},
179
+ search_depth=2,
180
+ timeout=10
181
+ )
182
+
183
+ if error_window is not None:
184
+ error_window_button = error_window.ButtonControl(Name="OK")
185
+ error_window_button.SetFocus()
186
+ error_window_button.Click(simulateMove=False, waitTime=0)
187
+
188
+ raise ManualProcessingRequiredError
189
+
190
+ except TimeoutError:
191
+ pass
192
+
139
193
  self.app_window = self.wait_for_control(
140
194
  auto.WindowControl,
141
- {'AutomationId': 'FormPatient'}
195
+ {'AutomationId': 'FormPatient'},
196
+ timeout=10
142
197
  )
198
+
143
199
  self.app_window.Maximize()
144
200
 
145
201
  def open_sub_tab(self, sub_tab_name: str):
@@ -198,12 +254,7 @@ class SolteqTandApp:
198
254
  control_type=auto.ControlType.ListControl,
199
255
  automation_id="cleverListView1"
200
256
  )
201
-
202
- list_items = self.find_element_by_property(
203
- control=document_list,
204
- control_type=auto.ControlType.ListItemControl
205
- )
206
- list_items.RightClick(simulateMove=False, waitTime=0)
257
+ document_list.RightClick(simulateMove=False, waitTime=0)
207
258
 
208
259
  document_list_menu = self.wait_for_control(
209
260
  auto.MenuControl,
@@ -314,6 +365,7 @@ class SolteqTandApp:
314
365
  note_message (str): The note message.
315
366
  checkmark_in_complete (bool): Checks the checkmark in 'Afslut'.
316
367
  """
368
+ print(note_message)
317
369
  self.open_tab("Journal")
318
370
 
319
371
  self.wait_for_control(
@@ -334,3 +386,47 @@ class SolteqTandApp:
334
386
  save_button = self.app_window.PaneControl(AutomationId="buttonSave")
335
387
  save_button.SetFocus()
336
388
  save_button.Click(simulateMove=False, waitTime=0)
389
+
390
+ def close_patient_window(self):
391
+ """MISSING"""
392
+
393
+ title_bar_window = self.app_window.TitleBarControl()
394
+ title_bar_window.ButtonControl(Name="Luk").Click(simulateMove=False, waitTime=0)
395
+
396
+ self.app_window = self.wait_for_control_to_disappear(
397
+ auto.WindowControl,
398
+ {'AutomationId': 'FormPatient'},
399
+ search_depth=2
400
+ )
401
+
402
+ self.app_window = self.wait_for_control(
403
+ auto.WindowControl,
404
+ {'AutomationId': 'FormFront'},
405
+ search_depth=2,
406
+ timeout=5
407
+ )
408
+
409
+ def close_solteq_tand(self):
410
+ """MISSING"""
411
+ self.app_window = self.wait_for_control(
412
+ auto.WindowControl,
413
+ {'AutomationId': 'FormFront'},
414
+ search_depth=2
415
+ )
416
+ self.app_window.SetFocus()
417
+ title_bar_window = self.app_window.TitleBarControl()
418
+ title_bar_window.ButtonControl(Name="Luk").Click(simulateMove=False, waitTime=0)
419
+
420
+ self.app_window = self.wait_for_control(
421
+ auto.ButtonControl,
422
+ {'Name': 'Ja'},
423
+ search_depth=3
424
+ )
425
+
426
+ self.app_window.Click(simulateMove=False)
427
+
428
+ self.app_window = self.wait_for_control_to_disappear(
429
+ auto.WindowControl,
430
+ {'AutomationId': 'FormFront'},
431
+ search_depth=2
432
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mbu_dev_shared_components
3
- Version: 0.0.53
3
+ Version: 0.0.54
4
4
  Summary: Shared components to use in RPA projects
5
5
  Author-email: MBU <rpa@mbu.aarhus.dk>
6
6
  Classifier: Programming Language :: Python :: 3