You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.1 KiB

  1. import os
  2. from PyQt5.QtWidgets import QApplication, QAction, QLabel, QDialogButtonBox, QDialog, QFileDialog, QMessageBox, QPushButton, QLineEdit, QCheckBox, QSpinBox, QDoubleSpinBox, QTableWidgetItem, QTabWidget, QComboBox, QWidget, QScrollArea, QMainWindow, QShortcut, QDockWidget, QLineEdit, QTableView
  3. from PyQt5.QtCore import QFile, QObject, Qt
  4. from PyQt5.QtGui import QImage, QPixmap
  5. from PyQt5 import uic
  6. from chordsheet.common import scriptDir
  7. from csgui.tableView import MTableView
  8. class UIFileDockWidget(QDockWidget):
  9. def __init__(self):
  10. super().__init__()
  11. def UIFileLoader(self, ui_file):
  12. ui_file = QFile(os.path.join(scriptDir, 'ui', ui_file))
  13. ui_file.open(QFile.ReadOnly)
  14. self.setWidget(uic.loadUi(ui_file))
  15. ui_file.close()
  16. def clear(self):
  17. # Clear all the fields
  18. for lineEdit in self.findChildren(QLineEdit):
  19. lineEdit.clear()
  20. for comboBox in self.findChildren(QComboBox):
  21. comboBox.clear()
  22. for tableView in self.findChildren(MTableView):
  23. tableView.clear()
  24. class DocInfoDockWidget(UIFileDockWidget):
  25. def __init__(self):
  26. super().__init__()
  27. self.UIFileLoader('docinfo.ui')
  28. self.setWindowTitle("Document information")
  29. class PageSetupDockWidget(UIFileDockWidget):
  30. def __init__(self):
  31. super().__init__()
  32. self.UIFileLoader('psetup.ui')
  33. self.setWindowTitle("Page setup")
  34. class ChordsDockWidget(UIFileDockWidget):
  35. def __init__(self):
  36. super().__init__()
  37. self.UIFileLoader('chords.ui')
  38. self.setWindowTitle("Chords")
  39. class SectionsDockWidget(UIFileDockWidget):
  40. def __init__(self):
  41. super().__init__()
  42. self.UIFileLoader('sections.ui')
  43. self.setWindowTitle("Sections")
  44. class BlocksDockWidget(UIFileDockWidget):
  45. def __init__(self):
  46. super().__init__()
  47. self.UIFileLoader('blocks.ui')
  48. self.setWindowTitle("Blocks")
  49. class PreviewDockWidget(UIFileDockWidget):
  50. def __init__(self):
  51. super().__init__()
  52. self.UIFileLoader('preview.ui')
  53. self.setWindowTitle("Preview")