Beispiel #1
0
    def test_os_environ_first(self):
        "Check if environment variables have precedence"

        with support.EnvironmentVarGuard() as env:
            env['COLUMNS'] = '777'
            size = termsize.get_terminal_size()
        self.assertEqual(size.columns, 777)

        with support.EnvironmentVarGuard() as env:
            env['ROWS'] = '888'
            size = termsize.get_terminal_size()
        self.assertEqual(size.rows, 888)
Beispiel #2
0
    def test_os_environ_first(self):
        "Check if environment variables have precedence"

        with support.EnvironmentVarGuard() as env:
            env['COLUMNS'] = '777'
            size = termsize.get_terminal_size()
        self.assertEqual(size.columns, 777)

        with support.EnvironmentVarGuard() as env:
            env['ROWS'] = '888'
            size = termsize.get_terminal_size()
        self.assertEqual(size.rows, 888)
Beispiel #3
0
 def test_does_not_crash(self):
     # There's no easy portable way to actually check the size of
     # the terminal, so let's check if it returns something
     # sensible instead.
     size = termsize.get_terminal_size()
     self.assertGreater(size.columns, 0)
     self.assertGreater(size.rows, 0)
Beispiel #4
0
 def test_does_not_crash(self):
     # There's no easy portable way to actually check the size of
     # the terminal, so let's check if it returns something
     # sensible instead.
     size = termsize.get_terminal_size()
     self.assertGreater(size.columns, 0)
     self.assertGreater(size.rows, 0)
Beispiel #5
0
def printRight(message,color = ENDC):
  width = get_terminal_size()[0]
  padding = " " * (width - len(message) - 1)
  print color,
  print '\r',padding,message
  print ENDC,
Beispiel #6
0
            sys.exit()
    else:
        period = period_d
        print "Using %s for horizontal displacement" % str(period)

    max_i = raw_input("\nOptions: A number above 0\nmax_i: ")
    if max_i:
        try:
            #print "gg"
            max_i = int(max_i)
        except:
            print "Please enter an integer"
            question()
            sys.exit()
    else:
        max_i = max_i_d
        print "Using %s for max_i" % str(max_i)

question()

for i in range(0, max_i*10):
    i = i/10.0
    if waveType == "sin":
        f = math.sin
    else:
        f = math.cos
    b = (2*math.pi)/period
    pos = amplitude * f(i*((2*math.pi)/period) - displacement_horiz) + displacement_verti
    width = get_terminal_size()[0]
    print " " * int(pos*10 + width/2), "*"