本文整理汇总了Python中pitivi.ui.zoominterface.Zoomable.nsToPixel方法的典型用法代码示例。如果您正苦于以下问题:Python Zoomable.nsToPixel方法的具体用法?Python Zoomable.nsToPixel怎么用?Python Zoomable.nsToPixel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pitivi.ui.zoominterface.Zoomable
的用法示例。
在下文中一共展示了Zoomable.nsToPixel方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_simple_update
# 需要导入模块: from pitivi.ui.zoominterface import Zoomable [as 别名]
# 或者: from pitivi.ui.zoominterface.Zoomable import nsToPixel [as 别名]
def do_simple_update(self, cr):
cr.identity_matrix()
if self.element.factory:
border_width = self.previewer._spacing()
self.bounds = goocanvas.Bounds(border_width, 4,
max(0, Zoomable.nsToPixel(self.element.duration) -
border_width), self.height)
示例2: do_size_allocate
# 需要导入模块: from pitivi.ui.zoominterface import Zoomable [as 别名]
# 或者: from pitivi.ui.zoominterface.Zoomable import nsToPixel [as 别名]
def do_size_allocate(self, allocation):
self.debug("ScaleRuler got %s", list(allocation))
gtk.Layout.do_size_allocate(self, allocation)
width = max(self.getMaxDurationWidth(), allocation.width)
self.debug("Setting layout size to %d x %d",
width, allocation.height)
self.set_size(width, allocation.height)
new_pos = Zoomable.nsToPixel(self.position) -\
self.pixel_position_offset
self.hadj.set_value(new_pos)
# the size has changed, therefore we want to redo our pixmap
self.doPixmap()
示例3: render_cairo
# 需要导入模块: from pitivi.ui.zoominterface import Zoomable [as 别名]
# 或者: from pitivi.ui.zoominterface.Zoomable import nsToPixel [as 别名]
def render_cairo(self, cr, bounds, element, hscroll_pos, y1):
if not self._view:
return
# The idea is to conceptually divide the clip into a sequence of
# rectangles beginning at the start of the file, and
# pixelsToNs(twidth) nanoseconds long. The thumbnail within the
# rectangle is the frame produced from the timestamp corresponding to
# rectangle's left edge. We speed things up by only drawing the
# rectangles which intersect the given bounds. FIXME: how would we
# handle timestretch?
height = bounds.y2 - bounds.y1
width = bounds.x2 - bounds.x1
# we actually draw the rectangles just to the left of the clip's in
# point and just to the right of the clip's out-point, so we need to
# mask off the actual bounds.
cr.rectangle(bounds.x1, bounds.y1, width, height)
cr.clip()
# tdur = duration in ns of thumbnail
# sof = start of file in pixel coordinates
x1 = bounds.x1
sof = Zoomable.nsToPixel(element.start - element.in_point) +\
hscroll_pos
# i = left edge of thumbnail to be drawn. We start with x1 and
# subtract the distance to the nearest leftward rectangle.
# Justification of the following:
# i = sof + k * twidth
# i = x1 - delta
# sof + k * twidth = x1 - delta
# i * tw = (x1 - sof) - delta
# <=> delta = x1 - sof (mod twidth).
# Fortunately for us, % works on floats in python.
i = x1 - ((x1 - sof) % (self.twidth + self._spacing()))
# j = timestamp *within the element* of thumbnail to be drawn. we want
# timestamps to be numerically stable, but in practice this seems to
# give good enough results. It might be possible to improve this
# further, which would result in fewer thumbnails needing to be
# generated.
j = Zoomable.pixelToNs(i - sof)
istep = self.twidth + self._spacing()
jstep = self.tdur + Zoomable.pixelToNs(self.spacing)
while i < bounds.x2:
self._thumbForTime(cr, j, i, y1)
cr.rectangle(i - 1, y1, self.twidth + 2, self.theight)
i += istep
j += jstep
cr.fill()
示例4: drawBackground
# 需要导入模块: from pitivi.ui.zoominterface import Zoomable [as 别名]
# 或者: from pitivi.ui.zoominterface.Zoomable import nsToPixel [as 别名]
def drawBackground(self, allocation):
self.pixmap.draw_rectangle(
self.style.bg_gc[gtk.STATE_NORMAL],
True,
0, 0,
allocation.width, allocation.height)
offset = int(Zoomable.nsToPixel(self.getShadedDuration())) - self.pixmap_offset
if offset > 0:
self.pixmap.draw_rectangle(
self.style.bg_gc[gtk.STATE_ACTIVE],
True,
0, 0,
int(offset),
int(allocation.height))
示例5: twidth
# 需要导入模块: from pitivi.ui.zoominterface import Zoomable [as 别名]
# 或者: from pitivi.ui.zoominterface.Zoomable import nsToPixel [as 别名]
def twidth(self):
return Zoomable.nsToPixel(self.tdur)
示例6: _request_size
# 需要导入模块: from pitivi.ui.zoominterface import Zoomable [as 别名]
# 或者: from pitivi.ui.zoominterface.Zoomable import nsToPixel [as 别名]
def _request_size(self):
alloc = self.get_allocation()
w = Zoomable.nsToPixel(self.max_duration)
h = max(self._height, alloc.height)
self.set_bounds(0, 0, w, h)
self._playhead.props.height = h + 10
示例7: _hadjValueChangedCb
# 需要导入模块: from pitivi.ui.zoominterface import Zoomable [as 别名]
# 或者: from pitivi.ui.zoominterface.Zoomable import nsToPixel [as 别名]
def _hadjValueChangedCb(self, hadj):
self.pixel_position_offset = Zoomable.nsToPixel(self.position) - hadj.get_value()