Changeset 1084:4d1bce6fff23
- Timestamp:
- 03/15/23 19:03:03 (22 months ago)
- Branch:
- python3
- Phase:
- public
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
locale/en/mlx.po
r1068 r1084 867 867 msgstr "Your SimBrief briefing was generated with the following data." 868 868 869 msgid "simbrief_uib" 870 msgstr "Use the built-in browser" 871 872 msgid "simbrief_uib_tooltip" 873 msgstr "" 874 "If this is ticked, the browser built in the browser is used to " 875 "produce the SimBrief building. The logger will log in to SimBrief " 876 "using the username and password below automatically and wait for " 877 "the briefing to be completed in the background." 878 "" 879 "If this is not ticked, the logger will open a window of the default " 880 "browser on your system, and calls SimBrief in that. In this case " 881 "you have to log in as usual." 882 869 883 msgid "simbrief_username" 870 884 msgstr "_Username:" 871 885 872 886 msgid "simbrief_username_tooltip" 873 msgstr "Enter your Simbrief username"887 msgstr "Enter your Simbrief/Navigraph username (e-mail address)" 874 888 875 889 msgid "simbrief_password" … … 880 894 881 895 msgid "simbrief_remember_password" 882 msgstr "_Remember password"896 msgstr "_Remember" 883 897 884 898 msgid "simbrief_remember_tooltip" -
locale/hu/mlx.po
r1068 r1084 867 867 msgstr "A SimBrief eligazítás az alábbi adatok alapján keszült." 868 868 869 msgid "simbrief_uib" 870 msgstr "Beépített böngésző használata" 871 872 msgid "simbrief_uib_tooltip" 873 msgstr "" 874 "Ha ezt bejelölöd, a loggerba épített böngészőt használjuk a " 875 "SimBrief eligazítás előállításához. Ilyenkor a logger hattérben " 876 "a lenti felhasználónévvel és jelszóval automatikusan bejelentkezik " 877 "SimBrief-be, átadja az adatokat és megvárja, míg az eligazítás elkészül." 878 "" 879 "Ha ezt nem jelölöd be, a logger a rendszereden lévő alapértelmezett " 880 "böngészőben nyit egy ablakot, és abban hívja meg a SimBriefet. Ilyenkor " 881 "a szokott módon kell bejelentkezned." 882 869 883 msgid "simbrief_username" 870 884 msgstr "Fel_használónév:" 871 885 872 886 msgid "simbrief_username_tooltip" 873 msgstr "Írd be a SimBrief felhasználónevedet"887 msgstr "Írd be a SimBrief/Navigraph felhasználónevedet (e-mail címedet)" 874 888 875 889 msgid "simbrief_password" … … 877 891 878 892 msgid "simbrief_password_tooltip" 879 msgstr "Írd be a SimBrief jelszavadat"893 msgstr "Írd be a SimBrief jelszavadat" 880 894 881 895 msgid "simbrief_remember_password" 882 msgstr "E_mlékezz a jelszóra"896 msgstr "E_mlékezz" 883 897 884 898 msgid "simbrief_remember_tooltip" -
src/mlx/config.py
r1080 r1084 234 234 235 235 self._useSimBrief = False 236 self._useInternalBrowserForSimBrief = False 236 237 self._simBriefUserName = "" 237 238 self._simBriefPassword = "" … … 460 461 if self._useSimBrief != useSimBrief: 461 462 self._useSimBrief = useSimBrief 463 self._modified = True 464 465 @property 466 def useInternalBrowserForSimBrief(self): 467 """Get if we should use the internal browser to handle SimBrief.""" 468 return self._useInternalBrowserForSimBrief 469 470 @useInternalBrowserForSimBrief.setter 471 def useInternalBrowserForSimBrief(self, useInternalBrowserForSimBrief): 472 """Set if we should use the internal browser to handle SimBrief.""" 473 if useInternalBrowserForSimBrief!=self._useInternalBrowserForSimBrief: 474 self._useInternalBrowserForSimBrief = useInternalBrowserForSimBrief 462 475 self._modified = True 463 476 … … 759 772 self._useSimBrief = self._getBoolean(config, "simbrief", 760 773 "use", False) 774 self._useInternalBrowserForSimBrief = self._getBoolean(config, "simbrief", 775 "useInternalBrowser", 776 False) 761 777 self._simBriefUserName = self._get(config, "simbrief", 762 778 "username", "") … … 854 870 config.set("simbrief", "use", 855 871 "yes" if self._useSimBrief else "no") 872 config.set("simbrief", "useInternalBrowser", 873 "yes" if self._useInternalBrowserForSimBrief else "no") 856 874 config.set("simbrief", "username", self._simBriefUserName) 857 875 config.set("simbrief", "password", self._simBriefPassword) … … 1013 1031 1014 1032 print(" useSimBrief:", self._useSimBrief) 1033 print(" useInternalBrowserForSimBrief:", self._useInternalBrowserForSimBrief) 1015 1034 print(" simBriefUserName:", self._simBriefUserName) 1016 1035 print(" rememberSimBriefPassword:", self._rememberSimBriefPassword) -
src/mlx/gui/cef.py
r1083 r1084 57 57 class SimBriefHandler(object): 58 58 """An object to store the state of a SimBrief query.""" 59 _formURL = "http://flare.privatedns.org/mava_simbrief/simbrief_form.html" 59 _formURLBase = MAVA_BASE_URL + "/simbrief_form.php" 60 61 _resultURLBase = MAVA_BASE_URL + "/simbrief_briefing.php" 62 63 @staticmethod 64 def getFormURL(plan): 65 """Get the form URL for the given plan.""" 66 return SimBriefHandler._formURLBase + "?" + \ 67 urllib.parse.urlencode(plan) 60 68 61 69 _querySettings = { … … 87 95 88 96 self._browser = \ 89 cefpython.CreateBrowserSync(windowInfo, browserSettings = {}, 90 navigateUrl = SimBriefHandler._formURL) 97 cefpython.CreateBrowserSync(windowInfo, browserSettings = {}) 91 98 self._browser.SetClientHandler(OffscreenRenderHandler()) 92 99 self._browser.SetFocus(True) … … 107 114 self._htmlFilePath = htmlFilePath 108 115 109 self._browser.LoadUrl(SimBriefHandler. _formURL)116 self._browser.LoadUrl(SimBriefHandler.getFormURL(plan)) 110 117 self._updateProgress(SIMBRIEF_PROGRESS_LOADING_FORM, 111 118 SIMBRIEF_RESULT_NONE, None) … … 123 130 self._updateProgress(self._lastProgress, 124 131 SIMBRIEF_RESULT_ERROR_OTHER, None) 125 elif url.startswith("http://flare.privatedns.org/mava_simbrief/simbrief_form.html"): 126 if self._plan is None: 127 return 128 129 self._updateProgress(SIMBRIEF_PROGRESS_FILLING_FORM, 132 elif url.startswith(SimBriefHandler._formURLBase): 133 self._updateProgress(SIMBRIEF_PROGRESS_WAITING_LOGIN, 130 134 SIMBRIEF_RESULT_NONE, None) 131 132 js = "form=document.getElementById(\"sbapiform\");" 133 for (name, value) in self._plan.items(): 134 js += "form." + name + ".value=\"" + value + "\";" 135 for (name, value) in SimBriefHandler._querySettings.items(): 136 if isinstance(value, bool): 137 js += "form." + name + ".checked=" + \ 138 ("true" if value else "false") + ";" 139 elif isinstance(value, str): 140 js += "form." + name + ".value=\"" + value + "\";" 141 142 js += "form.submitform.click();" 143 js += "window.formFilled();" 144 135 elif url.startswith("https://www.simbrief.com/system/login.api.sso.php"): 136 js = "document.getElementsByClassName(\"login_option navigraph\")[0].click();" 145 137 frame.ExecuteJavascript(js) 146 elif url.startswith("http ://www.simbrief.com/system/login.api.php"):138 elif url.startswith("https://identity.api.navigraph.com/login?"): 147 139 (user, password) = self._getCredentials(self._getCredentialsCount) 148 140 if user is None or password is None: … … 152 144 153 145 self._getCredentialsCount += 1 154 js = "form=document.forms[0];" 155 js += "form.user.value=\"" + user + "\";" 156 js += "form.pass.value=\"" + password + "\";" 157 js += "form.submit();" 146 147 js = "form=document.getElementsByName(\"form\")[0];" 148 js +="form.username.value=\"" + user + "\";" 149 js +="form.password.value=\"" + password + "\";" 150 js +="form.submit();" 158 151 frame.ExecuteJavascript(js) 159 elif url.startswith("http ://www.simbrief.com/ofp/ofp.loader.api.php"):152 elif url.startswith("https://www.simbrief.com/ofp/ofp.loader.api.php"): 160 153 self._updateProgress(SIMBRIEF_PROGRESS_WAITING_RESULT, 161 154 SIMBRIEF_RESULT_NONE, None) 162 elif url.startswith("http://flare.privatedns.org/mava_simbrief/simbrief_briefing.php"): 163 js = "form=document.getElementById(\"hiddenform\");" 164 js += "window.briefingData(form.hidden_is_briefing_available.value, form.hidden_link.value);"; 165 frame.ExecuteJavascript(js) 166 167 def _formFilled(self): 168 """Called when the form has been filled and submitted.""" 169 self._updateProgress(SIMBRIEF_PROGRESS_WAITING_LOGIN, 170 SIMBRIEF_RESULT_NONE, None) 171 172 def _briefingDataAvailable(self, available, link): 173 """Called when the briefing data is available.""" 174 if available: 175 link ="http://www.simbrief.com/ofp/flightplans/xml/" + link + ".xml" 176 155 elif url.startswith(SimBriefHandler._resultURLBase): 177 156 self._updateProgress(SIMBRIEF_PROGRESS_RETRIEVING_BRIEFING, 178 SIMBRIEF_RESULT_NONE, None) 179 180 thread = threading.Thread(target = self._getResults, args = (link,)) 181 _thread.daemon = True 182 _thread.start() 183 else: 184 self._updateProgress(SIMBRIEF_PROGRESS_RETRIEVING_BRIEFING, 185 SIMBRIEF_RESULT_ERROR_OTHER, None) 157 SIMBRIEF_RESULT_OK, None) 186 158 187 159 def _onLoadError(self, browser, frame, error_code, error_text_out, … … 215 187 216 188 return False 217 218 def _getResults(self, link):219 """Get the result from the given link."""220 availableInfo = {}221 ## Holds analysis data to be used222 flightInfo = {}223 224 # Obtaining the xml225 response = urllib.request.urlopen(link)226 xmlContent = response.read()227 # Processing xml228 content = etree.iterparse(StringIO(xmlContent))229 230 for (action, element) in content:231 # Processing tags that occur multiple times232 if element.tag == "weather":233 weatherElementList = list(element)234 for weatherElement in weatherElementList:235 flightInfo[weatherElement.tag] = weatherElement.text236 else:237 availableInfo[element.tag] = element.text238 239 # Processing plan_html240 ## Obtaining chart links241 imageLinks = []242 for imageLinkElement in lxml.html.find_class(availableInfo["plan_html"],243 "ofpmaplink"):244 for imageLink in imageLinkElement.iterlinks():245 if imageLink[1] == 'src':246 imageLinks.append(imageLink[2])247 flightInfo["image_links"] = imageLinks248 print((sorted(availableInfo.keys())))249 htmlFilePath = "simbrief_plan.html" if self._htmlFilePath is None \250 else self._htmlFilePath251 with open(htmlFilePath, 'w') as f:252 f.write(availableInfo["plan_html"])253 254 GObject.idle_add(self._resultsAvailable, flightInfo)255 189 256 190 #------------------------------------------------------------------------------ -
src/mlx/gui/flight.py
r1076 r1084 3243 3243 xscale = 0.0, yscale = 0.0) 3244 3244 3245 table = Gtk.Table( 6, 3)3245 table = Gtk.Table(7, 3) 3246 3246 table.set_row_spacings(4) 3247 3247 table.set_col_spacings(16) … … 3253 3253 row = 0 3254 3254 3255 # label = Gtk.Label(xstr("simbrief_username")) 3256 # label.set_use_underline(True) 3257 # label.set_alignment(0.0, 0.5) 3258 # table.attach(label, 0, 1, row, row+1) 3259 3260 # self._userName = Gtk.Entry() 3261 # self._userName.set_width_chars(16) 3262 # self._userName.connect("changed", 3263 # lambda button: self._updateForwardButton()) 3264 # self._userName.set_tooltip_text(xstr("simbrief_username_tooltip")) 3265 # table.attach(self._userName, 1, 2, row, row+1) 3266 # label.set_mnemonic_widget(self._userName) 3267 # row += 1 3268 3269 # label = Gtk.Label(xstr("simbrief_password")) 3270 # label.set_use_underline(True) 3271 # label.set_alignment(0.0, 0.5) 3272 # table.attach(label, 0, 1, row, row+1) 3273 3274 # self._password = Gtk.Entry() 3275 # self._password.set_visibility(False) 3276 # self._password.connect("changed", 3277 # lambda button: self._updateForwardButton()) 3278 # self._password.set_tooltip_text(xstr("simbrief_password_tooltip")) 3279 # table.attach(self._password, 1, 2, row, row+1) 3280 # label.set_mnemonic_widget(self._password) 3281 # row += 1 3282 3283 # self._rememberButton = Gtk.CheckButton(xstr("simbrief_remember_password")) 3284 # self._rememberButton.set_use_underline(True) 3285 # self._rememberButton.set_tooltip_text(xstr("simbrief_remember_tooltip")) 3286 # table.attach(self._rememberButton, 1, 2, row, row+1, ypadding = 8) 3287 # row += 1 3255 frame = Gtk.Frame.new() 3256 self._useInternalBrowser = Gtk.CheckButton(xstr("simbrief_uib")) 3257 frame.set_label_widget(self._useInternalBrowser) 3258 frame.set_label_align(0.025, 0.5) 3259 3260 self._useInternalBrowser.set_use_underline(True) 3261 self._useInternalBrowser.connect("toggled", 3262 self._useInternalBrowserToggled) 3263 self._useInternalBrowser.set_tooltip_text(xstr("simbrief_uib_tooltip")) 3264 3265 uibTable = Gtk.Table(2, 3) 3266 uibTable.set_row_spacings(4) 3267 uibTable.set_col_spacings(16) 3268 uibTable.set_homogeneous(False) 3269 3270 uibRow = 0 3271 3272 label = Gtk.Label(xstr("simbrief_username")) 3273 label.set_use_underline(True) 3274 label.set_alignment(0.0, 0.5) 3275 uibTable.attach(label, 0, 1, uibRow, uibRow+1) 3276 3277 self._userName = Gtk.Entry() 3278 self._userName.set_width_chars(16) 3279 self._userName.connect("changed", 3280 lambda button: self._updateForwardButton()) 3281 self._userName.set_tooltip_text(xstr("simbrief_username_tooltip")) 3282 uibTable.attach(self._userName, 1, 2, uibRow, uibRow+1) 3283 label.set_mnemonic_widget(self._userName) 3284 uibRow += 1 3285 3286 label = Gtk.Label(xstr("simbrief_password")) 3287 label.set_use_underline(True) 3288 label.set_alignment(0.0, 0.5) 3289 uibTable.attach(label, 0, 1, uibRow, uibRow+1) 3290 3291 self._password = Gtk.Entry() 3292 self._password.set_visibility(False) 3293 self._password.connect("changed", 3294 lambda button: self._updateForwardButton()) 3295 self._password.set_tooltip_text(xstr("simbrief_password_tooltip")) 3296 uibTable.attach(self._password, 1, 2, uibRow, uibRow+1) 3297 label.set_mnemonic_widget(self._password) 3298 3299 self._rememberButton = Gtk.CheckButton(xstr("simbrief_remember_password")) 3300 self._rememberButton.set_use_underline(True) 3301 self._rememberButton.set_tooltip_text(xstr("simbrief_remember_tooltip")) 3302 uibTable.attach(self._rememberButton, 2, 3, uibRow, uibRow+1, ypadding = 8) 3303 uibRow += 1 3304 3305 uibTable.set_margin_top(6) 3306 uibTable.set_margin_bottom(6) 3307 uibTable.set_margin_left(4) 3308 uibTable.set_margin_right(4) 3309 3310 frame.add(uibTable) 3311 frame.set_margin_bottom(10) 3312 3313 table.attach(frame, 0, 3, row, row+1) 3314 row += 1 3288 3315 3289 3316 label = Gtk.Label(xstr("simbrief_extra_fuel")) … … 3298 3325 label.set_mnemonic_widget(self._extraFuel) 3299 3326 3300 table.attach(Gtk.Label("kg"), 2, 3, row, row+1) 3327 label = Gtk.Label("kg") 3328 label.set_alignment(0.0, 0.5) 3329 table.attach(label, 2, 3, row, row+1) 3301 3330 row += 1 3302 3331 … … 3379 3408 config = self._wizard.gui.config 3380 3409 3381 # self._userName.set_text(config.simBriefUserName) 3382 # self._userName.set_sensitive(True) 3383 3384 # self._password.set_text(config.simBriefPassword) 3385 # self._password.set_sensitive(True) 3386 3387 # self._rememberButton.set_active(config.rememberSimBriefPassword) 3388 # self._rememberButton.set_sensitive(True) 3410 self._useInternalBrowser.set_active(config.useInternalBrowserForSimBrief) 3411 self._useInternalBrowser.set_sensitive(True) 3412 3413 self._userName.set_text(config.simBriefUserName) 3414 self._userName.set_sensitive(config.useInternalBrowserForSimBrief) 3415 3416 self._password.set_text(config.simBriefPassword) 3417 self._password.set_sensitive(config.useInternalBrowserForSimBrief) 3418 3419 self._rememberButton.set_active(config.rememberSimBriefPassword) 3420 self._rememberButton.set_sensitive(config.useInternalBrowserForSimBrief) 3389 3421 3390 3422 self._extraFuel.set_int(0) … … 3422 3454 """Update the sensitivity of the forward button.""" 3423 3455 self._button.set_sensitive(True) 3424 #self._button.set_sensitive(len(self._userName.get_text())>0 and3425 #len(self._password.get_text())>0)3456 self._button.set_sensitive(len(self._userName.get_text())>0 and 3457 len(self._password.get_text())>0) 3426 3458 3427 3459 def _backClicked(self, button): … … 3433 3465 self._wizard.nextPage() 3434 3466 else: 3435 # config = self._wizard.gui.config 3436 3437 # config.simBriefUserName = self._userName.get_text() 3438 3439 # rememberPassword = self._rememberButton.get_active() 3440 # config.simBriefPassword = \ 3441 # self._password.get_text() if rememberPassword else "" 3442 # config.rememberSimBriefPassword = rememberPassword 3443 3444 # config.save() 3467 config = self._wizard.gui.config 3468 3469 config.simBriefUserName = self._userName.get_text() 3470 3471 rememberPassword = self._rememberButton.get_active() 3472 config.simBriefPassword = \ 3473 self._password.get_text() if rememberPassword else "" 3474 config.rememberSimBriefPassword = rememberPassword 3475 3476 config.useInternalBrowserForSimBrief = \ 3477 self._useInternalBrowser.get_active() 3478 3479 config.save() 3445 3480 3446 3481 self._wizard.gui.simulator.requestTime(self._handleTime) 3482 3483 def _useInternalBrowserToggled(self, checkButton): 3484 """Called when the check button indicating if the internal browser 3485 should be used is toggled.""" 3486 useInternalBrowserForSimBrief = self._useInternalBrowser.get_active() 3487 self._userName.set_sensitive(useInternalBrowserForSimBrief) 3488 self._password.set_sensitive(useInternalBrowserForSimBrief) 3489 self._rememberButton.set_sensitive(useInternalBrowserForSimBrief) 3447 3490 3448 3491 def _handleTime(self, simulatorNow): … … 3463 3506 self._wizard.landingRunway = landingRunway 3464 3507 3465 #self._userName.set_sensitive(False)3466 #self._password.set_sensitive(False)3467 #self._rememberButton.set_sensitive(False)3508 self._userName.set_sensitive(False) 3509 self._password.set_sensitive(False) 3510 self._rememberButton.set_sensitive(False) 3468 3511 self._extraFuel.set_sensitive(False) 3469 3512 self._takeoffRunway.set_sensitive(False) … … 3476 3519 self._wizard.gui.beginBusy(xstr("simbrief_calling")) 3477 3520 3478 url = MAVA_BASE_URL + "/simbrief_form.php?" + \ 3479 urllib.parse.urlencode(plan) 3521 url = cef.SimBriefHandler.getFormURL(plan) 3480 3522 print("url:", url) 3481 3523 3482 # GObject.idle_add(self._resultsAvailable, 3483 # { "orig_metar": "LDZA...", 3484 # "dest_metar": "LHBP..." }) 3485 # return 3486 3487 webbrowser.open(url = url, new = 1) 3488 3489 # cef.callSimBrief(plan, 3490 # self._getCredentials, 3491 # self._simBriefProgress, 3492 # SimBriefSetupPage.getHTMLFilePath()) 3524 config = self._wizard.gui.config 3525 if config.useInternalBrowserForSimBrief: 3526 self._waitEnd = 0 3527 cef.callSimBrief(plan, 3528 self._getCredentials, 3529 self._simBriefProgress, 3530 SimBriefSetupPage.getHTMLFilePath()) 3531 else: 3532 webbrowser.open(url = url, new = 1) 3533 self._waitEnd = time.time() + SimBriefSetupPage._waitTimeout 3534 GObject.timeout_add(SimBriefSetupPage._resultQueryInterval, 3535 lambda: self._wizard.gui.webHandler. \ 3536 getSimBriefResult(self._resultCallback, 3537 self._resultTimestamp)) 3538 3493 3539 3494 3540 startSound(const.SOUND_NOTAM) 3495 3541 3496 self._waitEnd = time.time() + SimBriefSetupPage._waitTimeout 3497 GObject.timeout_add(SimBriefSetupPage._resultQueryInterval, 3498 lambda: self._wizard.gui.webHandler. \ 3499 getSimBriefResult(self._resultCallback, 3500 self._resultTimestamp)) 3501 3502 # def _getCredentials(self, count): 3503 # """Get the credentials. 3504 3505 # If count is 0, the user name and password entered into the setup page 3506 # are returned. Otherwise a dialog box is displayed informing the user of 3507 # invalid credentials and requesting another set of them.""" 3508 # print("_getCredentials", count) 3509 # if count==0: 3510 # return (self._userName.get_text(), self._password.get_text()) 3511 # else: 3512 # gui = self._wizard.gui 3513 # config = gui.config 3514 3515 # dialog = SimBriefCredentialsDialog(gui, 3516 # config.simBriefUserName, 3517 # config.simBriefPassword, 3518 # config.rememberSimBriefPassword) 3519 # response = dialog.run() 3520 3521 # if response==Gtk.ResponseType.OK: 3522 # userName = dialog.userName 3523 # self._userName.set_text(userName) 3524 # password = dialog.password 3525 # self._password.set_text(password) 3526 # rememberPassword = dialog.rememberPassword 3527 3528 # config.simBriefUserName = userName 3529 3530 # config.simBriefPassword = \ 3531 # password if rememberPassword else "" 3532 # config.rememberSimBriefPassword = rememberPassword 3533 3534 # config.save() 3535 3536 # return (userName, password) 3537 # else: 3538 # return (None, None) 3539 3540 # def _simBriefProgress(self, progress, result, flightInfo): 3541 # """The real SimBrief progress handler.""" 3542 # print("_simBriefProgress", progress, result, flightInfo) 3543 # if result==cef.SIMBRIEF_RESULT_NONE: 3544 # message = SimBriefSetupPage.progress2Message.get(progress, 3545 # "simbrief_progress_unknown") 3546 # self._wizard.gui.updateBusyState(xstr(message)) 3547 # else: 3548 # self._wizard.gui.endBusy() 3549 3550 # if result==cef.SIMBRIEF_RESULT_OK: 3551 # self._wizard.departureMETARChanged(flightInfo["orig_metar"], 3552 # self) 3553 # self._wizard.arrivalMETARChanged(flightInfo["dest_metar"], self) 3554 # self._wizard.nextPage() 3555 # else: 3556 # message = SimBriefSetupPage.result2Message.get(result, 3557 # "simbrief_result_unknown") 3558 # dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow, 3559 # type = Gtk.MessageType.ERROR, 3560 # message_format = 3561 # xstr(message) + "\n"+ 3562 # xstr("simbrief_cancelled")) 3563 3564 # dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 3565 # dialog.set_title(WINDOW_TITLE_BASE) 3566 # secondary = xstr("flightsel_save_failed_sec") 3567 # dialog.format_secondary_markup(secondary) 3568 # dialog.run() 3569 # dialog.hide() 3570 3571 # self._wizard.usingSimBrief = False 3572 # self._wizard.jumpPage("fuel", fromPageShift = 1) 3542 def _getCredentials(self, count): 3543 """Get the credentials. 3544 3545 If count is 0, the user name and password entered into the setup page 3546 are returned. Otherwise a dialog box is displayed informing the user of 3547 invalid credentials and requesting another set of them.""" 3548 print("_getCredentials", count) 3549 if count==0: 3550 return (self._userName.get_text(), self._password.get_text()) 3551 else: 3552 gui = self._wizard.gui 3553 config = gui.config 3554 3555 dialog = SimBriefCredentialsDialog(gui, 3556 config.simBriefUserName, 3557 config.simBriefPassword, 3558 config.rememberSimBriefPassword) 3559 response = dialog.run() 3560 3561 if response==Gtk.ResponseType.OK: 3562 userName = dialog.userName 3563 self._userName.set_text(userName) 3564 password = dialog.password 3565 self._password.set_text(password) 3566 rememberPassword = dialog.rememberPassword 3567 3568 config.simBriefUserName = userName 3569 3570 config.simBriefPassword = \ 3571 password if rememberPassword else "" 3572 config.rememberSimBriefPassword = rememberPassword 3573 3574 config.save() 3575 3576 return (userName, password) 3577 else: 3578 return (None, None) 3579 3580 def _simBriefProgress(self, progress, result, flightInfo): 3581 """The real SimBrief progress handler.""" 3582 print("_simBriefProgress", progress, result, flightInfo) 3583 if result==cef.SIMBRIEF_RESULT_NONE: 3584 message = SimBriefSetupPage.progress2Message.get(progress, 3585 "simbrief_progress_unknown") 3586 self._wizard.gui.updateBusyState(xstr(message)) 3587 else: 3588 if result==cef.SIMBRIEF_RESULT_OK: 3589 self._waitEnd = 0 3590 self._wizard.gui.webHandler. \ 3591 getSimBriefResult(self._resultCallback, 3592 self._resultTimestamp) 3593 else: 3594 self._wizard.gui.endBusy() 3595 3596 message = SimBriefSetupPage.result2Message.get(result, 3597 "simbrief_result_unknown") 3598 dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow, 3599 type = Gtk.MessageType.ERROR, 3600 message_format = 3601 xstr(message) + "\n"+ 3602 xstr("simbrief_cancelled")) 3603 3604 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 3605 dialog.set_title(WINDOW_TITLE_BASE) 3606 secondary = xstr("flightsel_save_failed_sec") 3607 dialog.format_secondary_markup(secondary) 3608 dialog.run() 3609 dialog.hide() 3610 3611 self._wizard.usingSimBrief = False 3612 self._wizard.jumpPage("fuel", fromPageShift = 1) 3573 3613 3574 3614 def _getPlan(self, simulatorNow):
Note:
See TracChangeset
for help on using the changeset viewer.