Skip to content

Commit 1ceb931

Browse files
committed
timeline_webview: Make a lot of logs debug-level
1 parent 67532da commit 1ceb931

File tree

1 file changed

+42
-38
lines changed

1 file changed

+42
-38
lines changed

src/windows/views/timeline_webview.py

+42-38
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ def update_transition_data(self, transition_json, only_basic_props=True, ignore_
372372
existing_item.data["start"] = transition_data["start"]
373373
existing_item.data["end"] = transition_data["end"]
374374

375-
log.info('transition start: %s' % transition_data["start"])
376-
log.info('transition end: %s' % transition_data["end"])
375+
log.debug('transition start: %s' % transition_data["start"])
376+
log.debug('transition end: %s' % transition_data["end"])
377377

378378
if brightness:
379379
existing_item.data["brightness"] = brightness
@@ -395,7 +395,7 @@ def contextMenuEvent(self, event):
395395
# Javascript callable function to show clip or transition content menus, passing in type to show
396396
@pyqtSlot(float)
397397
def ShowPlayheadMenu(self, position=None):
398-
log.info('ShowPlayheadMenu: %s' % position)
398+
log.debug('ShowPlayheadMenu: %s' % position)
399399

400400
# Get translation method
401401
_ = get_app()._tr
@@ -429,7 +429,7 @@ def ShowPlayheadMenu(self, position=None):
429429

430430
@pyqtSlot(str)
431431
def ShowEffectMenu(self, effect_id=None):
432-
log.info('ShowEffectMenu: %s' % effect_id)
432+
log.debug('ShowEffectMenu: %s' % effect_id)
433433

434434
# Set the selected clip (if needed)
435435
self.window.addSelection(effect_id, 'effect', True)
@@ -445,7 +445,7 @@ def ShowEffectMenu(self, effect_id=None):
445445

446446
@pyqtSlot(float, int)
447447
def ShowTimelineMenu(self, position, layer_id):
448-
log.info('ShowTimelineMenu: position: %s, layer: %s' % (position, layer_id))
448+
log.debug('ShowTimelineMenu: position: %s, layer: %s' % (position, layer_id))
449449

450450
# Get translation method
451451
_ = get_app()._tr
@@ -469,7 +469,7 @@ def ShowTimelineMenu(self, position, layer_id):
469469

470470
@pyqtSlot(str)
471471
def ShowClipMenu(self, clip_id=None):
472-
log.info('ShowClipMenu: %s' % clip_id)
472+
log.debug('ShowClipMenu: %s' % clip_id)
473473

474474
# Get translation method
475475
_ = get_app()._tr
@@ -939,7 +939,7 @@ def ShowClipMenu(self, clip_id=None):
939939
return menu.popup(QCursor.pos())
940940

941941
def Transform_Triggered(self, action, clip_ids):
942-
log.info("Transform_Triggered")
942+
log.debug("Transform_Triggered")
943943

944944
# Emit signal to transform this clip (for the 1st clip id)
945945
if clip_ids:
@@ -1020,7 +1020,7 @@ def Thumbnail_Updated(self, clip_id):
10201020

10211021
def Split_Audio_Triggered(self, action, clip_ids):
10221022
"""Callback for split audio context menus"""
1023-
log.info("Split_Audio_Triggered")
1023+
log.debug("Split_Audio_Triggered")
10241024

10251025
# Get translation method
10261026
_ = get_app()._tr
@@ -1095,7 +1095,7 @@ def Split_Audio_Triggered(self, action, clip_ids):
10951095

10961096
# Loop through each channel
10971097
for channel in range(0, channels):
1098-
log.info("Adding clip for channel %s" % channel)
1098+
log.debug("Adding clip for channel %s" % channel)
10991099

11001100
# Each clip is filtered to a different channel
11011101
p = openshot.Point(1, channel, openshot.CONSTANT)
@@ -1159,7 +1159,7 @@ def Split_Audio_Triggered(self, action, clip_ids):
11591159

11601160
def Layout_Triggered(self, action, clip_ids):
11611161
"""Callback for the layout context menus"""
1162-
log.info(action)
1162+
log.debug(action)
11631163

11641164
# Loop through each selected clip
11651165
for clip_id in clip_ids:
@@ -1234,7 +1234,7 @@ def Layout_Triggered(self, action, clip_ids):
12341234

12351235
def Animate_Triggered(self, action, clip_ids, position="Entire Clip"):
12361236
"""Callback for the animate context menus"""
1237-
log.info(action)
1237+
log.debug(action)
12381238

12391239
# Loop through each selected clip
12401240
for clip_id in clip_ids:
@@ -1421,7 +1421,7 @@ def Animate_Triggered(self, action, clip_ids, position="Entire Clip"):
14211421

14221422
def Copy_Triggered(self, action, clip_ids, tran_ids):
14231423
"""Callback for copy context menus"""
1424-
log.info(action)
1424+
log.debug(action)
14251425

14261426
# Empty previous clipboard
14271427
self.copy_clipboard = {}
@@ -1493,7 +1493,7 @@ def Copy_Triggered(self, action, clip_ids, tran_ids):
14931493

14941494
def Paste_Triggered(self, action, position, layer_id, clip_ids, tran_ids):
14951495
"""Callback for paste context menus"""
1496-
log.info(action)
1496+
log.debug(action)
14971497

14981498
# Get list of clipboard items (that are complete clips or transitions)
14991499
# i.e. ignore partial clipboard items (keyframes / effects / etc...)
@@ -1605,7 +1605,7 @@ def Paste_Triggered(self, action, position, layer_id, clip_ids, tran_ids):
16051605

16061606
def Nudge_Triggered(self, action, clip_ids, tran_ids):
16071607
"""Callback for clip nudges"""
1608-
log.info("Nudging clip(s) and/or transition(s)")
1608+
log.debug("Nudging clip(s) and/or transition(s)")
16091609
left_edge = -1.0
16101610
right_edge = -1.0
16111611

@@ -1616,7 +1616,7 @@ def Nudge_Triggered(self, action, clip_ids, tran_ids):
16161616
nudgeDistance /= 2.0 # 1/2 frame
16171617
if abs(nudgeDistance) < 0.01:
16181618
nudgeDistance = 0.01 * action # nudge is less than the minimum of +/- 0.01s
1619-
log.info("Nudging by %s sec" % nudgeDistance)
1619+
log.debug("Nudging by %s sec" % nudgeDistance)
16201620

16211621
# Loop through each selected clip (find furthest left and right edge)
16221622
for clip_id in clip_ids:
@@ -1692,7 +1692,7 @@ def Nudge_Triggered(self, action, clip_ids, tran_ids):
16921692

16931693
def Align_Triggered(self, action, clip_ids, tran_ids):
16941694
"""Callback for alignment context menus"""
1695-
log.info(action)
1695+
log.debug(action)
16961696

16971697
left_edge = -1.0
16981698
right_edge = -1.0
@@ -1775,7 +1775,7 @@ def Align_Triggered(self, action, clip_ids, tran_ids):
17751775

17761776
def Fade_Triggered(self, action, clip_ids, position="Entire Clip"):
17771777
"""Callback for fade context menus"""
1778-
log.info(action)
1778+
log.debug(action)
17791779

17801780
# Get FPS from project
17811781
fps = get_app().project.get("fps")
@@ -2004,7 +2004,7 @@ def Slice_Triggered(self, action, clip_ids, trans_ids, playhead_position=0):
20042004

20052005
def Volume_Triggered(self, action, clip_ids, position="Entire Clip"):
20062006
"""Callback for volume context menus"""
2007-
log.info(action)
2007+
log.debug(action)
20082008

20092009
# Callback function, to redraw audio data after an update
20102010
def callback(self, clip_id, callback_data):
@@ -2141,7 +2141,7 @@ def callback(self, clip_id, callback_data):
21412141

21422142
def Rotate_Triggered(self, action, clip_ids, position="Start of Clip"):
21432143
"""Callback for rotate context menus"""
2144-
log.info(action)
2144+
log.debug(action)
21452145

21462146
# Loop through each selected clip
21472147
for clip_id in clip_ids:
@@ -2181,7 +2181,7 @@ def Rotate_Triggered(self, action, clip_ids, position="Start of Clip"):
21812181

21822182
def Time_Triggered(self, action, clip_ids, speed="1X", playhead_position=0.0):
21832183
"""Callback for time context menus"""
2184-
log.info(action)
2184+
log.debug(action)
21852185

21862186
# Get FPS from project
21872187
fps = get_app().project.get("fps")
@@ -2219,8 +2219,9 @@ def Time_Triggered(self, action, clip_ids, speed="1X", playhead_position=0.0):
22192219
if "original_data" in clip.data.keys():
22202220
original_duration = clip.data["original_data"]["duration"]
22212221

2222-
log.info('ORIGINAL DURATION: %s' % original_duration)
2223-
log.info(clip.data)
2222+
log.info('Updating timing for clip ID {}, original duration: {}'
2223+
.format(clip.id, original_duration))
2224+
log.debug(clip.data)
22242225

22252226
# Extend end & duration (due to freeze)
22262227
clip.data["end"] = float(clip.data["end"]) + freeze_seconds
@@ -2979,8 +2980,8 @@ def callback(self, effect_names, callback_data):
29792980
<= js_position
29802981
<= clip.data["position"] + (clip.data["end"] - clip.data["start"])
29812982
):
2982-
log.info("Applying effect to clip")
2983-
log.info(clip)
2983+
log.info("Applying effect {} to clip ID {}".format(name, clip.id))
2984+
log.debug(clip)
29842985

