Browse Source

fix for flashing/cut off preview and pagesetup ui slimmed

master
Ivan Holmes 3 years ago
parent
commit
c9a93b5e93
  1. 3
      .gitignore
  2. 10
      csgui/pdfViewer.py
  3. 173
      ui/psetup.ui

3
.gitignore

@ -52,3 +52,6 @@ docs/_build/
# Mac stuff
.DS_Store
.vscode/
# Syncthing conflicts
*.sync-conflict-*

10
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():

173
ui/psetup.ui

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>257</width>
<height>271</height>
<width>210</width>
<height>334</height>
</rect>
</property>
<property name="sizePolicy">
@ -37,8 +37,8 @@
<property name="spacing">
<number>6</number>
</property>
<item row="11" column="0">
<widget class="QLabel" name="lineSpacingLabel">
<item row="12" column="0">
<widget class="QLabel" name="beatWidthLabel">
<property name="minimumSize">
<size>
<width>0</width>
@ -46,7 +46,7 @@
</size>
</property>
<property name="text">
<string>Line spacing</string>
<string>Beat width</string>
</property>
</widget>
</item>
@ -60,19 +60,6 @@
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="fontLabel">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="bottomMarginLineEdit">
<property name="maximumSize">
@ -83,39 +70,32 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="topMarginLineEdit">
<property name="maximumSize">
<item row="11" column="0">
<widget class="QLabel" name="lineSpacingLabel">
<property name="minimumSize">
<size>
<width>60</width>
<height>16777215</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Line spacing</string>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QDoubleSpinBox" name="lineSpacingDoubleSpinBox">
<item row="10" column="1">
<widget class="QCheckBox" name="includedFontCheckBox">
<property name="minimumSize">
<size>
<width>70</width>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
<property name="text">
<string>FreeSans</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="rightMarginLineEdit">
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
@ -135,22 +115,33 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="topMarginLabel">
<property name="minimumSize">
<item row="1" column="0">
<widget class="QLabel" name="documentUnitsLabel">
<property name="text">
<string>Units</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="topMarginLineEdit">
<property name="maximumSize">
<size>
<width>0</width>
<height>0</height>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="maximumSize">
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="bottomMarginLabel">
<property name="minimumSize">
<size>
<width>16777215</width>
<height>16777194</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Top margin</string>
<string>Bottom margin</string>
</property>
</widget>
</item>
@ -171,15 +162,8 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="documentUnitsLabel">
<property name="text">
<string>Units</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="bottomMarginLabel">
<item row="3" column="0">
<widget class="QLabel" name="rightMarginLabel">
<property name="minimumSize">
<size>
<width>0</width>
@ -187,25 +171,38 @@
</size>
</property>
<property name="text">
<string>Bottom margin</string>
<string>Right margin</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="leftMarginLabel">
<item row="3" column="1">
<widget class="QLineEdit" name="rightMarginLineEdit">
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QDoubleSpinBox" name="lineSpacingDoubleSpinBox">
<property name="minimumSize">
<size>
<width>0</width>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Left margin</string>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QCheckBox" name="includedFontCheckBox">
<item row="2" column="0">
<widget class="QLabel" name="leftMarginLabel">
<property name="minimumSize">
<size>
<width>0</width>
@ -213,36 +210,39 @@
</size>
</property>
<property name="text">
<string>Use FreeSans</string>
</property>
<property name="checked">
<bool>true</bool>
<string>Left margin</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="beatWidthLabel">
<property name="minimumSize">
<item row="10" column="0">
<widget class="QLabel" name="fontLabel">
<property name="maximumSize">
<size>
<width>0</width>
<height>0</height>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Beat width</string>
<string>Font</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="rightMarginLabel">
<item row="4" column="0">
<widget class="QLabel" name="topMarginLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777194</height>
</size>
</property>
<property name="text">
<string>Right margin</string>
<string>Top margin</string>
</property>
</widget>
</item>
@ -267,12 +267,27 @@
</item>
<item row="6" column="0" colspan="2">
<widget class="QFontComboBox" name="fontComboBox">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>26</height>
</size>
</property>
<property name="maxVisibleItems">
<number>12</number>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
<property name="frame">
<bool>true</bool>
</property>
</widget>
</item>
</layout>

Loading…
Cancel
Save