Commit 71139548 authored by Yori 'AGy' Fournier's avatar Yori 'AGy' Fournier
Browse files

Now it is possible to call directly the class with the class name

parent f96b3b0b
......@@ -55,3 +55,5 @@ from .qMyDesignGui import QMyDesignGui
#import myIOs
from .myIOs import *
from .myAxes import AxActivity
......@@ -20,11 +20,12 @@ _DEFAULT_DESIGN = {'declareKeywords': DEFAULT_DECLARE_KEYWORDS,
'plotting': DEFAULT_PLOTTING}
DEFAULT_ADDAXES = '''
myAxesDesign = self.design.get('MyAxes', _DEFAULT_DESIGN)
#myAxesDesign = self.design.get('MyAxes', _DEFAULT_DESIGN)
ratio = 6./8.
frame = [0.2, 0.15, 0.6, 0.7]
self.add_axes(AxDesign(self, ratio, frame, design=myAxesDesign), 'ax1')
#self.add_axes(AxDesign(self, ratio, frame, design=myAxesDesign), 'ax1')
#self.add_axes(MyAxes0(self, ratio, frame), 'ax1')
'''
DEFAULT_DECLARE_ALIASES = '''
......@@ -68,6 +69,12 @@ class FigDesign(MyFig):
figDesign = self.design.get(self.design.figClassName, _DEFAULT_FIG_DESIGN)
for axes in self.design:
if axes != self.design.figClassName:
print(str(axes) + " = type('" + str(axes) + "', (AxDesign,), {})")
exec(str(axes) + " = type('" + str(axes) + "', (AxDesign,), {})")
print(eval(str(axes)))
if 'addAxes' in figDesign:
exec(''.join(str(figDesign['addAxes'])))
else:
......@@ -76,10 +83,9 @@ class FigDesign(MyFig):
class AxDesign(MyAxes):
def __init__(self, fig, ratio, frameRect, design=_DEFAULT_DESIGN, *args, **kwargs):
self.design = design
def __init__(self, fig, ratio, frameRect, *args, **kwargs):
self.design = fig.design.get(self.__class__.__name__, _DEFAULT_DESIGN)
MyAxes.__init__(self, fig, ratio, frameRect, *args, **kwargs)
def declareKeywords(self):
......@@ -89,7 +95,9 @@ class AxDesign(MyAxes):
exec(''.join(str(self.design['declareKeywords'])))
else:
pass
self.keywords = {}
return(True)
def plotting(self):
......
......@@ -61,9 +61,9 @@ self.aliases = {}
'''
DEFAULT_ADDAXES = '''
myAxesDesign = self.design.get('MyAxes', _DEFAULT_DESIGN)
ratio = 6./8.
frame = [0.2, 0.15, 0.6, 0.7]
self.add_axes(AxDesign(self, ratio, frame, design=myAxesDesign), 'ax1')
self.add_axes(MyAxes0(self, ratio, frame), 'ax1')
'''
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment