def showDemoInfo(self): maplist = [] global demotime demotime = self.ui.demosList.currentItem().text() demoname = lib.demoname(demotime) nickname = lib.demonick(demoname) self.screens = lib.demoscreens(lib.demoname(demotime)) try: screenaddr = self.screens[0] self.screenimg = QImage(screenaddr) screenshot = QPixmap().fromImage(self.screenimg).scaled(self.ui.screen.size(), Qt.KeepAspectRatio, Qt.SmoothTransformation) for scr in self.screens: scrs = scr.split("_") if scrs[1] in ('TOHUNGA', 'ORBITAL'): maplist.append(scrs[1] + "_" + scrs[2]) else: maplist.append(scrs[1]) maps = ", ".join(maplist).lower() except: self.screenimg = QImage('/usr/share/urtdsc/noscreenshot.png') screenshot = QPixmap().fromImage(self.screenimg).scaled(self.ui.screen.size(), Qt.KeepAspectRatio, Qt.SmoothTransformation) maps = "No maps" self.ui.label.setText("<b>" + self.tr("Demoname") + ":</b> " + demoname + "<br><b>" + self.tr("Nickname") + ":</b> " + nickname + "<br><b>" + self.tr("Maps") + ":</b> " + maps) self.ui.screen.setPixmap(screenshot) self.ui.statusbar.showMessage(self.tr("Demo ") + demoname + self.tr(" have ") + str(len(self.screens)) + self.tr(" screenshot(s)."))
def __init__(self, parent): QWidget.__init__(self, parent) self.ui = AllScreensDialog.Ui_Dialog() self.ui.setupUi(self) maplist = [] self.ui.label.setText("") self.ui.screenshotsList.setIconSize(QSize(140, 140)) try: self.scrlist = lib.demoscreens(lib.demoname(demotime)) for screen in self.scrlist: screenimg = QImage(screen) screenshotForList = QIcon( QPixmap.fromImage(screenimg).scaled( QSize(140, 140), Qt.KeepAspectRatio, Qt.SmoothTransformation)) itemForList = QListWidgetItem(screenshotForList, QString.fromUtf8(''), self.ui.screenshotsList) self.ui.screenshotsList.addItem(itemForList) except: pass QMetaObject.connectSlotsByName(self) self.ui.screenshotsList.clicked.connect(self.showScreen) self.ui.copyToDesktop.clicked.connect(self.copyToDesktop)
def removeallstuff(self): lib.removefile( os.path.expanduser("~/" + config.URT_FOLDER + "/q3ut4/demos/") + lib.demoname(demotime)) for screen in self.screens: lib.removefile(screen) self.fillDemosList(2)
def showDemoInfo(self): maplist = [] global demotime demotime = self.ui.demosList.currentItem().text() demoname = lib.demoname(demotime) nickname = lib.demonick(demoname) self.screens = lib.demoscreens(lib.demoname(demotime)) try: screenaddr = self.screens[0] self.screenimg = QImage(screenaddr) screenshot = QPixmap().fromImage(self.screenimg).scaled( self.ui.screen.size(), Qt.KeepAspectRatio, Qt.SmoothTransformation) for scr in self.screens: scrs = scr.split("_") if scrs[1] in ('TOHUNGA', 'ORBITAL'): maplist.append(scrs[1] + "_" + scrs[2]) else: maplist.append(scrs[1]) maps = ", ".join(maplist).lower() except: self.screenimg = QImage('/usr/share/urtdsc/noscreenshot.png') screenshot = QPixmap().fromImage(self.screenimg).scaled( self.ui.screen.size(), Qt.KeepAspectRatio, Qt.SmoothTransformation) maps = "No maps" self.ui.label.setText("<b>" + self.tr("Demoname") + ":</b> " + demoname + "<br><b>" + self.tr("Nickname") + ":</b> " + nickname + "<br><b>" + self.tr("Maps") + ":</b> " + maps) self.ui.screen.setPixmap(screenshot) self.ui.statusbar.showMessage( self.tr("Demo ") + demoname + self.tr(" have ") + str(len(self.screens)) + self.tr(" screenshot(s)."))
def __init__(self, parent): QWidget.__init__(self, parent) self.ui = AllScreensDialog.Ui_Dialog() self.ui.setupUi(self) maplist = [] self.ui.label.setText("") self.ui.screenshotsList.setIconSize(QSize(140, 140)) try: self.scrlist = lib.demoscreens(lib.demoname(demotime)) for screen in self.scrlist: screenimg = QImage(screen) screenshotForList = QIcon(QPixmap.fromImage(screenimg).scaled(QSize(140, 140), Qt.KeepAspectRatio, Qt.SmoothTransformation)) itemForList = QListWidgetItem(screenshotForList, QString.fromUtf8(''), self.ui.screenshotsList) self.ui.screenshotsList.addItem(itemForList) except: pass QMetaObject.connectSlotsByName(self) self.ui.screenshotsList.clicked.connect(self.showScreen) self.ui.copyToDesktop.clicked.connect(self.copyToDesktop)
def copyallstuff(self): lib.copyfile( os.path.expanduser("~/" + config.URT_FOLDER + "/q3ut4/demos/") + lib.demoname(demotime)) for screen in self.screens: lib.copyfile(screen)
def copydemos(self): lib.copyfile( os.path.expanduser("~/" + config.URT_FOLDER + "/q3ut4/demos/") + lib.demoname(demotime))
def removeallstuff(self): lib.removefile(os.path.expanduser("~/" + config.URT_FOLDER + "/q3ut4/demos/") + lib.demoname(demotime)) for screen in self.screens: lib.removefile(screen) self.fillDemosList(2)
def copyallstuff(self): lib.copyfile(os.path.expanduser("~/" + config.URT_FOLDER + "/q3ut4/demos/") + lib.demoname(demotime)) for screen in self.screens: lib.copyfile(screen)
def copydemos(self): lib.copyfile(os.path.expanduser("~/" + config.URT_FOLDER + "/q3ut4/demos/") + lib.demoname(demotime))