Skip to content

Commit

Permalink
Merge pull request #4345 from OpenShot/merge-master-2.6.0
Browse files Browse the repository at this point in the history
Merge master 2.6.0 into develop
  • Loading branch information
JacksonRG authored Aug 25, 2021
2 parents 952f5e8 + 8403607 commit 5468a9a
Show file tree
Hide file tree
Showing 17 changed files with 120 additions and 90 deletions.
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "src/launch.py",
"console": "integratedTerminal"
}
]
}
5 changes: 5 additions & 0 deletions installer/build-mac-dmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ pat='RequestUUID = (.*)'
REQUEST_UUID="${BASH_REMATCH[1]}"
echo " RequestUUID Found: $REQUEST_UUID"

if [ "$REQUEST_UUID" == "" ]; then
echo "Failed to locate REQUEST_UUID, exiting with error."
exit 1
fi

echo "Check Notarization Progress... (list recent notarization records)"
xcrun altool --notarization-history 0 -u "jonathan@openshot.org" -p "@keychain:NOTARIZE_AUTH" | head -n 10

Expand Down
5 changes: 4 additions & 1 deletion installer/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import re
import urllib3
from github3 import login
from github3.models import GitHubError
from requests.auth import HTTPBasicAuth
from requests import post, get, head
from build_server import (
Expand Down Expand Up @@ -185,7 +186,7 @@ def main():
github_release_name,
target_commitish=git_branch_name,
prerelease=True,
body=formatted_logs.get(repo_name))
body=formatted_logs.get(repo_name)[:125000])

# Upload all deploy artifacts/installers to GitHub
# NOTE: ONLY for `openshot-qt` repo
Expand Down Expand Up @@ -367,6 +368,8 @@ def main():
except Exception as ex:
tb = traceback.format_exc()
error("Unhandled %s exception: %s - %s" % (script_mode, str(ex), str(tb)))
if type(ex) == GitHubError:
error(str(ex.errors))

if not errors_detected:
output("Successfully completed %s script!" % script_mode)
Expand Down
2 changes: 0 additions & 2 deletions src/classes/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ def check_libopenshot_version(self, info, openshot):
},
level="error",
))
raise RuntimeError(
"libopenshot version {} found, minimum is {}".format(ver, min_ver))

def gui(self):
from classes import language, sentry, ui_util, logger_libopenshot
Expand Down
6 changes: 3 additions & 3 deletions src/classes/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
import os
from time import strftime

VERSION = "2.5.1-dev3"
MINIMUM_LIBOPENSHOT_VERSION = "0.2.5"
DATE = "20200228000000"
VERSION = "2.6.0-dev"
MINIMUM_LIBOPENSHOT_VERSION = "0.2.6"
DATE = "20210819000000"
NAME = "openshot-qt"
PRODUCT_NAME = "OpenShot Video Editor"
GPL_VERSION = "3"
Expand Down
32 changes: 22 additions & 10 deletions src/classes/json_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ def convert_paths_to_absolute(self, file_path, data):
# Optimized regex replacement
data = re.sub(path_regex, self.replace_string_to_absolute, data)

except Exception as ex:
log.error("Error while converting relative paths to absolute paths: %s" % str(ex))
except Exception:
log.error("Error while converting relative paths to absolute paths", exc_info=1)

return data

Expand All @@ -266,14 +266,16 @@ def replace_string_to_relative(self, match):

# Determine if thumbnail path is found
if info.THUMBNAIL_PATH in folder_path:
# Convert path to relative thumbnail path
log.debug("Generating relative thumbnail path to %s in %s",
file_path, folder_path)
new_path = os.path.join("thumbnail", file_path).replace("\\", "/")
new_path = json.dumps(new_path, ensure_ascii=False)
return '"%s": %s' % (key, new_path)

# Determine if @transitions path is found
elif os.path.join(info.PATH, "transitions") in folder_path:
# Yes, this is an OpenShot transition
log.debug("Generating relative @transitions path for %s in %s",
file_path, folder_path)
folder_path, category_path = os.path.split(folder_path)

