コード例 #1
0
ファイル: drawing_objects.py プロジェクト: wenlibin02/pygrace
    def __init__(self, parent, attrs, *args, **kwargs):
        GraceObject.__init__(self, parent, attrs, *args, **kwargs)

        # these are needed for the parent checking by drawing objects, but
        # should not be imported everything else has been (to avoid a cycle
        # in the dependency graph)
        import graph
        import grace

        # if the drawing object is added by a Graph, then record the index of
        # the graph.  Otherwise the parent of the drawing object is the grace.
        # The case in which self.parent = None occurs when Base.copy_format
        # is used with a DrawingObject subclass.  In this case, since there
        # is no instance to associate with a graph (or not), then the drawing
        # object is linked to the grace (not any particular graph)
        if isinstance(self.parent, grace.Grace):
            self._linked_graph = None
        elif isinstance(self.parent, graph.Graph):
            self._linked_graph = self.parent.index
        elif self.parent == None:
            self._linked_graph = None            
        else:
            message = 'parent of drawing object (%s) is not graph or grace.' %\
                      type(self.parent)
            raise TypeError(message)
コード例 #2
0
    def __setattr__(self, key, value):

        # check type of Frame specific attribute
        if key == 'type':
            self._check_type(int, key, value)
            self._check_range(key, value, 0, 6, includeMax=False)
        GraceObject.__setattr__(self, key, value)
コード例 #3
0
ファイル: graph.py プロジェクト: mmckerns/pygrace
    def __setattr__(self, key, value):

        # check type of Frame specific attribute
        if key == 'type':
            self._check_type(int, key, value)
            self._check_range(key, value, 0, 6, includeMax=False)
        GraceObject.__setattr__(self, key, value)
コード例 #4
0
ファイル: dataset.py プロジェクト: wenlibin02/pygrace
    def __setattr__(self, key, value):

        DATA_TYPES = (
            'xy',
            'xydx',
            'xydy',
            'xydxdy',
            'xydydy',
            'xydxdx',
            'xydxdxdydy',
            'bar',
            'bardy',
            'bardydy',
            'xyhilo',
            'xyz',
            #                       'xyr', # apparently unsupported
            'xysize',
            'xycolor',
            #                       'xycolpat', # xmgrace does not support
            'xyvmap',
            'xyboxplot')

        # check DataSet specific attributes
        if key == 'type':
            self._check_type(str, key, value)
            self._check_membership(key, value, DATA_TYPES)
        elif key == 'dropline':
            self._check_type(str, key, value)
            self._check_membership(key, value, ('on', 'off'))
        elif key == 'comment':
            self._check_type(str, key, value)
        elif key == 'legend':
            self._check_type(str, key, value)

        GraceObject.__setattr__(self, key, value)
コード例 #5
0
    def __init__(self,
                 parent,
                 index,
                 onoff='on',
                 hidden='false',
                 type='XY',
                 stacked='false',
                 bar_hgap=0.00,
                 **kwargs):
        GraceObject.__init__(self, parent, locals())
        self.legend = Legend(self)
        self.frame = Frame(self)
        self.xaxis = Axis(self, 'x')
        self.yaxis = Axis(self, 'y')
        self.altxaxis = Axis(self, 'x', 'alt', 'off')
        self.altyaxis = Axis(self, 'y', 'alt', 'off')
        self.title = Title(self)
        self.subtitle = Subtitle(self)
        self.view = View(self)
        self.world = World(self)

        self.datasets = []
        self._datasetIndex = INDEX_ORIGIN

        self.drawing_objects = []
コード例 #6
0
ファイル: grace.py プロジェクト: mmckerns/pygrace
    def __init__(self,
                 width=792,
                 height=612,
		 background_color=0,
                 background_fill='off',
                 version='50114',
                 verbose=False,
                 colors=None,
                 **kwargs
		 ): 
        GraceObject.__init__(self, None, locals())

	self.timestamp = Timestamp(self)

        # set these first, so that children inherit this color scheme
        self.colors = colors or DefaultColorScheme()
        self.fonts = default_fonts

        self._graphIndex = INDEX_ORIGIN
	self.graphs = []

        self.drawing_objects = []
        
        # maximum frame ratios in viewport units
        self.get_canvas_dimensions()
