Add some files

This commit is contained in:
Raoul Snyman 2021-07-28 18:34:42 -07:00
parent c114085cad
commit 696f042a7f
Signed by: raoul
GPG Key ID: F55BCED79626AE9C
3 changed files with 596 additions and 0 deletions

381
resources/mainwindow.ui Normal file
View File

@ -0,0 +1,381 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>Ukatali</string>
</property>
<widget class="QWidget" name="editorWidget">
<layout class="QVBoxLayout" name="editorLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QsciScintilla" name="fileEditor">
<property name="toolTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>28</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="newAction"/>
<addaction name="openAction"/>
<addaction name="saveAction"/>
<addaction name="saveAsAction"/>
<addaction name="separator"/>
<addaction name="exportAction"/>
<addaction name="printAction"/>
<addaction name="separator"/>
<addaction name="exitAction"/>
</widget>
<widget class="QMenu" name="menu_Edit">
<property name="title">
<string>&amp;Edit</string>
</property>
<addaction name="undoAction"/>
<addaction name="redoAction"/>
<addaction name="separator"/>
<addaction name="cutAction"/>
<addaction name="copyAction"/>
<addaction name="pasteAction"/>
</widget>
<widget class="QMenu" name="menu_Settings">
<property name="title">
<string>&amp;Settings</string>
</property>
<addaction name="configureAction"/>
</widget>
<widget class="QMenu" name="menu_Help">
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="aboutAction"/>
</widget>
<addaction name="menu_File"/>
<addaction name="menu_Edit"/>
<addaction name="menu_Settings"/>
<addaction name="menu_Help"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QDockWidget" name="previewDock">
<property name="windowTitle">
<string>Preview</string>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="previewDockContents">
<layout class="QVBoxLayout" name="previewLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWebEngineView" name="previewView">
<property name="url">
<url>
<string>about:blank</string>
</url>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="newAction"/>
<addaction name="openAction"/>
<addaction name="saveAction"/>
<addaction name="separator"/>
<addaction name="exportAction"/>
<addaction name="printAction"/>
<addaction name="separator"/>
<addaction name="undoAction"/>
<addaction name="redoAction"/>
<addaction name="separator"/>
<addaction name="cutAction"/>
<addaction name="copyAction"/>
<addaction name="pasteAction"/>
<addaction name="separator"/>
<addaction name="configureAction"/>
</widget>
<action name="newAction">
<property name="icon">
<iconset theme="document-new"/>
</property>
<property name="text">
<string>&amp;New</string>
</property>
<property name="toolTip">
<string>Create a new ChordPro file</string>
</property>
<property name="shortcut">
<string>Ctrl+N</string>
</property>
</action>
<action name="openAction">
<property name="icon">
<iconset theme="document-open"/>
</property>
<property name="text">
<string>&amp;Open...</string>
</property>
<property name="toolTip">
<string>Open an existing ChordPro file</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
</action>
<action name="saveAction">
<property name="icon">
<iconset theme="document-save"/>
</property>
<property name="text">
<string>&amp;Save</string>
</property>
<property name="toolTip">
<string>Save the current ChordPro file</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
<action name="saveAsAction">
<property name="icon">
<iconset theme="document-save-as"/>
</property>
<property name="text">
<string>Save &amp;As...</string>
</property>
<property name="toolTip">
<string>Save the current file under a new name</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+S</string>
</property>
</action>
<action name="printAction">
<property name="icon">
<iconset theme="document-print"/>
</property>
<property name="text">
<string>&amp;Print</string>
</property>
<property name="toolTip">
<string>Print the current ChordPro file</string>
</property>
<property name="shortcut">
<string>Ctrl+P</string>
</property>
</action>
<action name="exportAction">
<property name="icon">
<iconset theme="document-export"/>
</property>
<property name="text">
<string>&amp;Export...</string>
</property>
<property name="toolTip">
<string>Export the current file as a different format</string>
</property>
<property name="shortcut">
<string>Ctrl+E</string>
</property>
</action>
<action name="undoAction">
<property name="icon">
<iconset theme="edit-undo"/>
</property>
<property name="text">
<string>&amp;Undo</string>
</property>
<property name="toolTip">
<string>Undo the last edit</string>
</property>
<property name="shortcut">
<string>Ctrl+Z</string>
</property>
</action>
<action name="redoAction">
<property name="icon">
<iconset theme="edit-redo"/>
</property>
<property name="text">
<string>&amp;Redo</string>
</property>
<property name="toolTip">
<string>Redo the last undone action</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+Z</string>
</property>
</action>
<action name="cutAction">
<property name="icon">
<iconset theme="edit-cut"/>
</property>
<property name="text">
<string>Cu&amp;t</string>
</property>
<property name="toolTip">
<string>Cut the currently selected text</string>
</property>
<property name="shortcut">
<string>Ctrl+X</string>
</property>
</action>
<action name="copyAction">
<property name="icon">
<iconset theme="edit-copy"/>
</property>
<property name="text">
<string>&amp;Copy</string>
</property>
<property name="toolTip">
<string>Copy the currently selected text to the clipboard</string>
</property>
<property name="shortcut">
<string>Ctrl+C</string>
</property>
</action>
<action name="pasteAction">
<property name="icon">
<iconset theme="edit-paste"/>
</property>
<property name="text">
<string>&amp;Paste</string>
</property>
<property name="toolTip">
<string>Paste the current clipboard text into the editor</string>
</property>
<property name="shortcut">
<string>Ctrl+V</string>
</property>
</action>
<action name="configureAction">
<property name="icon">
<iconset theme="configure"/>
</property>
<property name="text">
<string>&amp;Configure...</string>
</property>
<property name="toolTip">
<string>Configure Ukatali</string>
</property>
</action>
<action name="aboutAction">
<property name="icon">
<iconset theme="help-about"/>
</property>
<property name="text">
<string>&amp;About</string>
</property>
<property name="toolTip">
<string>About Ukatali</string>
</property>
</action>
<action name="exitAction">
<property name="icon">
<iconset theme="application-exit"/>
</property>
<property name="text">
<string>E&amp;xit</string>
</property>
<property name="toolTip">
<string>Quit Ukatali</string>
</property>
<property name="shortcut">
<string>Alt+F4</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>QsciScintilla</class>
<extends>QFrame</extends>
<header>Qsci/qsciscintilla.h</header>
</customwidget>
<customwidget>
<class>QWebEngineView</class>
<extends>QWidget</extends>
<header location="global">QtWebEngineWidgets/QWebEngineView</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>exitAction</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>299</y>
</hint>
</hints>
</connection>
</connections>
</ui>

