#!/usr/bin/python # -*- coding: utf-8 -*- # # ================= FILE HEADER ======================================== # # myplotlib v3.0.1, # # @file __init__.py # @author Yori 'AGy' Fournier # @licence CC-BY-SA # # Import and Configuration file for myplotlib # # @section Import # # myplotlib is base on matplotlib therefore it requires # Figure and Axes as main classes and a few further functions. # # @section Config # # Default value for user parameters # and configuration for the default plotting # # @section Module Import # # Import of myplotlib classes and function # # @section History # # v 0.0.0 - __init__.py file for the myplotlib module # # ====================================================================== # # # IMPORT --------------------------------------------------------------- from .config import INFO, WARN, SEVR, DBUG, SPCE from .config import D_HIERARCHY, CONTEXT import os as os import numpy as np from signal import Signal, Query, Status, Answer from mpl_unpickler import MplUnpickler np.set_printoptions(threshold='nan') # matplotlib import for client/local ----------------------------------- if D_HIERARCHY in ('CLIENT', 'client', 'LOCAL', 'local'): if D_HIERARCHY in ('CLIENT', 'client'): print(INFO + 'Import ' + __package__ + ' as a client.') else: print(INFO + 'Import ' + __package__ + ' for local use.') # Test mpl version: from matplotlib import __version__ as mplvers if int(mplvers.replace('.', '')[:3]) < 143: print( '\n\n' + WARN + 72 * '=' + '\n' + SPCE + 'The matplotlib version you are using is not supported.\n' + SPCE + 'Most of myplotlib should work, but some stuff may not.\n' + SPCE + 'ex: expect an error with test203\n' + SPCE + 72 * '=' + '\n\n') # matplotlib from matplotlib.pyplot import figure from matplotlib.pyplot import rc from matplotlib.pyplot import show, draw, ion, ioff, clf from matplotlib.pyplot import close as mpclose from matplotlib.pyplot import fignum_exists, savefig from matplotlib.axes import Axes from matplotlib.figure import Figure from matplotlib import is_interactive from matplotlib import use from .config import D_HOST, D_PORT from socket import socket, AF_INET, SOCK_STREAM elif D_HIERARCHY in ('SERVER', 'server'): if DBUG: print(INFO + 'Import ' + __package__ + ' as a server.') from .config import D_HOST, D_PORT from socket import socket, AF_INET, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR else: print(SEVR + 'the value of D_HIERARCHY has to be SERVER or CLIENT') raise ImportError # myplotlib from .mpl_data import MplData # CONFIGURATION -------------------------------------------------------- from .config import D_FIGNUM, D_FIGSIZE, D_REFORMAT, D_FORMATTED from .config import D_RAWDATA, D_INPUTARG from .config import D_IPATH from .config import D_OPATH, D_OFORMAT from .config import D_DEBUG if D_HIERARCHY in ('CLIENT', 'client', 'LOCAL', 'local'): from .rconfig import rcParams if D_HIERARCHY in ('CLIENT', 'client'): # MplAxes: Overlay on matplotlib.Axes class # from .mpl_axes_client import MplAxesClient as MplAxes from .mpl_axes import MplAxes from .mpl_grid import Grid, VerticalGrid, HorizontalGrid # MplFig: Overlay on matplotlib.Figure class from .mpl_fig_client import MplFigClient as MplFig from .progressbar import ProgressBar from .mpl_client import MplClient elif(D_HIERARCHY in ('SERVER', 'server')): # MplAxes: Overlay on matplotlib.Axes class # from .mpl_axes_server import MplAxesServer as MplAxes from .mpl_axes import MplAxes from .mpl_grid import Grid, VerticalGrid, HorizontalGrid # MplFig: Overlay on matplotlib.Figure class from .mpl_fig_server import MplFigServer as MplFig SERVER_IOFUNCTIONS = { # 'readStupidData': readStupidData, # 'readStupidData2': readStupidData2 } SERVER_FIGURES = { # 'FigTest': FigTest } from .mpl_server import MplServer, MplHandler elif D_HIERARCHY in ('LOCAL', 'local'): # MplAxes: Overlay on matplotlib.Axes class from .mpl_axes import MplAxes # MplFig: Overlay on matplotlib.Figure class from .mpl_grid import Grid, VerticalGrid, HorizontalGrid from .mpl_fig import MplFig from .empty_fig import EmptyFig from .empty_axes import EmptyAxes else: print(SEVR + 'the value of D_HIERARCHY has to be SERVER, CLIENT or LOCAL') raise ImportError if D_HIERARCHY in ('CLIENT', 'client', 'LOCAL', 'local'): _G_WINDOWS = [] # MyWin: Overlay on matplotlib.FigureManager class if rcParams['backend'] == u'TkAgg': from .myWin_TkAgg import MyWin_TkAgg as MyWin elif rcParams['backend'] == u'GTKAgg': from .myWin_GTKAgg import MyWin_GTKAgg as MyWin elif rcParams['backend'] == u'WXAgg': from .myWin_WXAgg import MyWin_WXAgg as MyWin elif rcParams['backend'] == u'Qt4Agg': from .myWin_Qt4Agg import MyWin_Qt4Agg as MyWin elif rcParams['backend'] == u'MacOSX': from .myWin_MacOSx import MyWin_MacOSx as MyWin else: print(SEVR + """The backend you choosed is not supported interactive mode not available""")