# Convert path to @transitions/ path
Expand All @@ -283,15 +285,15 @@ def replace_string_to_relative(self, match):

# Determine if @emojis path is found
elif os.path.join(info.PATH, "emojis") in folder_path:
# Yes, this is an OpenShot emoji
# Convert path to @emojis/ path
log.debug("Generating relative @emojis path for %s in %s",
file_path, folder_path)
new_path = os.path.join("@emojis", file_path).replace("\\", "/")
new_path = json.dumps(new_path, ensure_ascii=False)
return '"%s": %s' % (key, new_path)

# Determine if @assets path is found
elif path_context["new_project_assets"] in folder_path:
# Yes, this is an OpenShot transitions
log.debug("Replacing path to %s in %s", file_path, folder_path)
folder_path = folder_path.replace(path_context["new_project_assets"], "@assets")

# Convert path to @assets/ path
Expand All @@ -304,10 +306,20 @@ def replace_string_to_relative(self, match):
# Convert path to the correct relative path (based on the existing folder)
orig_abs_path = os.path.abspath(path)

# Determine windows drives that the project and file are on
project_win_drive = os.path.splitdrive(path_context.get("new_project_folder", ""))[0]
file_win_drive = os.path.splitdrive(path)[0]
if file_win_drive != project_win_drive:
log.debug("Drive mismatch, not making path relative: %s", orig_abs_path)
# If the file is on different drive. Don't abbreviate the path.
clean_path = orig_abs_path.replace("\\", "/")
clean_path = json.dumps(clean_path, ensure_ascii=False)
return f"{key}: {clean_path}"

# Remove file from abs path
orig_abs_folder = os.path.dirname(orig_abs_path)

# Calculate new relateive path
log.debug("Generating new relative path for %s", orig_abs_path)
new_rel_path_folder = os.path.relpath(orig_abs_folder, path_context.get("new_project_folder", ""))
new_rel_path = os.path.join(new_rel_path_folder, file_path).replace("\\", "/")
new_rel_path = json.dumps(new_rel_path, ensure_ascii=False)
Expand All @@ -328,8 +340,8 @@ def convert_paths_to_relative(self, file_path, previous_path, data):
# Optimized regex replacement
data = re.sub(path_regex, self.replace_string_to_relative, data)

except Exception as ex:
log.error("Error while converting absolute paths to relative paths: %s" % str(ex))
except Exception:
log.error("Error while converting absolute paths to relative paths", exc_info=1)

return data

Expand Down
5 changes: 1 addition & 4 deletions src/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,7 @@ def main():
argv = [sys.argv[0]]
argv.extend(extra_args)
argv.extend(args.remain)
try:
app = OpenShotApp(argv)
except Exception:
app.show_errors()
app = OpenShotApp(argv)

