Commit 8de6d09b authored by Yori 'AGy' Fournier's avatar Yori 'AGy' Fournier
Browse files

cleaned __init__/__main__/myIOs.__init__

parent d125073a
......@@ -54,6 +54,7 @@ from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as QCanvas
from myplotlib import INFO, SPCE, WARN, DBUG, SEVR
from myplotlib import MyAxes, MyFig, MyData, np
from myplotlib.test import FigTest1, readStupidData, readStupidData2
from myplotlib import D_DEBUG
# CONSTANTS
DEFAULT_DECLARE_ALIASES = '''
......
# IMPORTS
from . import sys
from . import INFO, SPCE, DBUG
from . import D_DEBUG
# CONFIG
D_NO_VERBOSE = False
#debug = D_DEBUG
debug = True
noverbose = D_NO_VERBOSE
if debug:
prompt = __name__ + ": "
INFO = INFO + prompt
SPCE = SPCE + prompt
DBUG = DBUG + prompt
# WIDGET IMPORTS
from . import QApplication
from . import QMyDesignGui
from . import myIOs
for key in myIOs.__dict__.keys():
if key not in myIOs.__builtins__.keys() and not key.startswith('__'):
print(key)
if not noverbose:
print(INFO + "Welcome by My Design Gui - v0\n")
if debug:
print(DBUG + "You are using python {}.{}.{}".format(sys.version_info[0], sys.version_info[1], sys.version_info[2]))
print(SPCE + "The inline arguments are: " + str(sys.argv) + '\n')
# Create application
app = QApplication(sys.argv)
# Create main window
w = QMyDesignGui()
# Start App
status = app.exec_()
sys.exit(status)
......@@ -4,19 +4,35 @@
# IMPORT OS -- SHOULD BE DONE THAT WAY TO DETECT THE FUNCTION PROPERLY
import os
from .. import DBUG, SPCE, WARN, D_DEBUG
#debug = D_DEBUG
debug = True
if debug:
prompt = "myIOs.__init__: "
DBUG = DBUG + prompt
SPCE = SPCE + prompt
WARN = WARN + prompt
# LIST OF FILE NAMES IN myIOS/*.py (except *_*.py)
functions = []
for function in os.listdir(os.path.dirname(os.path.abspath(__file__))):
if function[-3:] == '.py' and '_' not in os.path.basename(function):
functions.append(function[:-3])
print(functions)
# PRINT INFOS
if debug:
print(DBUG + "Importing the following function from myIOs:")
for func in functions:
print(SPCE + str(func))
# LOOP OVER FILES AND IMPORT THE FUNCTION
# THIS IS EQUIVALENT TO: FROM .FILE IMPORT FILE
for function in functions:
#module = __import__('mydesigngui.myIOs', globals(), locals(), [function], -1)
module = __import__('mydesigngui.myIOs', globals(), locals(), [function], 0)
subMod = vars(module)[function]
vars()[function] = vars(subMod)[function]
try:
module = __import__('mydesigngui.myIOs', globals(), locals(), [function], 0)
subMod = vars(module)[function]
vars()[function] = vars(subMod)[function]
except:
print(WARN + "The function " + function.__name__ + " could not be loaded...")
......@@ -15,7 +15,6 @@ PYVERSION = sys.version_info
for key in myIOs.__dict__.keys():
if key not in myIOs.__builtins__.keys() and not key.startswith('__'):
print(myIOs.__dict__[key])
if isinstance(myIOs.__dict__[key], FunctionType):
AVAIL_FUNCTIONS.append(myIOs.__dict__[key])
......
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