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..7a29928 100644 --- a/csgui/pdfViewer.py +++ b/csgui/pdfViewer.py @@ -28,7 +28,10 @@ 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) @@ -48,6 +51,7 @@ class PDFViewer(QScrollArea): self.scrollAreaContents.setLayout(self.scrollAreaLayout) self.pixmapList = [] + self.lastVScrollPosition = None def update_pdf(self, pdf): self.render(pdf) @@ -62,9 +66,11 @@ 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): + self.lastVScrollPosition = self.verticalScrollBar().value() while self.scrollAreaLayout.count(): item = self.scrollAreaLayout.takeAt(0) w = item.widget() @@ -79,4 +85,9 @@ class PDFViewer(QScrollArea): label.setPixmap(QPixmap.fromImage(qtimg)) self.scrollAreaLayout.addWidget(label) - # self.scrollAreaLayout.addStretch(1) + self.scrollAreaLayout.addStretch(1) + + # Somewhat of a hack. Should really replace pixmaps in place + # rather than removing labels elsewhere in code. + if self.lastVScrollPosition: + self.verticalScrollBar().setValue(self.lastVScrollPosition) 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 +