Skip to content

Commit 060045c

Browse files
committed
Fix python scripts
1 parent 9460b1c commit 060045c

File tree

4 files changed

+76
-50
lines changed

4 files changed

+76
-50
lines changed

Diff for: .tx/config

+10-15
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,32 @@ file_filter = src/isimpa/lang/<lang>/internat.po
99
minimum_perc = 90
1010

1111
[i-simpa.jobtool-toolbox]
12-
source_file = currentRelease/UserScript/job_tool/internat.pot
12+
source_file = currentRelease/SystemScript/job_tool/internat.pot
1313
source_lang = en
1414
type = PO
15-
file_filter = currentRelease/UserScript/job_tool/locale/<lang>/internat.po
15+
file_filter = currentRelease/SystemScript/job_tool/locale/<lang>/internat.po
1616

1717
[i-simpa.receivertools-toolbox]
18-
source_file = currentRelease/UserScript/recp_tool/internat.pot
18+
source_file = currentRelease/SystemScript/recp_tool/internat.pot
1919
source_lang = en
2020
type = PO
21-
file_filter = currentRelease/UserScript/recp_tool/locale/<lang>/internat.po
21+
file_filter = currentRelease/SystemScript/recp_tool/locale/<lang>/internat.po
2222

2323
[i-simpa.sourcetools-toolbox]
24-
source_file = currentRelease/UserScript/source_tools/internat.pot
24+
source_file = currentRelease/SystemScript/source_tools/internat.pot
2525
source_lang = en
2626
type = PO
27-
file_filter = currentRelease/UserScript/source_tools/locale/<lang>/internat.po
27+
file_filter = currentRelease/SystemScript/source_tools/locale/<lang>/internat.po
2828

2929
[i-simpa.vertextools-toolbox]
30-
source_file = currentRelease/UserScript/moveto_vertex/internat.pot
30+
source_file = currentRelease/SystemScript/moveto_vertex/internat.pot
3131
source_lang = en
3232
type = PO
33-
file_filter = currentRelease/UserScript/moveto_vertex/locale/<lang>/internat.po
33+
file_filter = currentRelease/SystemScript/moveto_vertex/locale/<lang>/internat.po
3434

3535
[i-simpa.preceiv_sourceTracker]
36-
source_file = currentRelease/UserScript/preceiv_sourceTracker/internat.pot
36+
source_file = currentRelease/SystemScript/preceiv_sourceTracker/internat.pot
3737
source_lang = en
3838
type = PO
39-
file_filter = currentRelease/UserScript/preceiv_sourceTracker/locale/<lang>/internat.po
39+
file_filter = currentRelease/SystemScript/preceiv_sourceTracker/locale/<lang>/internat.po
4040

41-
[i-simpa.SppsReportSample]
42-
source_file = currentRelease/UserScript/SppsReportSample/internat.pot
43-
source_lang = en
44-
type = PO
45-
file_filter = currentRelease/UserScript/SppsReportSample/locale/<lang>/internat.po

Diff for: currentRelease/SystemScript/recp_tool/__init__.py

