def __init__(self, parent=None, children=None, transform=None): if not transform: transform = Transform() EMItem3D.__init__(self, parent=parent, children=children, transform=transform) # initial color self.diffuse = [0.5,0.5,0.5,1.0] self.specular = [1.0,1.0,1.0,1.0] self.ambient = [1.0, 1.0, 1.0, 1.0] self.shininess = 25.0
def __init__(self, pdb_file, parent=None, children = set(), transform=None, style='bs'): #if not transform: transform = Transform() # Object initialization should not be put in the constructor. Causes issues EMItem3D.__init__(self, parent, children, transform=transform) self.setData(pdb_file) self.diffuse = [0.5,0.5,0.5,1.0] self.specular = [1.0,1.0,1.0,1.0] self.ambient = [1.0, 1.0, 1.0, 1.0] self.shininess = 25.0 self.pdb_file = pdb_file self.renderBoundingBox = False
def getNodeDialogWidget(attribdict): """Get Ball and Stick Model Widget""" ballstickwidget = QtGui.QWidget() grid = QtGui.QGridLayout() node_name_model_label = QtGui.QLabel("PDB Structure Name") attribdict["node_name"] = QtGui.QLineEdit(str(EMBallStickModel.representation)) grid.addWidget(node_name_model_label, 0, 0, 1, 2) grid.addWidget(attribdict["node_name"], 0, 2, 1, 2) EMItem3D.get_transformlayout(grid, 2, attribdict) ballstickwidget.setLayout(grid) return ballstickwidget
def __init__(self, x, y, z, size): EMItem3D.__init__(self, parent=None, transform=Transform()) self.xi = -size/2 self.yi = -size/2 self.zi = -size/2 self.xf = size/2 self.yf = size/2 self.zf = size/2 self.isactive = False # Matrix initialization self.nodematrix = Transform() self.parent = None
def getNodeDialogWidget(attribdict): """ Return a sphere control widget for the stacked_widget """ spherewidget = QtGui.QWidget() grid = QtGui.QGridLayout() sphere_dim_label = QtGui.QLabel("Sphere Dimension") attribdict["sphere_dim"] = QtGui.QLineEdit("50") node_name_label = QtGui.QLabel("Sphere Name") attribdict["node_name"] = QtGui.QLineEdit(str(EMSphere.name)) grid.addWidget(sphere_dim_label, 0, 0, 1, 2) grid.addWidget(attribdict["sphere_dim"], 0, 2, 1, 2) grid.addWidget(node_name_label , 1, 0, 1, 2) grid.addWidget(attribdict["node_name"], 1, 2, 1, 2) EMItem3D.get_transformlayout(grid, 2, attribdict) spherewidget.setLayout(grid) return spherewidget
def __init__(self, parentwidget=None, SGactivenodeset=set(), scalestep=0.5): """ @param parent: The parent of the widget @param SGnodelist: a list enumerating all the SGnodes @param SGactivenodeset: a set enumerating the list of active nodes @param scalestep: The step to increment the object scaling """ EMItem3D.__init__(self, parent=None, transform=Transform()) EMGLWidget.__init__(self,parentwidget) QtOpenGL.QGLFormat().setDoubleBuffer(True) self.camera = EMCamera(1.0, 10000.0) # Default near,far, and zclip values #self.SGactivenodeset = SGactivenodeset # A set of all active nodes (currently not used) self.scalestep = scalestep # The scale factor stepsize self.zrotatecursor = QtGui.QCursor(QtGui.QPixmap(zrotatecursor),-1,-1) self.xyrotatecursor = QtGui.QCursor(QtGui.QPixmap(xyrotatecursor),-1,-1) self.crosshaircursor = QtGui.QCursor(QtGui.QPixmap(crosshairscursor),-1,-1) self.scalecursor = QtGui.QCursor(QtGui.QPixmap(scalecursor),-1,-1) self.zhaircursor = QtGui.QCursor(QtGui.QPixmap(zhaircursor),-1,-1)
def getNodeDialogWidget(attribdict): """Get PDB Widget""" pdbwidget = QtGui.QWidget() grid = QtGui.QGridLayout() node_name_data_label = QtGui.QLabel("PDB Model Label") attribdict["node_name"] = QtGui.QLineEdit() data_path_label = QtGui.QLabel("PDB Model Path") attribdict["data_path"] = QtGui.QLineEdit() browse_button = QtGui.QPushButton("Browse") grid.addWidget(node_name_data_label, 0, 0, 1, 2) grid.addWidget(attribdict["node_name"], 0, 2, 1, 2) grid.addWidget(data_path_label, 1, 0, 1, 2) grid.addWidget(attribdict["data_path"], 1, 2, 1, 2) grid.addWidget(browse_button, 2, 0, 1, 4) EMItem3D.get_transformlayout(grid, 4, attribdict) pdbwidget.setLayout(grid) EMPDBItem3D.attribdict = attribdict QtCore.QObject.connect(browse_button, QtCore.SIGNAL('clicked()'), EMPDBItem3D._on_browse) return pdbwidget
def getNodeDialogWidget(attribdict): """ Return a text control widget for the stacked_widget """ textwidget = QtGui.QWidget() grid = QtGui.QGridLayout() text_label = QtGui.QLabel("Text") attribdict["text_content"] = QtGui.QLineEdit() grid.addWidget(text_label, 0, 0, 1, 2) grid.addWidget(attribdict["text_content"], 0, 2, 1, 2) fontsize_label = QtGui.QLabel("Font Size") attribdict["fontsize"] = QtGui.QLineEdit("32.0") grid.addWidget(fontsize_label , 1, 0, 1, 2) grid.addWidget(attribdict["fontsize"], 1, 2, 1, 2) node_name_label = QtGui.QLabel("Text Name") attribdict["node_name"] = QtGui.QLineEdit(str(EM3DText.name)) grid.addWidget(node_name_label , 2, 0, 1, 2) grid.addWidget(attribdict["node_name"], 2, 2, 1, 2) EMItem3D.get_transformlayout(grid, 4, attribdict) textwidget.setLayout(grid) return textwidget
def getNodeDialogWidget(attribdict): """ Return a cone control widget for the stacked_widget """ conewidget = QtGui.QWidget() grid = QtGui.QGridLayout() cone_radius_label = QtGui.QLabel("Cone Radius") attribdict["cone_radius"] = QtGui.QLineEdit("50") grid.addWidget(cone_radius_label, 0, 0, 1, 2) grid.addWidget(attribdict["cone_radius"], 0, 2, 1, 2) cone_height_label = QtGui.QLabel("Cone Height") attribdict["cone_height"] = QtGui.QLineEdit("50") node_name_label = QtGui.QLabel("Cone Name") attribdict["node_name"] = QtGui.QLineEdit(str(EMCone.name)) grid.addWidget(cone_height_label, 1, 0, 1, 2) grid.addWidget(attribdict["cone_height"], 1, 2, 1, 2) grid.addWidget(node_name_label , 2, 0, 1, 2) grid.addWidget(attribdict["node_name"], 2, 2, 1, 2) EMItem3D.get_transformlayout(grid, 4, attribdict) conewidget.setLayout(grid) return conewidget
def getNodeForDialog(attribdict): """Create a new node using a attribdict""" return EMPDBItem3D(str(attribdict["data_path"].text()), transform=EMItem3D.getTransformFromDict(attribdict))
def getNodeForDialog(attribdict): """Create a new node using a attribdict""" parent = attribdict["parent"] pdb_file = parent.attribdict['data_path'] transform = EMItem3D.getTransformFromDict(attribdict) return EMBallStickModel(pdb_file=pdb_file, parent=parent, transform=transform)
def setSelectedItem(self, is_selected): """ Set SG apix to curent selection""" EMItem3D.setSelectedItem(self, is_selected) sg = self.getRootNode()
def getNodeForDialog(attribdict): """ Create a new node using a attribdict """ return EM3DText(str(attribdict["text_content"].text()), float(attribdict["fontsize"].text()), transform=EMItem3D.getTransformFromDict(attribdict))
def getNodeForDialog(attribdict): """ Create a new node using a attribdict """ return EMCone(float(attribdict["cone_radius"].text()), float(attribdict["cone_height"].text()), transform=EMItem3D.getTransformFromDict(attribdict))
def getNodeForDialog(attribdict): """ Create a new node using a attribdict """ return EMSphere(float(attribdict["sphere_dim"].text()), transform=EMItem3D.getTransformFromDict(attribdict))