def __init__(self, parent): super(MyMenu, self).__init__() self.parent = parent self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) self.mainLayout = QtWidgets.QVBoxLayout(self) self.setMaximumWidth(110) self.mainLayout.setContentsMargins(0, 0, 0, 0) self.loginButton = dy.MPushButton("Login", icon=dy.qt.MIcon(package.get("LibIcon/login.svg"))).tiny() self.loginButton.setMaximumWidth(100) self.logoutButton = dy.MPushButton("Logout", icon=dy.qt.MIcon(package.get("LibIcon/logout.png"))).tiny() self.logoutButton.setMaximumWidth(100) self.setRootPath = dy.MPushButton("Set Root Path", icon=dy.qt.MIcon(package.get("LibIcon/tree_view.svg"))).tiny() self.setRootPath.setMaximumWidth(100) self.importButton = dy.MPushButton("导入资产", icon=dy.qt.MIcon(package.get("LibIcon/import.jpg"))).tiny() self.importButton.setMaximumWidth(100) self.set_theme() self.setup_ui() self.connect_ui()
def __init__(self, icon_path=None): super(LoginAvatar, self).__init__() self.menu = menu.Menu(self) menu_data = {"Login": package.get("LibIcon/login.svg"), "Logout": package.get("LibIcon/logout.svg"), "Set Root Path": package.get("LibIcon/tree_view.svg"), "导入资产": package.get("LibIcon/import.svg"), } self.menu.add_menu(menu_data) self.iconPath = icon_path self.set_dayu_image(QtGui.QPixmap(package.get("LibIcon/shezhi_mian.png")))
def __init__(self, parent): super(CloseLabel, self).__init__() self.setParent(parent) self.parent = parent self.nor_pixmap = QtGui.QPixmap( package.get("LibIcon/close_02.png")).scaled(30, 30) self.hight_pixmap = QtGui.QPixmap( package.get("LibIcon/close_01.png")).scaled(30, 30) self.width = self.nor_pixmap.width() self.height = self.nor_pixmap.height() self.setPixmap(self.nor_pixmap)
def set_project(self, item_list): items = File.File( package.get("LibData/project_data.yaml").replace( "\\", "/")).read_data_from_file() project_data = QtWidgets.QInputDialog().getItem( self, "Get item", "Project:", items, 0, False)[0] for item in item_list: item.menu.set_project(project_data)
def mousePressEvent(self, event): super(LoginAvatar, self).mousePressEvent(event) self.set_dayu_image(QtGui.QPixmap(package.get("LibIcon/shezhi_mian.png"))) if event.button() == QtCore.Qt.LeftButton: self.menu.close() self.menu.show() self.menu.move(QtGui.QCursor.pos()) elif event.button() == QtCore.Qt.RightButton: self.menu.close()
def set_preview_image(self, image_path): """ 设置预览图 :param image_path: 预览图尺寸 :return: """ image_path = os.path.join(self.root_path, image_path) if not os.path.exists(image_path): image_path = package.get("LibIcon/app-maya.png") self.previewLabel.setPixmap(image_path)
def change_zb_button_image(self, zb_file): file_suffix = os.path.splitext(zb_file)[1] if file_suffix not in [".ZBR", ".ZTL", ".ZPR"]: dy.MMessage.error("Place Drag Zbrush File", self) raise TypeError( "The file suffix {0} is not recognized".format(file_suffix)) self.zbDragButton.set_dayu_svg(package.get("LibIcon/Zbrush_done.png")) self.informationWidget.zbCheckBox.setChecked(True) self.informationWidget.zbLabel.setText(os.path.split(zb_file)[-1]) self.zb_path = zb_file return self.zb_path
def change_sp_button_image(self, sp_file): file_suffix = os.path.splitext(sp_file)[1] if file_suffix not in [".spp"]: dy.MMessage.error("Place Drag Substance Paint File", self) raise TypeError( "The file suffix {0} is not recognized".format(file_suffix)) self.spDragButton.set_dayu_svg( package.get("LibIcon/substance_done.png")) self.informationWidget.spCheckBox.setChecked(True) self.informationWidget.spLabel.setText(os.path.split(sp_file)[-1]) self.sp_path = sp_file return self.sp_path
def __init__(self, name): super(Tag, self).__init__() self.setObjectName(name) self.MainLayout = QtWidgets.QHBoxLayout(self) self.MainLayout.setContentsMargins(0, 0, 0, 0) self.setMinimumWidth(100) self.setMaximumWidth(100) self.Avatar = dy.MAvatar() self.Avatar.set_dayu_image( QtGui.QPixmap(package.get("LibIcon/tag_small.png"))) self.Label = dy.MLabel(name).strong() self.MainLayout.addWidget(self.Avatar) self.MainLayout.addWidget(self.Label)
def __init__(self): super(ToolBar, self).__init__() self.mainLayout = QtWidgets.QHBoxLayout(self) self.mainLayout.setContentsMargins(0, 0, 0, 0) self.setMaximumWidth(65) icon_data = File.File(package.get("LibData/library_config.yaml")).read_data_from_file()["CATEGORY"] self.toolbar = ToPBar(icon_data) self.categoryBar = CategoryWidget() self.categoryBar.hide() self._hold = False self.setup_ui() self.connect_ui()
def __init__(self): super(TagWidget, self).__init__() self.tag_data = File.File( package.get("LibData/tag_data.yaml")).read_data_from_file() self.MainLayout = QtWidgets.QVBoxLayout(self) self.MainLayout.setContentsMargins(0, 0, 0, 0) self.split = QtWidgets.QSplitter() self.split.setStyleSheet("width: 0px;") self.split.setOrientation(QtCore.Qt.Vertical) self.viewWidget = QtWidgets.QWidget() self.viewWidget.setMaximumHeight(self.split.height() / 3) self.viewLayout = dy.MFlowLayout(self.viewWidget) self.viewLayout.setContentsMargins(0, 0, 0, 0) self.tagScrollArea = QtWidgets.QScrollArea() self.tagScrollArea.setStyleSheet("width:0px;") self.tagScrollArea.setWidgetResizable(True) self.tagWidget = QtWidgets.QWidget() self.tagLayout = dy.MFlowLayout(self.tagWidget) self.tagScrollArea.setWidget(self.tagWidget) self.setup_ui()
def __init__(self, parent): super(CardMenu, self).__init__() self.parent = parent self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) self.mainLayout = QtWidgets.QVBoxLayout(self) self.importMayaButton = dy.MPushButton( u"导入Maya文件", icon=dy.qt.MIcon(package.get("LibIcon/app-maya.png"))).tiny() self.importZbButton = dy.MPushButton( u"打开Zbrush文件", icon=dy.qt.MIcon(package.get("LibIcon/Zbrush.png"))).tiny() self.importSpButton = dy.MPushButton( u"打开Sp文件", icon=dy.qt.MIcon(package.get("LibIcon/SP_Icon.png"))).tiny() self.openDirButton = dy.MPushButton( u"打开资产文件夹", icon=dy.qt.MIcon(package.get("LibIcon/folder_fill.svg"))).tiny() self.removeCardButton = dy.MPushButton( u"从资产库删除资产", icon=dy.qt.MIcon( package.get("LibIcon/trash_line.svg"))).tiny().warning() self.setProjectButton = dy.MPushButton( u"设置项目", icon=dy.qt.MIcon(package.get("LibIcon/gongju_an.svg"))).tiny() self.setProjectButton.hide() self.set_theme() self.setup_ui() self.connect_ui()
def __init__(self): super(PublishInformation, self).__init__() self.lib_data = File.File(package.get( "LibData/library_config.yaml")).read_data_from_file()["CATEGORY"] self.setObjectName("PublishInformation") self.mainLayout = QtWidgets.QVBoxLayout(self) self.mainLayout.setContentsMargins(0, 0, 0, 0) self.tabletLayout = QtWidgets.QHBoxLayout(self) self.tabletLayout.setContentsMargins(0, 0, 0, 0) self.resetStacked = dy.qt.QStackedWidget() self.PublishCheck_menu = TableMenu(u"发布检查", index=0) self.PublishSett_menu = TableMenu(u"发布信息", index=1) # assetWidget setting self.assetScrollArea = QtWidgets.QScrollArea() self.assetScrollArea.setObjectName("assetScrollArea") self.assetScrollArea.setWidgetResizable(True) self.assetWidget = QtWidgets.QWidget() self.assetWidget.setObjectName("assetWidget") self.assetLayout = QtWidgets.QVBoxLayout(self.assetWidget) self.assetScrollArea.setWidget(self.assetWidget) self.assetsNameLayout = QtWidgets.QHBoxLayout() self.assetsNameLabel = dy.MLabel(u"资产名称:").strong() self.assetsNameLine = dy.MLineEdit() self.assetsNameLine.setFixedWidth(250) self.assetsNameLayout.addWidget(self.assetsNameLabel) self.assetsNameLayout.addWidget(self.assetsNameLine) self.assetsCodeLayout = QtWidgets.QHBoxLayout() self.assetsCodeLabel = dy.MLabel(u"资产CODE:").strong() self.assetsCodeLine = dy.MLineEdit() self.assetsCodeLine.setFixedWidth(250) self.assetsCodeLayout.addWidget(self.assetsCodeLabel) self.assetsCodeLayout.addWidget(self.assetsCodeLine) self.TopCategoryLayout = QtWidgets.QHBoxLayout() self.TopCategoryLabel = dy.MLabel(u"一级分类:").strong() self.TopCategoryLine = dy.MComboBox() self.set_combobox(self.TopCategoryLine, self.lib_data) self.TopCategoryLine.setFixedWidth(200) self.TopCategoryLayout.addWidget(self.TopCategoryLabel) self.TopCategoryLayout.addWidget(self.TopCategoryLine) self.SecondaryCategoryLayout = QtWidgets.QHBoxLayout() self.SecondaryCategoryLabel = dy.MLabel(u"二级分类:").strong() self.SecondaryCategoryLine = dy.MComboBox() self.SecondaryCategoryLine.setFixedWidth(200) self.SecondaryCategoryLayout.addWidget(self.SecondaryCategoryLabel) self.SecondaryCategoryLayout.addWidget(self.SecondaryCategoryLine) self.ThirdCategoryLayout = QtWidgets.QHBoxLayout() self.ThirdCategoryLabel = dy.MLabel(u"三级分类:").strong() self.ThirdCategoryLine = dy.MComboBox() self.ThirdCategoryLine.setFixedWidth(200) self.ThirdCategoryLayout.addWidget(self.ThirdCategoryLabel) self.ThirdCategoryLayout.addWidget(self.ThirdCategoryLine) self.MapResolutionLayout = QtWidgets.QHBoxLayout() self.MapResolutionLabel = dy.MLabel(u"贴图分辨率:").strong() self.MapResolutionCombobox = dy.MComboBox() self.MapResolutionCombobox.setMaximumWidth(200) self.menu = dy.MMenu() self.menu.set_data(["8K", "4K", "2K"]) self.MapResolutionCombobox.set_menu(self.menu) self.MapResolutionLayout.addWidget(self.MapResolutionLabel) self.MapResolutionLayout.addWidget(self.MapResolutionCombobox) self.MapResolutionCombobox.set_value("8K") self.describeText = dy.MTextEdit() self.describeText.setMaximumHeight(500) self.describeText.setPlaceholderText(self.tr(u'请输入一些描述')) # uploadWidget self.uploadScrollArea = QtWidgets.QScrollArea() self.uploadScrollArea.setObjectName("uploadScrollArea") self.uploadScrollArea.setWidgetResizable(True) self.uploadWidget = QtWidgets.QWidget() self.uploadLayout = QtWidgets.QVBoxLayout(self.uploadWidget) self.uploadScrollArea.setWidget(self.uploadWidget) self.previewLayout = QtWidgets.QHBoxLayout() self.previewCheckBox = dy.MCheckBox() self.previewCheckBoxLabel = dy.MLabel(u"预览图片").strong() self.previewLabel = dy.MLabel().strong() self.zbLayout = QtWidgets.QHBoxLayout() self.zbCheckBox = dy.MCheckBox() self.zbCheckBoxLabel = dy.MLabel(u"Zbrush 文件").strong() self.zbLabel = dy.MLabel().strong() self.spLayout = QtWidgets.QHBoxLayout() self.spCheckBox = dy.MCheckBox() self.spCheckBoxLabel = dy.MLabel(u"Substance 文件").strong() self.spLabel = dy.MLabel().strong() self.textureLayout = QtWidgets.QHBoxLayout() self.textureCheckBox = dy.MCheckBox() self.textureCheckBoxLabel = dy.MLabel(u"贴图文件").strong() self.textureLabel = dy.MLabel().strong() self.maLayout = QtWidgets.QHBoxLayout() self.maCheckBox = dy.MCheckBox() self.maCheckBoxLabel = dy.MLabel(u"ma文件").strong() self.maLabel = dy.MLabel().strong() self.mbLayout = QtWidgets.QHBoxLayout() self.mbCheckBox = dy.MCheckBox() self.mbCheckBoxLabel = dy.MLabel(u"mb文件").strong() self.mbLabel = dy.MLabel().strong() self.fbxLayout = QtWidgets.QHBoxLayout() self.fbxCheckBox = dy.MCheckBox() self.fbxCheckBoxLabel = dy.MLabel(u"fbx文件").strong() self.fbxLabel = dy.MLabel().strong() self.setup_ui() self.connect_ui() self.set_theme()
def mouseReleaseEvent(self, event): super(LoginAvatar, self).mouseReleaseEvent(event) self.set_dayu_image(QtGui.QPixmap(package.get("LibIcon/shezhi.png")))
def __init__(self, icon_path=None): super(InfoAvatar, self).__init__() self.set_dayu_image(QtGui.QPixmap(package.get("LibIcon/info_fill.svg")))
def __init__(self): """ UI界面 """ super(LibraryUI, self).__init__() self.config_file = File.File(package.get("LibData/library_config.yaml")) self.config = self.config_file.read_data_from_file() self.setWindowTitle("Library Tool") self.setGeometry(150, 50, 1600, 900) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) self.iconPath = package.get("LibIcon") self._root_path = None self.reset_library() self.mainWidget = QtWidgets.QWidget(self) self.mainWidget.setGeometry(0, 0, 1600, 900) self.mainLayout = QtWidgets.QVBoxLayout(self.mainWidget) # menu 模块 self.menuLayout = QtWidgets.QHBoxLayout() self.avatar = dy.MAvatar() self.loginButton = LoginAvatar(self.iconPath) self.inforButton = InfoAvatar(self.iconPath) self.projectCombobox = dy.MComboBox() self.projectCombobox.setMaximumWidth(100) project_data = File.File(package.get("LibData/Project_data.yaml")).read_data_from_file() project_menu = dy.MMenu() project_menu.set_data(project_data) self.projectCombobox.set_menu(project_menu) self.hideButton = dy.MPushButton("", dy.qt.MIcon('minus_line.svg', '#ddd')).small() self.hideButton.setFlat(True) self.closeButton = dy.MPushButton("", dy.qt.MIcon('close_line.svg', '#ddd')).small() self.closeButton.setFlat(True) self.uploadButotn = dy.MPushButton("", dy.qt.MIcon('cloud_line.svg', '#ddd')).small().primary() self.uploadButotn.setFlat(True) self.SpliterLayout = QtWidgets.QHBoxLayout() self.toolbar = toolBar.ToolBar() self.mainSplitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal) self.mainSplitter.setStyleSheet("width:0px") self.listFrame = QtWidgets.QFrame() self.listLayout = QtWidgets.QVBoxLayout(self.listFrame) self.searchLayout = QtWidgets.QHBoxLayout() self.listSearchLine = dy.MLineEdit().search() self.tagButton = dy.MPushButton("", QtGui.QPixmap(package.get("LibIcon/tag.png"))).warning() self.tagButton.setMinimumWidth(60) self.ListScrollArea = QtWidgets.QScrollArea() self.ListScrollArea.setWidgetResizable(True) self.CardWidget = QtWidgets.QWidget() self.CardLayout = dy.MFlowLayout(self.CardWidget) self.ListScrollArea.setWidget(self.CardWidget) # export view 导出模块 self.exportFrame = QtWidgets.QFrame() self.exportFrame.hide() self.exportFrame.setMinimumWidth(500) self.exportFrame.setMaximumWidth(500) self.exportLayout = QtWidgets.QVBoxLayout(self.exportFrame) self.exportLayout.setContentsMargins(0, 0, 0, 0) self.screenShot = ScreenShot("请拖拽一个\n预览文件") self.screenShot.setMaximumHeight(350) self.dragLayout = QtWidgets.QHBoxLayout() self.zbDragButton = dy.MDragFileButton() self.zbDragButton.setFixedSize(120, 120) self.zbDragButton.set_dayu_svg(package.get("LibIcon/Zbrush.png")) self.zbDragButton.setText("") self.zbDragButton.setIconSize(QtCore.QSize(1080, 1080)) self.zbDragButton.set_dayu_filters([".ZBR", ".ZTL", ".ZPR"]) self.spDragButton = dy.MDragFileButton("") self.spDragButton.setFixedSize(120, 120) self.spDragButton.set_dayu_filters([".spp"]) self.spDragButton.set_dayu_svg(package.get("LibIcon/substance_Icon.png")) self.textureDragButton = dy.MDragFolderButton() self.textureDragButton.setText("") self.textureDragButton.setFixedSize(120, 120) self.informationWidget = export_assets_widget.PublishInformation() self.updateLayout = QtWidgets.QHBoxLayout() self.updateButton = dy.MPushButton('Upload To Library', dy.qt.MIcon('cloud_line.svg', '#ddd')).warning().large() self.introdiction = assets_introduction.Introduction(self.root_path) self.introdiction.setMinimumWidth(500) self.introdiction.setMaximumWidth(500) self.introdiction.hide() self.tagFrame = tag_widget.TagWidget() self.tagFrame.setMinimumWidth(500) self.tagFrame.setMaximumWidth(500) self.tagFrame.hide() self.info_window = info_widget.InfoUI() self.set_theme() self.setup_ui() self.connect_ui()
def __init__(self, parent=None): super(FileSystemModel, self).__init__() self._parent = parent self.iconPath = package.get("LibIcon") self.setFilter(QDir.Dirs | QDir.NoDotAndDotDot)