Changeset 556:07248b9b9899 for src/mlx


Ignore:
Timestamp:
02/01/14 12:28:17 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Fixed problems with sizing with PyGTK (re #224)

File:
1 edited

Legend:

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

    r555 r556  
    105105            longerHelp = completedHelp
    106106
    107         self._helpLabel = gtk.Label(completedHelp)
     107        self._helpLabel = gtk.Label(longerHelp)
    108108        # FIXME: should be a constant in common
    109109        self._helpLabel.set_justify(gtk.Justification.CENTER if pygobject
     
    28142814                                  xscale = 0.0, yscale = 0.0)
    28152815
    2816         table = gtk.Table(8, 2)
     2816        table = gtk.Table(10, 2)
    28172817        table.set_row_spacings(4)
    28182818        table.set_col_spacings(16)
     
    28452845        labelAlignment = gtk.Alignment(xalign=0.0, xscale=0.0)
    28462846        self._depTime = gtk.Label()
    2847         self._depTime.set_width_chars(10)
     2847        self._depTime.set_width_chars(13)
    28482848        self._depTime.set_alignment(0.0, 0.5)
    28492849        self._depTime.set_use_markup(True)
     
    28902890        labelAlignment = gtk.Alignment(xalign=0.0, xscale=0.0)
    28912891        self._arrTime = gtk.Label()
    2892         self._arrTime.set_width_chars(10)
     2892        self._arrTime.set_width_chars(13)
    28932893        self._arrTime.set_alignment(0.0, 0.5)
    28942894        self._arrTime.set_use_markup(True)
     
    33813381        self._pages.append(self._finishPage)
    33823382
     3383        self._requestedWidth = None
     3384        self._requestedHeight = None
     3385
     3386        self.connect("size-allocate", self._sizeAllocate)
     3387
     3388        for page in self._pages:
     3389            page.show_all()
     3390            page.setStyle()
     3391
     3392        self._initialize()
     3393
     3394    def _sizeAllocate(self, widget, allocation):
     3395        if self._requestedWidth is not None and \
     3396           self._requestedHeight is not None:
     3397           return
     3398
     3399        if self._currentPage is not None:
     3400            self.remove(self._pages[self._currentPage])
     3401
    33833402        maxWidth = 0
    33843403        maxHeight = 0
    33853404        for page in self._pages:
    3386             page.show_all()
     3405            self.add(page)
     3406            self.show_all()
    33873407            pageSizeRequest = page.size_request()
    33883408            width = pageSizeRequest.width if pygobject else pageSizeRequest[0]
     
    33903410            maxWidth = max(maxWidth, width)
    33913411            maxHeight = max(maxHeight, height)
    3392             page.setStyle()
    3393         maxWidth += 16
    3394         maxHeight += 32
     3412            self.remove(page)
     3413
     3414        if self._currentPage is not None:
     3415            self.add(self._pages[self._currentPage])
     3416
     3417        self._requestedWidth = maxWidth
     3418        self._requestedHeight = maxHeight
    33953419        self.set_size_request(maxWidth, maxHeight)
    3396 
    3397         self._initialize()
    33983420
    33993421    @property
Note: See TracChangeset for help on using the changeset viewer.