18 def __init__(self, file):
29 if len(l) > 0 and l[0] == '#':
40 print "WARNING: ignored line `%s' in screens file" % (s)
44 if current_format is not None:
45 current_screen.formats.append(current_format)
48 if current_screen is not None:
49 self.screens.append(current_screen)
52 current_screen = Screen()
53 current_screen.name = b[1]
55 if current_format is not None:
56 current_screen.formats.append(current_format)
59 current_format = Format()
60 current_format.ratio = float(b[1])
62 current_format.x = int(b[1])
64 current_format.y = int(b[1])
66 current_format.width = int(b[1])
67 elif b[0] == 'height':
68 current_format.height = int(b[1])
69 elif b[0] == 'external':
70 current_format.external = int(b[1]) == 1
72 if current_format is not None:
73 current_screen.formats.append(current_format)
75 if current_screen is not None:
76 self.screens.append(current_screen)
78 def get_format(self, screen, ratio):
79 for s in self.screens: