Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Yori Fournier
mydesigngui
Commits
f96b3b0b
Commit
f96b3b0b
authored
Mar 28, 2017
by
Yori Fournier
Browse files
Merge branch '19-compatible-with-py3' into 'master'
Now import is compatble with python3 Closes
#19
See merge request
!9
parents
452a0d34
ad4abe56
Changes
4
Hide whitespace changes
Inline
Side-by-side
__init__.py
View file @
f96b3b0b
...
...
@@ -52,5 +52,6 @@ from .qMyDesignGui import QMyDesignGui
# Import IOs
import
myIOs
#import myIOs
from
.myIOs
import
*
myIOs/__init__.py
View file @
f96b3b0b
...
...
@@ -10,9 +10,13 @@ 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
)
# 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], -1)
module
=
__import__
(
'mydesigngui.myIOs'
,
globals
(),
locals
(),
[
function
],
0
)
subMod
=
vars
(
module
)[
function
]
vars
()[
function
]
=
vars
(
subMod
)[
function
]
myIOs/readSerie.py
View file @
f96b3b0b
from
..
import
MyData
# CLASSES
from
.readOrgFile
import
readOrgFile
# FUNCTIONS
from
.readOrgFile
_
import
readOrgFile
# FUNCTIONS
_D_DTNAME
=
None
_D_FILENAME
=
'serieParam.org'
...
...
qOpenFileWidget.py
View file @
f96b3b0b
...
...
@@ -8,8 +8,10 @@ from . import QFormLayout
from
.
import
QPushButton
from
.
import
QSignal
from
types
import
FunctionType
from
.
import
sys
AVAIL_FUNCTIONS
=
[]
PYVERSION
=
sys
.
version_info
for
key
in
myIOs
.
__dict__
.
keys
():
if
key
not
in
myIOs
.
__builtins__
.
keys
()
and
not
key
.
startswith
(
'__'
):
...
...
@@ -31,10 +33,15 @@ class QFunctionFormular(QWidget):
self
.
wOptionalArgs
=
[]
self
.
unexplicitArgs
=
False
self
.
unexplicitKwArgs
=
False
argCount
=
function
.
func_code
.
co_argcount
# number of explicit arguments
argsName
=
function
.
func_code
.
co_varnames
# list of the names of the local variables
defaultValues
=
function
.
func_defaults
# default value of the optional arguments
if
(
PYVERSION
<
(
3
,
0
)):
argCount
=
function
.
func_code
.
co_argcount
# number of explicit arguments
argsName
=
function
.
func_code
.
co_varnames
# list of the names of the local variables
defaultValues
=
function
.
func_defaults
# default value of the optional arguments
else
:
argCount
=
function
.
__code__
.
co_argcount
# number of explicit arguments
argsName
=
function
.
__code__
.
co_varnames
# list of the names of the local variables
defaultValues
=
function
.
__defaults__
# default value of the optional arguments
# extract the known arguments
self
.
explicitArgs
=
argsName
[:
argCount
]
...
...
@@ -125,7 +132,7 @@ class QOpenFileWidget(QWidget):
for
function
in
AVAIL_FUNCTIONS
:
self
.
functionsCombo
.
addItem
(
function
.
__name__
)
index
=
AVAIL_FUNCTIONS
.
index
(
function
)
print
(
'> FUNCTION:'
+
str
(
type
(
AVAIL_FUNCTIONS
[
index
])))
print
(
'> FUNCTION:'
+
str
(
AVAIL_FUNCTIONS
[
index
].
__name__
)
+
" "
+
str
(
type
(
AVAIL_FUNCTIONS
[
index
])))
self
.
functionWidgets
.
append
(
QFunctionFormular
(
AVAIL_FUNCTIONS
[
index
],
self
))
self
.
layout
.
addWidget
(
self
.
functionWidgets
[
-
1
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment