Skip to content

Commit

Permalink
Rename "Export Entire Timeline" option to "End at Last Clip", and add…
Browse files Browse the repository at this point in the history
… a similar "Start at first Clip" option. Removed internal QLineEdits from save_settings (i.e. children of spinners)
  • Loading branch information
jonoomph committed Sep 30, 2024
1 parent 70c59e5 commit 39be79e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 39 deletions.
26 changes: 18 additions & 8 deletions src/windows/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ def __init__(self, *args, **kwargs):
self.cboChannelLayout.currentIndexChanged.connect(self.updateChannels)
self.ExportFrame.connect(self.updateProgressBar)
self.btnBrowseProfiles.clicked.connect(self.btnBrowseProfiles_clicked)
self.checkboxExportEntireTimeline.toggled.connect(partial(self.updateFrameRate, True))
self.checkStartFirstClip.toggled.connect(partial(self.updateFrameRate, True))
self.checkEndLastClip.toggled.connect(partial(self.updateFrameRate, True))

# ********* Advanced Profile List **********
# Loop through profiles
Expand Down Expand Up @@ -369,16 +370,23 @@ def updateFrameRate(self, set_limits=True):
self.timeline.info.has_audio = True

if set_limits:
if self.checkboxExportEntireTimeline.isChecked():
# Set the end frame to the full timeline length if the checkbox is checked
self.timeline_length_int = self.timeline.info.video_length
if self.checkEndLastClip.isChecked():
# Set end frame to last clip (right edge)
timeline_length_int = self.timeline.GetMaxFrame()
else:
# Set the end frame to the furthest right clip edge (existing behavior)
self.timeline_length_int = self.timeline.GetMaxFrame()
# Set end frame to project length (full timeline)
timeline_length_int = self.timeline.info.video_length

if self.checkStartFirstClip.isChecked():
# Set the start frame to the first clip position
timeline_start_int = self.timeline.GetMinFrame()
else:
# Set the start frame to the start of the project (0.0)
timeline_start_int = 1

# Set the min and max frame numbers for this project
self.txtStartFrame.setValue(1)
self.txtEndFrame.setValue(self.timeline_length_int)
self.txtStartFrame.setValue(timeline_start_int)
self.txtEndFrame.setValue(timeline_length_int)

# Calculate differences between editing/preview FPS and export FPS
current_fps = get_app().project.get("fps")
Expand Down Expand Up @@ -1172,6 +1180,8 @@ def save_settings(self):

# Iterate over all children in the dialog in the order they are defined
for child in self.findChildren(QWidget):
if child.objectName().startswith("qt_"):
continue
setting = {}
if isinstance(child, QLineEdit):
setting['name'] = child.objectName()
Expand Down
71 changes: 40 additions & 31 deletions src/windows/ui/export.ui
Original file line number Diff line number Diff line change
Expand Up @@ -40,36 +40,35 @@
</property>
</widget>
</item>
<item row="3" column="0" alignment="Qt::AlignBottom">
<!-- Create a horizontal layout for Restore Defaults and buttonBox -->
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="restore_defaults_button">
<property name="text">
<string>Restore Defaults</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::NoButton</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="restore_defaults_button">
<property name="text">
<string>Restore Defaults</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::NoButton</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
Expand Down Expand Up @@ -370,6 +369,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkStartFirstClip">
<property name="text">
<string>Start at first Clip</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
Expand Down Expand Up @@ -404,9 +410,12 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkboxExportEntireTimeline">
<widget class="QCheckBox" name="checkEndLastClip">
<property name="text">
<string>Export Entire Timeline</string>
<string>End at Last Clip</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
Expand Down

0 comments on commit 39be79e

Please sign in to comment.