Changeset 692:eea9d6135944
- Timestamp:
- 10/22/15 18:43:58 (9 years ago)
- Branch:
- cef
- Phase:
- public
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
locale/en/mlx.po
r691 r692 741 741 "your files will be able to read it." 742 742 743 msgid "simbrief_progress_searching_browser" 744 msgstr "Searching browser..." 745 746 msgid "simbrief_progress_loading_form" 747 msgstr "Loading form..." 748 749 msgid "simbrief_progress_filling_form" 750 msgstr "Filling form..." 751 752 msgid "simbrief_progress_waiting_login" 753 msgstr "Waiting login..." 754 755 msgid "simbrief_progress_logging_in" 756 msgstr "Logging in..." 757 758 msgid "simbrief_progress_waiting_result" 759 msgstr "Waiting for the result..." 760 761 msgid "simbrief_progress_retrieving_briefing" 762 msgstr "Retrieving briefing..." 763 764 msgid "simbrief_progress_unknown" 765 msgstr "?????" 766 767 msgid "simbrief_result_error_other" 768 msgstr "Some error occured, see debug logs." 769 770 msgid "simbrief_result_error_no_form" 771 msgstr "No form could be loaded." 772 773 msgid "simbrief_result_error_no_popup" 774 msgstr "No login window appeared." 775 776 msgid "simbrief_result_login_failed" 777 msgstr "Login failed." 778 779 msgid "simbrief_result_unknown" 780 msgstr "Unknown error occured." 781 782 msgid "simbrief_cancelled" 783 msgstr "Reverting to the old-style briefing." 784 743 785 msgid "briefing_title" 744 786 msgstr "Briefing (%d/2): %s" -
locale/hu/mlx.po
r691 r692 739 739 "tároljuk, ezért bárki elolvashatja, aki hozzáfér a fájljaidhoz." 740 740 741 msgid "simbrief_progress_searching_browser" 742 msgstr "Böngésző keresése..." 743 744 msgid "simbrief_progress_loading_form" 745 msgstr "Űrlap letöltése..." 746 747 msgid "simbrief_progress_filling_form" 748 msgstr "Űrlap kitöltése..." 749 750 msgid "simbrief_progress_waiting_login" 751 msgstr "Várakozás a bejelentkező ablakra..." 752 753 msgid "simbrief_progress_logging_in" 754 msgstr "Bejelentkezés..." 755 756 msgid "simbrief_progress_waiting_result" 757 msgstr "Várakozás az eredményre..." 758 759 msgid "simbrief_progress_retrieving_briefing" 760 msgstr "Az eligazítás letöltése..." 761 762 msgid "simbrief_progress_unknown" 763 msgstr "?????" 764 765 msgid "simbrief_result_error_other" 766 msgstr "Valamilyen hiba történt, lásd a hibanaplót." 767 768 msgid "simbrief_result_error_no_form" 769 msgstr "Nem sikerült letölteni az űrlapot." 770 771 msgid "simbrief_result_error_no_popup" 772 msgstr "Nem jelent meg a bejelentkező ablak." 773 774 msgid "simbrief_result_login_failed" 775 msgstr "A bejelentkezés nem sikerült." 776 777 msgid "simbrief_result_unknown" 778 msgstr "Ismeretlen hiba történt." 779 780 msgid "simbrief_cancelled" 781 msgstr "Áttérünk a régi eligazításra." 782 741 783 msgid "briefing_title" 742 784 msgstr "Eligazítás (%d/2): %s" -
src/mlx/gui/cef.py
r685 r692 77 77 #------------------------------------------------------------------------------ 78 78 79 SIMBRIEF_PROGRESS_SEARCHING_BROWSER = MavaSimbriefIntegrator.PROGRESS_SEARCHING_BROWSER 80 SIMBRIEF_PROGRESS_LOADING_FORM = MavaSimbriefIntegrator.PROGRESS_LOADING_FORM 81 SIMBRIEF_PROGRESS_FILLING_FORM = MavaSimbriefIntegrator.PROGRESS_FILLING_FORM 82 SIMBRIEF_PROGRESS_WAITING_LOGIN = MavaSimbriefIntegrator.PROGRESS_WAITING_LOGIN 83 SIMBRIEF_PROGRESS_LOGGING_IN = MavaSimbriefIntegrator.PROGRESS_LOGGING_IN 84 SIMBRIEF_PROGRESS_WAITING_RESULT = MavaSimbriefIntegrator.PROGRESS_WAITING_RESULT 85 86 SIMBRIEF_PROGRESS_RETRIEVING_BRIEFING = MavaSimbriefIntegrator.PROGRESS_MAX + 1 87 SIMBRIEF_PROGRESS_DONE = 1000 88 89 SIMBRIEF_RESULT_NONE = MavaSimbriefIntegrator.RESULT_NONE 90 SIMBRIEF_RESULT_OK = MavaSimbriefIntegrator.RESULT_OK 91 SIMBRIEF_RESULT_ERROR_OTHER = MavaSimbriefIntegrator.RESULT_ERROR_OTHER 92 SIMBRIEF_RESULT_ERROR_NO_FORM = MavaSimbriefIntegrator.RESULT_ERROR_NO_FORM 93 SIMBRIEF_RESULT_ERROR_NO_POPUP = MavaSimbriefIntegrator.RESULT_ERROR_NO_POPUP 94 SIMBRIEF_RESULT_ERROR_LOGIN_FAILED = MavaSimbriefIntegrator.RESULT_ERROR_LOGIN_FAILED 95 96 #------------------------------------------------------------------------------ 97 79 98 class SeleniumHandler(threading.Thread): 80 99 """Thread to handle Selenium operations.""" … … 158 177 local_html_debug = False) 159 178 160 updateProgress("Retrieving briefing...", False) 161 162 flight_info = integrator.get_results(link, 163 html_file_path = htmlFilePath) 164 165 updateProgress("Done", True) 179 if link is not None: 180 updateProgress(SIMBRIEF_PROGRESS_RETRIEVING_BRIEFING, 181 SIMBRIEF_RESULT_NONE, None) 182 183 try: 184 flight_info = integrator.get_results(link, 185 html_file_path = 186 htmlFilePath) 187 188 updateProgress(SIMBRIEF_PROGRESS_DONE, 189 SIMBRIEF_RESULT_OK, flight_info) 190 except Exception, e: 191 print "Failed retrieving the briefing:", e 192 updateProgress(SIMBRIEF_PROGRESS_RETRIEVING_BRIEFING, 193 SIMBRIEF_RESULT_ERROR_OTHER, None) 166 194 167 195 def _quit(self): -
src/mlx/gui/flight.py
r691 r692 1543 1543 self._cruiseLevel.set_text("") 1544 1544 self._route.get_buffer().set_text(self._wizard._bookedFlight.route) 1545 self._alternate.set_text("") 1545 1546 self._updateForwardButton() 1546 1547 … … 1594 1595 def _forwardClicked(self, button): 1595 1596 """Called when the Forward button is clicked.""" 1596 if self._wizard.gui.config.useSimBrief: 1597 if self._wizard.gui.config.useSimBrief and \ 1598 self._wizard.usingSimBrief is not False: 1597 1599 self._wizard.nextPage() 1598 1600 else: … … 1618 1620 ] 1619 1621 1622 progress2Message = { 1623 cef.SIMBRIEF_PROGRESS_SEARCHING_BROWSER: "simbrief_progress_searching_browser", 1624 cef.SIMBRIEF_PROGRESS_LOADING_FORM: "simbrief_progress_loading_form", 1625 cef.SIMBRIEF_PROGRESS_FILLING_FORM: "simbrief_progress_filling_form", 1626 cef.SIMBRIEF_PROGRESS_WAITING_LOGIN: "simbrief_progress_waiting_login", 1627 cef.SIMBRIEF_PROGRESS_LOGGING_IN: "simbrief_progress_logging_in", 1628 cef.SIMBRIEF_PROGRESS_WAITING_RESULT: "simbrief_progress_waiting_result", 1629 cef.SIMBRIEF_PROGRESS_RETRIEVING_BRIEFING: "simbrief_progress_retrieving_briefing" 1630 } 1631 1632 result2Message = { 1633 cef.SIMBRIEF_RESULT_ERROR_OTHER: "simbrief_result_error_other", 1634 cef.SIMBRIEF_RESULT_ERROR_NO_FORM: "simbrief_result_error_no_form", 1635 cef.SIMBRIEF_RESULT_ERROR_NO_POPUP: "simbrief_result_error_no_popup", 1636 cef.SIMBRIEF_RESULT_ERROR_LOGIN_FAILED: "simbrief_result_error_login_failed" 1637 } 1638 1620 1639 @staticmethod 1621 1640 def getHTMLFilePath(): … … 1738 1757 startSound(const.SOUND_NOTAM) 1739 1758 1740 def _simBriefProgressCallback(self, message, done):1759 def _simBriefProgressCallback(self, progress, result, flightInfo): 1741 1760 """Called by the SimBrief handling thread.""" 1742 gobject.idle_add(self._simBriefProgress, message, done)1743 1744 def _simBriefProgress(self, message, done):1761 gobject.idle_add(self._simBriefProgress, progress, result, flightInfo) 1762 1763 def _simBriefProgress(self, progress, result, flightInfo): 1745 1764 """The real SimBrief progress handler.""" 1746 if done: 1765 print "_simBriefProgress", progress, result, flightInfo 1766 if result==cef.SIMBRIEF_RESULT_NONE: 1767 message = SimBriefSetupPage.progress2Message.get(progress, 1768 "simbrief_progress_unknown") 1769 self._wizard.gui.updateBusyState(xstr(message)) 1770 else: 1747 1771 self._wizard.gui.endBusy() 1748 self._wizard.nextPage() 1749 else: 1750 self._wizard.gui.updateBusyState(message) 1772 1773 if result==cef.SIMBRIEF_RESULT_OK: 1774 self._wizard.nextPage() 1775 else: 1776 message = SimBriefSetupPage.result2Message.get(result, 1777 "simbrief_result_unknown") 1778 dialog = gtk.MessageDialog(parent = self._wizard.gui.mainWindow, 1779 type = MESSAGETYPE_ERROR, 1780 message_format = 1781 xstr(message) + "\n"+ 1782 xstr("simbrief_cancelled")) 1783 1784 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK) 1785 dialog.set_title(WINDOW_TITLE_BASE) 1786 secondary = xstr("flightsel_save_failed_sec") 1787 dialog.format_secondary_markup(secondary) 1788 dialog.run() 1789 dialog.hide() 1790 1791 self._wizard.usingSimBrief = False 1792 self._wizard.jumpPage(2, fromPageShift = 1) 1751 1793 1752 1794 def _getPlan(self): … … 3951 3993 return self._loginResult 3952 3994 3953 def setCurrentPage(self, index, finalize = False): 3954 """Set the current page to the one with the given index.""" 3995 def setCurrentPage(self, index, finalize = False, fromPageShift = None): 3996 """Set the current page to the one with the given index. 3997 3998 @param fromPageShift if given, the relative index of one of the 3999 previous pages that should be used as the from-page of the next 4000 page. E.g. if fromPageShift is 1, the previous page will be the 4001 from-page.""" 3955 4002 assert index < len(self._pages) 3956 4003 … … 3961 4008 page.complete() 3962 4009 self.remove(page) 4010 if fromPageShift is not None: 4011 fromPage -= fromPageShift 3963 4012 3964 4013 self._currentPage = index … … 4157 4206 self.jumpPage(1, finalize) 4158 4207 4159 def jumpPage(self, count, finalize = True ):4208 def jumpPage(self, count, finalize = True, fromPageShift = None): 4160 4209 """Go to the page which is 'count' pages after the current one.""" 4161 self.setCurrentPage(self._currentPage + count, finalize = finalize) 4210 self.setCurrentPage(self._currentPage + count, 4211 finalize = finalize, fromPageShift = fromPageShift) 4162 4212 4163 4213 def grabDefault(self): … … 4208 4258 self._arrivalNOTAMs = None 4209 4259 self._arrivalMETAR = None 4210 self._usingSimBrief = False4260 self._usingSimBrief = None 4211 4261 4212 4262 firstPage = 0 if self._loginResult is None else 1 -
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.