Changeset 831

Show
Ignore:
Timestamp:
03/05/08 15:46:50 (9 months ago)
Author:
sontag
Message:

Fixes ticket #20 by determining the num lines/cols via wutil when possible. Still requires a "stty resize" upon resize, as seems to have been the original intent

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/iraffunctions.py

    r828 r831  
    20312031                raise TypeError('unexpected keyword argument: '+key) 
    20322032        if terminal is None and len(kw) == 0: 
     2033            # will need default values for the next step; try _wutil for them 
     2034            dftNcol = '80' 
     2035            dftNlin = '24' 
     2036            try: 
     2037               if _sys.stdout.isatty(): 
     2038                   nlines,ncols = _wutil.getTermWindowSize() 
     2039                   dftNcol = str(ncols) 
     2040                   dftNlin = str(nlines) 
     2041            except: pass # No error message here - may not always be available 
    20332042            # no args: print terminal type and size 
    20342043            print '%s ncols=%s nlines=%s' % (envget('terminal','undefined'), 
    2035                     envget('ttyncols','80'), envget('ttynlines','24')) 
     2044                    envget('ttyncols',dftNcol), envget('ttynlines',dftNlin)) 
    20362045        elif expkw['resize'] or expkw['terminal'] == "resize": 
    2037             # resize: sets CL environmental parameters giving screen size 
     2046            # resize: sets CL env parameters giving screen size; show errors 
    20382047            if _sys.stdout.isatty(): 
    20392048                nlines,ncols = _wutil.getTermWindowSize() 
     
    20412050        elif expkw['terminal']: 
    20422051            set(terminal=expkw['terminal']) 
     2052            # They are setting the terminal type.  Let's at least try to 
     2053            # get the dimensions if not given. This is more than the CL does. 
     2054            if (not kw.has_key('nlines')) and (not kw.has_key('ncols')) and \ 
     2055               _sys.stdout.isatty(): 
     2056                try: 
     2057                    nlines,ncols = _wutil.getTermWindowSize() 
     2058                    set(ttyncols=str(ncols), ttynlines=str(nlines)) 
     2059                except: pass # No error msg here - may not always be available 
    20432060        elif expkw['playback'] is not None: 
    20442061            _writeError("stty playback not implemented")