Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travis CI Integration, Zoom fixes, and undo/redo fixes #2084

Merged
merged 15 commits into from
Sep 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
language: cpp
dist: trusty

before_install:
- sudo add-apt-repository ppa:openshot.developers/libopenshot-daily -y
- sudo apt-get update -qq
- sudo apt-get install gcc-4.8 xvfb tar cmake libopenshot-dev libopenshot-audio-dev libunittest++-dev swig doxygen doxypy libssl-dev python3 python3-dev python3-pip python3-pyqt5 python3-setuptools python3-openshot python3-pyqt5 python3-pyqt5.qtmultimedia python3-pyqt5.qtopengl python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-requests python3-xdg python3-zmq qttranslations5-l10n -y
- sudo apt autoremove -y
- wget https://files.pythonhosted.org/packages/d0/6d/9492644452727094543575de9846af5a2b9c764f760e2d414af7c876618c/cx_Freeze-5.0.1.tar.gz
- tar xf cx_Freeze-5.0.1.tar.gz
- cd cx_Freeze-5.0.1; python3 setup.py build; sudo python3 setup.py install; cd ..;
- pwd

script:
- python3 freeze.py build;
- xvfb-run --auto-servernum --server-num=1 --server-args "-screen 0 1920x1080x24" python3 src/tests/query_tests.py

notifications:
email: true

env:
global:
- TRAVIS_LIBOPENSHOT=TEST
- LANG="en_US.UTF-8"
17 changes: 9 additions & 8 deletions src/classes/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ def zoomToSeconds(zoomValue):

def secondsToZoom(scaleValue):
""" Convert a number of seconds to a timeline zoom factor """
# Find closest zoom or exact match
closestValue = zoomSeconds[0]
for zoomValue in zoomSeconds:
if zoomValue > scaleValue:
break;
closestValue = zoomValue
return zoomSeconds.index(closestValue)

if scaleValue in zoomSeconds:
return zoomSeconds.index(scaleValue)
else:
# Find closest zoom
closestValue = zoomSeconds[0]
for zoomValue in zoomSeconds:
if zoomValue < scaleValue:
closestValue = zoomValue
return zoomSeconds.index(closestValue)
26 changes: 15 additions & 11 deletions src/classes/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,17 @@ def json(self, is_array=False, only_value=False):

# Build the dictionary to be serialized
if only_value:
data_dict = self.values
data_dict = copy.deepcopy(self.values)
else:
data_dict = {"type": self.type,
"key": self.key,
"value": self.values,
"value": copy.deepcopy(self.values),
"partial": self.partial_update,
"old_values": self.old_values}
"old_values": copy.deepcopy(self.old_values)}

# Always remove 'history' key (if found)
if "history" in data_dict:
data_dict.pop("history")

if not is_array:
# Use a JSON Object as the root object
Expand Down Expand Up @@ -126,13 +130,15 @@ def load_history(self, project):

# Loop through each, and load serialized data into updateAction objects
for actionDict in history.get("redo", []):
action = UpdateAction()
action.load_json(json.dumps(actionDict))
self.redoHistory.append(action)
if "history" not in actionDict.keys():
action = UpdateAction()
action.load_json(json.dumps(actionDict))
self.redoHistory.append(action)
for actionDict in history.get("undo", []):
action = UpdateAction()
action.load_json(json.dumps(actionDict))
self.actionHistory.append(action)
if "history" not in actionDict.keys():
action = UpdateAction()
action.load_json(json.dumps(actionDict))
self.actionHistory.append(action)

# Notify watchers of new status
self.update_watchers()
Expand Down Expand Up @@ -268,8 +274,6 @@ def load(self, values):

self.last_action = UpdateAction('load', '', values)
self.redoHistory.clear()
if not self.ignore_history:
self.actionHistory.append(self.last_action)
self.dispatch_action(self.last_action)

# Perform new actions, clearing redo history for taking a new path
Expand Down
2 changes: 1 addition & 1 deletion src/settings/_default.project
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"import_path": "",
"files": [],
"duration": 300,
"scale": 16,
"scale": 15,
"tick_pixels": 100,
"playhead_position": 0,
"profile": "HDV 720 24p",
Expand Down
2 changes: 1 addition & 1 deletion src/windows/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -2069,7 +2069,7 @@ def setup_toolbars(self):
self.timelineToolbar.addSeparator()

# Get project's initial zoom value
initial_scale = get_app().project.get(["scale"]) or 16
initial_scale = get_app().project.get(["scale"]) or 15
# Round non-exponential scale down to next lowest power of 2
initial_zoom = secondsToZoom(initial_scale)

Expand Down
4 changes: 3 additions & 1 deletion src/windows/views/timeline_webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def changed(self, action):
# Reset the scale when loading new JSON
if action.type == "load":
# Set the scale again (to project setting)
initial_scale = get_app().project.get(["scale"]) or 16
initial_scale = get_app().project.get(["scale"]) or 15
get_app().window.sliderZoom.setValue(secondsToZoom(initial_scale))

# Javascript callable function to update the project data when a clip changes
Expand Down Expand Up @@ -2565,7 +2565,9 @@ def update_zoom(self, newValue):
self.redraw_audio_timer.start()

# Save current zoom
get_app().updates.ignore_history = True
get_app().updates.update(["scale"], newScale)
get_app().updates.ignore_history = False

def keyPressEvent(self, event):
""" Keypress callback for timeline """
Expand Down