Skip to content

Commit

Permalink
Merge pull request #1726 from ferdnyc/tutorial2
Browse files Browse the repository at this point in the history
WIL*: New tutorial system, better child window management
  • Loading branch information
DylanC authored Jul 23, 2018
2 parents b6c39aa + 7953e12 commit 91abe8d
Show file tree
Hide file tree
Showing 3 changed files with 255 additions and 88 deletions.
37 changes: 27 additions & 10 deletions src/windows/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -2130,17 +2130,37 @@ def foundCurrentVersion(self, version):

def moveEvent(self, event):
""" Move tutorial dialogs also (if any)"""
QMainWindow.moveEvent(self, event)
if self.tutorial_manager:
#log.info("Sending move event to tutorial manager")
self.tutorial_manager.re_position_dialog()

def eventFilter(self, object, e):
""" Filter out certain types of window events """
if e.type() == QEvent.WindowActivate:
self.tutorial_manager.re_show_dialog()
elif e.type() == QEvent.WindowStateChange and self.isMinimized():
self.tutorial_manager.minimize()
def resizeEvent(self, event):
QMainWindow.resizeEvent(self, event)
if self.tutorial_manager:
#log.info("Sending resize event to tutorial manager")
self.tutorial_manager.re_position_dialog()

def showEvent(self, event):
""" Have any child windows follow main-window state """
#log.info("Showing main window")
QMainWindow.showEvent(self, event)
for child in self.findChildren(QDockWidget):
if child.isFloating() and child.isEnabled():
# child.setWindowState(self.windowState())
#log.info("Showing child {}".format(child.windowTitle()))
child.raise_()
child.show()

def hideEvent(self, event):
""" Have any child windows hide with main window """
#log.info("Hiding main window")
QMainWindow.hideEvent(self, event)
for child in self.findChildren(QDockWidget):
if child.isFloating() and child.isVisible():
#log.info("Hiding child {}".format(child.windowTitle()))
child.hide()

return False

def show_property_timeout(self):
"""Callback for show property timer"""
Expand Down Expand Up @@ -2393,9 +2413,6 @@ def __init__(self, mode=None):
self.ExportFrame.connect(self.FrameExported)
self.ExportEnded.connect(self.ExportFinished)

# Install event filter
self.installEventFilter(self)

# Save settings
s.save()

Expand Down
199 changes: 182 additions & 17 deletions src/windows/ui/main-window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>808</width>
<height>631</height>
<width>1200</width>
<height>800</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -190,9 +190,18 @@
</attribute>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>9</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item row="0" column="0">
<layout class="QVBoxLayout" name="tabFiles"/>
</item>
Expand All @@ -214,9 +223,18 @@
</attribute>
<widget class="QWidget" name="dockVideoContents">
<layout class="QGridLayout" name="gridLayout_3">
<property name="margin">
<number>9</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item row="0" column="1">
<layout class="QVBoxLayout" name="tabVideo"/>
</item>
Expand All @@ -232,9 +250,18 @@
</attribute>
<widget class="QWidget" name="dockWidgetContents_3">
<layout class="QGridLayout" name="gridLayout_4">
<property name="margin">
<number>9</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item row="0" column="0">
<layout class="QVBoxLayout" name="tabTransitions"/>
</item>
Expand All @@ -250,9 +277,18 @@
</attribute>
<widget class="QWidget" name="dockWidgetContents_4">
<layout class="QGridLayout" name="gridLayout_5">
<property name="margin">
<number>9</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item row="0" column="0">
<layout class="QVBoxLayout" name="tabEffects"/>
</item>
Expand All @@ -274,9 +310,18 @@
</attribute>
<widget class="QWidget" name="dockPropertiesContent">
<layout class="QGridLayout" name="gridLayout_6">
<property name="margin">
<number>9</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item row="1" column="1">
<widget class="QLineEdit" name="txtPropertyFilter">
<property name="inputMask">
Expand All @@ -293,6 +338,93 @@
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="dockTutorial">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
<property name="cursor">
<cursorShape>ForbiddenCursor</cursorShape>
</property>
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="visible">
<bool>true</bool>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="floating">
<bool>true</bool>
</property>
<property name="features">
<set>QDockWidget::DockWidgetFloatable</set>
</property>
<property name="allowedAreas">
<set>Qt::NoDockWidgetArea</set>
</property>
<property name="windowTitle">
<string>Tutorial</string>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="visible">
<bool>false</bool>
</property>
<attribute name="dockWidgetArea">
<number>0</number>
</attribute>
<widget class="QWidget" name="dockTutorialContents">
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<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 row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout"/>
</item>
</layout>
</widget>
</widget>
<action name="actionNew">
<property name="icon">
<iconset theme="document-new" resource="../../images/openshot.qrc">
Expand Down Expand Up @@ -779,6 +911,39 @@
<string>Clear</string>
</property>
</action>
<action name="actionEffectsShowAll">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Show All</string>
</property>
<property name="toolTip">
<string>Show All</string>
</property>
</action>
<action name="actionEffectsShowVideo">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Video</string>
</property>
<property name="toolTip">
<string>Video</string>
</property>
</action>
<action name="actionEffectsShowAudio">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Audio</string>
</property>
<property name="toolTip">
<string>Audio</string>
</property>
</action>
<action name="actionEffectsClear">
<property name="icon">
<iconset theme="edit-clear" resource="../../images/openshot.qrc">
Expand Down
Loading

0 comments on commit 91abe8d

Please sign in to comment.