def setupUI(self):
super(self.__class__,self).setupUI('grid')
#------------------------------
# user ui creation part
#------------------------------
# + template: qui version since universal tool template v7
# - no extra variable name, all text based creation and reference
self.qui('source_txt | process_btn;Process and Update', 'upper_vbox')
self.qui('upper_vbox | result_txt', 'input_split;v')
self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox')
self.qui('input_split | fileBtn_layout', 'main_layout')
# - template : quickUI version since universal tool template v6
'''
upper_layout = self.quickUI(["source_txt;QTextEdit","process_btn;QPushButton;Process and Update"],"upper_QVBoxLayout")
upper_layout.setContentsMargins(0,0,0,0)
input_split = self.quickSplitUI("input_split", [ upper_layout, self.quickUI(["result_txt;QTextEdit"])[0] ], "v")
fileBtn_layout = self.quickUI(["filePath_input;QLineEdit", "fileLoad_btn;QPushButton;Load", "fileExport_btn;QPushButton;Export"],"fileBtn_QHBoxLayout")
self.quickUI([input_split, fileBtn_layout], main_layout)
'''
# - template : invisible but functional button
'''
self.uiList['secret_btn'] = QtWidgets.QPushButton(self)
self.uiList['secret_btn'].setText("")
self.uiList['secret_btn'].setGeometry(0, 0, 50, 20)
self.uiList['secret_btn'].setStyleSheet("QPushButton{background-color: rgba(0, 0, 0,0);} QPushButton:pressed{background-color: rgba(0, 0, 0,0); border: 0px;} QPushButton:hover{background-color: rgba(0, 0, 0,0); border: 0px;}")
#:hover:pressed:focus:hover:disabled
'''
#------------- end ui creation --------------------
keep_margin_layout = ['main_layout']
keep_margin_layout_obj = []
# add tab layouts
for each in self.uiList.values():
if isinstance(each, QtWidgets.QTabWidget):
for i in range(each.count()):
keep_margin_layout_obj.append( each.widget(i).layout() )
for name, each in self.uiList.items():
if isinstance(each, QtWidgets.QLayout) and name not in keep_margin_layout and not name.endswith('_grp_layout') and each not in keep_margin_layout_obj:
each.setContentsMargins(0, 0, 0, 0)
self.quickInfo('Ready')
# self.statusBar().hide()
universal_tool_template_0904.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录