コード例 #7
0
 def __init__(self,
              parent,
              xmin=0.15,
              xmax=1.15,
              ymin=0.15,
              ymax=0.85,
              **kwargs):
     GraceObject.__init__(self, parent, locals())
コード例 #8
0
ファイル: dataset.py プロジェクト: bjmorgan/pygrace
 def __init__(self, parent,
              type = 0,
              rule = 0,
              color = 1,
              pattern = 1,
              **kwargs
              ):
     GraceObject.__init__(self, parent, locals())
コード例 #9
0
ファイル: dataset.py プロジェクト: nonAbelianDucks/pygrace
    def __setattr__(self, key, value):

        # check Line specific attributes
        if key == "type":
            self._check_type(int, key, value)
            self._check_range(key, value, 0, 6, includeMax=False)

        GraceObject.__setattr__(self, key, value)
コード例 #10
0
ファイル: graph.py プロジェクト: mmckerns/pygrace
 def __init__(self, parent,
              xmin=0.15,
              xmax=1.15,
              ymin=0.15,
              ymax=0.85,
              **kwargs
              ):
     GraceObject.__init__(self, parent, locals())
コード例 #11
0
ファイル: graph.py プロジェクト: mmckerns/pygrace
 def __init__(self, parent,
              text='',
              font=4,
              color=1,
              size=1.75,
              **kwargs
              ):
     GraceObject.__init__(self, parent, locals())
コード例 #12
0
ファイル: dataset.py プロジェクト: nonAbelianDucks/pygrace
 def __init__(self, parent, data, index, type="xy", hidden="false", dropline="off", comment="", legend="", **kwargs):
     GraceObject.__init__(self, parent, locals())
     self.baseline = Baseline(self)
     self.symbol = Symbol(self)
     self.line = Line(self)
     self.fill = Fill(self)
     self.avalue = AnnotatedValue(self)
     self.errorbar = ErrorBar(self)
コード例 #13
0
ファイル: dataset.py プロジェクト: wenlibin02/pygrace
 def __init__(self,
              parent,
              type=1,
              linestyle=1,
              linewidth=2.0,
              color=1,
              pattern=1,
              **kwargs):
     GraceObject.__init__(self, parent, locals())
コード例 #14
0
ファイル: dataset.py プロジェクト: bjmorgan/pygrace
 def __init__(self, parent,
              type = 1,
              linestyle = 1,
              linewidth = 2.0,
              color = 1,
              pattern = 1,
              **kwargs
              ):
     GraceObject.__init__(self, parent, locals())
コード例 #15
0
ファイル: graph.py プロジェクト: mmckerns/pygrace
    def __setattr__(self, key, value):

        # check type of Frame specific attribute
        if key == 'znorm':
            self._check_type((float, int), key, value)
        elif key == 'stack_world':
            self._check_type(tuple, key, value)

        GraceObject.__setattr__(self, key, value)
コード例 #16
0
    def __setattr__(self, key, value):

        # check type of Frame specific attribute
        if key == 'znorm':
            self._check_type((float, int), key, value)
        elif key == 'stack_world':
            self._check_type(tuple, key, value)

        GraceObject.__setattr__(self, key, value)
コード例 #17
0
ファイル: grace.py プロジェクト: bjmorgan/pygrace
 def __init__(self, parent,
              onoff='off',
              x = 0.03,
              y = 0.03,
              color = 1,
              font = 4,
              rot = 0,
              char_size = 1.0,
              **kwargs
              ):
     GraceObject.__init__(self, parent, locals())
コード例 #18
0
ファイル: dataset.py プロジェクト: wenlibin02/pygrace
    def __setattr__(self, key, value):

        # check type of ErrorBar specific attribute
        if key == 'riser_clip':
            self._check_type(str, key, value)
            self._check_membership(key, value, ('on', 'off'))
        elif key == 'riser_clip_length':
            self._check_type((float, int), key, value)
            self._check_range(key, value, 0, None)

        GraceObject.__setattr__(self, key, value)
