Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
2f3b88c8
Commit
2f3b88c8
authored
Jan 05, 2014
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Попытка добиться работы from uniset import *
parent
5d449bc8
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
31 additions
and
32 deletions
+31
-32
UGlobal.py
python/lib/UGlobal.py
+5
-2
__init__.py
python/lib/__init__.py
+10
-7
Makefile.am
python/lib/pyUniSet/Makefile.am
+2
-2
PyUInterface.cc
python/lib/pyUniSet/PyUInterface.cc
+1
-1
PyUInterface.h
python/lib/pyUniSet/PyUInterface.h
+0
-0
UConnector.cc
python/lib/pyUniSet/UConnector.cc
+0
-8
UConnector.h
python/lib/pyUniSet/UConnector.h
+0
-0
UExceptions.h
python/lib/pyUniSet/UExceptions.h
+1
-1
UInterface.i
python/lib/pyUniSet/UInterface.i
+2
-2
UInterface_wrap.cxx
python/lib/pyUniSet/UInterface_wrap.cxx
+1
-1
testUC.py
python/tests/UConnector/testUC.py
+9
-8
No files found.
python/lib/UGlobal.py
View file @
2f3b88c8
...
...
@@ -6,7 +6,7 @@ import time
import
sys
def
is_id
(
str_id
):
if
str_id
.
__class__
.
__name__
==
"int"
or
str_id
.
__class__
.
__name__
==
"long"
:
if
isinstance
(
str_id
,
int
)
or
isinstance
(
str_id
,
long
)
:
return
True
if
str_id
.
strip
()
.
isdigit
():
...
...
@@ -19,9 +19,12 @@ def to_int(s):
if
s
==
None
or
s
==
""
:
return
0
if
s
.
__class__
.
__name__
==
"int"
or
s
.
__class__
.
__name__
==
"long"
:
if
isinstance
(
s
,
int
)
or
isinstance
(
s
,
long
)
:
return
s
if
isinstance
(
s
,
float
):
return
int
(
s
)
if
len
(
s
)
>
2
and
s
[
0
]
==
'0'
and
s
[
1
]
==
'x'
:
return
int
(
s
,
16
)
...
...
python/lib/__init__.py
View file @
2f3b88c8
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from
UInterface
import
*
from
UGlobal
import
*
from
UniXML
import
*
__all__
=
[
"UInterface"
,
"UGlobal"
,
"UniXML"
,
"pyUInterface"
,
"pyUniSet"
,
"pyUModbus"
,
"pyUConnector"
,
"pyUExceptions"
]
from
pyUExceptions
import
*
from
pyUniSet
import
*
from
pyUModbus
import
*
from
pyUConnector
import
*
#from UInterface import *
#from UGlobal import *
#from UniXML import *
#from pyUInterface import *
#from pyUniSet import *
#from pyUModbus import *
#from pyUConnector import *
#from pyUExceptions import *
python/lib/pyUniSet/Makefile.am
View file @
2f3b88c8
...
...
@@ -4,12 +4,12 @@ python_SCRIPTS = pyUniSet.py pyUConnector.py pyUModbus.py pyUExceptions.py
pyexec_LTLIBRARIES
=
_pyUConnector.la _pyUModbus.la _pyUExceptions.la _pyUniSet.la
_pyUniSet_la_SOURCES
=
p
yUInterface.cc UInterface_wrap.cxx
_pyUniSet_la_SOURCES
=
P
yUInterface.cc UInterface_wrap.cxx
_pyUniSet_la_CXXFLAGS
=
$(UNISET_CFLAGS)
$(PYTHON_CFLAGS)
_pyUniSet_la_LDFLAGS
=
-module
-avoid-version
_pyUniSet_la_LIBADD
=
$(UNISET_LIBS)
$(PYTHON_LIBS)
UInterface_wrap.cxx
:
UInterface.i
p
yUInterface.h
UInterface_wrap.cxx
:
UInterface.i
P
yUInterface.h
swig
-python
-c
++
-classic
UInterface.i
_pyUConnector_la_SOURCES
=
UConnector.cc UConnector_wrap.cxx
...
...
python/lib/pyUniSet/
p
yUInterface.cc
→
python/lib/pyUniSet/
P
yUInterface.cc
View file @
2f3b88c8
...
...
@@ -4,7 +4,7 @@
#include "UInterface.h"
#include "Configuration.h"
#include "UniSetTypes.h"
#include "
p
yUInterface.h"
#include "
P
yUInterface.h"
//---------------------------------------------------------------------------
using
namespace
std
;
//---------------------------------------------------------------------------
...
...
python/lib/pyUniSet/
p
yUInterface.h
→
python/lib/pyUniSet/
P
yUInterface.h
View file @
2f3b88c8
File moved
python/lib/pyUniSet/UConnector.cc
View file @
2f3b88c8
...
...
@@ -71,10 +71,6 @@ long UConnector::getValue( long id, long node )throw(UException)
{
return
ui
->
getValue
(
id
,
node
);
}
catch
(
UException
&
ex
)
{
throw
;
}
catch
(
UniSetTypes
::
Exception
&
ex
)
{
throw
UException
(
ex
.
what
());
...
...
@@ -100,10 +96,6 @@ void UConnector::setValue( long id, long val, long node )throw(UException)
{
ui
->
setValue
(
id
,
val
,
node
);
}
catch
(
UException
&
ex
)
{
throw
;
}
catch
(
UniSetTypes
::
Exception
&
ex
)
{
throw
UException
(
ex
.
what
());
...
...
python/lib/pyUniSet/UConnector.h
View file @
2f3b88c8
python/lib/pyUniSet/UExceptions.h
View file @
2f3b88c8
...
...
@@ -24,7 +24,7 @@ struct UTimeOut:
struct
USysError
:
public
UException
{
USysError
()
:
UException
(
"U
TimeOut
"
){}
USysError
()
:
UException
(
"U
SysError
"
){}
USysError
(
const
std
::
string
&
e
)
:
UException
(
e
){}
~
USysError
(){}
};
...
...
python/lib/pyUniSet/UInterface.i
View file @
2f3b88c8
...
...
@@ -6,10 +6,10 @@
%module pyUniSet
%{
#include "
p
yUInterface.h"
#include "
P
yUInterface.h"
%}
/* Для генерации классов и констант в Питоне */
%include "
p
yUInterface.h"
%include "
P
yUInterface.h"
%include "UTypes.h"
%include "UExceptions.h"
python/lib/pyUniSet/UInterface_wrap.cxx
View file @
2f3b88c8
...
...
@@ -3055,7 +3055,7 @@ namespace swig {
}
#include "
p
yUInterface.h"
#include "
P
yUInterface.h"
SWIGINTERN
swig_type_info
*
...
...
python/tests/UConnector/testUC.py
View file @
2f3b88c8
...
...
@@ -3,13 +3,9 @@
import
sys
sys
.
path
.
append
(
'./.libs/'
)
sys
.
path
.
append
(
'../../lib/pyUniSet/.libs/'
)
sys
.
path
.
append
(
'../../lib/pyUniSet/'
)
#sys.path.append('../lib/')
#from pyUniSet import *
from
pyUConnector
import
*
from
pyUExceptions
import
*
from
uniset
import
*
if
__name__
==
"__main__"
:
...
...
@@ -45,9 +41,14 @@ if __name__ == "__main__":
print
"(1)setValue exception: "
+
str
(
e
.
getError
())
try
:
print
"(
1
)getValue:
%
d=
%
d"
%
(
3
,
uc1
.
getValue
(
3
,
DefaultID
)
)
print
"(
2
)getValue:
%
d=
%
d"
%
(
3
,
uc1
.
getValue
(
3
,
DefaultID
)
)
except
UException
,
e
:
print
"(1)getValue exception: "
+
str
(
e
.
getError
())
print
"(2)getValue exception: "
+
str
(
e
.
getError
())
try
:
print
"(3)getValue:
%
d=
%
d"
%
(
100
,
uc1
.
getValue
(
100
,
DefaultID
)
)
except
UException
,
e
:
print
"(3)getValue exception: "
+
str
(
e
.
getError
())
except
UException
,
e
:
print
"(testUI): catch exception: "
+
str
(
e
.
getError
())
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