Esempio n. 1
0
 def reset( self ):
     """
     Resets the values to the current application information.
     """
     self.setValue('colorSet', XPaletteColorSet())
     self.setValue('font',     QApplication.font())
     self.setValue('fontSize', QApplication.font().pointSize())
Esempio n. 2
0
 def __init__(self, name, **options):
     # define custom properties
     self._name        = name
     self._chart       = None
     self._orientation = options.get('orientation', Qt.Horizontal)
     self._showLabels  = options.get('showLabels', True)
     self._shadeAxis   = options.get('shadeAxis', None)
     self._minimum     = options.get('minimum', None)
     self._maximum     = options.get('maximum', None)
     self._values      = options.get('values', None)
     self._labels      = options.get('labels', None)
     self._labelFont   = options.get('labelFont', QApplication.font())
     self._labelFormat = options.get('labelFormat', '{0}')
     self._hLabelPad   = options.get('horizontalLabelPadding', 6)
     self._vLabelPad   = options.get('verticalLabelPadding', 3)
     self._title       = options.get('title', '')
     
     self._maximumLabelCount = options.get('maximumLabelCount', None)
     self._minimumLabelWidth = options.get('minimumLabelWidth', 32)
     self._minimumLabelHeight = options.get('minimumLabelHeight', 22)
     
     # setup default dynamic options
     self._dynamicRange = options.get('useDynamicRange',
                                      not 'labels' in options)
     self._dynamicScalingEnabled = options.get('dynamicScalingEnabled',
                                               False)
     
     # setup default title font
     titleFont = QApplication.font()
     titleFont.setBold(True)
     self._titleFont = options.get('titleFont', titleFont)
Esempio n. 3
0
 def reset(self):
     """
     Resets the values to the current application information.
     """
     self.setValue('colorSet', XPaletteColorSet())
     self.setValue('font', QApplication.font())
     self.setValue('fontSize', QApplication.font().pointSize())
Esempio n. 4
0
    def __init__(self, chartWidget):
        super(XChartScene, self).__init__(chartWidget)

        # create custom properties
        self._chartWidget = chartWidget
        self._minimumWidth = -1
        self._minimumHeight = -1
        self._maximumWidth = -1
        self._maximumHeight = -1
        self._horizontalPadding = 6
        self._verticalPadding = 6
        self._showGrid = True
        self._showRows = True
        self._showColumns = True
        self._trackingEnabled = True
        self._chartType = XChartScene.Type.Line
        self._trackerItem = None

        # used with pie charts
        self._pieAxis = Qt.YAxis
        self._pieAlignment = Qt.AlignCenter

        self._horizontalRuler = XChartRuler(XChartRuler.Type.Number)
        self._verticalRuler = XChartRuler(XChartRuler.Type.Number)
        self._font = QApplication.font()

        self._alternatingColumnColors = False
        self._alternatingRowColors = True

        self._dirty = False
        self._buildData = {}

        palette = QApplication.palette()

        self._axisColor = palette.color(palette.Mid).darker(125)
        self._baseColor = palette.color(palette.Base)
        self._alternateColor = palette.color(palette.Base).darker(104)
        self._borderColor = palette.color(palette.Mid)

        # create custom properties
        chartWidget.installEventFilter(self)
        self.chartTypeChanged.connect(self.update)
Esempio n. 5
0
 def __init__( self, chartWidget ):
     super(XChartScene, self).__init__(chartWidget)
     
     # create custom properties
     self._chartWidget       = chartWidget
     self._minimumWidth      = -1
     self._minimumHeight     = -1
     self._maximumWidth      = -1
     self._maximumHeight     = -1
     self._horizontalPadding = 6
     self._verticalPadding   = 6
     self._showGrid          = True
     self._showRows          = True
     self._showColumns       = True
     self._trackingEnabled   = True
     self._chartType         = XChartScene.Type.Line
     self._trackerItem       = None
     
     # used with pie charts
     self._pieAxis           = Qt.YAxis
     self._pieAlignment      = Qt.AlignCenter
     
     self._horizontalRuler   = XChartRuler(XChartRuler.Type.Number)
     self._verticalRuler     = XChartRuler(XChartRuler.Type.Number)
     self._font              = QApplication.font()
     
     self._alternatingColumnColors = False
     self._alternatingRowColors    = True
     
     self._dirty             = False
     self._buildData         = {}
     
     palette                 = QApplication.palette()
     
     self._axisColor         = palette.color(palette.Mid).darker(125)
     self._baseColor         = palette.color(palette.Base)
     self._alternateColor    = palette.color(palette.Base).darker(104)
     self._borderColor       = palette.color(palette.Mid)
     
     # create custom properties
     chartWidget.installEventFilter(self)
     self.chartTypeChanged.connect(self.update)
Esempio n. 6
0
 def maxNotchSize( self, orientation ):
     """
     Returns the maximum size for this ruler based on its notches and the
     given orientation.
     
     :param      orientation | <Qt.Orientation>
     
     :return     <int>
     """
     metrics = QFontMetrics(QApplication.font())
     
     if orientation == Qt.Vertical:
         notch = ''
         for n in self.notches():
             if len(nativestring(n)) > len(nativestring(notch)):
                 notch = nativestring(n)
         
         return metrics.width(notch)
     else:
         return metrics.height()
Esempio n. 7
0
    def maxNotchSize(self, orientation):
        """
        Returns the maximum size for this ruler based on its notches and the
        given orientation.
        
        :param      orientation | <Qt.Orientation>
        
        :return     <int>
        """
        metrics = QFontMetrics(QApplication.font())

        if orientation == Qt.Vertical:
            notch = ''
            for n in self.notches():
                if len(nativestring(n)) > len(nativestring(notch)):
                    notch = nativestring(n)

            return metrics.width(notch)
        else:
            return metrics.height()
Esempio n. 8
0
 def __init__( self, *args, **defaults ):
     defaults.setdefault('colorSet',  XPaletteColorSet())
     defaults.setdefault('font',      QApplication.font())
     defaults.setdefault('fontSize',  QApplication.font().pointSize())
     
     super(XScheme, self).__init__( *args, **defaults )
Esempio n. 9
0
    def __init__(self, *args, **defaults):
        defaults.setdefault('colorSet', XPaletteColorSet())
        defaults.setdefault('font', QApplication.font())
        defaults.setdefault('fontSize', QApplication.font().pointSize())

        super(XScheme, self).__init__(*args, **defaults)