コード例 #19
0
ファイル: dataset.py プロジェクト: wenlibin02/pygrace
    def __setattr__(self, key, value):

        # check Fill specific attributes
        if key == 'type':
            self._check_type(int, key, value)
            self._check_range(key, value, 0, 2)
        elif key == 'rule':
            self._check_type(int, key, value)
            self._check_range(key, value, 0, 1)

        GraceObject.__setattr__(self, key, value)
コード例 #20
0
ファイル: dataset.py プロジェクト: bjmorgan/pygrace
    def __setattr__(self, key, value):

        # check Fill specific attributes
        if key == 'type':
            self._check_type(int, key, value)
            self._check_range(key, value, 0, 2)
        elif key == 'rule':
            self._check_type(int, key, value)
            self._check_range(key, value, 0, 1)
            
        GraceObject.__setattr__(self, key, value)
コード例 #21
0
 def __init__(self,
              parent,
              onoff='off',
              x=0.03,
              y=0.03,
              color=1,
              font=4,
              rot=0,
              char_size=1.0,
              **kwargs):
     GraceObject.__init__(self, parent, locals())
コード例 #22
0
ファイル: dataset.py プロジェクト: bjmorgan/pygrace
    def __setattr__(self, key, value):

        # check type of ErrorBar specific attribute
        if key == 'riser_clip':
            self._check_type(str, key, value)
            self._check_membership(key, value, ('on', 'off'))
        elif key == 'riser_clip_length':
            self._check_type((float, int), key, value)
            self._check_range(key, value, 0, None)

        GraceObject.__setattr__(self, key, value)
コード例 #23
0
    def __setattr__(self, key, value):

        # check Graph specific attributes
        if key == 'type':
            self._check_type(str, key, value)
        elif key == 'stacked':
            self._check_type(str, key, value)
            self._check_membership(key, value, ('true', 'false'))
        elif key == 'bar_hgap':
            self._check_type((float, int), key, value)

        GraceObject.__setattr__(self, key, value)
コード例 #24
0
 def __init__(self,
              parent,
              xmin=0,
              xmax=1,
              ymin=0,
              ymax=1,
              stack_world=(0, 0, 0, 0),
              znorm=1,
              **kwargs):
     GraceObject.__init__(self, parent, locals())
     self._formatting_template = \
         {'stack_world': '%.20f, %.20f, %.20f, %.20f'}
コード例 #25
0
    def __setattr__(self, key, value):

        # check Legend specific attributes
        if key == 'loc':
            self._check_type(tuple, key, value)
        elif key == 'invert':
            self._check_type(str, key, value)
            self._check_membership(key, value, ('true', 'false'))
        elif key == 'hgap' or key == 'vgap':
            self._check_type((float, int), key, value)

        GraceObject.__setattr__(self, key, value)
コード例 #26
0
ファイル: graph.py プロジェクト: mmckerns/pygrace
 def __init__(self, parent,
              xmin=0,
              xmax=1,
              ymin=0,
              ymax=1,
              stack_world=(0,0,0,0),
              znorm=1,
              **kwargs
              ):
     GraceObject.__init__(self, parent, locals())
     self._formatting_template = \
         {'stack_world': '%.20f, %.20f, %.20f, %.20f'}
コード例 #27
0
ファイル: graph.py プロジェクト: mmckerns/pygrace
    def __setattr__(self, key, value):

        # check Graph specific attributes
        if key == 'type':
            self._check_type(str, key, value)
        elif key == 'stacked':
            self._check_type(str, key, value)
            self._check_membership(key, value, ('true', 'false'))
        elif key == 'bar_hgap':
            self._check_type((float, int), key, value)

        GraceObject.__setattr__(self, key, value)
コード例 #28
0
ファイル: graph.py プロジェクト: mmckerns/pygrace
    def __setattr__(self, key, value):

        # check Legend specific attributes
        if key == 'loc':
            self._check_type(tuple, key, value)
        elif key == 'invert':
            self._check_type(str, key, value)
            self._check_membership(key, value, ('true', 'false'))
        elif key == 'hgap' or key == 'vgap':
            self._check_type((float, int), key, value)
            
        GraceObject.__setattr__(self, key, value)
