From c9a93b5e93dec18a93703c72be792b243ef450a1 Mon Sep 17 00:00:00 2001 From: Ivan Holmes Date: Fri, 15 Apr 2022 02:41:37 +0100 Subject: [PATCH] fix for flashing/cut off preview and pagesetup ui slimmed --- .gitignore | 5 +- csgui/pdfViewer.py | 10 ++- ui/psetup.ui | 173 ++++++++++++++++++++++++--------------------- 3 files changed, 105 insertions(+), 83 deletions(-) diff --git a/.gitignore b/.gitignore index da86f19..7e3efe0 100644 --- a/.gitignore +++ b/.gitignore @@ -51,4 +51,7 @@ docs/_build/ # Mac stuff .DS_Store -.vscode/ \ No newline at end of file +.vscode/ + +# Syncthing conflicts +*.sync-conflict-* \ No newline at end of file diff --git a/csgui/pdfViewer.py b/csgui/pdfViewer.py index 9f30c31..f988e9c 100644 --- a/csgui/pdfViewer.py +++ b/csgui/pdfViewer.py @@ -8,7 +8,7 @@ class PDFLabel(QLabel): def __init__(self, parent): super().__init__(parent) self.parent = parent - self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) + self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) def paintEvent(self, event): self.adjustSize() @@ -28,13 +28,16 @@ class PDFLabel(QLabel): parentMargins[0]*2 + scrollBarWidth idealWidth = self.parent.width() - totalMargin + print(idealWidth) pixSize = self.pixmap().size() + print(pixSize) + print((self.parent.scrollAreaContents.size())) pixSize.scale(idealWidth, 1000000, Qt.KeepAspectRatio) scaledPix = self.pixmap().scaled(pixSize, Qt.KeepAspectRatio, Qt.SmoothTransformation) painter.drawPixmap(QPoint(), scaledPix) - self.setMaximumSize(pixSize) + # self.setMaximumSize(pixSize) class PDFViewer(QScrollArea): def __init__(self, parent): @@ -62,7 +65,8 @@ class PDFViewer(QScrollArea): self.pixmapList = [] pdfView = fitz.Document(stream=pdf, filetype='pdf') for page in pdfView: - self.pixmapList.append(page.get_pixmap(alpha=False)) + # needs to be high enough for big monitors. 300 should do it... + self.pixmapList.append(page.get_pixmap(dpi=300, alpha=False)) def clear(self): while self.scrollAreaLayout.count(): diff --git a/ui/psetup.ui b/ui/psetup.ui index 75ec37d..4a2f147 100644 --- a/ui/psetup.ui +++ b/ui/psetup.ui @@ -6,8 +6,8 @@ 0 0 - 257 - 271 + 210 + 334 @@ -37,8 +37,8 @@ 6 - - + + 0 @@ -46,7 +46,7 @@ - Line spacing + Beat width @@ -60,19 +60,6 @@ - - - - - 40 - 16777215 - - - - Font - - - @@ -83,39 +70,32 @@ - - - + + + - 60 - 16777215 + 0 + 0 + + Line spacing + - - + + - 70 + 0 0 - - - 70 - 16777215 - + + FreeSans - - - - - - - 60 - 16777215 - + + true @@ -135,22 +115,33 @@ - - - + + + + Units + + + + + + - 0 - 0 + 60 + 16777215 - + + + + + - 16777215 - 16777194 + 0 + 0 - Top margin + Bottom margin @@ -171,15 +162,8 @@ - - - - Units - - - - - + + 0 @@ -187,25 +171,38 @@ - Bottom margin + Right margin - - + + + + + 60 + 16777215 + + + + + + - 0 + 70 0 - - Left margin + + + 70 + 16777215 + - - + + 0 @@ -213,36 +210,39 @@ - Use FreeSans - - - true + Left margin - - - + + + - 0 - 0 + 40 + 16777215 - Beat width + Font - - + + 0 0 + + + 16777215 + 16777194 + + - Right margin + Top margin @@ -267,12 +267,27 @@ + + + 150 + 0 + + 16777215 26 + + 12 + + + QComboBox::AdjustToContents + + + true +