Changeset 4159

Show
Ignore:
Timestamp:
06/18/08 19:47:56 (2 months ago)
Author:
ed
Message:

Added the TransparencyDelay? property. It is simply eye candy; it smooths out changes in transparency over the time specified in this property (default=0.25 sec.).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/ui/uiwx/dPemMixin.py

    r4139 r4159  
    4040        # Transparency level 
    4141        self._transparency = 255 
    42          
     42        # Time to change transparency 
     43        self._transparencyDelay = 0.25 
     44 
    4345        # There are a few controls that don't yet support 3-way inits (grid, for  
    4446        # one). These controls will send the wx classref as the preClass argument,  
     
    459461        if self._hover: 
    460462            if self._hoverTimer: 
    461                 self._hoverTimer.stop() 
     463                self._hoverTimer.release() 
     464                self._hoverTimer = None 
    462465            self.endHover(evt) 
    463466     
     
    24792482        if self._constructed(): 
    24802483            val = min(max(val, 0), 255) 
    2481             self._transparency = val 
    2482             self.SetTransparent(val) 
     2484            delay = self.TransparencyDelay 
     2485            if delay: 
     2486                sleeptime = delay / 10.0 
     2487                oldVal = self._transparency 
     2488                self._transparency = val 
     2489                slice = (val - oldVal) / 10 
     2490                newVal = oldVal 
     2491                for i in xrange(10): 
     2492                    newVal = int(round(newVal + slice, 0)) 
     2493                    newVal = min(max(newVal, 0), 255) 
     2494                    self.SetTransparent(newVal) 
     2495                    self.refresh() 
     2496                    time.sleep(sleeptime) 
     2497                # Make sure that there is no rounding error 
     2498                self.SetTransparent(val) 
     2499            else: 
     2500                self.SetTransparent(val) 
    24832501        else: 
    24842502            self._properties["Transparency"] = val 
     2503 
     2504 
     2505    def _getTransparencyDelay(self): 
     2506        return self._transparencyDelay 
     2507 
     2508    def _setTransparencyDelay(self, val): 
     2509        if self._constructed(): 
     2510            self._transparencyDelay = val 
     2511        else: 
     2512            self._properties["TransparencyDelay"] = val 
    24852513 
    24862514 
     
    27212749            Default=0. Does not currently work on Gtk/Linux.  (int)""")) 
    27222750     
     2751    TransparencyDelay = property(_getTransparencyDelay, _setTransparencyDelay, None, 
     2752            _("""Time in seconds to change transparency. Set it to zero to see instant changes. 
     2753            Default=0.25 (float)""")) 
     2754 
    27232755    Visible = property(_getVisible, _setVisible, None, 
    27242756            _("Specifies whether the object is visible at runtime.  (bool)") )