コード例 #29
0
ファイル: dataset.py プロジェクト: bjmorgan/pygrace
    def __setattr__(self, key, value):

        # check type of Symbol specific attribute
        if key == 'skip':
            self._check_type(int, key, value)
        elif key == 'char':
            self._check_type(int, key, value)
            self._check_range(key, value, 0, 128, includeMax=False)
        elif key == 'shape':
            self._check_type(int, key, value)
            self._check_range(key, value, 0, 12, includeMax=False)

        GraceObject.__setattr__(self, key, value)
コード例 #30
0
ファイル: dataset.py プロジェクト: wenlibin02/pygrace
    def __setattr__(self, key, value):

        # check type of Symbol specific attribute
        if key == 'skip':
            self._check_type(int, key, value)
        elif key == 'char':
            self._check_type(int, key, value)
            self._check_range(key, value, 0, 128, includeMax=False)
        elif key == 'shape':
            self._check_type(int, key, value)
            self._check_range(key, value, 0, 12, includeMax=False)

        GraceObject.__setattr__(self, key, value)
コード例 #31
0
ファイル: dataset.py プロジェクト: bjmorgan/pygrace
 def __init__(self, parent,
              shape = 1,
              size = 0.5,
              color = 1,
              pattern = 1,
              fill_color = 1,
              fill_pattern = 1,
              linewidth = 1.0,
              linestyle = 1,
              char = 65,
              char_font = 0,
              skip = 0,
              **kwargs
              ):
     GraceObject.__init__(self, parent, locals())
コード例 #32
0
ファイル: dataset.py プロジェクト: wenlibin02/pygrace
 def __init__(self,
              parent,
              onoff="on",
              place="both",
              color=1,
              pattern=1,
              size=1.0,
              linewidth=2.0,
              linestyle=1,
              riser_linewidth=2.0,
              riser_linestyle=1,
              riser_clip="off",
              riser_clip_length=0.1,
              **kwargs):
     GraceObject.__init__(self, parent, locals())
コード例 #33
0
ファイル: dataset.py プロジェクト: bjmorgan/pygrace
 def __init__(self, parent,
              onoff = "on",
              place = "both",
              color = 1,
              pattern = 1,
              size = 1.0,
              linewidth = 2.0,
              linestyle = 1,
              riser_linewidth = 2.0,
              riser_linestyle = 1,
              riser_clip = "off",
              riser_clip_length = 0.1,
              **kwargs
              ):
     GraceObject.__init__(self, parent, locals())
コード例 #34
0
ファイル: dataset.py プロジェクト: bjmorgan/pygrace
 def __init__(self, parent, data, index,
              type='xy',
              hidden='false',
              dropline='off',
              comment='',
              legend='',
              **kwargs
              ):
     GraceObject.__init__(self, parent, locals())
     self.baseline = Baseline(self)
     self.symbol = Symbol(self)
     self.line = Line(self)
     self.fill = Fill(self)
     self.avalue = AnnotatedValue(self)
     self.errorbar = ErrorBar(self)
コード例 #35
0
    def __setattr__(self, key, value):

        # check Grace specific attributes
        if key == 'width' or key == 'height':
            self._check_type(int, key, value)
            self._check_range(key, value, 0, None)
        elif key == 'verbose':
            self._check_type(bool, key, value)
        elif key == 'version':
            self._check_type(str, key, value)
        elif key == 'background_fill':
            self._check_type(str, key, value)
            self._check_membership(key, value, ('on', 'off'))

        GraceObject.__setattr__(self, key, value)
コード例 #36
0
ファイル: grace.py プロジェクト: bjmorgan/pygrace
    def __setattr__(self, key, value):

        # check Grace specific attributes
        if key == 'width' or key == 'height':
            self._check_type(int, key, value)
            self._check_range(key, value, 0, None)
        elif key == 'verbose':
            self._check_type(bool, key, value)
        elif key == 'version':
            self._check_type(str, key, value)
        elif key == 'background_fill':
            self._check_type(str, key, value)
            self._check_membership(key, value, ('on', 'off'))
            
        GraceObject.__setattr__(self, key, value)
コード例 #37
0
ファイル: dataset.py プロジェクト: wenlibin02/pygrace
 def __init__(self,
              parent,
              shape=1,
              size=0.5,
              color=1,
              pattern=1,
              fill_color=1,
              fill_pattern=1,
              linewidth=1.0,
              linestyle=1,
              char=65,
              char_font=0,
              skip=0,
              **kwargs):
     GraceObject.__init__(self, parent, locals())