29852986
# Create Effect
29862987
effect = openshot.EffectInfo().CreateEffect(name)
@@ -3015,6 +3016,9 @@ def dragMoveEvent(self, event):
30153016
def dropEvent(self, event):
30163017
log.info("Dropping item on timeline - item_id: %s, item_type: %s" % (self.item_id, self.item_type))
30173018

3019+
# Accept event
3020+
event.accept()
3021+
30183022
# Get position of cursor
30193023
pos = event.posF()
30203024

@@ -3034,28 +3038,31 @@ def dropEvent(self, event):
30343038
# Add clips for each file dropped
30353039
for uri in event.mimeData().urls():
30363040
filepath = uri.toLocalFile()
3037-
if os.path.exists(filepath) and os.path.isfile(filepath):
3038-
# Valid file, so create clip for it
3039-
log.info('Adding clip for {}'.format(os.path.basename(filepath)))
3040-
for file in File.filter(path=filepath):
3041-
# Insert clip for this file at this position
3042-
self.addClip([file.id], pos)
3041+
if not os.path.exists(filepath) or not os.path.isfile(filepath):
3042+
continue
3043+
3044+
# Valid file, so create clip for it
3045+
log.debug('Adding clip for {}'.format(os.path.basename(filepath)))
3046+
for file in File.filter(path=filepath):
3047+
# Insert clip for this file at this position
3048+
self.addClip([file.id], pos)
30433049

