Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Etienne Nadji
PyScribus
Commits
4bdb67b6
Commit
4bdb67b6
authored
Sep 03, 2021
by
Etienne Nadji
Browse files
extra.wireframe : Black reformat
modifié : wireframe.py
parent
7afdbcbb
Changes
1
Hide whitespace changes
Inline
Side-by-side
source/pyscribus/extra/wireframe.py
View file @
4bdb67b6
...
...
@@ -57,11 +57,7 @@ class WireframeObject:
# Pages have layer -1, as 0 is the lower layer available
self
.
layer
=
-
1
self
.
draw_settings
=
{
"fill"
:
""
,
"outline"
:
""
,
"bleed"
:
"red"
}
self
.
draw_settings
=
{
"fill"
:
""
,
"outline"
:
""
,
"bleed"
:
"red"
}
if
sla_object
:
self
.
from_object
(
sla_object
)
...
...
@@ -76,8 +72,9 @@ class WireframeObject:
type_ok
=
False
for
class_test
in
[
pageobjects
.
LatexObject
,
pageobjects
.
RenderObject
]:
pageobjects
.
LatexObject
,
pageobjects
.
RenderObject
,
]:
if
isinstance
(
sla_object
,
class_test
):
self
.
type
=
"render"
...
...
@@ -114,19 +111,18 @@ class WireframeObject:
tx
=
self
.
box
.
coords
[
"top-left"
][
0
].
value
-
self
.
bleed
[
"left"
]
ty
=
self
.
box
.
coords
[
"top-left"
][
1
].
value
-
self
.
bleed
[
"top"
]
bx
=
self
.
box
.
coords
[
"bottom-right"
][
0
].
value
+
self
.
bleed
[
"right"
]
by
=
self
.
box
.
coords
[
"bottom-right"
][
1
].
value
+
self
.
bleed
[
"bottom"
]
by
=
(
self
.
box
.
coords
[
"bottom-right"
][
1
].
value
+
self
.
bleed
[
"bottom"
]
)
bleed_rect
=
((
tx
,
ty
),
(
bx
,
by
))
canvas
.
rectangle
(
bleed_rect
,
outline
=
"red"
)
rect
=
(
(
self
.
box
.
coords
[
"top-left"
][
0
],
self
.
box
.
coords
[
"top-left"
][
1
]
),
(
self
.
box
.
coords
[
"top-left"
][
0
],
self
.
box
.
coords
[
"top-left"
][
1
]),
(
self
.
box
.
coords
[
"bottom-right"
][
0
],
self
.
box
.
coords
[
"bottom-right"
][
1
]
self
.
box
.
coords
[
"bottom-right"
][
1
]
,
),
)
...
...
@@ -135,7 +131,7 @@ class WireframeObject:
canvas
.
rectangle
(
rect
,
fill
=
self
.
draw_settings
[
"fill"
],
outline
=
self
.
draw_settings
[
"outline"
]
outline
=
self
.
draw_settings
[
"outline"
]
,
)
else
:
...
...
@@ -181,8 +177,10 @@ class Wireframe:
self
.
page_objects
=
[]
self
.
bleed
=
{
"top"
:
dimensions
.
Dim
(
0
),
"right"
:
dimensions
.
Dim
(
0
),
"left"
:
dimensions
.
Dim
(
0
),
"bottom"
:
dimensions
.
Dim
(
0
)
"top"
:
dimensions
.
Dim
(
0
),
"right"
:
dimensions
.
Dim
(
0
),
"left"
:
dimensions
.
Dim
(
0
),
"bottom"
:
dimensions
.
Dim
(
0
),
}
def
from_sla
(
self
,
sla
):
...
...
@@ -204,7 +202,6 @@ class Wireframe:
self
.
page_objects
.
append
(
wo
)
def
append
(
self
,
sla_object
):
def
add
(
obj
,
sla_obj
):
if
sla_obj
.
is_page
:
obj
.
pages
.
append
(
sla_obj
)
...
...
@@ -318,16 +315,10 @@ class Wireframe:
default_outline
=
opt_value
if
opt_name
==
"landmark"
:
if
opt_value
:
draw_landmark
=
True
else
:
draw_landmark
=
False
draw_landmark
=
bool
(
opt_value
)
if
opt_name
==
"bleed"
:
if
opt_value
:
draw_bleed
=
True
else
:
draw_bleed
=
False
draw_bleed
=
bool
(
opt_value
)
if
opt_name
==
"stylesheet"
:
...
...
@@ -369,7 +360,9 @@ class Wireframe:
if
key
:
obj
.
draw_settings
[
"fill"
]
=
stylesheet
[
key
][
"fill"
]
obj
.
draw_settings
[
"outline"
]
=
stylesheet
[
key
][
"outline"
]
obj
.
draw_settings
[
"outline"
]
=
stylesheet
[
key
][
"outline"
]
else
:
# --- Using default_outline if no defined outline -------
...
...
@@ -381,7 +374,10 @@ class Wireframe:
for
obj
in
object_set
:
drawed
=
False
if
obj
.
draw_settings
[
"fill"
]
or
obj
.
draw_settings
[
"outline"
]:
if
(
obj
.
draw_settings
[
"fill"
]
or
obj
.
draw_settings
[
"outline"
]
):
drawed
=
True
if
not
drawed
:
...
...
@@ -425,7 +421,8 @@ class Wireframe:
image
.
save
(
out_file
)
return
True
else
:
return
image
return
image
# vim:set shiftwidth=4 softtabstop=4 spl=en:
Write
Preview
Supports
Markdown
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