Changeset 589:f91b10730de0 for src/mlx
- Timestamp:
- 12/23/14 08:38:54 (10 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r588 r589 2669 2669 xscale = 0.0, yscale = 0.0) 2670 2670 2671 table = gtk.Table( 6, 5)2671 table = gtk.Table(7, 24) 2672 2672 table.set_row_spacings(4) 2673 2673 table.set_col_spacings(16) … … 2676 2676 self.setMainWidget(alignment) 2677 2677 2678 row = 0 2679 2680 label = gtk.Label(xstr("landing_metar")) 2681 label.set_use_underline(True) 2682 label.set_alignment(0.0, 0.5) 2683 table.attach(label, 0, 1, row, row+1) 2684 2685 self._metar = gtk.Entry() 2686 self._metar.set_width_chars(40) 2687 self._metar.connect("changed", self._metarChanged) 2688 self._metar.get_buffer().connect_after("inserted-text", self._metarInserted) 2689 table.attach(self._metar, 1, 24, row, row+1) 2690 label.set_mnemonic_widget(self._metar) 2691 2692 self._updatingMETAR = False 2693 2694 row += 1 2695 2678 2696 self._starButton = gtk.CheckButton() 2679 2697 self._starButton.connect("clicked", self._starButtonClicked) 2680 table.attach(self._starButton, 0, 1, 0,1)2698 table.attach(self._starButton, 0, 1, row, row + 1) 2681 2699 2682 2700 label = gtk.Label(xstr("landing_star")) 2683 2701 label.set_use_underline(True) 2684 2702 label.set_alignment(0.0, 0.5) 2685 table.attach(label, 1, 2, 0,1)2703 table.attach(label, 1, 2, row, row + 1) 2686 2704 2687 2705 self._star = gtk.Entry() … … 2690 2708 self._star.connect("changed", self._upperChanged) 2691 2709 self._star.set_sensitive(False) 2692 table.attach(self._star, 2, 4, 0,1)2710 table.attach(self._star, 2, 4, row, row + 1) 2693 2711 label.set_mnemonic_widget(self._starButton) 2712 2713 row += 1 2694 2714 2695 2715 self._transitionButton = gtk.CheckButton() 2696 2716 self._transitionButton.connect("clicked", self._transitionButtonClicked) 2697 table.attach(self._transitionButton, 0, 1, 1, 2)2717 table.attach(self._transitionButton, 0, 1, row, row + 1) 2698 2718 2699 2719 label = gtk.Label(xstr("landing_transition")) 2700 2720 label.set_use_underline(True) 2701 2721 label.set_alignment(0.0, 0.5) 2702 table.attach(label, 1, 2, 1, 2)2722 table.attach(label, 1, 2, row, row + 1) 2703 2723 2704 2724 self._transition = gtk.Entry() … … 2707 2727 self._transition.connect("changed", self._upperChanged) 2708 2728 self._transition.set_sensitive(False) 2709 table.attach(self._transition, 2, 4, 1, 2)2729 table.attach(self._transition, 2, 4, row, row + 1) 2710 2730 label.set_mnemonic_widget(self._transitionButton) 2731 2732 row += 1 2711 2733 2712 2734 label = gtk.Label(xstr("landing_runway")) 2713 2735 label.set_use_underline(True) 2714 2736 label.set_alignment(0.0, 0.5) 2715 table.attach(label, 1, 2, 2, 3)2737 table.attach(label, 1, 2, row, row + 1) 2716 2738 2717 2739 self._runway = gtk.Entry() … … 2719 2741 self._runway.set_tooltip_text(xstr("landing_runway_tooltip")) 2720 2742 self._runway.connect("changed", self._upperChanged) 2721 table.attach(self._runway, 2, 4, 2, 3)2743 table.attach(self._runway, 2, 4, row, row + 1) 2722 2744 label.set_mnemonic_widget(self._runway) 2745 2746 row += 1 2723 2747 2724 2748 label = gtk.Label(xstr("landing_approach")) 2725 2749 label.set_use_underline(True) 2726 2750 label.set_alignment(0.0, 0.5) 2727 table.attach(label, 1, 2, 3, 4)2751 table.attach(label, 1, 2, row, row + 1) 2728 2752 2729 2753 self._approachType = gtk.Entry() … … 2731 2755 self._approachType.set_tooltip_text(xstr("landing_approach_tooltip")) 2732 2756 self._approachType.connect("changed", self._upperChanged) 2733 table.attach(self._approachType, 2, 4, 3, 4)2757 table.attach(self._approachType, 2, 4, row, row + 1) 2734 2758 label.set_mnemonic_widget(self._approachType) 2759 2760 row += 1 2735 2761 2736 2762 label = gtk.Label(xstr("landing_vref")) … … 2738 2764 label.set_use_underline(True) 2739 2765 label.set_alignment(0.0, 0.5) 2740 table.attach(label, 1, 2, 4, 5)2766 table.attach(label, 1, 2, row, row + 1) 2741 2767 2742 2768 self._vref = IntegerEntry() … … 2744 2770 self._vref.set_tooltip_markup(xstr("landing_vref_tooltip_knots")) 2745 2771 self._vref.connect("integer-changed", self._vrefChanged) 2746 table.attach(self._vref, 3, 4, 4, 5)2772 table.attach(self._vref, 3, 4, row, row + 1) 2747 2773 label.set_mnemonic_widget(self._vref) 2748 2774 2749 2775 self._vrefUnit = gtk.Label(xstr("label_knots")) 2750 table.attach(self._vrefUnit, 4, 5, 4, 5) 2776 table.attach(self._vrefUnit, 4, 5, row, row + 1) 2777 2778 row += 1 2751 2779 2752 2780 self._antiIceOn = gtk.CheckButton(xstr("landing_antiice")) 2753 2781 self._antiIceOn.set_use_underline(True) 2754 2782 self._antiIceOn.set_tooltip_text(xstr("landing_antiice_tooltip")) 2755 table.attach(self._antiIceOn, 3, 5, 5, 6)2783 table.attach(self._antiIceOn, 3, 5, row, row + 1) 2756 2784 2757 2785 self.addCancelFlightButton() … … 2764 2792 self._starButton.set_active(True) 2765 2793 self._transitionButton.set_active(True) 2794 2795 self._active = False 2766 2796 2767 2797 @property … … 2807 2837 self._antiIceOn.set_active(False) 2808 2838 self._flightEnded = False 2839 self._active = False 2809 2840 2810 2841 def activate(self): 2811 2842 """Called when the page is activated.""" 2843 self._updatingMETAR = True 2844 self._metar.get_buffer().set_text(self._wizard.arrivalMETAR, -1) 2845 self._updatingMETAR = False 2846 2812 2847 self._starButton.set_sensitive(True) 2813 2848 self._starButton.set_active(False) … … 2835 2870 2836 2871 self._updateForwardButton() 2872 2873 self._active = True 2837 2874 2838 2875 def flightEnded(self): … … 2841 2878 self._flightEnded = True 2842 2879 self._updateForwardButton() 2880 2881 def changeMETAR(self, metar): 2882 """Change the METAR as a result of an edit on one of the other 2883 pages.""" 2884 if self._active: 2885 print "LandingPage.changeMETAR" 2886 self._updatingMETAR = True 2887 self._metar.get_buffer().set_text(metar, -1) 2888 self._updatingMETAR = False 2889 2890 self._updateForwardButton() 2843 2891 2844 2892 def _starButtonClicked(self, button): … … 2861 2909 """Update the sensitivity of the forward button.""" 2862 2910 sensitive = self._flightEnded and \ 2911 self._metar.get_text()!="" and \ 2863 2912 (self._starButton.get_active() or \ 2864 2913 self._transitionButton.get_active()) and \ … … 2902 2951 """Callback for the fleet retrieval.""" 2903 2952 self._wizard.nextPage() 2953 2954 def _metarChanged(self, entry): 2955 """Called when the METAR has changed.""" 2956 print "LandingPage.metarChanged", self._updatingMETAR 2957 if not self._updatingMETAR: 2958 self._updateForwardButton() 2959 self._wizard.metarChanged(entry.get_text(), self) 2960 2961 def _metarInserted(self, buffer, position, text, length): 2962 """Called when new characters are inserted into the METAR. 2963 2964 It uppercases all characters.""" 2965 print "LandingPage.metarInserted", self._updatingMETAR 2966 if not self._updatingMETAR: 2967 self._updatingMETAR = True 2968 2969 buffer.delete_text(position, length) 2970 buffer.insert_text(position, text.upper(), length) 2971 2972 self._updatingMETAR = False 2904 2973 2905 2974 #----------------------------------------------------------------------------- … … 3846 3915 originator is the page that originated the change. It will not be 3847 3916 called to set the METAR, while others will be.""" 3848 for page in [self._arrivalBriefingPage ]:3917 for page in [self._arrivalBriefingPage, self._landingPage]: 3849 3918 if page is not originator: 3850 3919 page.changeMETAR(metar)
Note:
See TracChangeset
for help on using the changeset viewer.