def openFile(self): if self.hasLogin: dialog = QFileDialog() # dayu_theme.apply(dialog) dialog.setStyleSheet(Data.getQSS()) #根据当前所在文件目录,设置默认打开文件格式 dialog.setNameFilter(u"资源文件(*.png);;图片文件(*.jpg *.png *.jpeg);;") #加载对应的文件 dialog.setFileMode(QFileDialog.ExistingFiles) dialog.setViewMode(QFileDialog.Detail) self.paths = None if dialog.exec_(): self.paths = dialog.selectedFiles() if self.paths == None: return # 创建标签选择窗口 self.tagWidget = Tag.TagWidget(self.paths, self.userName) self.tagWidget.show() Data.setWindowCenter(self.tagWidget) self.tagWidget.send_tag_signal.connect( self.cenWinAddTags) # 链接添加标签的信号到中心窗口添加标签方法 self.tagWidget.load_file_signal.connect(self.slot_show_loading) else: self.slot_show_message(MMessage.info, (u'请先登录账号!'))
def __init__(self): super(CenterWindow,self).__init__() self.setObjectName("CenterWindow") self.fileList = [] # 保存当前选择标签下的文件列表 self.tag = "" # 保存当前标签 self.tableWidget_show = True # tableWidget窗口是否显示 self.row = 0 # 定位添加标签 self.column = 0 self.setupUI() # 设置tablewidget self.tableWidget = self.ui.findChild(QTableWidget, "tableWidget") self.tableWidget.setMaximumHeight(Data.getWindowHeight()/5) self.setTableWidget() self.tableWidget.setStyleSheet(Data.getQSS()) self.tableWidget.setStyleSheet("background-color: #323232") self.searchWidget = self.ui.findChild(QWidget, "widget_2") self.search_engine_line_edit = MLineEdit().search_engine().large() dayu_theme.apply(self.search_engine_line_edit) self.searchWidget.setLayout(QHBoxLayout()) self.searchWidget.layout().addWidget(self.search_engine_line_edit) self.slider = MSlider(Qt.Horizontal) self.slider.setMaximumWidth(Data.getWindowWidth()/4) self.slider.setValue(50) self.slider.setRange(1, 100) dayu_theme.apply(self.slider) self.searchWidget.layout().addWidget(self.slider) self.button_tag = MToolButton().svg('detail_line.svg').icon_only() self.button_tag.setEnabled(True) self.button_del = MToolButton().svg('trash_line.svg').icon_only() self.button_del.setCheckable(True) dayu_theme.apply(self.button_del) dayu_theme.apply(self.button_tag) self.searchWidget.layout().addWidget(self.button_tag) self.searchWidget.layout().addWidget(self.button_del) self.slider.valueChanged.connect(self.changeBtnSize) self.button_tag.clicked.connect(self.showTableWidget) self.button_del.clicked.connect(self.deleteTag) self.search_engine_line_edit.returnPressed.connect(self.on_searchBtn_click) self.setThread()
def setupUI(self): self.setMaximumWidth(Data.getWindowWidth() / 3) self.ui = loadUi(file_path + "\\res\\UI\\ParameterWindow.ui") self.ui.setParent(self) self.setLayout(QVBoxLayout()) self.layout().addWidget(self.ui) self.widget_1 = self.ui.findChild(QWidget, "widget") self.widget_2 = self.ui.findChild(QWidget, "widget_2") self.widget_3 = self.ui.findChild(QWidget, "widget_3") self.widget_4 = self.ui.findChild(QWidget, "widget_4") self.widget_1.setLayout(QVBoxLayout()) self.widget_2.setLayout(QVBoxLayout()) self.widget_4.setLayout(QVBoxLayout()) self.widget_2.layout().setSpacing(8) #设置布局 tab_card = MTabWidget() self.label_filePic = MLabel("") self.widget_1.setMinimumSize(Data.getWindowHeight() / 2.8, Data.getWindowHeight() / 2.8) tab_card.addTab(self.label_filePic, u'预览图') # Todo 加载3d视口 # self.model_widget = QWidget() self.model_widget = CefBrowser(self, url="editor") # self.model_widget.setLayout(QVBoxLayout()) tab_card.addTab(self.model_widget, u'3D视口') self.widget_1.layout().addWidget(tab_card) self.widget_1.layout().setContentsMargins(0, 0, 0, 0) self.widget_2.layout().addWidget(MDivider(u'操作面板')) self.let_filename = MLineEdit(text='filename') tool_button = MLabel(text=u'文件名').mark().secondary() tool_button.setAlignment(Qt.AlignCenter) tool_button.setFixedWidth(80) self.let_filename.set_prefix_widget(tool_button) self.widget_2.layout().addWidget(self.let_filename) self.let_path = MLineEdit(text='filepath') tool_button_2 = MLabel(text=u'文件地址').mark().secondary() tool_button_2.setAlignment(Qt.AlignCenter) tool_button_2.setFixedWidth(80) self.let_path.set_prefix_widget(tool_button_2) self.widget_2.layout().addWidget(self.let_path) self.widget_2.layout().addWidget(MLabel(u'标签')) self.let_tag = MLineEdit(text='tag') self.btn_reviseTag = MPushButton(text=u'修改').primary() self.btn_reviseTag.setFixedWidth(80) self.let_tag.set_suffix_widget(self.btn_reviseTag) self.widget_2.layout().addWidget(self.let_tag) self.btn_export = MPushButton(u'导出到houdini').primary() self.widget_2.layout().addWidget(self.btn_export) self.btn_exportToMaya = MPushButton(u'导出到Maya').primary() self.widget_2.layout().addWidget(self.btn_exportToMaya) self.timer = QTimer() self.timer.setInterval(0.1) self.timer.timeout.connect(self.slot_timeout) self.auto_color_progress = MProgressBar().auto_color() self.widget_2.layout().addWidget(self.auto_color_progress) self.widget_4.layout().addWidget(MDivider(u'操作记录')) self.setWindowTitle(u"参数面板") # #获取控件 self.tableWidget_operationNote = self.ui.findChild( QTableWidget, "tableWidget_operationNote") self.tableWidget_operationNote.setStyleSheet(Data.getQSS()) #设置默认值 self.let_filename.setReadOnly(True) #只读 self.let_path.setReadOnly(True) #只读 self.let_tag.setReadOnly(True) #只读 self.tableWidget_operationNote.setHorizontalHeaderLabels( [u'用户', u'操作', u'时间']) # #连接信号与槽 self.btn_export.clicked.connect(self.slot_run) self.btn_reviseTag.clicked.connect(lambda: self.reviseTag()) # self.tableWidget_operationNote.setColumnCount(3) setSectionResizeMode(self.tableWidget_operationNote.horizontalHeader(), QHeaderView.Stretch) # 自适应