yansirui Posted July 7, 2018 Share Posted July 7, 2018 Hello guys, I have some problems about Pyside, I was trying to write button Background, even if use the setstylesheet , but nothing happen with my houdini, if the coding run in houdini 16.0 that ok for result. Current version is 16.5 who knows real problem, it's bug ? from PySide2.QtWidgets import * from PySide2.QtCore import * import os class demo(QWidget): def __init__(self): super(demo,self).__init__() self.setWindowFlags(Qt.WindowStaysOnTopHint) self.setWindowTitle("import_Geo") self.setUI() def setUI(self): La =QWidget(self) Main=QVBoxLayout(La) Grid=QGridLayout() Box =QHBoxLayout() Main.addLayout(Grid) Main.addLayout(Box) self.setLayout(Main) self.setGeometry(300,300,300,150) Menu_Title = QLabel("Choose_type:",self) Path_floder= QLabel("Path_flode:",self) Prefix= QLabel("Enter_Prefix:",self) self.Enter_Prefix=QLineEdit("",self) self.Enter_line = QLineEdit("",self) self.Menu=QComboBox(self) self.Menu.addItem("obj") self.Menu.addItem("abc") Button_import=QPushButton("Choose_path",self) Button_import.setToolTip("Choose your floder please") Grid.addWidget(Path_floder,1,0) Grid.addWidget(self.Enter_line,1,1) Grid.addWidget(Menu_Title,0,0) Grid.addWidget(self.Menu,0,1) Grid.addWidget(Button_import,0,2) Grid.addWidget(self.Enter_Prefix,2,1) Grid.addWidget(Prefix,2,0) Grid.setRowStretch(2,1) Button_import.setStyleSheet("QPushButton{color:rgb(0,0,0);background-color:rgb(140,140,140)}") self.setStyleSheet("background-color:rgb(140,140,140)") self.Enter_Prefix.setStyleSheet("QLineEdit{border:rgba(0,0,0,100%)}") Box.addStretch(1) self.button =QPushButton("OK",self) button1 =QPushButton("Cancel",self) Box.addWidget(self.button) Box.addWidget(button1) Button_import.clicked.connect(self.Click) #if self.button.isChecked(): #self.Menu.activated[str].connect(self.text) button1.clicked.connect(self.close) self.Menu.activated[str].connect(self.click_ok) self.button.clicked.connect(self.close) def text(self): Postfix=self.Menu.currentText() Prefix_name=self.Enter_Prefix.text() if Postfix=="abc" : a=hou.node("/obj").createNode("geo") a.node('file1').destroy() merge=a.createNode("merge") Output=a.createNode("null") counter=0 for file in self.dir: if file.endswith(".abc"): if file.startswith(Prefix_name): file_name=file.split(".")[0] full_path= self.path+file node =a.createNode("alembic") node.parm("fileName").set(full_path) node.setColor(hou.Color(1,1,0)) node.setName(file_name) merge.setInput(counter,node) Output.setInput(0,merge) Output.setColor(hou.Color(0,0,0)) counter+=1 elif Postfix=="obj": Output=a.createNode("null") a=hou.node("/obj").createNode("geo") a.node('file1').destroy() merge=a.createNode("merge") counter=0 for file in self.dir: if file.endswith(".obj"): if file.startswith(Prefix_name): file_name=file.split(".")[0] full_path= self.path+file node =a.createNode("file") node.parm("file").set(full_path) node.setColor(hou.Color(0.9,0,0)) node.setName(file_name) merge.setInput(counter,node) Output.setInput(0,merge) Output.setColor(hou.Color(0,0,0)) counter+=1 def click_ok(self): self.button.clicked.connect(self.text) def Click(self): self.path =hou.ui.selectFile(file_type=hou.fileType.Directory) self.Enter_line.setText(self.path) self.dir=os.listdir(self.path) showdemo=demo() showdemo.show() this is my coding if who knows reason i need your help. Cheers guys. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.