def __init__(self, parent=None): # constructors of base classes super(BeamUI, self).__init__(parent) self.setObjectName('mainUI') self.setWindowIcon(QtGui.QIcon('')) self.setWindowTitle("Beam Editor") self.setAcceptDrops(True) self.mainVboxLayout = QtGui.QVBoxLayout (self) self.guideLayout = QtGui.QVBoxLayout () self.mainVboxLayout.addLayout(self.guideLayout) self.build_from_selection = QtGui.QPushButton("build_from_selection") self.mainVboxLayout.addWidget(self.build_from_selection) compDir = shifter.getComponentDirectories () path = self.current_path () trackLoadComponent = [] for path, comps in compDir.iteritems (): for comp_name in comps: if comp_name in trackLoadComponent: pm.displayWarning( "Custom component name: %s, already in default " "components. Names should be unique. This component is" " not loaded" % comp_name) continue else: trackLoadComponent.append (comp_name) if not os.path.exists(os.path.join(path, comp_name, "__init__.py")): continue module = shifter.importComponentGuide (comp_name) print "BeamUI.__init__.module",module reload (module) commandbutton = self.loadUiWidget (os.path.join (path.replace("beam_components","widgets"), "commandbutton.ui")) icon = QtGui.QPixmap(os.path.join (path,module.TYPE,"icon.jpg")) self.guideLayout.addWidget (commandbutton) commandbutton.pushButton.setText(module.TYPE) commandbutton.label.setPixmap (icon) QtCore.QObject.connect (commandbutton.pushButton, QtCore.SIGNAL ("clicked()"), partial (self.drawComp, module.TYPE)) self.createConnections()
def createConnections(self): QtCore.QObject.connect (self.build_from_selection, QtCore.SIGNAL ("clicked()"), partial (self.buildFromSelection))