30443050
# Clear new clip
30453051
self.new_item = False
30463052
self.item_type = None
30473053
self.item_id = None
30483054

3049-
# Accept event
3050-
event.accept()
3051-
30523055
# Update the preview and reselct current frame in properties
30533056
get_app().window.refreshFrameSignal.emit()
30543057
get_app().window.propertyTableView.select_frame(self.window.preview_thread.player.Position())
30553058

30563059
def dragLeaveEvent(self, event):
30573060
"""A drag is in-progress and the user moves mouse outside of timeline"""
3058-
log.info('dragLeaveEvent - Undo drop')
3061+
log.debug('dragLeaveEvent - Undo drop')
3062+
3063+
# Accept event
3064+
event.accept()
3065+
30593066
if self.item_type == "clip":
30603067
get_app().window.actionRemoveClip.trigger()
30613068
elif self.item_type == "transition":
@@ -3066,12 +3073,9 @@ def dragLeaveEvent(self, event):
30663073
self.item_type = None
30673074
self.item_id = None
30683075

3069-
# Accept event
3070-
event.accept()
3071-
30723076
def redraw_audio_onTimeout(self):
30733077
"""Timer is ready to redraw audio (if any)"""
3074-
log.info('redraw_audio_onTimeout')
3078+
log.debug('redraw_audio_onTimeout')
30753079

30763080
# Stop timer
30773081
self.redraw_audio_timer.stop()

0 commit comments

Comments
 (0)