10 AvailableOutputs.append("--error-output=Qt")
17 AvailableOutputs.append("--error-output=GTK")
23 AvailableOutputs.append("--error-output=SDL")
28 if Output == "--error-output=Qt":
30 elif Output == "--error-output=GTK":
32 elif Output == "--error-output=SDL":
42 def createQt(errorLine):
43 app = QApplication(sys.argv)
44 QObject.connect(app, SIGNAL('lastWindowClosed()')
49 dialog = QDialog(None, "Error", 0, 0)
50 dialog.setCaption(dialog.tr("Error"))
51 layout=QVBoxLayout(dialog)
55 label=QLabel(errorLine, dialog)
57 layout.addWidget(label)
59 bnExit=QPushButton("Quit", dialog, "add")
60 dialog.connect(bnExit, SIGNAL("clicked()"), qApp, SLOT("quit()"))
62 layout.addWidget(bnExit)
64 app.setMainWidget(dialog)
68 def createGTK(errorLine):
69 window = gtk.Window(gtk.WINDOW_TOPLEVEL)
70 window.connect("destroy", lambda w: gtk.main_quit())
72 window.set_title("Error")
73 vbox = gtk.VBox(False, 5)
75 window.set_border_width(5)
78 frame.set_shadow_type(gtk.SHADOW_NONE)
79 label = gtk.Label(errorLine)
81 vbox.pack_start(frame, False, False, 0)
83 button = gtk.Button("Quit")
84 button.connect_object("clicked", gtk.Widget.destroy, window)
86 vbox.pack_start(button, False, False, 0)
92 def createSDL(errorLine):
95 pygame.display.set_caption("Error")
97 size = width, height = 800, 600
101 screen = pygame.display.set_mode(size)
102 font = pygame.font.Font(None, 32)
105 start = datetime.datetime.now()
106 finish = datetime.datetime.now()
107 delta = finish - start
108 while delta.seconds < autoQuit:
109 for event in pygame.event.get():
110 if event.type == pygame.QUIT or event.type == pygame.KEYDOWN:
116 for line in errorLine.split('\n'):
117 text = font.render(line, 1, (255,255,255) )
118 place[1] += font.size(line)[1]
119 screen.blit(text, text.get_rect().move(place))
122 quitline = "Press any button to continue ("
123 quitline += str(autoQuit - delta.seconds)
125 text = font.render(quitline, 1, (255,255,255) )
126 screen.blit(text, text.get_rect().move(200,400))
128 pygame.display.flip()
130 finish = datetime.datetime.now()
131 delta = finish - start
133 def badDirectRendering():
134 out = os.popen("glxinfo | grep \"direct rendering\"", 'r')
136 direct = "Yes" not in line
142 out = os.popen('xdpyinfo | grep "depth of root"', 'r')
144 p = re.compile("([0-9]*) planes")
145 for line in out.readlines():
146 match = p.search(line)
147 if (match is not None):
148 if int(match.group(1)) > 16:
156 def possibleOutput(text):
157 return text in sys.argv and text in AvailableOutputs
159 if __name__=="__main__":
160 if len(AvailableOutputs) > 0:
161 Output = AvailableOutputs[0]
165 for text in sys.argv:
166 if possibleOutput(text):
169 if "--no-test" in sys.argv:
172 if (badDirectRendering()):
173 error("XBMC needs hardware accelerated OpenGL rendering.\nInstall an appropriate graphics driver.\n\nPlease consult XBMC Wiki for supported hardware\nhttp://wiki.xbmc.org/?title=Supported_hardware")
175 if (badColorDepth()):
176 error("XBMC cannot run unless the\nscreen color depth is atleast 24 bit.\n\nPlease reconfigure your screen.")