Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61028083
tools.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, May 4, 02:06
Size
1 KB
Mime Type
text/x-python
Expires
Mon, May 6, 02:06 (2 d)
Engine
blob
Format
Raw Data
Handle
17454931
Attached To
rNIETZSCHEPYTHON nietzsche-python
tools.py
View Options
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" This code contains some useful tools
"""
# Copyright (C) University of Basel 2019 {{{1
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/> 1}}}
import
sys
sys
.
path
.
append
(
'svgscripts'
)
from
datatypes.matrix
import
Matrix
__author__
=
"Christian Steiner"
__maintainer__
=
__author__
__copyright__
=
'University of Basel'
__email__
=
"christian.steiner@unibas.ch"
__status__
=
"Development"
__license__
=
"GPL v3"
__version__
=
"0.0.1"
UNITTESTING
=
False
def
convert_old_matrix
(
tp
,
xmin
,
ymin
)
->
(
Matrix
,
float
,
float
):
"""Return new matrix, x and y for old transkription_position.
"""
matrix
=
tp
.
transform
.
clone_transformation_matrix
()
matrix
.
matrix
[
Matrix
.
XINDEX
]
=
round
(
tp
.
transform
.
matrix
[
Matrix
.
XINDEX
]
+
xmin
,
3
)
matrix
.
matrix
[
Matrix
.
YINDEX
]
=
round
(
tp
.
transform
.
matrix
[
Matrix
.
YINDEX
]
+
ymin
,
3
)
x
=
round
(
tp
.
left
-
tp
.
transform
.
matrix
[
Matrix
.
XINDEX
],
3
)
\
if
tp
.
left
>
0
\
else
0
y
=
round
((
tp
.
height
-
1.5
)
*-
1
,
3
)
return
matrix
,
x
,
y
Event Timeline
Log In to Comment