def start(self): QApplication.setStyle(QStyleFactory.create('Plastique')) app = QApplication(sys.argv) set_style(app) # Splash Start splash = QSplashScreen(QPixmap('img/bsplash.png')) splash.show() self.gui = ZenBB(self.db) self.gui.download_action = self.download_action # Loading and setting things up h = max(650, 640) self.gui._set_tool_bar() self.gui.main_window.setMinimumSize(16 * h / 9, h) # Movies splash.showMessage('Loading latest Movies', Qt.AlignCenter, Qt.white) self.gui.widget_movie.load_default() # TV splash.showMessage('Loading latest TV Shows', Qt.AlignCenter, Qt.white) self.gui.widget_tv.load_default() # Anime splash.showMessage('Loading latest Anime', Qt.AlignCenter, Qt.white) # self.widget_anime.load_default() # connect to server splash.showMessage('Connecting ...', Qt.AlignCenter, Qt.white) # connection = self.s.query(XDCCServer).filter(XDCCServer.url == 'irc.criten.net').limit(1).all() connection = self.db.query(XDCCServer).all() cb = CallBack() cb.info.policy = 1 self.bot = MultiBot(connection) # self.bot.callback = lambda p, y: cb.add_packet(p, self.db, y) self.bot.irc.download_end_callback = self.download_end self.bot.irc.download_starting_callback = self.download_start self.bot.irc.download_progress_callback = self.download_progress # Splash End self.gui.main_window.show() splash.finish(self.gui.main_window) w = self.gui.widget_movie.sizeHint().width() self.gui.main_window.resize(w + 20, w * 9 / 16) # Custom loop try: while self.gui.running: app.processEvents() self.bot.irc.reactor.process_once() finally: self.db.commit()
if b is not None: self.layout.addWidget(b, self.row, 6, 1, 5) def save_config(self): pass def load_config(self): pass if __name__ == '__main__': import sys from GUI.style import set_style QApplication.setStyle(QStyleFactory.create('Plastique')) app = QApplication(sys.argv) # db = 'C:/ZenBBData/my_db.db' engine = create_engine('sqlite:///' + db, echo=False) db = create_db(engine) m = db.query(Movie).all()[0] set_style(app) main = Configuration() main.show() sys.exit(app.exec_())