I think I might have missed something. You were asking about connecting
menu item signals from a UI file? Whats this new code related to?
On Wednesday, December 26, 2012, Rishis3D wrote:
> Thanks for your reply justin.
>
> at first i starts with pyqt convert UI to python format.. eveything is
> ok..but i have problem in gridlayout in my ui.. i cant rearrange my widgets
> inside gridlayout properly when i refresh ...
>
> i have attached my ui image .. its a poselibrary ui.. so every time i
> click the createpose button it will create a pose file and a png file for
> icon.. in a specfic folder.. and my gridlayout layout my buttons based on
> the files by date.. by doing tat my widgets arrange properly .. but not in
> a proper postion..
>
> Here is my code:
>
> self.connect(self.ui.CreatePose_pushButton,
> QtCore.SIGNAL("clicked()"), self.createPose)
>
> def createPose(self):
> # To get Posename from UI
> self.__current_Posename = self.getPoseName()
>
> Path = 'D:\\PoseLibrary\\'
>
> # To Grab All files in tat Path
> Poses = self.findAllFiles(Path, '.xml')
>
> self.__NameSpace = self.ui.NameSpace_comboBox.currentText()
>
> #To find HighestTrailingNumber to Increment the file name
> if self.__current_Posename == "":
> newSuffix = self.findHighestTrailingNumber(Poses,
> self.__Default_Posename) + 1
> self.PoseName = self.__Default_Posename + str(newSuffix)
> else:
> self.PoseName = self.__current_Posename
>
>
> # Creating XML and Icon files
> open(Path + self.PoseName + '.xml','w').close()
>
> icon = self.createIcon(self.PoseName, Path)
> # open(Path + self.PoseName + '.png','w').close()
>
>
> self.refreshPoseLibrary(Path)
> self.ui.PoseName_lineEdit.clear()
>
>
>
> def refreshPoseLibrary(self, Path ):
> # First Clear all my buttons in gridlayout
> self.deleteAll()
>
> # get all file fromm the path dir
>
> Files = self.getfiles_by_Date(Path)
> Poses = self.findAllFiles(Files, '.xml')
>
> # Create Btn
> for Pose in Poses:
> icon = Path + Pose + '.png'
> self.icon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal,
> QtGui.QIcon.Off)
> self.button = QtGui.QPushButton('')
> self.button.setObjectName(Pose)
> self.buttonGroup.addButton(self.button)
> self.button.setIcon(self.icon)
> self.button.setIconSize(QtCore.QSize(128, 128))
> self.button.setMinimumSize(QtCore.QSize(128, 128))
> self.button.setMaximumSize(QtCore.QSize(128, 128))
> self.ui.gridLayout.addWidget(self.button)
> self.button.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
> self.connect(self.button,
> QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), self.popup)
>
> def deleteAll(self):
> while self.ui.gridLayout.count():
> item = self.ui.gridLayout.takeAt(0)
> widget = item.widget()
> widget.deleteLater()
>
>
> def getfiles_by_Date(self, dirpath):
> Files = [s for s in os.listdir(dirpath)
> if os.path.isfile(os.path.join(dirpath, s))]
> Files.sort(key=lambda s: os.path.getmtime(os.path.join(dirpath, s)))
> return Files
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To post to this group, send email to
> [email protected]<javascript:;>
> .
> To unsubscribe from this group, send email to
> [email protected] <javascript:;>.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].