def __init__(self, parent, enableUi,File=""): f = QGLFormat() f.setStencil(True) f.setRgba(True) f.setDepth(True) f.setDoubleBuffer(True) QGLWidget.__init__(self, f, parent=parent) self.setMinimumSize(500, 500) self._enableUi=enableUi self.pymol = pymol2.PyMOL()# _pymolPool.getInstance() self.pymol.start() self.cmd = self.pymol.cmd # self.toPymolName = self.pymol.toPymolName ### Attribute Error self._pymolProcess() if not self._enableUi: self.pymol.cmd.set("internal_gui",0) self.pymol.cmd.set("internal_feedback",0) self.pymol.cmd.button("double_left","None","None") self.pymol.cmd.button("single_right","None","None") self.pymol.cmd.load(File) self.pymol.reshape(self.width(),self.height()) self._timer = QtCore.QTimer() self._timer.setSingleShot(True) self._timer.timeout.connect(self._pymolProcess) self.resizeGL(self.width(),self.height()) #globalSettings.settingsChanged.connect(self._updateGlobalSettings) self._updateGlobalSettings()
def _set_config(c): """Set the OpenGL configuration""" glformat = QGLFormat() glformat.setRedBufferSize(c['red_size']) glformat.setGreenBufferSize(c['green_size']) glformat.setBlueBufferSize(c['blue_size']) glformat.setAlphaBufferSize(c['alpha_size']) if QT5_NEW_API or PYSIDE6_API: # Qt5 >= 5.4.0 - below options automatically enabled if nonzero. glformat.setSwapBehavior(glformat.DoubleBuffer if c['double_buffer'] else glformat.SingleBuffer) elif PYQT6_API: glformat.setSwapBehavior( glformat.SwapBehavior.DoubleBuffer if c['double_buffer'] else glformat.SwapBehavior.SingleBuffer) else: # Qt4 and Qt5 < 5.4.0 - buffers must be explicitly requested. glformat.setAccum(False) glformat.setRgba(True) glformat.setDoubleBuffer(True if c['double_buffer'] else False) glformat.setDepth(True if c['depth_size'] else False) glformat.setStencil(True if c['stencil_size'] else False) glformat.setSampleBuffers(True if c['samples'] else False) glformat.setDepthBufferSize(c['depth_size'] if c['depth_size'] else 0) glformat.setStencilBufferSize( c['stencil_size'] if c['stencil_size'] else 0) glformat.setSamples(c['samples'] if c['samples'] else 0) glformat.setStereo(c['stereo']) return glformat
def _set_config(c): """Set the OpenGL configuration""" glformat = QGLFormat() glformat.setRedBufferSize(c['red_size']) glformat.setGreenBufferSize(c['green_size']) glformat.setBlueBufferSize(c['blue_size']) glformat.setAlphaBufferSize(c['alpha_size']) if QT5_NEW_API: # Qt5 >= 5.4.0 - below options automatically enabled if nonzero. glformat.setSwapBehavior(glformat.DoubleBuffer if c['double_buffer'] else glformat.SingleBuffer) else: # Qt4 and Qt5 < 5.4.0 - buffers must be explicitly requested. glformat.setAccum(False) glformat.setRgba(True) glformat.setDoubleBuffer(True if c['double_buffer'] else False) glformat.setDepth(True if c['depth_size'] else False) glformat.setStencil(True if c['stencil_size'] else False) glformat.setSampleBuffers(True if c['samples'] else False) glformat.setDepthBufferSize(c['depth_size'] if c['depth_size'] else 0) glformat.setStencilBufferSize(c['stencil_size'] if c['stencil_size'] else 0) glformat.setSamples(c['samples'] if c['samples'] else 0) glformat.setStereo(c['stereo']) return glformat
def __init__(self, parent, shareWidget, useStencilBuffer): """ If shareWidget is specified, useStencilBuffer is ignored: set it in the widget you're sharing with. """ if shareWidget: self.shareWidget = shareWidget #bruce 051212 glformat = shareWidget.format() QGLWidget.__init__(self, glformat, parent, shareWidget) if not self.isSharing(): print "Request of display list sharing is failed." return else: glformat = QGLFormat() if (useStencilBuffer): glformat.setStencil(True) # set gl format to request stencil buffer # (needed for mouseover-highlighting of objects of general # shape in depositMode.bareMotion) [bruce 050610] QGLWidget.__init__(self, glformat, parent) # Current view attributes (sometimes saved in or loaded from # the currently displayed part or its mmp file): # rotation self.quat = Q(1, 0, 0, 0) # point of view (i.e. negative of center of view) self.pov = V(0.0, 0.0, 0.0) # half-height of window in Angstroms (reset by certain view-changing operations) self.scale = float(env.prefs[startup_GLPane_scale_prefs_key]) # zoom factor self.zoomFactor = 1.0 self.trackball = Trackball(10, 10) self._functions_to_call_when_gl_context_is_current = [] # piotr 080714: Defined this attribute here in case # chunk.py accesses it in ThumbView. self.lastNonReducedDisplayMode = default_display_mode return
def __init__(self, parent, shareWidget, useStencilBuffer): """ If shareWidget is specified, useStencilBuffer is ignored: set it in the widget you're sharing with. """ if shareWidget: self.shareWidget = shareWidget # bruce 051212 glformat = shareWidget.format() QGLWidget.__init__(self, glformat, parent, shareWidget) if not self.isSharing(): print "Request of display list sharing is failed." return else: glformat = QGLFormat() if useStencilBuffer: glformat.setStencil(True) # set gl format to request stencil buffer # (needed for mouseover-highlighting of objects of general # shape in depositMode.bareMotion) [bruce 050610] QGLWidget.__init__(self, glformat, parent) # Current view attributes (sometimes saved in or loaded from # the currently displayed part or its mmp file): # rotation self.quat = Q(1, 0, 0, 0) # point of view (i.e. negative of center of view) self.pov = V(0.0, 0.0, 0.0) # half-height of window in Angstroms (reset by certain view-changing operations) self.scale = float(env.prefs[startup_GLPane_scale_prefs_key]) # zoom factor self.zoomFactor = 1.0 self.trackball = Trackball(10, 10) self._functions_to_call_when_gl_context_is_current = [] # piotr 080714: Defined this attribute here in case # chunk.py accesses it in ThumbView. self.lastNonReducedDisplayMode = default_display_mode return
def _set_config(c): """Set the OpenGL configuration""" glformat = QGLFormat() glformat.setRedBufferSize(c["red_size"]) glformat.setGreenBufferSize(c["green_size"]) glformat.setBlueBufferSize(c["blue_size"]) glformat.setAlphaBufferSize(c["alpha_size"]) glformat.setAccum(False) glformat.setRgba(True) glformat.setDoubleBuffer(True if c["double_buffer"] else False) glformat.setDepth(True if c["depth_size"] else False) glformat.setDepthBufferSize(c["depth_size"] if c["depth_size"] else 0) glformat.setStencil(True if c["stencil_size"] else False) glformat.setStencilBufferSize(c["stencil_size"] if c["stencil_size"] else 0) glformat.setSampleBuffers(True if c["samples"] else False) glformat.setSamples(c["samples"] if c["samples"] else 0) glformat.setStereo(c["stereo"]) return glformat
def _set_config(c): """Set the OpenGL configuration""" glformat = QGLFormat() glformat.setRedBufferSize(c['red_size']) glformat.setGreenBufferSize(c['green_size']) glformat.setBlueBufferSize(c['blue_size']) glformat.setAlphaBufferSize(c['alpha_size']) glformat.setAccum(False) glformat.setRgba(True) glformat.setDoubleBuffer(True if c['double_buffer'] else False) glformat.setDepth(True if c['depth_size'] else False) glformat.setDepthBufferSize(c['depth_size'] if c['depth_size'] else 0) glformat.setStencil(True if c['stencil_size'] else False) glformat.setStencilBufferSize( c['stencil_size'] if c['stencil_size'] else 0) glformat.setSampleBuffers(True if c['samples'] else False) glformat.setSamples(c['samples'] if c['samples'] else 0) glformat.setStereo(c['stereo']) return glformat
def __init__(self, parent, shareWidget, useStencilBuffer): """ #doc @note: If shareWidget is specified, useStencilBuffer is ignored: set it in the widget you're sharing with. """ if shareWidget: self.shareWidget = shareWidget #bruce 051212 glformat = shareWidget.format() QGLWidget.__init__(self, glformat, parent, shareWidget) if not self.isSharing(): assert 0, "%r refused to share GL display list namespace " \ "with %r" % (self, shareWidget) return else: glformat = QGLFormat() if (useStencilBuffer): glformat.setStencil(True) # set gl format to request stencil buffer # (needed for mouseover-highlighting of objects of general # shape in BuildAtoms_Graphicsmode.bareMotion) [bruce 050610] if (self.useMultisample): # use full scene anti-aliasing on hardware that supports it # (note: setting this True works around bug 2961 on some systems) glformat.setSampleBuffers(True) QGLWidget.__init__(self, glformat, parent) pass self.glprefs = drawing_globals.glprefs # future: should be ok if this differs for different glpanes, # even between self and self.shareWidget. AFAIK, the refactoring # I'm doing yesterday and today means this would work fine, # or at least it does most of what would be required for that. # [bruce 090304] self._initialize_view_attributes() # Initial value of depth "constant" (changeable by prefs.) self.DEPTH_TWEAK = DEPTH_TWEAK_UNITS * DEPTH_TWEAK_VALUE self.trackball = Trackball(10, 10) self._functions_to_call_when_gl_context_is_current = [] # piotr 080714: Defined this attribute here in case # chunk.py accesses it in ThumbView. self.lastNonReducedDisplayMode = default_display_mode # piotr 080807 # Most recent quaternion to be used in animation timer. self.last_quat = None self.transforms = [] ### TODO: clear this at start of frame, complain if not clear # stack of current transforms (or Nodes that generate them) # [bruce 090220] # Note: this may be revised once we have TransformNode, # e.g. we might push their dt and st separately; # note we might need to push a "slot" for them if they might # change before being popped, or perhaps even if they might # change between the time pushed and the time later used # (by something that collects them from here in association # with a ColorSortedDisplayList). return
def __init__(self, parent, shareWidget, useStencilBuffer): """ #doc @note: If shareWidget is specified, useStencilBuffer is ignored: set it in the widget you're sharing with. """ if shareWidget: self.shareWidget = shareWidget #bruce 051212 glformat = shareWidget.format() QGLWidget.__init__(self, glformat, parent, shareWidget) if not self.isSharing(): assert 0, "%r refused to share GL display list namespace " \ "with %r" % (self, shareWidget) return else: glformat = QGLFormat() if (useStencilBuffer): glformat.setStencil(True) # set gl format to request stencil buffer # (needed for mouseover-highlighting of objects of general # shape in BuildAtoms_Graphicsmode.bareMotion) [bruce 050610] if (self.useMultisample): # use full scene anti-aliasing on hardware that supports it # (note: setting this True works around bug 2961 on some systems) glformat.setSampleBuffers(True) QGLWidget.__init__(self, glformat, parent) pass self.glprefs = drawing_globals.glprefs # future: should be ok if this differs for different glpanes, # even between self and self.shareWidget. AFAIK, the refactoring # I'm doing yesterday and today means this would work fine, # or at least it does most of what would be required for that. # [bruce 090304] self._initialize_view_attributes() # Initial value of depth "constant" (changeable by prefs.) self.DEPTH_TWEAK = DEPTH_TWEAK_UNITS * DEPTH_TWEAK_VALUE self.trackball = Trackball(10, 10) self._functions_to_call_when_gl_context_is_current = [] # piotr 080714: Defined this attribute here in case # chunk.py accesses it in ThumbView. self.lastNonReducedDisplayMode = default_display_mode # piotr 080807 # Most recent quaternion to be used in animation timer. self.last_quat = None self.transforms = [ ] ### TODO: clear this at start of frame, complain if not clear # stack of current transforms (or Nodes that generate them) # [bruce 090220] # Note: this may be revised once we have TransformNode, # e.g. we might push their dt and st separately; # note we might need to push a "slot" for them if they might # change before being popped, or perhaps even if they might # change between the time pushed and the time later used # (by something that collects them from here in association # with a ColorSortedDisplayList). return