| 289 | |
| 290 | |
| 291 | class CefApplication(QApplication): |
| 292 | def __init__(self, args): |
| 293 | super(CefApplication, self).__init__(args) |
| 294 | if not cef.GetAppSetting("external_message_pump"): |
| 295 | self.timer = self.createTimer() |
| 296 | self.setupIcon() |
| 297 | |
| 298 | def createTimer(self): |
| 299 | timer = QTimer() |
| 300 | # noinspection PyUnresolvedReferences |
| 301 | timer.timeout.connect(self.onTimer) |
| 302 | timer.start(10) |
| 303 | return timer |
| 304 | |
| 305 | def onTimer(self): |
| 306 | cef.MessageLoopWork() |
| 307 | |
| 308 | def stopTimer(self): |
| 309 | # Stop the timer after Qt's message loop has ended |
| 310 | self.timer.stop() |
| 311 | |
| 312 | def setupIcon(self): |
| 313 | icon_file = os.path.join(os.path.abspath(os.path.dirname(__file__)), |
| 314 | "resources", "{0}.png".format(sys.argv[1])) |
| 315 | if os.path.exists(icon_file): |
| 316 | self.setWindowIcon(QIcon(icon_file)) |
| 317 | |
| 318 | |
| 319 | class LoadHandler(object): |