diff options
| author | Brianna | 2017-06-23 07:12:40 -0400 |
|---|---|---|
| committer | GitHub | 2017-06-23 07:12:40 -0400 |
| commit | 7d4fb7843849f8a90de13c1a1cb93ca9428fd3b1 (patch) | |
| tree | d8294bae70979f1134410f7794ca74a395f125ab /mainwindow.py | |
| parent | 3c903794e3588560f2b9d342214009d55a675d5a (diff) | |
| parent | 8c9914850e9987d4f05e8b88dedb058ffbb4f53f (diff) | |
Merge branch 'feature-newgui' into newgui-commandline
Diffstat (limited to 'mainwindow.py')
| -rw-r--r-- | mainwindow.py | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/mainwindow.py b/mainwindow.py index 6023831..f3d45e6 100644 --- a/mainwindow.py +++ b/mainwindow.py @@ -1,7 +1,7 @@ from queue import Queue from PyQt4 import QtCore, QtGui, uic from PyQt4.QtCore import QSettings, Qt -from PyQt4.QtGui import QMenu +from PyQt4.QtGui import QMenu, QShortcut import sys import os import signal @@ -39,14 +39,14 @@ class PreviewWindow(QtGui.QLabel): self.repaint() -class MainWindow(QtCore.QObject): +class MainWindow(QtGui.QMainWindow): newTask = QtCore.pyqtSignal(list) processTask = QtCore.pyqtSignal() videoTask = QtCore.pyqtSignal(str, str, list) def __init__(self, window, project): - QtCore.QObject.__init__(self) + QtGui.QMainWindow.__init__(self) # print('main thread id: {}'.format(QtCore.QThread.currentThreadId())) self.window = window @@ -63,9 +63,7 @@ class MainWindow(QtCore.QObject): LoadDefaultSettings(self) self.presetManager = PresetManager( uic.loadUi( - os.path.join(os.path.dirname(os.path.realpath(__file__)), - 'presetmanager.ui')), - self) + os.path.join(self.core.wd, 'presetmanager.ui')), self) if not os.path.exists(self.dataDir): os.makedirs(self.dataDir) @@ -143,7 +141,7 @@ class MainWindow(QtCore.QObject): window.spinBox_aBitrate.valueChanged.connect(self.updateCodecSettings) self.previewWindow = PreviewWindow(self, os.path.join( - os.path.dirname(os.path.realpath(__file__)), "background.png")) + self.core.wd, "background.png")) window.verticalLayout_previewWrapper.addWidget(self.previewWindow) # Make component buttons @@ -242,6 +240,29 @@ class MainWindow(QtCore.QObject): self.openProject(self.currentProject, prompt=False) self.drawPreview(True) + # Setup Hotkeys + QtGui.QShortcut("Ctrl+S", self.window, self.saveCurrentProject) + QtGui.QShortcut("Ctrl+A", self.window, self.openSaveProjectDialog) + QtGui.QShortcut("Ctrl+O", self.window, self.openOpenProjectDialog) + QtGui.QShortcut("Ctrl+N", self.window, self.createNewProject) + + QtGui.QShortcut("Ctrl+T", self.window, activated=lambda: + self.window.pushButton_addComponent.click()) + QtGui.QShortcut("Ctrl+Space", self.window, activated=lambda: + self.window.listWidget_componentList.setFocus()) + QtGui.QShortcut("Ctrl+Shift+S", self.window, + self.presetManager.openSavePresetDialog) + QtGui.QShortcut("Ctrl+Shift+C", self.window, + self.presetManager.clearPreset) + + QtGui.QShortcut("Ctrl+Up", self.window, + activated=lambda: self.moveComponent(-1)) + QtGui.QShortcut("Ctrl+Down", self.window, + activated=lambda: self.moveComponent(1)) + QtGui.QShortcut("Ctrl+Home", self.window, self.moveComponentTop) + QtGui.QShortcut("Ctrl+End", self.window, self.moveComponentBottom) + QtGui.QShortcut("Ctrl+r", self.window, self.removeComponent) + def cleanUp(self): self.timer.stop() self.previewThread.quit() @@ -506,6 +527,16 @@ class MainWindow(QtCore.QObject): stackedWidget.setCurrentIndex(newRow) self.drawPreview() + def moveComponentTop(self): + componentList = self.window.listWidget_componentList + row = -componentList.currentRow() + self.moveComponent(row) + + def moveComponentBottom(self): + componentList = self.window.listWidget_componentList + row = len(componentList)-1 + self.moveComponent(row) + def dragComponent(self, event): '''Drop event for the component listwidget''' componentList = self.window.listWidget_componentList |
