@@ -109,7 +163,13 @@ class ProxyLabelWithConditionalPainting(QGraphicsProxyWidget):
classInlineEditableSOIView(QScrollArea):
"""Widget som kan byttes ut med view, edit etc."""
"""Widget that allows for "inline" editing of an SOI. Also prints to PDF.
Paramters
---------
soi : soitool.SOI
SOI to edit.
"""
defis_widget_in_scene(self,widget):
"""Indicate wether given widget already has a proxy in the scene."""
...
...
@@ -156,7 +216,13 @@ class InlineEditableSOIView(QScrollArea):
self.number_of_pages=1
self.proxies=set()
# NOTE: These variables are only included to support PDF output of the widget. When rendering self.scene onto a QPrinter this widget will use these variables to indicate that "copy number self.copy_current is being printed, out of a total of self.copy_total copies". By looping self.copy_total times, updating self.copy_current each time and rendering onto a QPrinter it is possible to print multiple copies of the SOI, each marked with a copy number.
# NOTE: These variables are only included to support PDF output of the
# widget. When rendering self.scene onto a QPrinter this widget will
# use these variables to indicate that "copy number self.copy_current
# is being printed, out of a total of self.copy_total copies". By
# looping self.copy_total times, updating self.copy_current each time
# and rendering onto a QPrinter it is possible to print multiple
# copies of the SOI, each marked with a copy number.
self.copy_current=1
self.copy_total=3
...
...
@@ -229,7 +295,7 @@ class InlineEditableSOIView(QScrollArea):
)
foriinrange(self.copy_total):
# Update copy number and redraw pages so that it is reflected
# in the scene
self.copy_current=i+1
...
...
@@ -357,9 +423,13 @@ class InlineEditableSOIView(QScrollArea):
# NOTE: See __init__ for explanation on self.copy_current and
# self.copy_total
proxy=ProxyLabelWithConditionalPainting("1 av N",f"{self.copy_current} av {self.copy_total}")
proxy=ProxyLabelWithCustomQPrintText(
"1 av N",f"{self.copy_current} av {self.copy_total}"