Skip to content

Commit

Permalink
Merge pull request OpenShot#2375 from ferdnyc/testmerge
Browse files Browse the repository at this point in the history
Contents of PR OpenShot#2276 without duplicated commit
  • Loading branch information
DylanC authored Nov 20, 2018
2 parents f9cbde8 + 7d50fa9 commit ce9f895
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/classes/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ def title(self):
""" Get the translated display title of this item """
path = self.data.get("reader", {}).get("path")
folder_path, filename = os.path.split(path)
return os.path.splitext(filename)[0]
#return os.path.splitext(filename)[0]
return filename

class Transition(QueryObject):
""" This class allows Transitions (i.e. timeline effects) to be queried, updated, and deleted from the project data. """
Expand Down
11 changes: 11 additions & 0 deletions src/windows/file_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def __init__(self, file):
self.txtTags.setText(tags)
self.txtFilePath.setText(os.path.join(path, filename))

self.btnBrowse.clicked.connect(self.browsePath)

# Populate video fields
self.txtWidth.setValue(self.file.data["width"])
self.txtHeight.setValue(self.file.data["height"])
Expand Down Expand Up @@ -172,11 +174,20 @@ def __init__(self, file):
# Switch to 1st page
self.toolBox.setCurrentIndex(0)

def browsePath(self):
starting_folder, filename = os.path.split(self.file.data["path"])
newFilePath = QFileDialog.getOpenFileName(None,("Locate media file: %s" % filename),
starting_folder)
self.txtFilePath.setText(newFilePath[0])

def accept(self):
# Update file details
self.file.data["name"] = self.txtFileName.text()
self.file.data["tags"] = self.txtTags.text()

#experimental: update file path
self.file.data["path"] = self.txtFilePath.text()

# Update Framerate
self.file.data["fps"]["num"] = self.txtFrameRateNum.value()
self.file.data["fps"]["den"] = self.txtFrameRateDen.value()
Expand Down
17 changes: 17 additions & 0 deletions src/windows/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,14 @@ def actionEditTitle_trigger(self, event):
# Force update of files model (which will rebuild missing thumbnails)
get_app().window.filesTreeView.refresh_view()

# force update of clips

clips = Clip.filter(file_id=selected_file_id)
for c in clips:
# update clip
c.data["reader"]["path"] = file_path
c.save()

def actionDuplicateTitle_trigger(self, event):

# Get selected svg title file
Expand Down Expand Up @@ -1644,6 +1652,15 @@ def actionFile_Properties_trigger(self, event):
# Run the dialog event loop - blocking interaction on this window during that time
result = win.exec_()
if result == QDialog.Accepted:

# BRUTE FORCE approach: go through all clips and update file path

clips = Clip.filter(file_id=file_id)
for c in clips:
# update clip
c.data["reader"]["path"] = f.data["path"]
c.save()

log.info('File Properties Finished')
else:
log.info('File Properties Cancelled')
Expand Down
14 changes: 11 additions & 3 deletions src/windows/ui/file-properties.ui
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,25 @@
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnBrowse">
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QDialogButtonBox" name="buttonBox"/>
</item>
<item row="1" column="0" rowspan="2">
<item row="2" column="0" rowspan="2">
<widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
Expand Down Expand Up @@ -910,6 +917,7 @@
</widget>
</widget>
</item>

</layout>
</widget>
<resources/>
Expand Down

0 comments on commit ce9f895

Please sign in to comment.