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

import os
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
from PyQt5.QtCore import QFile, QObject, Qt
from PyQt5.QtGui import QImage, QPixmap
from PyQt5 import uic
from chordsheet.common import scriptDir
from csgui.tableView import MTableView
class UIFileDockWidget(QDockWidget):
def __init__(self):
super().__init__()
def UIFileLoader(self, ui_file):
ui_file = QFile(os.path.join(scriptDir, 'ui', ui_file))
ui_file.open(QFile.ReadOnly)
self.setWidget(uic.loadUi(ui_file))
ui_file.close()
def clear(self):
# Clear all the fields
for lineEdit in self.findChildren(QLineEdit):
lineEdit.clear()
for comboBox in self.findChildren(QComboBox):
comboBox.clear()
for tableView in self.findChildren(MTableView):
tableView.clear()
class DocInfoDockWidget(UIFileDockWidget):
def __init__(self):
super().__init__()
self.UIFileLoader('docinfo.ui')
self.setWindowTitle("Document information")
class PageSetupDockWidget(UIFileDockWidget):
def __init__(self):
super().__init__()
self.UIFileLoader('psetup.ui')
self.setWindowTitle("Page setup")
class ChordsDockWidget(UIFileDockWidget):
def __init__(self):
super().__init__()
self.UIFileLoader('chords.ui')
self.setWindowTitle("Chords")
class SectionsDockWidget(UIFileDockWidget):
def __init__(self):
super().__init__()
self.UIFileLoader('sections.ui')
self.setWindowTitle("Sections")
class BlocksDockWidget(UIFileDockWidget):
def __init__(self):
super().__init__()
self.UIFileLoader('blocks.ui')
self.setWindowTitle("Blocks")
class PreviewDockWidget(UIFileDockWidget):
def __init__(self):
super().__init__()
self.UIFileLoader('preview.ui')
self.setWindowTitle("Preview")