コード例 #38
0
ファイル: dataset.py プロジェクト: bjmorgan/pygrace
 def __init__(self, parent,
              onoff = "off",
              type = 4,
              char_size = 0.65,
              font = 4,
              color = 1,
              rot = 0,
              format = "general",
              prec = 3,
              prepend = '',
              append = '',
              offset = (0.0,0.0),
              **kwargs
              ):
     GraceObject.__init__(self, parent, locals())
     self._formatting_template = {'offset': '%.20f, %.20f'}
コード例 #39
0
ファイル: dataset.py プロジェクト: wenlibin02/pygrace
 def __init__(self,
              parent,
              onoff="off",
              type=4,
              char_size=0.65,
              font=4,
              color=1,
              rot=0,
              format="general",
              prec=3,
              prepend='',
              append='',
              offset=(0.0, 0.0),
              **kwargs):
     GraceObject.__init__(self, parent, locals())
     self._formatting_template = {'offset': '%.20f, %.20f'}
コード例 #40
0
ファイル: dataset.py プロジェクト: wenlibin02/pygrace
 def __init__(self,
              parent,
              data,
              index,
              type='xy',
              hidden='false',
              dropline='off',
              comment='',
              legend='',
              **kwargs):
     GraceObject.__init__(self, parent, locals())
     self.baseline = Baseline(self)
     self.symbol = Symbol(self)
     self.line = Line(self)
     self.fill = Fill(self)
     self.avalue = AnnotatedValue(self)
     self.errorbar = ErrorBar(self)
コード例 #41
0
ファイル: drawing_objects.py プロジェクト: wenlibin02/pygrace
    def __setattr__(self, key, value):

        # check Graph specific attributes
        if key == 'start' or key == 'end':
            self._check_type(tuple, key, value)
        elif key == 'arrow':
            self._check_type(int, key, value)
            self._check_range(key, value, 0, 3)
        elif key == 'arrow_type':
            self._check_type(int, key, value)
            self._check_range(key, value, 0, 2)
        elif key == 'arrow_length':
            self._check_type((float, int), key, value)
            self._check_range(key, value, 0, None)
        elif key == 'arrow_layout':
            self._check_type(tuple, key, value)
            self._check_range(key, value[0], 0, None)
            self._check_range(key, value[1], 0, 1, includeMax=True)
            
        GraceObject.__setattr__(self, key, value)
コード例 #42
0
ファイル: graph.py プロジェクト: mmckerns/pygrace
 def __init__(self, parent,
              onoff = 'on',         # must be 'on' or 'off'
              loctype = 'view',     # must be 'view' or 'world'
              loc = (0.85, 0.75),   # coordinates by upper left corner
              box_color = 1,
              box_pattern =  1,
              box_linewidth = 2.0,
              box_linestyle = 1,
              box_fill_color = 0,
              box_fill_pattern = 1,
              font = 4,
              char_size = 1.65,
              color = 1,
              length = 3,
              vgap = 1,
              hgap = 1,
              invert = 'false',
              **kwargs
              ):
     GraceObject.__init__(self, parent, locals())
     self._formatting_template = {'loc': '%.20f, %.20f'}
コード例 #43
0
 def __init__(
         self,
         parent,
         onoff='on',  # must be 'on' or 'off'
         loctype='view',  # must be 'view' or 'world'
         loc=(0.85, 0.75),  # coordinates by upper left corner
         box_color=1,
         box_pattern=1,
         box_linewidth=2.0,
         box_linestyle=1,
         box_fill_color=0,
         box_fill_pattern=1,
         font=4,
         char_size=1.65,
         color=1,
         length=3,
         vgap=1,
         hgap=1,
         invert='false',
         **kwargs):
     GraceObject.__init__(self, parent, locals())
     self._formatting_template = {'loc': '%.20f, %.20f'}
