def __init__(self, parent=None): ''' Initialise the ZincViewGraphics first calling the QMainWindow __init__ function. ''' QtWidgets.QMainWindow.__init__(self, parent) # create instance of Zinc Context from which all other objects are obtained self._context = ZincContext("ZincViewGraphics") # set up standard materials for colouring graphics self._context.getMaterialmodule().defineStandardMaterials() # set up standard glyphs, graphics to show at points e.g. spheres, arrows self._context.getGlyphmodule().defineStandardGlyphs() # Load the user interface controls self._ui = Ui_ZincViewGraphics() self._ui.setupUi(self) self._makeConnections() # Must pass the Context to the Zinc SceneviewerWidget self._ui.sceneviewerWidget.setContext(self._context) # must set other sceneviewer defaults once graphics are initialised self._ui.sceneviewerWidget.graphicsInitialized.connect( self._graphicsInitialized) # read the model and create some graphics to see it: self.setupModel()
def __init__(self, filename, parent=None): super(ZincViewImage, self).__init__(parent) self._context = ZincContext("ZincViewGraphics") self._material_module = self._context.getMaterialmodule() self._region = self._context.getDefaultRegion() self._fieldmodule = self._region.getFieldmodule() self._scaled_coordinate_field = None self._image_based_material = None self._filename = filename self._ui = Ui_ZincViewGraphics() self._ui.setupUi(self) self._make_connections() self._ui.sceneviewerWidget.setContext(self._context) self._ui.sceneviewerWidget.graphicsInitialized.connect(self._graphics_initialized) self._create_model() self._load_image()