Logo Search packages:      
Sourcecode: eikazo version File versions  Download package

def Eikazo::Preview::SanePreview::alloc_childs (   self,
  w,
  allocation 
)

event function for size-allocate. Here, we know how large
    this widget is, and we know the width of the vruler and
    the height of the hruler. Hence we can calculate, how much space
    to give to the drawingArea. We'll do this by re-sizing the
    entire table

Definition at line 159 of file Preview.py.

00159                                          :
        """ event function for size-allocate. Here, we know how large
            this widget is, and we know the width of the vruler and
            the height of the hruler. Hence we can calculate, how much space
            to give to the drawingArea. We'll do this by re-sizing the
            entire table
        """
        if not self.vrulerwidth or not self.hrulerheight:
            return
        w,h = tuple(allocation)[2:]
        
        # we want a certain apsect ratio of the drawing area
        # Additionally, we must not give all available space to the table,
        # otherwise would not be able to make the widdget smaller
        w -= sum(self.vrulerwidth)+3
        h -= sum(self.hrulerheight)+3
        
        if h>0 and w>0:
            r = float(w)/h
            if r < self.aspectratio:
                h = int(w / self.aspectratio)
            elif r > self.aspectratio:
                w = int(h * self.aspectratio)
            
            self.preview.set_size_request(w-1, h-1)
            self.preview.map = None
    
    def setImage(self, img, scanwindow):


Generated by  Doxygen 1.6.0   Back to index