Changeset 692:eea9d6135944 for src/mlx/gui/mava_simbrief.py
- Timestamp:
- 10/22/15 18:43:58 (9 years ago)
- Branch:
- cef
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/mava_simbrief.py
r685 r692 21 21 """Implements the integration with the excellent Simbrief pilot briefing 22 22 system for MALEV Virtual.""" 23 24 # Progress stage: searching the suitable browser window 25 PROGRESS_SEARCHING_BROWSER = 1 26 27 # Progress stage: retrieving the form from the server 28 PROGRESS_LOADING_FORM = 2 29 30 # Progress stage: filling the form 31 PROGRESS_FILLING_FORM = 3 32 33 # Progress stage: waiting for the login 34 PROGRESS_WAITING_LOGIN = 4 35 36 # Progress stage: logging in 37 PROGRESS_LOGGING_IN = 5 38 39 # Progress stage: waiting for result 40 PROGRESS_WAITING_RESULT = 6 41 42 # The maximal reserved progress stage 43 PROGRESS_MAX = 16 44 45 # Result code: none (i.e. the SimBrief query is in progress). 46 RESULT_NONE = 0 47 48 # Result code: success 49 RESULT_OK = 1 50 51 # Result code: other error 52 RESULT_ERROR_OTHER = 2 53 54 # Result code: form could not be loaded 55 RESULT_ERROR_NO_FORM = 11 56 57 # Result code: no popup (i.e. login) window found 58 RESULT_ERROR_NO_POPUP = 12 59 60 # Result code: login failed 61 RESULT_ERROR_LOGIN_FAILED = 13 62 63 # The maximal reserved result code 64 RESULT_MAX = 32 23 65 24 66 def __init__(self, … … 114 156 is_briefing_available = True 115 157 else: 116 update_progress("Looking for a browser...", False) 158 update_progress(MavaSimbriefIntegrator.PROGRESS_SEARCHING_BROWSER, 159 MavaSimbriefIntegrator.RESULT_NONE, None) 117 160 # There must be window whose title is 'SimBrief' so that we 118 161 # could find our one among several 119 162 if self._find_window_by_title("SimBrief") is None: 120 163 print "No SimBrief window was found!" 164 update_progress(MavaSimbriefIntegrator.PROGRESS_SEARCHING_BROWSER, 165 MavaSimbriefIntegrator.RESULT_ERROR_OTHER, None) 121 166 return None 122 167 123 168 # normal operation with a real xml file 124 update_progress("Retrieving form...", False) 169 update_progress(MavaSimbriefIntegrator.PROGRESS_LOADING_FORM, 170 MavaSimbriefIntegrator.RESULT_NONE, None) 125 171 if local_html_debug: 126 172 self.driver.get( … … 133 179 if main_handle is None: 134 180 print "No SimBrief Integration window was found!" 181 update_progress(MavaSimbriefIntegrator.PROGRESS_LOADING_FORM, 182 MavaSimbriefIntegrator.RESULT_ERROR_NO_FORM, None) 135 183 return None 136 184 … … 140 188 141 189 # Entering form data 142 update_progress("Filling form...", False) 190 update_progress(MavaSimbriefIntegrator.PROGRESS_FILLING_FORM, 191 MavaSimbriefIntegrator.RESULT_NONE, None) 143 192 self.driver.switch_to_window(main_handle) 144 193 self.fill_form(self.plan, … … 149 198 button.send_keys(Keys.RETURN) 150 199 151 update_progress("Waiting for login...", False) 200 update_progress(MavaSimbriefIntegrator.PROGRESS_WAITING_LOGIN, 201 MavaSimbriefIntegrator.RESULT_NONE, None) 152 202 popup_handle = self._find_popup(handles) 153 203 if popup_handle is None: 154 print "No popup window was found!" 204 update_progress(MavaSimbriefIntegrator.PROGRESS_WAITING_LOGIN, 205 MavaSimbriefIntegrator.RESULT_ERROR_NO_POPUP, None) 155 206 return None 156 207 … … 164 215 165 216 if userElement is not None: 166 update_progress("Logging in...", False) 217 update_progress(MavaSimbriefIntegrator.PROGRESS_LOGGING_IN, 218 MavaSimbriefIntegrator.RESULT_NONE, None) 167 219 (userName, password) = get_credentials(login_count) 220 if userName is None or password is None: 221 update_progress(MavaSimbriefIntegrator.PROGRESS_WAITING_LOGIN, 222 MavaSimbriefIntegrator.RESULT_ERROR_LOGIN_FAILED, None) 223 return None 224 168 225 userElement.send_keys(userName) 169 226 self.driver.find_element_by_name("pass").send_keys(password) … … 178 235 pass 179 236 180 update_progress("Waiting for the result...", False) 237 update_progress(MavaSimbriefIntegrator.PROGRESS_WAITING_RESULT, 238 MavaSimbriefIntegrator.RESULT_NONE, None) 181 239 self.driver.switch_to.window(main_handle) 182 240 try:
Note:
See TracChangeset
for help on using the changeset viewer.