# Setup Qt application details
app.setApplicationName('openshot')
Expand Down
13 changes: 8 additions & 5 deletions src/timeline/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,9 @@ App.controller("TimelineCtrl", function ($scope) {
timeline.add_missing_transition(JSON.stringify(missing_transition_details));
}
// Remove manual move stylesheet
bounding_box.element.removeClass("manual-move");
if (bounding_box.element) {
bounding_box.element.removeClass("manual-move");
}

// Remove CSS class (after the drag)
bounding_box = {};
Expand Down Expand Up @@ -894,7 +896,7 @@ App.controller("TimelineCtrl", function ($scope) {
bounding_box.track_position = 0;

// Set z-order to be above other clips/transitions
if (item_type !== "os_drop") {
if (item_type !== "os_drop" && bounding_box.element) {
bounding_box.element.addClass("manual-move");
}
};
Expand Down Expand Up @@ -938,8 +940,10 @@ App.controller("TimelineCtrl", function ($scope) {
}
}
//change the element location
bounding_box.element.css("left", results.position.left);
bounding_box.element.css("top", bounding_box.track_position - scrolling_tracks_offset_top);
if (bounding_box.element) {
bounding_box.element.css("left", results.position.left);
bounding_box.element.css("top", bounding_box.track_position - scrolling_tracks_offset_top);
}
};

// Update X,Y indexes of tracks / layers (anytime the project.layers scope changes)
Expand Down Expand Up @@ -1393,7 +1397,6 @@ App.controller("TimelineCtrl", function ($scope) {
// Re-index Layer Y values
$scope.updateLayerIndex();
}
$scope.$digest();
}
// return true
return true;
Expand Down
24 changes: 9 additions & 15 deletions src/timeline/js/directives/clip.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,22 +330,16 @@ App.directive("tlClip", function ($timeout) {

// Move all other selected clips with this one if we have more than one clip
$(".ui-selected").each(function () {
clip_name = $(this).attr("id");
var newX, newY;
if (move_clips[clip_name] && ( move_clips[clip_name]['top'] && move_clips[clip_name]['left'] )) {
newY = move_clips[clip_name]['top'] + y_offset;
newX = move_clips[clip_name]['left'] + x_offset;
} else {
move_clips[clip_name] = {};
newY = this.style.top + y_offset;
newX = this.style.left + x_offset;
if (move_clips[$(this).attr("id")]) {
let newY = move_clips[$(this).attr("id")]["top"] + y_offset;
let newX = move_clips[$(this).attr("id")]["left"] + x_offset;
//update the clip location in the array
move_clips[$(this).attr("id")]["top"] = newY;
move_clips[$(this).attr("id")]["left"] = newX;
//change the element location
$(this).css("left", newX);
$(this).css("top", newY);
}
//update the clip location in the array
move_clips[$(this).attr("id")]["top"] = newY;
move_clips[$(this).attr("id")]["left"] = newX;
//change the element location
$(this).css("left", newX);
$(this).css("top", newY);
});
},
revert: function (valid) {
Expand Down
26 changes: 9 additions & 17 deletions src/timeline/js/directives/transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,24 +278,16 @@ App.directive("tlTransition", function () {

// Move all other selected transitions with this one
$(".ui-selected").each(function () {
transition_name = $(this).attr("id");
var newX, newY;
if (move_clips[transition_name] && ( move_clips[transition_name]['top'] && move_clips[clip_name]['left'] )) {
newY = move_clips[transition_name]['top'] + y_offset;
newX = move_clips[transition_name]['left'] + x_offset;
} else {
// If this transition is not yet in move_clips, add it.
move_clips[transition_name] = {};
newY = this.style.top + y_offset;
newX = this.style.left + x_offset;
if (move_transitions[$(this).attr("id")]) {
let newY = move_transitions[$(this).attr("id")]["top"] + y_offset;
let newX = move_transitions[$(this).attr("id")]["left"] + x_offset;
// Update the transition location in the array
move_transitions[$(this).attr("id")]["top"] = newY;
move_transitions[$(this).attr("id")]["left"] = newX;
// Change the element location
$(this).css("left", newX);
$(this).css("top", newY);
}
// Update the transition location in the array
move_transitions[$(this).attr("id")]["top"] = newY;
move_transitions[$(this).attr("id")]["left"] = newX;
// Change the element location
$(this).css("left", newX);
$(this).css("top", newY);

});

},
Expand Down
7 changes: 5 additions & 2 deletions src/windows/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,10 @@ def titlestring(sec, fps, mess):
# get translations
_ = get_app()._tr

# Init some variables
seconds_run = 0
fps_encode = 0

# Init progress bar
self.progressExportVideo.setMinimum(self.txtStartFrame.value())
self.progressExportVideo.setMaximum(self.txtEndFrame.value())
Expand Down Expand Up @@ -872,7 +876,6 @@ def titlestring(sec, fps, mess):

progressstep = max(1 , round(( video_settings.get("end_frame") - video_settings.get("start_frame") ) / 1000))
start_time_export = time.time()
seconds_run = 0
start_frame_export = video_settings.get("start_frame")
end_frame_export = video_settings.get("end_frame")
last_exported_time = time.time()
Expand All @@ -881,7 +884,7 @@ def titlestring(sec, fps, mess):
digits_after_decimalpoint = 1
# Precision of the progress bar
format_of_progress_string = "%4.1f%% "
fps_encode = 0

# Write each frame in the selected range
for frame in range(video_settings.get("start_frame"), video_settings.get("end_frame") + 1):
# Update progress bar (emit signal to main window)
Expand Down
20 changes: 10 additions & 10 deletions src/windows/models/properties_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ def remove_keyframe(self, item):
if not c:
return

# Create reference
# Create reference
clip_data = c.data
if object_id:
clip_data = c.data.get('objects').get(object_id)

if property_key in clip_data: # Update clip attribute
log_id = "{}/{}".format(clip_id, object_id) if object_id else clip_id
log.debug("%s: remove %s keyframe. %s", log_id, property_key, clip_data.get(property_key))
Expand Down Expand Up @@ -281,7 +281,7 @@ def color_update(self, item, new_color, interpolation=-1, interpolation_details=
c = Effect.get(id=clip_id)

if c:
# Create reference
# Create reference
clip_data = c.data
if object_id:
clip_data = c.data.get('objects').get(object_id)
Expand All @@ -301,7 +301,7 @@ def color_update(self, item, new_color, interpolation=-1, interpolation_details=
# Keyframe
# Loop through points, find a matching points on this frame
found_point = False
for point in clip_data[property_key][color]["Points"]:
for point in clip_data[property_key][color].get("Points", []):
log.debug("looping points: co.X = %s" % point["co"]["X"])
if interpolation == -1 and point["co"]["X"] == self.frame_number:
# Found point, Update value
Expand Down Expand Up @@ -348,7 +348,7 @@ def color_update(self, item, new_color, interpolation=-1, interpolation_details=
if not found_point:
clip_updated = True
log.debug("Created new point at X=%d", self.frame_number)
clip_data[property_key][color]["Points"].append({
clip_data[property_key][color].setdefault("Points", []).append({
'co': {'X': self.frame_number, 'Y': new_value},
'interpolation': 1,
})
Expand All @@ -357,7 +357,7 @@ def color_update(self, item, new_color, interpolation=-1, interpolation_details=
clip_data = {property_key: clip_data[property_key]}
if object_id:
clip_data = {'objects': {object_id: clip_data}}

# Save changes
if clip_updated:
# Save
Expand Down Expand Up @@ -430,8 +430,8 @@ def value_updated(self, item, interpolation=-1, value=None, interpolation_detail
c = Effect.get(id=clip_id)

if c:
# Create reference

# Create reference
clip_data = c.data
if object_id:
clip_data = c.data.get('objects').get(object_id)
Expand All @@ -447,7 +447,7 @@ def value_updated(self, item, interpolation=-1, value=None, interpolation_detail
# Loop through points, find a matching points on this frame
found_point = False
point_to_delete = None
for point in clip_data[property_key]["Points"]:
for point in clip_data[property_key].get('Points', []):
log.debug("looping points: co.X = %s" % point["co"]["X"])
if interpolation == -1 and point["co"]["X"] == self.frame_number:
# Found point, Update value
Expand Down Expand Up @@ -503,7 +503,7 @@ def value_updated(self, item, interpolation=-1, value=None, interpolation_detail
elif not found_point and new_value is not None:
clip_updated = True
log.debug("Created new point at X=%d", self.frame_number)
clip_data[property_key]["Points"].append({
clip_data[property_key].setdefault('Points', []).append({
'co': {'X': self.frame_number, 'Y': new_value},
'interpolation': 1})

Expand Down
2 changes: 1 addition & 1 deletion src/windows/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def Populate(self, filter=""):
widget.setMinimum(int(param["min"]))
widget.setMaximum(int(param["max"]))
widget.setValue(int(param["value"]))
widget.setSingleStep(1.0)
widget.setSingleStep(1)
widget.setToolTip(param["title"])
widget.valueChanged.connect(functools.partial(self.spinner_value_changed, param))

Expand Down
Loading

0 comments on commit 5468a9a

Please sign in to comment.