def chat_image_view_ui(self, button):
if not button.img_path:
return
# make widjet
ui_path = G.MW.chat_img_viewer_path
# widget
loader = QtUiTools.QUiLoader()
file = QtCore.QFile(ui_path)
#file.open(QtCore.QFile.ReadOnly)
img_window = G.MW.chatImgViewer = loader.load(file, G.MW)
file.close()
# SHOW IMAGE
image = QtGui.QImage(button.img_path)
img_window.setWindowTitle(button.img_path)
img_window.image_label.setBackgroundRole(QtGui.QPalette.Base)
img_window.image_label.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
img_window.image_label.setScaledContents(True)
img_window.image_label.setPixmap(QtGui.QPixmap.fromImage(image))
# connect button
img_window.cansel_button.clicked.connect(partial(G.MW.close_window, img_window))
img_window.show()
评论列表
文章目录