docsetdialog.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. # @Author: Bachir Soussi Chiadmi <bach>
  4. # @Date: 23-05-2017
  5. # @Email: bachir@figureslibres.io
  6. # @Last modified by: bach
  7. # @Last modified time: 21-04-2017
  8. # @License: GPL-V3
  9. import os
  10. # from PyQt5.QtCore import
  11. from PyQt5.QtGui import QIcon, QIntValidator
  12. from PyQt5.QtWidgets import QWidget, QLabel, QDialog, QGroupBox, QDialogButtonBox, QVBoxLayout, QFormLayout, QLineEdit, QComboBox, QSpinBox
  13. class DocsetDialog(QDialog):
  14. def __init__(self, parent):
  15. super(DocsetDialog, self).__init__(parent)
  16. self.createFormGroupBox()
  17. buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
  18. buttonBox.accepted.connect(self.accept)
  19. buttonBox.rejected.connect(self.reject)
  20. mainLayout = QVBoxLayout()
  21. mainLayout.addWidget(self.formGroupBox)
  22. mainLayout.addWidget(buttonBox)
  23. self.setLayout(mainLayout)
  24. self.setWindowTitle("Doc settings")
  25. def createFormGroupBox(self):
  26. self.formGroupBox = QGroupBox("Form layout")
  27. layout = QFormLayout()
  28. pw = QLineEdit(str(210))
  29. pw.setValidator(QIntValidator())
  30. pw.setMaxLength(5)
  31. layout.addRow(QLabel("Page Width (mm):"), pw)
  32. ph = QLineEdit(str(297))
  33. ph.setValidator(QIntValidator())
  34. ph.setMaxLength(5)
  35. layout.addRow(QLabel("Page Height (mm):"), ph)
  36. #
  37. mt = QLineEdit(str(15))
  38. mt.setValidator(QIntValidator())
  39. mt.setMaxLength(3)
  40. layout.addRow(QLabel("Margin Top (mm):"), mt)
  41. mb = QLineEdit(str(15))
  42. mb.setValidator(QIntValidator())
  43. mb.setMaxLength(3)
  44. layout.addRow(QLabel("Margin Bottom (mm):"), mb)
  45. mi = QLineEdit(str(15))
  46. mi.setValidator(QIntValidator())
  47. mi.setMaxLength(3)
  48. layout.addRow(QLabel("Margin inner (mm):"), mi)
  49. me = QLineEdit(str(10))
  50. me.setValidator(QIntValidator())
  51. me.setMaxLength(3)
  52. layout.addRow(QLabel("Margin external (mm):"), me)
  53. #
  54. cs = QLineEdit(str(5))
  55. cs.setValidator(QIntValidator())
  56. cs.setMaxLength(3)
  57. layout.addRow(QLabel("Crop size (mm):"), cs)
  58. bs = QLineEdit(str(5))
  59. bs.setValidator(QIntValidator())
  60. bs.setMaxLength(3)
  61. layout.addRow(QLabel("Bleed size (mm):"), bs)
  62. # # layout.addRow(QLabel("Country:"), QComboBox())
  63. # layout.addRow(QLabel("Age:"), QSpinBox())
  64. self.formGroupBox.setLayout(layout)