class_docstr: **Bases:** :class:`object`
  
  Abstract class providing useful methods to GraphicsObject and GraphicsWidget.
  (This is required because we cannot have multiple inheritance with QObject subclasses.)
  
  A note about Qt's GraphicsView framework:
  
  The GraphicsView system places a lot of emphasis on the notion that the graphics within the scene should be device independent--you should be able to take the same graphics and display them on screens of different resolutions, printers, export to SVG, etc. This is nice in principle, but causes me a lot of headache in practice. It means that I have to circumvent all the device-independent expectations any time I want to operate in pixel coordinates rather than arbitrary scene coordinates. A lot of the code in GraphicsItem is devoted to this task--keeping track of view widgets and device transforms, computing the size and shape of a pixel in local item coordinates, etc. Note that in item coordinates, a pixel does not have to be square or even rectangular, so just asking how to increase a bounding rect by 2px can be a rather complex task.
docstr: Method to override to manually specify the SVG writer mechanism.
  
  Parameters
  ----------
  nodes
      Dictionary keyed by the name of graphics items and the XML
      representation of the the item that can be written as valid
      SVG.
  
  Returns
  -------
  tuple
      First element is the top level group for this item. The
      second element is a list of xml Elements corresponding to the
      child nodes of the item.
  None
      Return None if no XML is needed for rendering
  
  Raises
  ------
  NotImplementedError
      override method to implement in subclasses of GraphicsItem
  
  See Also
  --------
  pyqtgraph.exporters.SVGExporter._generateItemSvg
      The generic and default implementation
docstr_tok: ["Method","to","override","to","manually","specify","the","SVG","writer","mechanism",".","Parameters","--","--","--","--","--","nodes","Dictionary","keyed","by","the","name","of","graphics","items","and","the","XML","representation","of","the","the","item","that","can","be","written","as","valid","SVG",".","Returns","--","--","--","-","tuple","First","element","is","the","top","level","group","for","this","item",".","The","second","element","is","a","list","of","xml","Elements","corresponding","to","the","child","nodes","of","the","item",".","None","Return","None","if","no","XML","is","needed","for","rendering","Raises","--","--","--","NotImplementedError","override","method","to","implement","in","subclasses","of","GraphicsItem","See","Also","--","--","--","--","pyqtgraph.exporters.SVGExporter._generateItemSvg","The","generic","and","default","implementation"]
code: def generateSvg(
      self, nodes: dict[str, Element]
  ) -> Optional[tuple[Element, list[Element]]]:
      """Method to override to manually specify the SVG writer mechanism.
  
      Parameters
      ----------
      nodes
          Dictionary keyed by the name of graphics items and the XML
          representation of the the item that can be written as valid
          SVG.
  
      Returns
      -------
      tuple
          First element is the top level group for this item. The
          second element is a list of xml Elements corresponding to the
          child nodes of the item.
      None
          Return None if no XML is needed for rendering
  
      Raises
      ------
      NotImplementedError
          override method to implement in subclasses of GraphicsItem
  
      See Also
      --------
      pyqtgraph.exporters.SVGExporter._generateItemSvg
          The generic and default implementation
  
      """
      raise NotImplementedError
  
imports: import operator
  import weakref
  from collections import OrderedDict
  from functools import reduce
  from math import hypot
  from typing import Optional
  from xml.etree.ElementTree import Element
  from ..None import functions
  from ..GraphicsScene import GraphicsScene
  from ..Point import Point
  from ..Qt import QtCore, QtWidgets, isQObjectAlive
label_desc: Use image node_id 42 for calling the GraphicsItem obj's underlying member method code with example usage: obj.generateSvg(nodes) without return types