diff options
| author | DH4 | 2017-06-03 16:46:52 -0500 |
|---|---|---|
| committer | DH4 | 2017-06-03 16:46:52 -0500 |
| commit | cf197904b82d6f5769f23c15d047d22a2bd46644 (patch) | |
| tree | 7e1f9926cf42e3b5c71d353312fbc048c4ed4dbb | |
| parent | 2d515540aa5f22a6027a86ff616f32ab5f7b0b1d (diff) | |
Add component changed to menu.
| -rw-r--r-- | main.py | 17 | ||||
| -rw-r--r-- | mainwindow.ui | 101 |
2 files changed, 84 insertions, 34 deletions
@@ -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,28 +141,12 @@ <property name="sizeHint" stdset="0"> <size> <width>20</width> - <height>20</height> + <height>15</height> </size> </property> </spacer> </item> <item> - <widget class="QComboBox" name="comboBox_componentSelection"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>280</width> - <height>0</height> - </size> - </property> - </widget> - </item> - <item> <layout class="QHBoxLayout" name="horizontalLayout_14"> <item> <widget class="QPushButton" name="pushButton_addComponent"> @@ -197,17 +181,63 @@ </layout> </item> <item> - <widget class="QListWidget" name="listWidget_componentList"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <layout class="QHBoxLayout" name="horizontalLayout_7"> + <property name="leftMargin"> + <number>4</number> </property> - </widget> + <property name="rightMargin"> + <number>2</number> + </property> + <item> + <widget class="QListWidget" name="listWidget_componentList"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="showDropIndicator" stdset="0"> + <bool>false</bool> + </property> + <property name="dragEnabled"> + <bool>false</bool> + </property> + <property name="dragDropOverwriteMode"> + <bool>false</bool> + </property> + <property name="dragDropMode"> + <enum>QAbstractItemView::NoDragDrop</enum> + </property> + </widget> + </item> + </layout> </item> <item> <layout class="QHBoxLayout" name="horizontalLayout_15"> + <property name="leftMargin"> + <number>2</number> + </property> <item> <widget class="QComboBox" name="comboBox_openPreset"> <property name="sizePolicy"> @@ -216,17 +246,36 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="minimumSize"> + <size> + <width>180</width> + <height>0</height> + </size> + </property> <item> <property name="text"> - <string>Open Preset</string> + <string>Component Presets</string> </property> </item> </widget> </item> <item> <widget class="QPushButton" name="pushButton_savePreset"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Save</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButton_removePreset"> <property name="text"> - <string>Save Preset</string> + <string>Remove</string> </property> </widget> </item> |
