From cf197904b82d6f5769f23c15d047d22a2bd46644 Mon Sep 17 00:00:00 2001
From: DH4
Date: Sat, 3 Jun 2017 16:46:52 -0500
Subject: Add component changed to menu.
---
main.py | 17 +++++-----
mainwindow.ui | 101 +++++++++++++++++++++++++++++++++++++++++++---------------
2 files changed, 84 insertions(+), 34 deletions(-)
diff --git a/main.py b/main.py
index 1f3e1ec..49fe469 100644
--- a/main.py
+++ b/main.py
@@ -5,7 +5,7 @@ from importlib import import_module
from collections import OrderedDict
from PyQt4 import QtCore, QtGui, uic
from PyQt4.QtCore import QSettings, QModelIndex, Qt
-from PyQt4.QtGui import QDesktopServices
+from PyQt4.QtGui import QDesktopServices, QMenu
import preview_thread, core, video_thread
@@ -183,13 +183,14 @@ class Main(QtCore.QObject):
window.verticalLayout_previewWrapper.addWidget(self.previewWindow)
self.modules = self.findComponents()
- for component in self.modules:
- window.comboBox_componentSelection.addItem(component.Component.__doc__)
- window.listWidget_componentList.clicked.connect(lambda _: self.changeComponentWidget())
+ self.compMenu = QMenu()
+ for i, comp in enumerate(self.modules):
+ action = self.compMenu.addAction(comp.Component.__doc__)
+ action.triggered[()].connect( lambda item=i: self.addComponent(item))
- self.window.pushButton_addComponent.clicked.connect( \
- lambda _: self.addComponent(self.window.comboBox_componentSelection.currentIndex())
- )
+ self.window.pushButton_addComponent.setMenu(self.compMenu)
+ window.listWidget_componentList.clicked.connect(lambda _: self.changeComponentWidget())
+
self.window.pushButton_removeComponent.clicked.connect(lambda _: self.removeComponent())
currentRes = str(self.settings.value('outputWidth'))+'x'+str(self.settings.value('outputHeight'))
@@ -408,7 +409,7 @@ class Main(QtCore.QObject):
def updateOpenPresetComboBox(self, component):
self.window.comboBox_openPreset.clear()
- self.window.comboBox_openPreset.addItem("Open Preset")
+ self.window.comboBox_openPreset.addItem("Component Presets")
destination = os.path.join(self.presetDir,
str(component).strip(), str(component.version()))
if not os.path.exists(destination):
diff --git a/mainwindow.ui b/mainwindow.ui
index eda5bb6..5e10028 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -141,27 +141,11 @@
20
- 20
+ 15
- -
-
-
-
- 0
- 0
-
-
-
-
- 280
- 0
-
-
-
-
-
-
@@ -197,17 +181,63 @@
-
-
-
-
- 0
- 0
-
+
+
+ 4
-
+
+ 2
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Sunken
+
+
+ 1
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+ QAbstractItemView::NoDragDrop
+
+
+
+
-
+
+ 2
+
-
@@ -216,17 +246,36 @@
0
+
+
+ 180
+ 0
+
+
-
- Open Preset
+ Component Presets
-
+
+
+ 0
+ 0
+
+
+
+ Save
+
+
+
+ -
+
- Save Preset
+ Remove
--
cgit v1.2.3