(self, widget, allocation, old_data)
Scale our font correctly based on how big we are not vs before
Scale our font correctly based on how big we are not vs before
Scale our font correctly based on how big we are not vs before
def zoom_scale(self, widget, allocation, old_data):
        """Scale our font correctly based on how big we are not vs before"""
        self.cnxids.remove_signal(self, 'size-allocate')
        # FIXME: Is a zoom signal actualy used anywhere?
        self.cnxids.remove_signal(self, 'zoom')

        new_columns = self.vte.get_column_count()
        new_rows = self.vte.get_row_count()
        new_font = self.vte.get_font()

        dbg('Terminal::zoom_scale: Resized from %dx%d to %dx%d' % (
             old_data['old_columns'],
             old_data['old_rows'],
             new_columns,
             new_rows))

        if new_rows == old_data['old_rows'] or \
           new_columns == old_data['old_columns']:
            dbg('Terminal::zoom_scale: One axis unchanged, not scaling')
            return

        scale_factor = min ( (new_columns / old_data['old_columns'] * 0.97),
                             (new_rows / old_data['old_rows'] * 1.05) )

        new_size = int(old_data['old_font'].get_size() * scale_factor)
        if new_size == 0:
            err('refusing to set a zero sized font')
            return
        new_font.set_size(new_size)
        dbg('setting new font: %s' % new_font)
        self.set_font(new_font)
def zoom_scale ( self , widget , allocation , old_data ) : self . cnxids . remove_signal ( self , 'size-allocate' ) # FIXME: Is a zoom signal actualy used anywhere? self . cnxids . remove_signal ( self , 'zoom' ) new_columns = self . vte . get_column_count ( ) new_rows = self . vte . get_row_count ( ) new_font = self . vte . get_font ( ) dbg ( 'Terminal::zoom_scale: Resized from %dx%d to %dx%d' % ( old_data [ 'old_columns' ] , old_data [ 'old_rows' ] , new_columns , new_rows ) ) if new_rows == old_data [ 'old_rows' ] or new_columns == old_data [ 'old_columns' ] : dbg ( 'Terminal::zoom_scale: One axis unchanged, not scaling' ) return scale_factor = min ( ( new_columns / old_data [ 'old_columns' ] * 0.97 ) , ( new_rows / old_data [ 'old_rows' ] * 1.05 ) ) new_size = int ( old_data [ 'old_font' ] . get_size ( ) * scale_factor ) if new_size == 0 : err ( 'refusing to set a zero sized font' ) return new_font . set_size ( new_size ) dbg ( 'setting new font: %s' % new_font ) self . set_font ( new_font )