8
src/ukatali/app.py Normal file
View File

@ -0,0 +1,8 @@
from PyQt5 import QtWidgets
from mainwindow import MainWindow
app = QtWidgets.QApplication([])
window = MainWindow()
window.show()
app.exec()

207
src/ukatali/mainwindow.py Normal file
View File

@ -0,0 +1,207 @@
# -*- coding: utf-8 -*-
from PyQt5 import QtCore, QtGui, QtWidgets, QtWebEngineWidgets, Qsci
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super().__init__(parent)
self.setup_ui()
def setup_ui(self):
self.setObjectName("MainWindow")
self.resize(800, 600)
self.editorWidget = QtWidgets.QWidget(self)
self.editorWidget.setObjectName("editorWidget")
self.editorLayout = QtWidgets.QVBoxLayout(self.editorWidget)
self.editorLayout.setContentsMargins(0, 0, 0, 0)
self.editorLayout.setSpacing(0)
self.editorLayout.setObjectName("editorLayout")
self.fileEditor = Qsci.QsciScintilla(self.editorWidget)
self.fileEditor.setColor(QtWidgets.QApplication.palette().windowText().color())
self.fileEditor.setFont(QtGui.QFont("monospace"))
self.fileEditor.setObjectName("fileEditor")
self.editorLayout.addWidget(self.fileEditor)
self.setCentralWidget(self.editorWidget)
self.menubar = QtWidgets.QMenuBar(self)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 28))
self.menubar.setObjectName("menubar")
self.fileMenu = QtWidgets.QMenu(self.menubar)
self.fileMenu.setObjectName("fileMenu")
self.editMenu = QtWidgets.QMenu(self.menubar)
self.editMenu.setObjectName("editMenu")
self.settingsMenu = QtWidgets.QMenu(self.menubar)
self.settingsMenu.setObjectName("settingsMenu")
self.helpMenu = QtWidgets.QMenu(self.menubar)
self.helpMenu.setObjectName("helpMenu")
self.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(self)
self.statusbar.setObjectName("statusbar")
self.setStatusBar(self.statusbar)
self.previewDock = QtWidgets.QDockWidget(self)
self.previewDock.setObjectName("previewDock")
self.previewDockContents = QtWidgets.QWidget()
self.previewDockContents.setObjectName("previewDockContents")
self.previewLayout = QtWidgets.QVBoxLayout(self.previewDockContents)
self.previewLayout.setContentsMargins(0, 0, 0, 0)
self.previewLayout.setSpacing(0)
self.previewLayout.setObjectName("previewLayout")
self.previewView = QtWebEngineWidgets.QWebEngineView(self.previewDockContents)
self.previewView.setUrl(QtCore.QUrl("about:blank"))
self.previewView.setObjectName("previewView")
self.previewLayout.addWidget(self.previewView)
self.previewDock.setWidget(self.previewDockContents)
self.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.previewDock)
self.toolBar = QtWidgets.QToolBar(self)
self.toolBar.setObjectName("toolBar")
self.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
self.newAction = QtWidgets.QAction(self)
icon = QtGui.QIcon.fromTheme("document-new")
self.newAction.setIcon(icon)
self.newAction.setObjectName("newAction")
self.openAction = QtWidgets.QAction(self)
icon = QtGui.QIcon.fromTheme("document-open")
self.openAction.setIcon(icon)
self.openAction.setObjectName("openAction")
self.saveAction = QtWidgets.QAction(self)
icon = QtGui.QIcon.fromTheme("document-save")
self.saveAction.setIcon(icon)
self.saveAction.setObjectName("saveAction")
self.saveAsAction = QtWidgets.QAction(self)
icon = QtGui.QIcon.fromTheme("document-save-as")
self.saveAsAction.setIcon(icon)
self.saveAsAction.setObjectName("saveAsAction")
self.printAction = QtWidgets.QAction(self)
icon = QtGui.QIcon.fromTheme("document-print")
self.printAction.setIcon(icon)
self.printAction.setObjectName("printAction")
self.exportAction = QtWidgets.QAction(self)
icon = QtGui.QIcon.fromTheme("document-export")
self.exportAction.setIcon(icon)
self.exportAction.setObjectName("exportAction")
self.undoAction = QtWidgets.QAction(self)
icon = QtGui.QIcon.fromTheme("edit-undo")
self.undoAction.setIcon(icon)
self.undoAction.setObjectName("undoAction")
self.redoAction = QtWidgets.QAction(self)
icon = QtGui.QIcon.fromTheme("edit-redo")
self.redoAction.setIcon(icon)
self.redoAction.setObjectName("redoAction")
self.cutAction = QtWidgets.QAction(self)
icon = QtGui.QIcon.fromTheme("edit-cut")
self.cutAction.setIcon(icon)
self.cutAction.setObjectName("cutAction")
self.copyAction = QtWidgets.QAction(self)
icon = QtGui.QIcon.fromTheme("edit-copy")
self.copyAction.setIcon(icon)
self.copyAction.setObjectName("copyAction")
self.pasteAction = QtWidgets.QAction(self)
icon = QtGui.QIcon.fromTheme("edit-paste")
self.pasteAction.setIcon(icon)
self.pasteAction.setObjectName("pasteAction")
self.configureAction = QtWidgets.QAction(self)
icon = QtGui.QIcon.fromTheme("configure")
self.configureAction.setIcon(icon)
self.configureAction.setObjectName("configureAction")
self.aboutAction = QtWidgets.QAction(self)
icon = QtGui.QIcon.fromTheme("help-about")
self.aboutAction.setIcon(icon)
self.aboutAction.setObjectName("aboutAction")
self.exitAction = QtWidgets.QAction(self)
icon = QtGui.QIcon.fromTheme("application-exit")
self.exitAction.setIcon(icon)
self.exitAction.setObjectName("exitAction")
self.fileMenu.addAction(self.newAction)
self.fileMenu.addAction(self.openAction)
self.fileMenu.addAction(self.saveAction)
self.fileMenu.addAction(self.saveAsAction)
self.fileMenu.addSeparator()
self.fileMenu.addAction(self.exportAction)
self.fileMenu.addAction(self.printAction)
self.fileMenu.addSeparator()
self.fileMenu.addAction(self.exitAction)
self.editMenu.addAction(self.undoAction)
self.editMenu.addAction(self.redoAction)
self.editMenu.addSeparator()
self.editMenu.addAction(self.cutAction)
self.editMenu.addAction(self.copyAction)
self.editMenu.addAction(self.pasteAction)
self.settingsMenu.addAction(self.configureAction)
self.helpMenu.addAction(self.aboutAction)
self.menubar.addAction(self.fileMenu.menuAction())
self.menubar.addAction(self.editMenu.menuAction())
self.menubar.addAction(self.settingsMenu.menuAction())
self.menubar.addAction(self.helpMenu.menuAction())
self.toolBar.addAction(self.newAction)
self.toolBar.addAction(self.openAction)
self.toolBar.addAction(self.saveAction)
self.toolBar.addSeparator()
self.toolBar.addAction(self.exportAction)
self.toolBar.addAction(self.printAction)
self.toolBar.addSeparator()
self.toolBar.addAction(self.undoAction)
self.toolBar.addAction(self.redoAction)
self.toolBar.addSeparator()
self.toolBar.addAction(self.cutAction)
self.toolBar.addAction(self.copyAction)
self.toolBar.addAction(self.pasteAction)
self.toolBar.addSeparator()
self.toolBar.addAction(self.configureAction)
self.retranslate_ui()
self.exitAction.triggered.connect(self.close)
self.undoAction.triggered.connect(self.fileEditor.undo)
self.redoAction.triggered.connect(self.fileEditor.redo)
self.cutAction.triggered.connect(self.fileEditor.cut)
self.copyAction.triggered.connect(self.fileEditor.copy)
self.pasteAction.triggered.connect(self.fileEditor.paste)
QtCore.QMetaObject.connectSlotsByName(self)
def retranslate_ui(self):
_translate = QtCore.QCoreApplication.translate
self.setWindowTitle(_translate("MainWindow", "Ukatali"))
self.fileMenu.setTitle(_translate("MainWindow", "&File"))
self.editMenu.setTitle(_translate("MainWindow", "&Edit"))
self.settingsMenu.setTitle(_translate("MainWindow", "&Settings"))
self.helpMenu.setTitle(_translate("MainWindow", "&Help"))
self.previewDock.setWindowTitle(_translate("MainWindow", "Preview"))
self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar"))
self.newAction.setText(_translate("MainWindow", "&New"))
self.newAction.setToolTip(_translate("MainWindow", "Create a new ChordPro file"))
self.newAction.setShortcut(_translate("MainWindow", "Ctrl+N"))
self.openAction.setText(_translate("MainWindow", "&Open..."))
self.openAction.setToolTip(_translate("MainWindow", "Open an existing ChordPro file"))
self.openAction.setShortcut(_translate("MainWindow", "Ctrl+O"))
self.saveAction.setText(_translate("MainWindow", "&Save"))
self.saveAction.setToolTip(_translate("MainWindow", "Save the current ChordPro file"))
self.saveAction.setShortcut(_translate("MainWindow", "Ctrl+S"))
self.saveAsAction.setText(_translate("MainWindow", "Save &As..."))
self.saveAsAction.setToolTip(_translate("MainWindow", "Save the current file under a new name"))
self.saveAsAction.setShortcut(_translate("MainWindow", "Ctrl+Shift+S"))
self.printAction.setText(_translate("MainWindow", "&Print"))
self.printAction.setToolTip(_translate("MainWindow", "Print the current ChordPro file"))
self.printAction.setShortcut(_translate("MainWindow", "Ctrl+P"))
self.exportAction.setText(_translate("MainWindow", "&Export..."))
self.exportAction.setToolTip(_translate("MainWindow", "Export the current file as a different format"))
self.exportAction.setShortcut(_translate("MainWindow", "Ctrl+E"))
self.undoAction.setText(_translate("MainWindow", "&Undo"))
self.undoAction.setToolTip(_translate("MainWindow", "Undo the last edit"))
self.undoAction.setShortcut(_translate("MainWindow", "Ctrl+Z"))
self.redoAction.setText(_translate("MainWindow", "&Redo"))
self.redoAction.setToolTip(_translate("MainWindow", "Redo the last undone action"))
self.redoAction.setShortcut(_translate("MainWindow", "Ctrl+Shift+Z"))
self.cutAction.setText(_translate("MainWindow", "Cu&t"))
self.cutAction.setToolTip(_translate("MainWindow", "Cut the currently selected text"))
self.cutAction.setShortcut(_translate("MainWindow", "Ctrl+X"))
self.copyAction.setText(_translate("MainWindow", "&Copy"))
self.copyAction.setToolTip(_translate("MainWindow", "Copy the currently selected text to the clipboard"))
self.copyAction.setShortcut(_translate("MainWindow", "Ctrl+C"))
self.pasteAction.setText(_translate("MainWindow", "&Paste"))
self.pasteAction.setToolTip(_translate("MainWindow", "Paste the current clipboard text into the editor"))
self.pasteAction.setShortcut(_translate("MainWindow", "Ctrl+V"))
self.configureAction.setText(_translate("MainWindow", "&Configure..."))
self.configureAction.setToolTip(_translate("MainWindow", "Configure Ukatali"))
self.aboutAction.setText(_translate("MainWindow", "&About"))
self.aboutAction.setToolTip(_translate("MainWindow", "About Ukatali"))
self.exitAction.setText(_translate("MainWindow", "E&xit"))
self.exitAction.setToolTip(_translate("MainWindow", "Quit Ukatali"))
self.exitAction.setShortcut(_translate("MainWindow", "Alt+F4"))