mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-18 11:52:25 +12:00
New collapsibleGroupBox, cooler
This commit is contained in:
parent
768243f5f9
commit
f694cde63c
52
src/ui/collapsibleGroupBox2.py
Normal file
52
src/ui/collapsibleGroupBox2.py
Normal file
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env python
|
||||
#--!-- coding: utf8 --!--
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from qt import *
|
||||
|
||||
class collapsibleGroupBox2(QWidget):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
self.frame = QFrame(self)
|
||||
self.button = QPushButton("Toggle", self)
|
||||
self.button.setCheckable(True)
|
||||
self.button.setChecked(True)
|
||||
self.switched = False
|
||||
self.vPolicy = None
|
||||
|
||||
def resizeEvent(self, event):
|
||||
if not self.switched:
|
||||
self.switchLayout()
|
||||
return QWidget.resizeEvent(self, event)
|
||||
|
||||
def switchLayout(self):
|
||||
self.frame.setLayout(self.layout())
|
||||
self.wLayout = QVBoxLayout(self)
|
||||
self.wLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.wLayout.addWidget(self.button)
|
||||
self.wLayout.addWidget(self.frame)
|
||||
self.button.toggled.connect(self.setExpanded)
|
||||
self.frame.layout().setContentsMargins(5, 0, 5, 0)
|
||||
self.switched = True
|
||||
|
||||
self.vPolicy = self.sizePolicy().verticalPolicy()
|
||||
|
||||
def setFlat(self, val):
|
||||
if val:
|
||||
self.frame.setFrameShape(QFrame.NoFrame)
|
||||
|
||||
def setCheckable(self, val):
|
||||
pass
|
||||
|
||||
def setTitle(self, title):
|
||||
self.button.setText(title)
|
||||
|
||||
def setExpanded(self, val):
|
||||
self.frame.setVisible(val)
|
||||
if val:
|
||||
self.setSizePolicy(QSizePolicy.Preferred, self.vPolicy)
|
||||
else:
|
||||
self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)
|
|
@ -879,7 +879,7 @@ class Ui_MainWindow(object):
|
|||
self.verticalLayout_20.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize)
|
||||
self.verticalLayout_20.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout_20.setObjectName("verticalLayout_20")
|
||||
self.groupBox_4 = collapsibleGroupBox(self.tab_17)
|
||||
self.groupBox_4 = collapsibleGroupBox2(self.tab_17)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
|
@ -938,7 +938,7 @@ class Ui_MainWindow(object):
|
|||
self.txtRedacGoal.setObjectName("txtRedacGoal")
|
||||
self.formLayout_5.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.txtRedacGoal)
|
||||
self.verticalLayout_20.addWidget(self.groupBox_4)
|
||||
self.groupBox_5 = collapsibleGroupBox(self.tab_17)
|
||||
self.groupBox_5 = collapsibleGroupBox2(self.tab_17)
|
||||
self.groupBox_5.setFlat(True)
|
||||
self.groupBox_5.setCheckable(True)
|
||||
self.groupBox_5.setObjectName("groupBox_5")
|
||||
|
@ -953,7 +953,7 @@ class Ui_MainWindow(object):
|
|||
self.txtRedacSummaryFull.setObjectName("txtRedacSummaryFull")
|
||||
self.verticalLayout_22.addWidget(self.txtRedacSummaryFull)
|
||||
self.verticalLayout_20.addWidget(self.groupBox_5)
|
||||
self.groupBox_6 = collapsibleGroupBox(self.tab_17)
|
||||
self.groupBox_6 = collapsibleGroupBox2(self.tab_17)
|
||||
self.groupBox_6.setFlat(True)
|
||||
self.groupBox_6.setCheckable(True)
|
||||
self.groupBox_6.setObjectName("groupBox_6")
|
||||
|
@ -1273,9 +1273,9 @@ class Ui_MainWindow(object):
|
|||
self.actShowHelp.setText(_translate("MainWindow", "Afficher les &bulles d\'aide"))
|
||||
self.actShowHelp.setShortcut(_translate("MainWindow", "Ctrl+Shift+B"))
|
||||
|
||||
from ui.collapsibleGroupBox import collapsibleGroupBox
|
||||
from ui.chkOutlineCompile import chkOutlineCompile
|
||||
from ui.cmbOutlineStatusChoser import cmbOutlineStatusChoser
|
||||
from ui.sldImportance import sldImportance
|
||||
from ui.editorWidget import editorWidget
|
||||
from ui.cmbOutlinePersoChoser import cmbOutlinePersoChoser
|
||||
from ui.sldImportance import sldImportance
|
||||
from ui.cmbOutlineStatusChoser import cmbOutlineStatusChoser
|
||||
from ui.chkOutlineCompile import chkOutlineCompile
|
||||
from ui.collapsibleGroupBox2 import collapsibleGroupBox2
|
||||
from ui.editorWidget import editorWidget
|
||||
|
|
|
@ -1717,7 +1717,7 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="collapsibleGroupBox" name="groupBox_4">
|
||||
<widget class="collapsibleGroupBox2" name="groupBox_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -1827,7 +1827,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="collapsibleGroupBox" name="groupBox_5">
|
||||
<widget class="collapsibleGroupBox2" name="groupBox_5">
|
||||
<property name="title">
|
||||
<string>Résumé de la scène</string>
|
||||
</property>
|
||||
|
@ -1858,7 +1858,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="collapsibleGroupBox" name="groupBox_6">
|
||||
<widget class="collapsibleGroupBox2" name="groupBox_6">
|
||||
<property name="title">
|
||||
<string>Notes pour la scène</string>
|
||||
</property>
|
||||
|
@ -2167,12 +2167,6 @@
|
|||
<header>ui.sldImportance.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>collapsibleGroupBox</class>
|
||||
<extends>QGroupBox</extends>
|
||||
<header>ui.collapsibleGroupBox.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cmbOutlinePersoChoser</class>
|
||||
<extends>QComboBox</extends>
|
||||
|
@ -2194,6 +2188,12 @@
|
|||
<header>ui.editorWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>collapsibleGroupBox2</class>
|
||||
<extends>QGroupBox</extends>
|
||||
<header>ui.collapsibleGroupBox2.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
|
Loading…
Reference in a new issue