+30-13
Original file line numberDiff line numberDiff line change
@@ -56,38 +56,54 @@ def getmenu(self,typeel,idel,menu):
5656
menu.insert(2,(_(u"Create a receiver grid"),self.makelinerecpid,"Bitmaps/popup_new.png"))
5757
return True
5858
def makeline(self,idel):
59-
lbl_startpt=_(u"Starting position [x,y,z] (m)")
59+
lbl_startptx=_(u"Starting position x (m)")
60+
lbl_startpty=_(u"Starting position y (m)")
61+
lbl_startptz=_(u"Starting position z (m)")
6062
lbl_nbrecp=_(u"Number of rows")
6163
lbl_nbrecpcol=_(u"Number of cols")
62-
lbl_step=_(u"Row step [x,y,z] (m)")
63-
lbl_stepcol=_(u"Col step [x,y,z] (m)")
64-
inputs={ lbl_startpt : "[0.,0.,0.]",
64+
lbl_stepx=_(u"Row step x (m)")
65+
lbl_stepy=_(u"Row step y (m)")
66+
lbl_stepz=_(u"Row step z (m)")
67+
lbl_stepcolx=_(u"Col step x (m)")
68+
lbl_stepcoly=_(u"Col step y (m)")
69+
lbl_stepcolz=_(u"Col step z (m)")
70+
inputs={ lbl_startptx : "0",
71+
lbl_startpty : "0",
72+
lbl_startptz : "0",
6573
lbl_nbrecp : "1",
6674
lbl_nbrecpcol : "1",
67-
lbl_step : "[1.,0.,0.]",
68-
lbl_stepcol : "[0.,1.,0.]"
75+
lbl_stepx : "1",
76+
lbl_stepy : "0",
77+
lbl_stepz : "0",
78+
lbl_stepcolx : "0",
79+
lbl_stepcoly : "1",
80+
lbl_stepcolz : "0"
6981
}
7082
res=ui.application.getuserinput(_(u"Create a receiver grid"),
7183
_(u"Please fill the following fields to create the receivers points grid"),
7284
inputs)
7385
if res[0]:
74-
startpoint=eval(res[1][lbl_startpt])
86+
startpoint=[float(res[1][lbl_startptx]),float(res[1][lbl_startpty]),float(res[1][lbl_startptz])]
7587
nbrecp=int(res[1][lbl_nbrecp])
7688
nbrecpcol=int(res[1][lbl_nbrecpcol])
77-
step=eval(res[1][lbl_step])
78-
stepcol=eval(res[1][lbl_stepcol])
89+
step=[float(res[1][lbl_stepx]),float(res[1][lbl_stepy]),float(res[1][lbl_stepz])]
90+
stepcol=[float(res[1][lbl_stepcolx]),float(res[1][lbl_stepcoly]),float(res[1][lbl_stepcolz])]
7991
MakeGridRecp(idel,startpoint,nbrecp,nbrecpcol,step,stepcol)
8092
def align_on_same_point(self,idel):
8193

82-
lbl_topt=_(u"Orient to position [x,y,z]")
94+
lbl_toptx=_(u"Orient to position x (m)")
95+
lbl_topty=_(u"Orient to position y (m)")
96+
lbl_toptz=_(u"Orient to position z (m)")
8397
res=ui.application.getuserinput(_(u"Orient a group of receivers to a point"),
8498
_(u"Please enter the coordinates of the orientation point"),
85-
{ lbl_topt : "[0.,0.,0.]"
99+
{ lbl_toptx : "0",
100+
lbl_topty : "0",
101+
lbl_toptz : "0",
86102
})
87103
if res[0]:
88104
grprecp=ui.element(idel)
89105
recplst=grprecp.getallelementbytype(ui.element_type.ELEMENT_TYPE_SCENE_RECEPTEURSP_RECEPTEUR)
90-
topt=eval(res[1][lbl_topt])
106+
topt=[float(res[1][lbl_topt]), float(res[1][lbl_topty]), float(res[1][lbl_toptz])]
91107
for recpid in recplst:
92108
recp=ui.element(recpid)
93109
recp.updatepositionconfig("direction_dot",topt)
@@ -158,7 +174,8 @@ def translate(self,idgrp):
158174
for rp in rplst:
159175
rpEl=ui.element(rp)
160176
#On recupere la position du rp
161-
newpos=vec3(rpEl.getpositionconfig("pos_recepteur"))+vectranslation
177+
posrecp = rpEl.getpositionconfig("pos_recepteur")
178+
newpos=vec3(posrecp[0], posrecp[1], posrecp[2])+vectranslation
162179
rpEl.updatepositionconfig("pos_recepteur",[newpos.x,newpos.y,newpos.z])
163180
ui.application.register_menu_manager(ui.element_type.ELEMENT_TYPE_SCENE_RECEPTEURSP, manager())
164181

Diff for: currentRelease/SystemScript/source_tools/__init__.py

+27-15
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ def makeline(self,idel):
7373
})
7474
if res[0]:
7575
try:
76-
startpoint=vec3(float(res[1][lbl_startptx]),float(res[1][lbl_startpty]),float(res[1][lbl_startptz]))
76+
startpoint=[float(res[1][lbl_startptx]),float(res[1][lbl_startpty]),float(res[1][lbl_startptz])]
7777
nbsources=int(res[1][lbl_nbsources])
78-
step=vec3(float(res[1][lbl_stepx]),float(res[1][lbl_stepy]),float(res[1][lbl_stepz]))
78+
step=[float(res[1][lbl_stepx]),float(res[1][lbl_stepy]),float(res[1][lbl_stepz])]
7979
except:
8080
print(_(u"Wrong parameters"),file=sys.stderr)
8181
return
@@ -92,9 +92,11 @@ def enable_grp_sources(self,idgrp):
9292
def disable_grp_sources(self,idgrp):
9393
self.set_grp_src_activation(idgrp,False)
9494
def rotate_src(self,idgrp):
95-
lbl_vec=_(u"Vector of rotation")
95+
lbl_vecx=_(u"Vector of rotation x")
96+
lbl_vecy=_(u"Vector of rotation y")
97+
lbl_vecz=_(u"Vector of rotation z")
9698
lbl_angle=_(u"Angle (degrees)")
97-
lbl_rotation_pos=_(u"Rotation centre")
99+
lbl_rotation_pos=_(u"Rotation centre x (m)")
98100
##Evaluation du centre de rotation
99101
#on recupere le groupe des sources
100102
srcgroup=ui.element(idgrp)
@@ -110,15 +112,19 @@ def rotate_src(self,idgrp):
110112

