def yanal_egim_sol(self): value = self.ui.sliderSolUst.value() egim = (100 - value) / 100 print(str(value) + " egim: " + str(egim)) styleSheet = """ QFrame{ border-top-left-radius: 275px; background-color: qconicalgradient(cx:1, cy:1, angle:180, stop:{STOP_1} rgba(85, 170, 255, 0), stop:{STOP_2} rgba(252, 201, 109, 255)); } """ stop_1 = str(egim - 0.001) stop_2 = str(egim) basdeger = 0 azaltma = 0.0 bas = 0 hizGosterge = value * 1.44 newStyleSheet = styleSheet.replace("{STOP_1}", stop_1).replace("{STOP_2}", stop_2) hizGosterge = int(hizGosterge) self.ui.solUstProgress.setStyleSheet(newStyleSheet) resimegim = value * -2.5 Rightmatrix = QMatrix() Rightmatrix.rotate(resimegim) self.ui.yanal_egim_resim.setPixmap( QPixmap(u"E:\QT Çalışmaları\son_dashboard\kobraon.png"). transformed(Rightmatrix))
def dikey_egim_sag(self): value = self.ui.sliderSagAlt.value() #egim = value / 100 egim = (100 - value) / 100 print(str(value) + " egim: " + str(egim)) styleSheet = """ QFrame{ border-bottom-right-radius: 275px;\n background-color: qconicalgradient(cx:0, cy:0, angle:0, stop:{STOP_1} rgba(85, 170, 255, 0), stop:{STOP_2} rgba(121, 50, 190, 255));\n } """ stop_1 = str(egim - 0.001) stop_2 = str(egim) basdeger = 0 azaltma = 0.0 bas = 0 hizGosterge = value * 1.44 newStyleSheet = styleSheet.replace("{STOP_1}", stop_1).replace("{STOP_2}", stop_2) hizGosterge = int(hizGosterge) self.ui.sagAltProgress.setStyleSheet(newStyleSheet) resimegim = value * 2.5 Rightmatrix = QMatrix() Rightmatrix.rotate(resimegim) self.ui.dikey_egim_resim.setPixmap( QPixmap(u"E:\QT Çalışmaları\son_dashboard\kobrayan.png"). transformed(Rightmatrix))
def _turn(self, var: QSize): """ turns icon :param var: :return: """ rm = QMatrix() rm.rotate(var.width()) super().setIcon(self.icon.transformed(rm))
def setupMatrix(self): scale = 2**((self.zoomSlider.value() - 250) / 50.0) matrix = QMatrix() matrix.scale(scale, scale) matrix.rotate(self.rotateSlider.value()) self.graphicsView.setMatrix(matrix) self.setResetButtonEnabled()
def show_label_img(self, do_roate=False, do_roate_img=False, do_roate_mask=False, do_clear=False): if not self.all_img_file: return img_path = self.all_img_file[self.all_img_file_index] img = QPixmap(str(img_path)) img_mask_path = img_path.parent.joinpath(f'mask/{img_path.stem}.bmp') img_mask_path.parent.mkdir(parents=True, exist_ok=True) if img_mask_path.is_dir(): QMessageBox.warning( self, '<致命错误>', f'标注文件<{img_mask_path}>是一个目录, 请把它拷贝到别的地方, 然后重新打开标注工具!!!', QMessageBox.Ok) sys.exit(-1) if img_mask_path.exists(): img_mask = QPixmap(str(img_mask_path)) if img_mask.size() != self.mask_img_size: os.remove(str(img_mask_path)) if not img_mask_path.exists() or do_clear: img_mask = QPixmap(self.mask_img_size) img_mask.fill(QColor(0, 0, 0)) img_mask.save(str(img_mask_path)) if do_roate: rm = QMatrix() rm.rotate(90) img = img.transformed(rm) img.save(str(img_path)) img_mask = img_mask.transformed(rm) img_mask.save(str(img_mask_path)) if do_roate_img: rm = QMatrix() rm.rotate(90) img = img.transformed(rm) img.save(str(img_path)) if do_roate_mask: rm = QMatrix() rm.rotate(90) img_mask = img_mask.transformed(rm) img_mask.save(str(img_mask_path)) self.label_img.update_label_img(img, img_mask, str(img_mask_path))