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

cleaning

cleaned __init__
cleaned DEFAULT_FUNCTION values
parent 72efa602
# System
import sys
# Qt4
......@@ -9,37 +10,97 @@ except:
from PySide import QtGui
from PySide import QtCore
# Qt4 Lib
# App
QApplication = QtGui.QApplication
# Widgets
QWidget = QtGui.QWidget
QVBoxLayout = QtGui.QVBoxLayout
QGridLayout = QtGui.QGridLayout
#
QPushButton = QtGui.QPushButton
QMainWindow = QtGui.QMainWindow
QTabWidget = QtGui.QTabWidget
QFont = QtGui.QFont
QLabel = QtGui.QLabel
QLineEdit = QtGui.QLineEdit
QTextEdit = QtGui.QTextEdit
QPlainTextEdit = QtGui.QPlainTextEdit
QAction = QtGui.QAction
QIcon = QtGui.QIcon
QComboBox = QtGui.QComboBox
#
QTabWidget = QtGui.QTabWidget
QPlainTextEdit = QtGui.QPlainTextEdit
QListWidget = QtGui.QListWidget
#
QFileDialog = QtGui.QFileDialog
QMainWindow = QtGui.QMainWindow
# Layout
QVBoxLayout = QtGui.QVBoxLayout
QGridLayout = QtGui.QGridLayout
QFormLayout = QtGui.QFormLayout
QListWidget = QtGui.QListWidget
# Font
QFont = QtGui.QFont
# Trigger
QAction = QtGui.QAction
MouseButtonDblClick = QtCore.QEvent.MouseButtonDblClick
# Others
QIcon = QtGui.QIcon
LeftButton = QtCore.Qt.LeftButton
# MatPlotLib
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as QCanvas
# MyPlotLib
from myplotlib import INFO, SPCE, WARN, DBUG, SEVR
from myplotlib import MyAxes, MyFig, MyData, np
from myplotlib.test import FigTest1, readStupidData, readStupidData2
from .mplDesign import MyDesign, AxDesign, FigDesign
# CONSTANTS
DEFAULT_DECLARE_ALIASES = '''
self.aliases = {}
'''
DEFAULT_ADDAXES = '''
ratio = 6./8.
frame = [0.2, 0.15, 0.6, 0.7]
self.add_axes(MyAxes0(self, ratio, frame), 'ax1')
'''
DEFAULT_DECLARE_KEYWORDS = '''
self.keywords = {'color': 'r'}
'''
DEFAULT_FORMAT_RAWDATA = '''
self.data = {'xdata': [-1, 1],
'ydata1': [-1, 1],
'ydata2': [1, -1]}
'''
DEFAULT_PLOTTING = '''
# import
from matplotlib.patches import Rectangle
# get keyword
color = self.keywords.get('color', 'r')
# Plot the red lines
self.plot(self.data['xdata'], self.data['ydata1'], color=color)
self.plot(self.data['xdata'], self.data['ydata2'], color=color)
# add text
self.text(-0.45, -0.07, 'Nothing to plot', color='purple')
# add Patch
self.add_patch(Rectangle((-0.5, -0.12), 1.0, 0.21, color='w', zorder=3))
# set x/y-axis to invisible
self.xaxis.set_visible(False)
self.yaxis.set_visible(False)
'''
# Local Import
from .mplDesign import MyDesign, AxDesign, FigDesign
from .pythonHighlighter import PythonHighlighter
from .qMyFigContainer import QMyFigContainer
from .qTabMyAxes import QTabMyAxes
......@@ -50,10 +111,10 @@ from .qMyDesignWidget import QMyDesignWidget
from .qOpenFileWidget import QOpenFileWidget
from .qMyDesignGui import QMyDesignGui
# Import IOs
#import myIOs
from .myIOs import *
from .myAxes import AxActivity
# Import myAxes
#from .myAxes import AxActivity
# import myFigures
from . import MyAxes
from . import MyFig
DEFAULT_DECLARE_KEYWORDS = '''
self.keywords = {}
'''
DEFAULT_FORMAT_RAWDATA = '''
self.data = {'xdata': [-5, 2],
'ydata': [-2, 4]}
'''
DEFAULT_PLOTTING = '''
self.plot(self.data['xdata'], self.data['ydata'])
'''
from . import DEFAULT_DECLARE_ALIASES
from . import DEFAULT_ADDAXES
from . import DEFAULT_DECLARE_KEYWORDS
from . import DEFAULT_FORMAT_RAWDATA
from . import DEFAULT_PLOTTING
_DEFAULT_DESIGN = {'declareKeywords': DEFAULT_DECLARE_KEYWORDS,
'formatRawData': DEFAULT_FORMAT_RAWDATA,
'plotting': DEFAULT_PLOTTING}
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')
'''
DEFAULT_DECLARE_ALIASES = '''
self.aliases = {}
'''
_DEFAULT_FIG_DESIGN = {'declareAliases': DEFAULT_DECLARE_ALIASES,
'addAxes': DEFAULT_ADDAXES}
class MyDesign(dict):
def __init__(self):
......
......@@ -9,6 +9,10 @@ from . import PythonHighlighter
from . import QSignal
from . import DEFAULT_DECLARE_KEYWORDS
from . import DEFAULT_FORMAT_RAWDATA
from . import DEFAULT_PLOTTING
class QTabMyAxes(QWidget):
......@@ -70,17 +74,3 @@ class QTabMyAxes(QWidget):
name = str(self.editName.text())
return(name)
DEFAULT_DECLARE_KEYWORDS = '''
self.keywords = {}
'''
DEFAULT_FORMAT_RAWDATA = '''
self.data = {'xdata': [-5, 2],
'ydata': [-2, 4]}
'''
DEFAULT_PLOTTING = '''
self.plot(self.data['xdata'], self.data['ydata'])
'''
......@@ -7,6 +7,8 @@ from . import QTextEdit
from . import QPlainTextEdit
from . import PythonHighlighter
from . import DEFAULT_DECLARE_ALIASES
from . import DEFAULT_ADDAXES
class QTabMyFig(QWidget):
......@@ -48,22 +50,9 @@ class QTabMyFig(QWidget):
functions.update({'addAxes': str(self.editAddAxes.toPlainText())})
return(functions)
def getClassName(self):
name = str(self.editName.text())
return(name)
DEFAULT_DECLARE_ALIASES = '''
self.aliases = {}
'''
DEFAULT_ADDAXES = '''
ratio = 6./8.
frame = [0.2, 0.15, 0.6, 0.7]
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