111113
res=ui.application.getuserinput(_(u"Rotation of a group of sound sources"),
112114
"",
113-
{ lbl_vec : "[0.,0.,1.]",
115+
{ lbl_vecx : "0",
116+
lbl_vecy : "0",
117+
lbl_vecz : "1",
114118
lbl_angle : "90",
115-
lbl_rotation_pos : str(centregroup)
119+
lbl_rotation_posx : str(centregroup[0]),
120+
lbl_rotation_posy : str(centregroup[1]),
121+
lbl_rotation_posz : str(centregroup[2])
116122
})
117123
if res[0]:
118124
try:
119-
vecrotation=vec3(eval(res[1][lbl_vec]))
125+
vecrotation=vec3(float(res[1][lbl_vecx]), float(res[1][lbl_vecy]), float(res[1][lbl_vecz]))
120126
anglerotation=float(res[1][lbl_angle])
121-
centregroup=vec3(eval(res[1][lbl_rotation_pos]))
127+
centregroup=vec3(float(res[1][lbl_rotation_posx]), float(res[1][lbl_rotation_posy]), float(res[1][lbl_rotation_posz]))
122128
except:
123129
print(_(u"Wrong parameters"),file=sys.stderr)
124130
return
@@ -128,18 +134,23 @@ def rotate_src(self,idgrp):
128134
srclst=srcgroup.getallelementbytype(ui.element_type.ELEMENT_TYPE_SCENE_SOURCES_SOURCE)
129135
for src in srclst:
130136
sourceEl=ui.element(src)
131-
rotatedpos=vec3(sourceEl.getpositionconfig("pos_source"))-centregroup
137+
pos_source = sourceEl.getpositionconfig("pos_source")
138+
rotatedpos=vec3(pos_source[0], pos_source[1], pos_source[2])-centregroup
132139
rotatedpos=rotatedpos.rotate(vecrotation,math.radians(anglerotation))+centregroup
133-
sourceEl.updatepositionconfig("pos_source",[rotatedpos.x,rotatedpos.y,rotatedpos.z])
140+
sourceEl.updatepositionconfig("pos_source",[rotatedpos[0],rotatedpos[1], rotatedpos[2])
134141
def translate_src(self,idgrp):
135-
lbl_vec=_(u"Direction (m)")
142+
lbl_vecx=_(u"Direction x (m)")
143+
lbl_vecy=_(u"Direction y (m)")
144+
lbl_vecz=_(u"Direction z (m)")
136145
res=ui.application.getuserinput(_(u"Translation of a group of sound sources"),
137146
"",
138-
{ lbl_vec : "[1.,0.,0.]"
147+
{ lbl_vecx : "1",
148+
lbl_vecy : "0",
149+
lbl_vecz : "0",
139150
})
140151
if res[0]:
141152
try:
142-
vectranslation=vec3(eval(res[1][lbl_vec]))
153+
vectranslation=vec3(float(res[1][lbl_vec]), float(res[1][lbl_vecy]), float(res[1][lbl_vecz]))
143154
except:
144155
print(_(u"Wrong parameters"),file=sys.stderr)
145156
return
@@ -150,7 +161,8 @@ def translate_src(self,idgrp):
150161
for src in srclst:
151162
sourceEl=ui.element(src)
152163
#On recupere la position de la source
153-
newpos=vec3(sourceEl.getpositionconfig("pos_source"))+vectranslation
154-
sourceEl.updatepositionconfig("pos_source",[newpos.x,newpos.y,newpos.z])
164+
pos_source = sourceEl.getpositionconfig("pos_source")
165+
newpos=vec3(pos_source[0], pos_source[1], pos_source[2])+vectranslation
166+
sourceEl.updatepositionconfig("pos_source",[newpos[0],newpos[1],newpos[2]])
155167

156168
ui.application.register_menu_manager(ui.element_type.ELEMENT_TYPE_SCENE_SOURCES, manager())

Diff for: src/isimpa/CMakeLists.txt

+9-7
Original file line numberDiff line numberDiff line change
@@ -427,12 +427,12 @@ IF(GETTEXT_FOUND )
427427
add_subdirectory (lang/fr)
428428
add_subdirectory (lang/pl)
429429
# Plugins locale
430-
ADDMULTIPLE_LANG(${PROJECT_SOURCE_DIR}/currentRelease/UserScript/job_tool/locale ${CMAKE_BINARY_DIR}/src/job_tool)
431-
ADDMULTIPLE_LANG(${PROJECT_SOURCE_DIR}/currentRelease/UserScript/recp_tool/locale ${CMAKE_BINARY_DIR}/src/recp_tool)
432-
ADDMULTIPLE_LANG(${PROJECT_SOURCE_DIR}/currentRelease/UserScript/source_tools/locale ${CMAKE_BINARY_DIR}/src/source_tools)
433-
ADDMULTIPLE_LANG(${PROJECT_SOURCE_DIR}/currentRelease/UserScript/moveto_vertex/locale ${CMAKE_BINARY_DIR}/src/moveto_vertex)
434-
ADDMULTIPLE_LANG(${PROJECT_SOURCE_DIR}/currentRelease/UserScript/preceiv_sourceTracker/locale ${CMAKE_BINARY_DIR}/src/preceiv_sourceTracker)
435-
ADDMULTIPLE_LANG(${PROJECT_SOURCE_DIR}/currentRelease/UserScript/SppsReportSample/locale ${CMAKE_BINARY_DIR}/src/SppsReportSample)
430+
ADDMULTIPLE_LANG(${PROJECT_SOURCE_DIR}/currentRelease/SystemScript/job_tool/locale ${CMAKE_BINARY_DIR}/src/job_tool)
431+
ADDMULTIPLE_LANG(${PROJECT_SOURCE_DIR}/currentRelease/SystemScript/recp_tool/locale ${CMAKE_BINARY_DIR}/src/recp_tool)
432+
ADDMULTIPLE_LANG(${PROJECT_SOURCE_DIR}/currentRelease/SystemScript/source_tools/locale ${CMAKE_BINARY_DIR}/src/source_tools)
433+
ADDMULTIPLE_LANG(${PROJECT_SOURCE_DIR}/currentRelease/SystemScript/moveto_vertex/locale ${CMAKE_BINARY_DIR}/src/moveto_vertex)
434+
ADDMULTIPLE_LANG(${PROJECT_SOURCE_DIR}/currentRelease/SystemScript/preceiv_sourceTracker/locale ${CMAKE_BINARY_DIR}/src/preceiv_sourceTracker)
435+
#disabled ADDMULTIPLE_LANG(${PROJECT_SOURCE_DIR}/currentRelease/SystemScript/SppsReportSample/locale ${CMAKE_BINARY_DIR}/src/SppsReportSample)
436436
# Building isimpa require building pofiles
437437
add_dependencies(isimpa pofiles)
438438
ENDIF()
@@ -583,7 +583,9 @@ if(WIN32) # Check if we are on Windows
583583
endif()
584584

585585
# Package creation instructions, NSIS under windows
586-
SET(CPACK_GENERATOR "NSIS;ZIP")
586+
if(WIN32 AND NOT DEFINED CPACK_GENERATOR) # Check if we are on Windows
587+
SET(CPACK_GENERATOR "NSIS;7z")
588+
endif()
587589
SET(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
588590

589591
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "I-SIMPA")

0 commit comments

Comments
 (0)