Commit cb8d3acf authored by Radek Hušek's avatar Radek Hušek
Browse files

improve ui

parent 95f949d1
......@@ -134,17 +134,21 @@ class CPP(QWidget):
_crop_changed(True)
hbox = QHBoxLayout()
self._compact = QCheckBox('Co&mpact', self)
hbox.addWidget(QLabel("Copies"))
self._compact_copies = QSpinBox(self)
self._compact_copies.setMinimum(1)
self._compact_copies.setMaximum(1000)
self._compact_copies.setSingleStep(1)
self._compact_copies.setValue(self._defaults.get("copies", 1))
self._compact_copies.setEnabled(False)
self._compact_copies.setEnabled(True)
hbox.addWidget(self._compact_copies)
vbox.addLayout(hbox)
hbox = QHBoxLayout()
self._compact = QCheckBox('Co&mpact', self)
def _compact_changed(enabled):
self._pdfbook.setEnabled(not enabled)
self._compact_copies.setEnabled(enabled)
if enabled:
self._duplex.setCurrentIndex(1)
self._pdfbook.setChecked(False)
......@@ -157,7 +161,6 @@ class CPP(QWidget):
_compact_changed(True)
hbox.addWidget(self._compact)
hbox.addWidget(self._compact_copies)
vbox.addLayout(hbox)
hbox = QHBoxLayout()
......@@ -226,6 +229,8 @@ class CPP(QWidget):
MM_TO_BP = 2.83465
cmd = self._printer.currentData().copy()
if self._crop.isChecked():
margin = " ".join([ "%d" % (MM_TO_BP * m.value()) for m in self._crop_margin ])
pipeline.append([ "%s/pdfcrop_wrapper.sh" % DIR,
......@@ -238,6 +243,8 @@ class CPP(QWidget):
elif self._pdfbook.isChecked():
self._duplex.setCurrentIndex(1)
pipeline.append([ "pdfbook", "/dev/stdin", "-o", "/dev/stdout" ])
elif self._compact_copies.value() != 1:
cmd += [ "-n", str(self._compact_copies.value()) ]
if self._printer.currentData() is self._save_as_file:
f = QFileDialog.getSaveFileName(self, 'Save as ...')
......@@ -245,7 +252,6 @@ class CPP(QWidget):
self.close()
pipeline.append([ "dd", "of=%s" % (f[0],) ])
else:
cmd = self._printer.currentData().copy()
cmd += [ "-o", self._duplex.currentData() ]
if self._pdfbook.isChecked() and self._staple.isChecked():
cmd += [ "-o", "XRFold=BiFoldStaple" ]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment