Commits

nakamura committed 7afc1f0

resize preferred width/height

Comments (0)

Files changed (1)

         row, col = divmod(len(self.terminals), self.config.columns)
         self._grid.attach(term_frame, col, row, 1, 1)
 
-        self.resize_layout()
-
         term_frame.terminal.connect_object('commit',
                                            self.do_term_commit, term_frame)
         term_frame.terminal.connect_object('key-press-event',
                                            self.do_term_key_press, term_frame)
 
         term_frame.show_all()
+        self.resize_layout()
 
     def resize_layout(self):
-        w = 0
-        h = 0
-
-        for row in (self.terminals[n:n+self.config.columns]
-                    for n in xrange(0, len(self.terminals), self.config.columns)):
-            w = max(w, sum(t.width for t in row))
-            h += max(t.height for t in row)
+        w, _ = self._grid.get_preferred_width()
+        h, _ = self._grid.get_preferred_height()
 
         self._layout.set_size(w, h)
         self._grid.set_size_request(w, h)