Changeset 146:516b35b98365


Ignore:
Timestamp:
05/01/12 18:12:10 (13 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Disabled the handling of mouse events if the widget is disabled

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/flight.py

    r145 r146  
    995995        super(FuelTank, self).__init__()
    996996
     997        self._enabled = True
    997998        self.fuelTank = fuelTank
    998999        self.capacity = capacity
     
    10541055        """Disable the fuel tank."""
    10551056        self._expectedButton.set_sensitive(False)
     1057        self._enabled = False
    10561058
    10571059    def _redraw(self):
     
    11391141
    11401142        The expected level will be set there."""
    1141         if event.button==1:
     1143        if self._enabled and event.button==1:
    11421144            self._setExpectedFromY(event.y)
    11431145       
    11441146    def _motionNotify(self, tankFigure, event):
    11451147        """Called when the mouse pointer moves within the area of a tank figure."""
    1146         if event.state==BUTTON1_MASK:           
     1148        if self._enabled and event.state==BUTTON1_MASK:           
    11471149            self._setExpectedFromY(event.y)
    11481150
    11491151    def _scrolled(self, tankFigure, event):
    11501152        """Called when a scroll event is received."""
    1151         increment = 1 if event.state==CONTROL_MASK \
    1152                     else 100 if event.state==SHIFT_MASK \
    1153                     else 10 if event.state==0 else 0
    1154         if increment!=0:
    1155             if event.direction==SCROLL_DOWN:
    1156                 increment *= -1
    1157             self._expectedButton.spin(SPIN_USER_DEFINED, increment)
     1153        if self._enabled:
     1154            increment = 1 if event.state==CONTROL_MASK \
     1155                        else 100 if event.state==SHIFT_MASK \
     1156                        else 10 if event.state==0 else 0
     1157            if increment!=0:
     1158                if event.direction==SCROLL_DOWN:
     1159                    increment *= -1
     1160                self._expectedButton.spin(SPIN_USER_DEFINED, increment)
    11581161       
    11591162    def _expectedChanged(self, spinButton):
Note: See TracChangeset for help on using the changeset viewer.