def SetData(self, pSize=None, dataLen=0, state="", waifuSize=None, waifuDataLen=0, waifuState="", waifuTick=0, isInit=False): self.epsLabel.setText("位置:{}/{}".format(self.parent().curIndex+1, self.parent().maxPic)) if pSize or isInit: if not pSize: pSize = QSize(0, 0) self.resolutionLabel.setText("分辨率:{}x{}".format(str(pSize.width()), str(pSize.height()))) if dataLen or isInit: self.sizeLabel.setText("大小: " + ToolUtil.GetDownloadSize(dataLen)) if waifuSize or isInit: if not waifuSize: waifuSize = QSize(0, 0) self.resolutionWaifu.setText("分辨率:{}x{}".format(str(waifuSize.width()), str(waifuSize.height()))) if waifuDataLen or isInit: self.sizeWaifu.setText("大小:" + ToolUtil.GetDownloadSize(waifuDataLen)) if state or isInit: self.stateLable.setText("状态:" + state) if waifuState or isInit: self.stateWaifu.setText("状态:" + waifuState) if waifuTick or isInit: self.tickLabel.setText("耗时:" + str(waifuTick) + "s") self.parent().MoveTool()
def UpdateTable(self): for task in self.downloadingList: assert isinstance(task, DownloadInfo) downloadLen = task.speedDownloadLen size = ToolUtil.GetDownloadSize(downloadLen) allSize = ToolUtil.GetDownloadSize(task.downloadLen) task.speed = size + "/s" task.downSize = allSize self.UpdateTableItem(task) task.speedDownloadLen = 0
def SetData(self, pSize=None, dataLen=0, state="", waifuSize=None, waifuDataLen=0, waifuState="", waifuTick=0, isInit=False): self.UpdateSlider() self.epsLabel.setText("位置:{}/{}".format(self.readImg.curIndex + 1, self.readImg.maxPic)) if pSize or isInit: if not pSize: pSize = QSize(0, 0) self.resolutionLabel.setText("分辨率:{}x{}".format( str(pSize.width()), str(pSize.height()))) if dataLen or isInit: self.sizeLabel.setText("大小: " + ToolUtil.GetDownloadSize(dataLen)) if waifuSize or isInit: if not waifuSize: waifuSize = QSize(0, 0) self.resolutionWaifu.setText("分辨率:{}x{}".format( str(waifuSize.width()), str(waifuSize.height()))) if waifuDataLen or isInit: self.sizeWaifu.setText("大小:" + ToolUtil.GetDownloadSize(waifuDataLen)) if state or isInit: self.stateLable.setText("状态:" + state) if waifuState or isInit: if waifuState == QtFileData.WaifuStateStart: self.stateWaifu.setStyleSheet("color:red;") elif waifuState == QtFileData.WaifuStateEnd: self.stateWaifu.setStyleSheet("color:green;") elif waifuState == QtFileData.WaifuStateFail: self.stateWaifu.setStyleSheet("color:red;") else: self.stateWaifu.setStyleSheet("color:dark;") if config.CanWaifu2x: self.stateWaifu.setText("状态:" + waifuState) if waifuTick or isInit: self.tickLabel.setText("耗时:" + str(waifuTick) + "s")
def _ShowImg(self, data): self.scaleCnt = 0 self.pixMap = QPixmap() self.pixMap.loadFromData(data) self.show() self.graphicsItem.setPixmap(self.pixMap) self.graphicsView.setSceneRect(QRectF(QPointF(0, 0), QPointF(self.pixMap.width(), self.pixMap.height()))) size = ToolUtil.GetDownloadSize(len(data)) self.sizeLabel.setText(size) weight, height = ToolUtil.GetPictureSize(data) self.resolutionLabel.setText(str(weight) + "x" + str(height)) self.ScalePicture()
def UpdateTable(self): for task in self.downloadingList: assert isinstance(task, DownloadInfo) self.UpdateTableItem(task) task.speedStr = ToolUtil.GetDownloadSize(task.speed) + "/s" task.speed = 0