openshot.code team mailing list archive
-
openshot.code team
-
Mailing list archive
-
Message #00478
[Branch ~openshot.code/openshot/main] Rev 671: When zooiming in the timline, center around the playhead to prevent the playhead from disappearin...
------------------------------------------------------------
revno: 671
fixes bug: https://launchpad.net/bugs/499730
committer: Andy Finch <we.rocked.in79@xxxxxxxxx>
branch nick: openshot
timestamp: Sat 2012-05-19 22:03:16 +0100
message:
When zooiming in the timline, center around the playhead to prevent the playhead from disappearing off to the right.
modified:
openshot/windows/MainGTK.py
--
lp:openshot
https://code.launchpad.net/~openshot.code/openshot/main
Your team OpenShot Code is subscribed to branch lp:openshot.
To unsubscribe from this branch go to https://code.launchpad.net/~openshot.code/openshot/main/+edit-subscription
=== modified file 'openshot/windows/MainGTK.py'
--- openshot/windows/MainGTK.py 2012-05-06 20:50:56 +0000
+++ openshot/windows/MainGTK.py 2012-05-19 21:03:16 +0000
@@ -1503,7 +1503,6 @@
self.hscrollbar2.get_adjustment().set_page_size(self.timeline_scrolled_window_width)
def on_frmMain_delete_event(self, widget, *args):
-
# get correct gettext method
_ = self._
@@ -2402,8 +2401,22 @@
# subtract 5 units
self.hsZoom.set_value(zoom_slider - 2)
+ self.center_playhead()
-
+ def center_playhead(self):
+ # get current scroll position
+ current_scroll_pixels = self.hscrollbar2.get_value()
+ # get playhead position
+ pixels_per_second = self.project.sequences[0].get_pixels_per_second()
+ playhead_time = self.project.sequences[0].play_head_position
+ playhead_pixels = playhead_time * pixels_per_second
+
+ # get the middle of the window
+ screen_width = (self.width / 2) - 100
+
+ if playhead_pixels > (current_scroll_pixels + screen_width):
+ # scroll to last scroll position
+ self.hscrollbar2.set_value(playhead_pixels - screen_width)
def on_btnZoomOu_clicked(self, widget, *args):
@@ -2431,8 +2444,7 @@
elif zoom_slider <= 11:
# add 2 units
- self.hsZoom.set_value(zoom_slider + 2)
-
+ self.hsZoom.set_value(zoom_slider + 2)
def on_hsZoom_value_changed(self, widget, *args):
@@ -2459,7 +2471,8 @@
self.project.Render()
# scroll to last scroll position
- self.scroll_to_last(current_scroll_time)
+ self.scroll_to_last(current_scroll_time)
+
def on_hsZoom_change_value(self, widget, *args):
@@ -2490,20 +2503,7 @@
if self.MyVideo.isPlaying:
- # get current scroll position
- current_scroll_pixels = self.hscrollbar2.get_value()
-
- # get playhead position
- pixels_per_second = self.project.sequences[0].get_pixels_per_second()
- playhead_time = self.project.sequences[0].play_head_position
- playhead_pixels = playhead_time * pixels_per_second
-
- # get the middle of the window
- screen_width = (self.width / 2) - 100
-
- if playhead_pixels > (current_scroll_pixels + screen_width):
- # scroll to last scroll position
- self.hscrollbar2.set_value(playhead_pixels - screen_width)
+ self.center_playhead()
def on_tlbResize_toggled(self, widget, *args):