コード例 #44
0
ファイル: dataset.py プロジェクト: bjmorgan/pygrace
    def __setattr__(self, key, value):

        DATA_TYPES = ('xy', 'xydx', 'xydy', 'xydxdy', 'xydydy', 
                      'xydxdx', 'xydxdxdydy', 'bar', 'bardy', 'bardydy',
                      'xyhilo', 'xyz', 
#                       'xyr', # apparently unsupported
                      'xysize', 'xycolor',
#                       'xycolpat', # xmgrace does not support
                      'xyvmap', 'xyboxplot')

        # check DataSet specific attributes
        if key == 'type':
            self._check_type(str, key, value)
            self._check_membership(key, value, DATA_TYPES)
        elif key == 'dropline':
            self._check_type(str, key, value)
            self._check_membership(key, value, ('on', 'off'))
        elif key == 'comment':
            self._check_type(str, key, value)
        elif key == 'legend':
            self._check_type(str, key, value)
            
        GraceObject.__setattr__(self, key, value)
コード例 #45
0
ファイル: graph.py プロジェクト: mmckerns/pygrace
    def __init__(self, parent, index,
                 onoff='on',
                 hidden='false',
                 type='XY',
                 stacked = 'false',
                 bar_hgap=0.00,
                 **kwargs
                 ):
        GraceObject.__init__(self, parent, locals())
        self.legend = Legend(self)
        self.frame = Frame(self)
        self.xaxis = Axis(self, 'x')
        self.yaxis = Axis(self, 'y')
        self.altxaxis = Axis(self, 'x', 'alt', 'off')
        self.altyaxis = Axis(self, 'y', 'alt', 'off')
        self.title = Title(self)
        self.subtitle = Subtitle(self)
        self.view = View(self)
        self.world = World(self)

        self.datasets = []
        self._datasetIndex = INDEX_ORIGIN

        self.drawing_objects = []
コード例 #46
0
    def __init__(self,
                 width=792,
                 height=612,
                 background_color=0,
                 background_fill='off',
                 version='50114',
                 verbose=False,
                 colors=None,
                 **kwargs):
        GraceObject.__init__(self, None, locals())

        self.timestamp = Timestamp(self)

        # set these first, so that children inherit this color scheme
        self.colors = colors or DefaultColorScheme()
        self.fonts = default_fonts

        self._graphIndex = INDEX_ORIGIN
        self.graphs = []

        self.drawing_objects = []

        # maximum frame ratios in viewport units
        self.get_canvas_dimensions()
コード例 #47
0
ファイル: dataset.py プロジェクト: nonAbelianDucks/pygrace
    def __setattr__(self, key, value):

        DATA_TYPES = (
            "xy",
            "xydx",
            "xydy",
            "xydxdy",
            "xydydy",
            "xydxdx",
            "xydxdxdydy",
            "bar",
            "bardy",
            "bardydy",
            "xyhilo",
            "xyz",
            #                       'xyr', # apparently unsupported
            "xysize",
            "xycolor",
            #                       'xycolpat', # xmgrace does not support
            "xyvmap",
            "xyboxplot",
        )

        # check DataSet specific attributes
        if key == "type":
            self._check_type(str, key, value)
            self._check_membership(key, value, DATA_TYPES)
        elif key == "dropline":
            self._check_type(str, key, value)
            self._check_membership(key, value, ("on", "off"))
        elif key == "comment":
            self._check_type(str, key, value)
        elif key == "legend":
            self._check_type(str, key, value)

        GraceObject.__setattr__(self, key, value)
コード例 #48
0
ファイル: dataset.py プロジェクト: bjmorgan/pygrace
 def __init__(self, parent,
              type = 0,
              onoff="off",
              **kwargs
              ):
     GraceObject.__init__(self, parent, locals())
コード例 #49
0
 def __init__(self, parent, text='', font=4, color=1, size=1.75, **kwargs):
     GraceObject.__init__(self, parent, locals())
コード例 #50
0
ファイル: dataset.py プロジェクト: wenlibin02/pygrace
 def __init__(self, parent, type=0, rule=0, color=1, pattern=1, **kwargs):
     GraceObject.__init__(self, parent, locals())
コード例 #51
0
ファイル: dataset.py プロジェクト: wenlibin02/pygrace
 def __init__(self, parent, type=0, onoff="off", **kwargs):
     GraceObject.__init__(self, parent, locals())