Changeset 700:829f72992a92
- Timestamp:
- 10/25/15 08:02:04 (9 years ago)
- Branch:
- cef
- Phase:
- public
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
locale/en/mlx.po
r699 r700 783 783 msgstr "Reverting to the old-style briefing." 784 784 785 msgid "simbrief_credentials_title" 786 msgstr "SimBrief login" 787 788 msgid "simbrief_login_failed" 789 msgstr "" 790 "Failed to log in to SimBrief using the\n" 791 "supplied credentials. Please, enter\n" 792 "new ones, or cancel SimBrief." 793 785 794 msgid "briefing_title" 786 795 msgstr "Briefing (%d/2): %s" -
locale/hu/mlx.po
r699 r700 781 781 msgstr "Áttérünk a régi eligazításra." 782 782 783 msgid "simbrief_credentials_title" 784 msgstr "SimBrief bejelentkezés" 785 786 msgid "simbrief_login_failed" 787 msgstr "" 788 "A megadott adatokkal nem tudtam\n" 789 "bejelentkezni a SimBriefbe. Adj meg\n" 790 "új adatokat, vagy hagyjuk a SimBriefet" 791 783 792 msgid "briefing_title" 784 793 msgstr "Eligazítás (%d/2): %s" -
src/mlx/gui/flight.py
r698 r700 19 19 import os 20 20 import tempfile 21 import threading 21 22 22 23 #----------------------------------------------------------------------------- … … 1603 1604 #----------------------------------------------------------------------------- 1604 1605 1606 class SimBriefCredentialsDialog(gtk.Dialog): 1607 """A dialog window to ask for SimBrief credentials.""" 1608 def __init__(self, gui, userName, password, rememberPassword): 1609 """Construct the dialog.""" 1610 super(SimBriefCredentialsDialog, self).__init__(WINDOW_TITLE_BASE + " - " + 1611 xstr("simbrief_credentials_title"), 1612 gui.mainWindow, 1613 DIALOG_MODAL) 1614 self.add_button(xstr("button_cancel"), RESPONSETYPE_CANCEL) 1615 self.add_button(xstr("button_ok"), RESPONSETYPE_OK) 1616 1617 contentArea = self.get_content_area() 1618 1619 contentAlignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 1620 xscale = 0.0, yscale = 0.0) 1621 contentAlignment.set_padding(padding_top = 4, padding_bottom = 16, 1622 padding_left = 8, padding_right = 8) 1623 1624 contentArea.pack_start(contentAlignment, False, False, 0) 1625 1626 contentVBox = gtk.VBox() 1627 contentAlignment.add(contentVBox) 1628 1629 label = gtk.Label(xstr("simbrief_login_failed")) 1630 label.set_alignment(0.0, 0.0) 1631 1632 contentVBox.pack_start(label, False, False, 0) 1633 1634 tableAlignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 1635 xscale = 0.0, yscale = 0.0) 1636 tableAlignment.set_padding(padding_top = 24, padding_bottom = 0, 1637 padding_left = 0, padding_right = 0) 1638 1639 table = gtk.Table(3, 2) 1640 table.set_row_spacings(4) 1641 table.set_col_spacings(16) 1642 table.set_homogeneous(False) 1643 1644 tableAlignment.add(table) 1645 contentVBox.pack_start(tableAlignment, True, True, 0) 1646 1647 label = gtk.Label(xstr("simbrief_username")) 1648 label.set_use_underline(True) 1649 label.set_alignment(0.0, 0.5) 1650 table.attach(label, 0, 1, 0, 1) 1651 1652 self._userName = gtk.Entry() 1653 self._userName.set_width_chars(16) 1654 #self._userName.connect("changed", 1655 # lambda button: self._updateForwardButton()) 1656 self._userName.set_tooltip_text(xstr("simbrief_username_tooltip")) 1657 self._userName.set_text(userName) 1658 table.attach(self._userName, 1, 2, 0, 1) 1659 label.set_mnemonic_widget(self._userName) 1660 1661 label = gtk.Label(xstr("simbrief_password")) 1662 label.set_use_underline(True) 1663 label.set_alignment(0.0, 0.5) 1664 table.attach(label, 0, 1, 1, 2) 1665 1666 self._password = gtk.Entry() 1667 self._password.set_visibility(False) 1668 #self._password.connect("changed", 1669 # lambda button: self._updateForwardButton()) 1670 self._password.set_tooltip_text(xstr("simbrief_password_tooltip")) 1671 self._password.set_text(password) 1672 table.attach(self._password, 1, 2, 1, 2) 1673 label.set_mnemonic_widget(self._password) 1674 1675 self._rememberButton = gtk.CheckButton(xstr("simbrief_remember_password")) 1676 self._rememberButton.set_use_underline(True) 1677 self._rememberButton.set_tooltip_text(xstr("simbrief_remember_tooltip")) 1678 self._rememberButton.set_active(rememberPassword) 1679 table.attach(self._rememberButton, 1, 2, 2, 3, ypadding = 8) 1680 1681 @property 1682 def userName(self): 1683 """Get the user name entered.""" 1684 return self._userName.get_text() 1685 1686 @property 1687 def password(self): 1688 """Get the password entered.""" 1689 return self._password.get_text() 1690 1691 @property 1692 def rememberPassword(self): 1693 """Get whether the password is to be remembered.""" 1694 return self._rememberButton.get_active() 1695 1696 def run(self): 1697 """Run the dialog.""" 1698 self.show_all() 1699 1700 response = super(SimBriefCredentialsDialog, self).run() 1701 1702 self.hide() 1703 1704 return response 1705 1706 #----------------------------------------------------------------------------- 1707 1605 1708 class SimBriefSetupPage(Page): 1606 1709 """Page for setting up some parameters for SimBrief.""" … … 1702 1805 table.attach(self._rememberButton, 1, 2, 2, 3, ypadding = 8) 1703 1806 1807 self._credentialsCondition = threading.Condition() 1808 self._credentialsAvailable = False 1809 self._credentialsUserName = None 1810 self._credentialsPassword = None 1811 1704 1812 self.addCancelFlightButton() 1705 1813 … … 1716 1824 1717 1825 self._updateForwardButton() 1718 1719 1826 1720 1827 def _updateForwardButton(self): … … 1745 1852 print "plan:", plan 1746 1853 1747 userName = self._userName.get_text()1748 password = self._password.get_text()1749 1750 1854 self._wizard.gui.beginBusy("Calling SimBrief...") 1751 1855 1752 1856 cef.callSimBrief(plan, 1753 lambda count: (userName, password),1857 self._getCredentialsCallback, 1754 1858 self._simBriefProgressCallback, 1755 1859 SimBriefSetupPage.getHTMLFilePath()) 1756 1860 1757 1861 startSound(const.SOUND_NOTAM) 1862 1863 def _getCredentialsCallback(self, count): 1864 """Called when the SimBrief home page requests the credentials.""" 1865 with self._credentialsCondition: 1866 self._credentialsAvailable = False 1867 1868 gobject.idle_add(self._getCredentials, count) 1869 1870 while not self._credentialsAvailable: 1871 self._credentialsCondition.wait() 1872 1873 return (self._credentialsUserName, self._credentialsPassword) 1874 1875 def _getCredentials(self, count): 1876 """Get the credentials. 1877 1878 If count is 0, the user name and password entered into the setup page 1879 are returned. Otherwise a dialog box is displayed informing the user of 1880 invalid credentials and requesting another set of them.""" 1881 with self._credentialsCondition: 1882 if count==0: 1883 self._credentialsUserName = self._userName.get_text() 1884 self._credentialsPassword = self._password.get_text() 1885 else: 1886 gui = self._wizard.gui 1887 config = gui.config 1888 1889 dialog = SimBriefCredentialsDialog(gui, 1890 config.simBriefUserName, 1891 config.simBriefPassword, 1892 config.rememberSimBriefPassword) 1893 response = dialog.run() 1894 1895 if response==RESPONSETYPE_OK: 1896 self._credentialsUserName = dialog.userName 1897 self._userName.set_text(self._credentialsUserName) 1898 self._credentialsPassword = dialog.password 1899 self._password.set_text(self._credentialsPassword) 1900 rememberPassword = dialog.rememberPassword 1901 1902 config.simBriefUserName = self._credentialsUserName 1903 1904 config.simBriefPassword = \ 1905 self._credentialsPassword if rememberPassword else "" 1906 config.rememberSimBriefPassword = rememberPassword 1907 1908 config.save() 1909 else: 1910 self._credentialsUserName = None 1911 self._credentialsPassword = None 1912 1913 self._credentialsAvailable = True 1914 self._credentialsCondition.notify() 1758 1915 1759 1916 def _simBriefProgressCallback(self, progress, result, flightInfo):
Note:
See TracChangeset
for help on using the changeset viewer.