Compare commits

...

6 Commits

Author SHA1 Message Date
0ec8b77554 pve 2025-10-24 05:26:42 +02:00
b6196c1d46 pve, pygl 2025-10-21 13:18:23 +02:00
fff635f5c2 pve, pygl 2025-10-21 11:08:13 +02:00
be3b56856d pyui 2025-10-18 05:47:01 +02:00
e803956d75 cleanup 2025-10-12 04:11:18 +02:00
d8ff18387f gl canvas and context 2025-10-12 03:31:39 +02:00
22 changed files with 706 additions and 186 deletions

53
pve.py
View File

@ -1,53 +0,0 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# People's Video Editor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
import multiprocessing
import cProfile
from pyav.demuxer import Demuxer
from pyav.decoder import Decoder
demuxer = Demuxer('test.mp4')
print(f"nb_streams = {demuxer.nb_streams}")
print(f"video codec = {demuxer.video_stream.codec.description()}")
print(f"audio codec = {demuxer.audio_stream.codec.description()}")
cpu_count = multiprocessing.cpu_count()
print(f"using {cpu_count} threads for video decoding")
video_decoder = Decoder(demuxer.video_stream, cpu_count)
audio_decoder = Decoder(demuxer.audio_stream, 1)
num_video_frames = 0
num_audio_frames = 0
with cProfile.Profile() as pr:
while True:
packet = demuxer.read_packet()
eof = (packet is None)
if eof or demuxer.video_stream.contains(packet):
video_frames = video_decoder.decode(packet)
num_video_frames += len(video_frames)
if eof or demuxer.audio_stream.contains(packet):
audio_frames = audio_decoder.decode(packet)
num_audio_frames += len(audio_frames)
if eof:
break
print(f"num video frames: {num_video_frames}, audio frames: {num_audio_frames}")
pr.print_stats()

15
pve/__init__.py Normal file
View File

@ -0,0 +1,15 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# People's Video Editor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.

100
pve/node.py Normal file
View File

@ -0,0 +1,100 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# People's Video Editor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from weakref import ref
class Node:
__slots__ = 'parent', 'children', 'state', '__weakref__'
STATE_NEW = 0
STATE_MODIFIED = 1
STATE_BUILT = 2
def __init__(self, parent = None, children = None):
self.parent = None
self.children = None
self.state = Node.STATE_NEW
if children is not None:
self.add_children(children)
if parent is not None:
parent.add_child(self)
def __del__(self):
if self.parent is not None:
self.parent().remove_child(self)
def add_child(self, child: Node):
assert child.parent is None
child.parent = ref(self)
if self.children is None:
self.children = [child]
else:
self.children.append(child)
child.state = Node.STATE_NEW
self.set_modified()
def add_children(self, children):
for child in children:
self.add_child(child)
def remove_child(self, child: Node):
assert child.parent is self
child.parent = None
self.children.remove(child)
self.set_modified()
def remove_children(self, children):
for child in children:
self.remove_child(child)
def is_new(self):
return self.state == Node.STATE_NEW
def needs_rebuilding(self):
return self.state != Node.STATE_BUILT
def set_modified(self):
if self.needs_rebuilding():
return
self.state = Node.STATE_MODIFIED
if self.parent is not None:
self.set_parent_modified(self.parent())
def set_parent_modified(self, parent):
parent.set_modified()
def rebuild(self):
if not self.needs_rebuilding():
return True
if self.children is not None:
if not self.rebuild_children(self.children):
return False
if not self.build():
return False
self.state = Node.STATE_BUILT
return True
def rebuild_children(self, children):
for child in children:
if not self.rebuild_child(child):
return False
return True
def rebuild_child(self, child):
return child.rebuild()
def build(self):
return True

131
pve/pixmap.py Normal file
View File

@ -0,0 +1,131 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# People's Video Editor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from fractions import Fraction
class Geometry:
__slots__ = '_width', '_height', '_ratio', '_size'
def __init__(self, width = 0, height = 0, ratio = None):
if width > 0 and height > 0:
assert ratio is None
self._width = width
self._height = height
self._ratio = Fraction(width, height).limit_denominator()
self._size = width * height
elif width > 0 and ratio:
self._width = width
self._height = round((width * ratio.numerator) / ratio.denominator)
self._ratio = ratio
self._size = width * self._height
elif height > 0 and ratio:
self._width = round((height * ratio.denominator) / ratio.numerator)
self._height = height
self._ratio = ratio
self._size = self._width * height
else:
raise ValueError
def __ge__(self, other):
return (self._width >= other._width and self._height >= other._height)
@property
def width(self):
return self._width
@property
def height(self):
return self._height
@property
def ratio(self):
return self._ratio
class Format:
__slots__ = '_channels', '_depth', '_type', '_size'
def __init__(self, channels, depth):
self._channels = channels
self._depth = depth
if depth == 8:
self._type = 'B'
self._size = channels
elif depth == 16:
self._type = 'H'
self._size = channels * 2
else:
raise ValueError
def __eq__(self, other):
return (self._channels == other._channels and self._depth == other._depth)
@property
def channels(self):
return self._channels
@property
def depth(self):
return self._depth
class Pixmap:
__slots__ = '_geometry', '_format', '_line_size', '_bytes', '_view'
def __init__(self, geometry, format):
self._geometry = geometry
self._format = format
self._line_size = geometry._width * format._size
self._bytes = bytearray(geometry._size * format._size)
self._view = memoryview(self._bytes)
def __del__(self):
del self._view
del self._bytes
@property
def geometry(self):
return self._geometry
@property
def width(self):
return self._geometry._width
@property
def height(self):
return self._geometry._height
@property
def ratio(self):
return self._geometry._ratio
@property
def format(self):
return self._format
@property
def channels(self):
return self._format._channels
@property
def depth(self):
return self._format._depth
@property
def line_size(self):
return self._line_size
@property
def view(self):
return self._view

107
pve/polygon.py Normal file
View File

@ -0,0 +1,107 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# People's Video Editor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from array import array
from .node import Node
from .vector import Vector2
class Point:
__slots__ = 'position', 'mapping'
def __init__(self, xy = Vector2(), uv = Vector2()):
assert isinstance(xy, Vector2) and isinstance(uv, Vector2)
self.position = xy
self.mapping = uv
class Polygon(Node):
__slots__ = '_positions', '_mappings', '_len'
@classmethod
def rectangle(cls, geometry):
tl = Vector2(0.0, 0.0)
tr = Vector2(geometry._width, 0.0)
br = Vector2(geometry._width, geometry._height)
bl = Vector2(0.0, geometry._height)
return cls(points = (
Point(tl, tl),
Point(tr, tr),
Point(br, br),
Point(bl, bl)))
def __init__(self, parent = None, children = None, size = 0, points = None):
Node.__init__(self, parent, children)
self.clear_points()
self.add_points(size, points)
def __len__(self):
return self._len
def __getitem__(self, index):
begin = index * 2
end = begin + 2
return Point(
Vector2(*self._positions[begin:end]),
Vector2(*self._mappings[begin:end]))
def __setitem__(self, index, point):
begin = index * 2
end = begin + 2
self._positions[begin:end] = array(Vector2.TYPE, point.position)
self._mappings[begin:end] = array(Vector2.TYPE, point.mapping)
def add_child(self, child):
assert isinstance(child, Polygon)
Node.add_child(self, child)
def add_points(self, count = 0, points = None):
assert (count > 0) ^ len(points)
if count:
initializer = bytes(count * Vector2.SIZE)
self._positions.frombytes(initializer)
self._mappings.frombytes(initializer)
self._len += count
else:
for point in points:
self._positions.extend(point.position)
self._mappings.extend(point.mapping)
self._len += len(points)
def insert_points(self, index, count = 0, points = None):
assert (count == 0) ^ (points is None)
index *= 2
if count:
initializer = array(Vector2.TYPE, bytes(count * Vector2.SIZE))
self._positions[index:index] = initializer
self._mappings[index:index] = initializer
self._len += count
else:
polygon = Polygon(points = points)
self._positions[index:index] = polygon._positions
self._mappings[index:index] = polygon._mappings
self._len += polygon._len
def remove_points(self, index, count = 1):
begin = index * 2
end = begin + count * 2
del self._positions[begin:end]
del self._mappings[begin:end]
self._len -= count
def clear_points(self):
self._positions = array(Vector2.TYPE)
self._mappings = array(Vector2.TYPE)
self._len = 0

26
pve/shape.py Normal file
View File

@ -0,0 +1,26 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# People's Video Editor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from .node import Node
class Shape(Node):
def __init__(self, parent = None, children = None):
Node.__init__(self, parent, children)
def rebuild(self):
#TODO
raise NotImplementedError

29
pve/vector.py Normal file
View File

@ -0,0 +1,29 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# People's Video Editor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
class Vector2:
__slots__ = 'x', 'y'
TYPE = 'f'
SIZE = 8
def __init__(self, x = 0.0, y = 0.0):
assert isinstance(x, float) and isinstance(y, float)
self.x = x
self.y = y
def __iter__(self):
return iter((self.x, self.y))

58
pve_editor.py Normal file
View File

@ -0,0 +1,58 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# People's Video Editor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from pyui.application import Application
application = Application()
application.MainLoop()
# import multiprocessing
# import cProfile
#
# from pyav.demuxer import Demuxer
# from pyav.decoder import Decoder
#
# demuxer = Demuxer('test.mp4')
#
# print(f"nb_streams = {demuxer.nb_streams}")
# print(f"video codec = {demuxer.video_stream.codec.description()}")
# print(f"audio codec = {demuxer.audio_stream.codec.description()}")
#
# cpu_count = multiprocessing.cpu_count()
#
# print(f"using {cpu_count} threads for video decoding")
#
# video_decoder = Decoder(demuxer.video_stream, cpu_count)
# audio_decoder = Decoder(demuxer.audio_stream, 1)
#
# num_video_frames = 0
# num_audio_frames = 0
#
# with cProfile.Profile() as pr:
# while True:
# packet = demuxer.read_packet()
# eof = (packet is None)
# if eof or demuxer.video_stream.contains(packet):
# video_frames = video_decoder.decode(packet)
# num_video_frames += len(video_frames)
# if eof or demuxer.audio_stream.contains(packet):
# audio_frames = audio_decoder.decode(packet)
# num_audio_frames += len(audio_frames)
# if eof:
# break
#
# print(f"num video frames: {num_video_frames}, audio frames: {num_audio_frames}")
# pr.print_stats()

View File

@ -19,4 +19,4 @@ shared_library_path="./pyav/libav"
absolute_shared_library_path=$(realpath ${shared_library_path}) absolute_shared_library_path=$(realpath ${shared_library_path})
LD_LIBRARY_PATH=${absolute_shared_library_path} \ LD_LIBRARY_PATH=${absolute_shared_library_path} \
python3 pve.py python3 pve_editor.py

15
pygl/__init__.py Normal file
View File

@ -0,0 +1,15 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# People's Video Editor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.

41
pygl/libgl/__init__.py Normal file
View File

@ -0,0 +1,41 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# People's Video Editor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
import ctypes
Texture_p = ctypes.c_void_p
VertexBuffer_p = ctypes.c_void_p
def create_texture(width, height, channels, depth):
return None
def delete_texture(texture):
pass
def upload_texture(texture, view, line_size):
pass
def dowload_texture(texture, view, line_size):
pass
def create_vertex_buffer(size, channels, elems):
return None
def delete_vertex_buffer(buffer):
pass
def upload_vertex_buffer(buffer, views, size):
pass

66
pygl/texture.py Normal file
View File

@ -0,0 +1,66 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# People's Video Editor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from . import libgl
class Texture:
__slots__ = '_geometry', '_format', '_texture'
def __init__(self, geometry, format):
self._geometry = geometry
self._format = format
self._texture = libgl.create_texture(geometry.width, geometry.height, format.channels, format.depth)
def __del__(self):
libgl.delete_texture(self._texture)
@property
def geometry(self):
return self._geometry
@property
def width(self):
return self._geometry._width
@property
def height(self):
return self._geometry._height
@property
def ratio(self):
return self._geometry._ratio
@property
def format(self):
return self._format
@property
def channels(self):
return self._format._channels
@property
def depth(self):
return self._format._depth
def upload(self, pixmap):
assert (self._format == pixmap.format)
assert (self._geometry >= pixmap.geometry)
return libgl.upload_texture(self._texture, pixmap.view, pixmap.line_size)
def download(self, pixmap):
assert (self._format == pixmap.format)
assert (self._geometry >= pixmap.geometry)
return libgl.upload_texture(self._texture, pixmap.view, pixmap.line_size)

35
pygl/vertexbuffer.py Normal file
View File

@ -0,0 +1,35 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# People's Video Editor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from . import libgl
class VertexBuffer:
__slots__ = '_buffer', '_size'
def __init__(self, size, channels, elems):
self._buffer = libgl.create_vertex_buffer(size, channels, elems)
self._size = size
def __del__(self):
libgl.delete_vertex_buffer(self._buffer)
@property
def size(self):
return self._size
def upload(self, mesh):
assert (self._size >= mesh.size)
return libgl.upload_vertex_buffer(self._buffer, mesh.views, mesh.size)

View File

@ -17,4 +17,12 @@
from . import mainframe_generated from . import mainframe_generated
class MainFrame(mainframe_generated.MainFrame): class MainFrame(mainframe_generated.MainFrame):
pass __slots__ = 'media_panel', 'preview_panel', 'navigation_panel', 'filter_panel', 'timeline_panel'
def __init__(self, parent):
mainframe_generated.MainFrame.__init__(self, parent)
self.media_panel = self._media_panel
self.preview_panel = self._preview_panel
self.navigation_panel = self._navigation_panel
self.filter_panel = self._filter_panel
self.timeline_panel = self._timeline_panel

View File

@ -48,7 +48,7 @@ class MainFrame ( wx.Frame ):
self.media_splitter.Bind( wx.EVT_IDLE, self.media_splitterOnIdle ) self.media_splitter.Bind( wx.EVT_IDLE, self.media_splitterOnIdle )
self.media_splitter.SetMinimumPaneSize( 100 ) self.media_splitter.SetMinimumPaneSize( 100 )
self.media_panel = wx.Panel( self.media_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self._media_panel = wx.Panel( self.media_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
self.right_panel = wx.Panel( self.media_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.right_panel = wx.Panel( self.media_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
right_sizer = wx.BoxSizer( wx.HORIZONTAL ) right_sizer = wx.BoxSizer( wx.HORIZONTAL )
@ -60,15 +60,15 @@ class MainFrame ( wx.Frame ):
self.center_panel = wx.Panel( self.filter_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self.center_panel = wx.Panel( self.filter_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
center_sizer = wx.BoxSizer( wx.VERTICAL ) center_sizer = wx.BoxSizer( wx.VERTICAL )
self.preview_panel = PreviewPanel( self.center_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self._preview_panel = PreviewPanel( self.center_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
center_sizer.Add( self.preview_panel, 1, wx.EXPAND | wx.ALL, 5 ) center_sizer.Add( self._preview_panel, 1, wx.EXPAND | wx.ALL, 5 )
self.navigation_panel = wx.Panel( self.center_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self._navigation_panel = wx.Panel( self.center_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
navigation_sizer = wx.BoxSizer( wx.VERTICAL ) navigation_sizer = wx.BoxSizer( wx.VERTICAL )
scrubber_sizer = wx.BoxSizer( wx.HORIZONTAL ) scrubber_sizer = wx.BoxSizer( wx.HORIZONTAL )
self.scrubber_slider = wx.Slider( self.navigation_panel, wx.ID_ANY, 50, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL ) self.scrubber_slider = wx.Slider( self._navigation_panel, wx.ID_ANY, 50, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL )
scrubber_sizer.Add( self.scrubber_slider, 1, wx.ALL, 5 ) scrubber_sizer.Add( self.scrubber_slider, 1, wx.ALL, 5 )
@ -76,7 +76,7 @@ class MainFrame ( wx.Frame ):
control_sizer = wx.BoxSizer( wx.HORIZONTAL ) control_sizer = wx.BoxSizer( wx.HORIZONTAL )
self.control_toolbar = wx.ToolBar( self.navigation_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TB_HORIZONTAL ) self.control_toolbar = wx.ToolBar( self._navigation_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TB_HORIZONTAL )
self.m_tool1 = self.control_toolbar.AddTool( wx.ID_ANY, _(u"tool"), wx.NullBitmap, wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None ) self.m_tool1 = self.control_toolbar.AddTool( wx.ID_ANY, _(u"tool"), wx.NullBitmap, wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None )
self.control_toolbar.Realize() self.control_toolbar.Realize()
@ -87,32 +87,32 @@ class MainFrame ( wx.Frame ):
navigation_sizer.Add( control_sizer, 0, wx.EXPAND, 5 ) navigation_sizer.Add( control_sizer, 0, wx.EXPAND, 5 )
self.navigation_panel.SetSizer( navigation_sizer ) self._navigation_panel.SetSizer( navigation_sizer )
self.navigation_panel.Layout() self._navigation_panel.Layout()
navigation_sizer.Fit( self.navigation_panel ) navigation_sizer.Fit( self._navigation_panel )
center_sizer.Add( self.navigation_panel, 0, wx.EXPAND | wx.ALL, 5 ) center_sizer.Add( self._navigation_panel, 0, wx.EXPAND | wx.ALL, 5 )
self.center_panel.SetSizer( center_sizer ) self.center_panel.SetSizer( center_sizer )
self.center_panel.Layout() self.center_panel.Layout()
center_sizer.Fit( self.center_panel ) center_sizer.Fit( self.center_panel )
self.filter_panel = wx.Panel( self.filter_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self._filter_panel = wx.Panel( self.filter_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
self.filter_splitter.SplitVertically( self.center_panel, self.filter_panel, -200 ) self.filter_splitter.SplitVertically( self.center_panel, self._filter_panel, -200 )
right_sizer.Add( self.filter_splitter, 1, wx.EXPAND, 5 ) right_sizer.Add( self.filter_splitter, 1, wx.EXPAND, 5 )
self.right_panel.SetSizer( right_sizer ) self.right_panel.SetSizer( right_sizer )
self.right_panel.Layout() self.right_panel.Layout()
right_sizer.Fit( self.right_panel ) right_sizer.Fit( self.right_panel )
self.media_splitter.SplitVertically( self.media_panel, self.right_panel, 200 ) self.media_splitter.SplitVertically( self._media_panel, self.right_panel, 200 )
top_sizer.Add( self.media_splitter, 1, wx.EXPAND, 5 ) top_sizer.Add( self.media_splitter, 1, wx.EXPAND, 5 )
self.top_panel.SetSizer( top_sizer ) self.top_panel.SetSizer( top_sizer )
self.top_panel.Layout() self.top_panel.Layout()
top_sizer.Fit( self.top_panel ) top_sizer.Fit( self.top_panel )
self.timeline_panel = wx.Panel( self.timeline_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) self._timeline_panel = wx.Panel( self.timeline_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
self.timeline_splitter.SplitHorizontally( self.top_panel, self.timeline_panel, -100 ) self.timeline_splitter.SplitHorizontally( self.top_panel, self._timeline_panel, -100 )
main_sizer.Add( self.timeline_splitter, 1, wx.EXPAND, 5 ) main_sizer.Add( self.timeline_splitter, 1, wx.EXPAND, 5 )

View File

@ -17,4 +17,14 @@
from . import preview_generated from . import preview_generated
class PreviewPanel(preview_generated.PreviewPanel): class PreviewPanel(preview_generated.PreviewPanel):
pass __slots__ = 'video_canvas'
def __init__(self, parent, id, pos, size, style):
preview_generated.PreviewPanel.__init__(self, parent, id = id, pos = pos, size = size, style = style)
self.video_canvas = self._video_canvas
def initdialog_event_handler(self, event):
self.video_canvas.SetCurrent(self.video_canvas.context)
def size_event_handler(self, event):
pass

View File

@ -7,7 +7,7 @@
## PLEASE DO *NOT* EDIT THIS FILE! ## PLEASE DO *NOT* EDIT THIS FILE!
########################################################################### ###########################################################################
from .video import VideoPanel from .video import VideoCanvas
import wx import wx
import wx.xrc import wx.xrc
@ -45,8 +45,8 @@ class PreviewPanel ( wx.Panel ):
centering_sizer.Add( ( 0, 0), 1, wx.EXPAND, 5 ) centering_sizer.Add( ( 0, 0), 1, wx.EXPAND, 5 )
self.video_panel = VideoPanel( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 400,300 ), wx.BORDER_NONE|wx.FULL_REPAINT_ON_RESIZE|wx.TAB_TRAVERSAL ) self._video_canvas = VideoCanvas( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 400,300 ), wx.BORDER_NONE|wx.FULL_REPAINT_ON_RESIZE|wx.TAB_TRAVERSAL )
centering_sizer.Add( self.video_panel, 0, wx.EXPAND, 5 ) centering_sizer.Add( self._video_canvas, 0, wx.EXPAND, 5 )
centering_sizer.Add( ( 0, 0), 1, wx.EXPAND, 5 ) centering_sizer.Add( ( 0, 0), 1, wx.EXPAND, 5 )
@ -64,7 +64,19 @@ class PreviewPanel ( wx.Panel ):
self.SetSizer( centering_sizer ) self.SetSizer( centering_sizer )
self.Layout() self.Layout()
# Connect Events
self.Bind( wx.EVT_INIT_DIALOG, self.initdialog_event_handler )
self.Bind( wx.EVT_SIZE, self.size_event_handler )
def __del__( self ): def __del__( self ):
pass pass
# Virtual event handlers, override them in your derived class
def initdialog_event_handler( self, event ):
pass
def size_event_handler( self, event ):
pass

View File

@ -23,11 +23,11 @@
<property name="php_disconnect_events">0</property> <property name="php_disconnect_events">0</property>
<property name="php_disconnect_mode">source_name</property> <property name="php_disconnect_mode">source_name</property>
<property name="php_skip_events">1</property> <property name="php_skip_events">1</property>
<property name="python_disconnect_events">1</property> <property name="python_disconnect_events">0</property>
<property name="python_disconnect_mode">source_name</property> <property name="python_disconnect_mode">source_name</property>
<property name="python_image_path_wrapper_function_name"></property> <property name="python_image_path_wrapper_function_name"></property>
<property name="python_indent_with_spaces">1</property> <property name="python_indent_with_spaces">1</property>
<property name="python_skip_events">1</property> <property name="python_skip_events">0</property>
<property name="relative_path">1</property> <property name="relative_path">1</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<property name="use_native_eol">0</property> <property name="use_native_eol">0</property>
@ -325,7 +325,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">media_panel</property> <property name="name">_media_panel</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
@ -343,8 +343,8 @@
<property name="window_style">wxTAB_TRAVERSAL</property> <property name="window_style">wxTAB_TRAVERSAL</property>
</object> </object>
</object> </object>
<object class="splitteritem" expanded="false"> <object class="splitteritem" expanded="true">
<object class="wxPanel" expanded="false"> <object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -396,16 +396,16 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property> <property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="false"> <object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">right_sizer</property> <property name="name">right_sizer</property>
<property name="orient">wxHORIZONTAL</property> <property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="false"> <object class="sizeritem" expanded="true">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxSplitterWindow" expanded="false"> <object class="wxSplitterWindow" expanded="true">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -463,8 +463,8 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<object class="splitteritem" expanded="false"> <object class="splitteritem" expanded="true">
<object class="wxPanel" expanded="false"> <object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -561,7 +561,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">preview_panel</property> <property name="name">_preview_panel</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
@ -619,7 +619,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">navigation_panel</property> <property name="name">_navigation_panel</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
@ -845,7 +845,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">filter_panel</property> <property name="name">_filter_panel</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
@ -910,7 +910,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">timeline_panel</property> <property name="name">_timeline_panel</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>

View File

@ -23,11 +23,11 @@
<property name="php_disconnect_events">0</property> <property name="php_disconnect_events">0</property>
<property name="php_disconnect_mode">source_name</property> <property name="php_disconnect_mode">source_name</property>
<property name="php_skip_events">1</property> <property name="php_skip_events">1</property>
<property name="python_disconnect_events">1</property> <property name="python_disconnect_events">0</property>
<property name="python_disconnect_mode">source_name</property> <property name="python_disconnect_mode">source_name</property>
<property name="python_image_path_wrapper_function_name"></property> <property name="python_image_path_wrapper_function_name"></property>
<property name="python_indent_with_spaces">1</property> <property name="python_indent_with_spaces">1</property>
<property name="python_skip_events">1</property> <property name="python_skip_events">0</property>
<property name="relative_path">1</property> <property name="relative_path">1</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<property name="use_native_eol">0</property> <property name="use_native_eol">0</property>
@ -55,6 +55,8 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style">wxBORDER_NONE|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL</property> <property name="window_style">wxBORDER_NONE|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL</property>
<event name="OnInitDialog">initdialog_event_handler</event>
<event name="OnSize">size_event_handler</event>
<object class="wxFlexGridSizer" expanded="true"> <object class="wxFlexGridSizer" expanded="true">
<property name="cols">3</property> <property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property> <property name="flexible_direction">wxBOTH</property>
@ -147,7 +149,7 @@
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">video_panel</property> <property name="name">_video_canvas</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
@ -157,7 +159,7 @@
<property name="resize">Resizable</property> <property name="resize">Resizable</property>
<property name="show">1</property> <property name="show">1</property>
<property name="size">400,300</property> <property name="size">400,300</property>
<property name="subclass">VideoPanel; .video; </property> <property name="subclass">VideoCanvas; .video; </property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>

View File

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="19"/>
<object class="Project" expanded="true">
<property name="code_generation">Python</property>
<property name="cpp_class_decoration">; </property>
<property name="cpp_disconnect_events">0</property>
<property name="cpp_event_generation">connect</property>
<property name="cpp_help_provider">none</property>
<property name="cpp_namespace"></property>
<property name="cpp_precompiled_header"></property>
<property name="cpp_use_array_enum">0</property>
<property name="cpp_use_enum">1</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="file">video_generated</property>
<property name="first_id">6000</property>
<property name="internationalize">1</property>
<property name="lua_skip_events">1</property>
<property name="lua_ui_table">UI</property>
<property name="name">video</property>
<property name="path">/home/roz/Dev/rk/rk_pve/pyui</property>
<property name="php_disconnect_events">0</property>
<property name="php_disconnect_mode">source_name</property>
<property name="php_skip_events">1</property>
<property name="python_disconnect_events">1</property>
<property name="python_disconnect_mode">source_name</property>
<property name="python_image_path_wrapper_function_name"></property>
<property name="python_indent_with_spaces">1</property>
<property name="python_skip_events">1</property>
<property name="relative_path">1</property>
<property name="use_microsoft_bom">0</property>
<property name="use_native_eol">0</property>
<object class="Panel" expanded="true">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="drag_accept_files">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">VideoPanel</property>
<property name="pos"></property>
<property name="size">400,300</property>
<property name="subclass">; ; forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxBORDER_NONE|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL</property>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -14,7 +14,16 @@
# You should have received a copy of the GNU General Public License along with People's Video Editor. # You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>. # If not, see <https://www.gnu.org/licenses/>.
from . import video_generated import wx
import wx.glcanvas
class VideoPanel(video_generated.VideoPanel): class VideoCanvas(wx.glcanvas.GLCanvas):
pass __slots__ = 'context'
def __init__(self, parent, id, pos, size, style):
wx.glcanvas.GLCanvas.__init__(self, parent, id = id, pos = pos, size = size, style = style, attribList =
wx.glcanvas.GLAttributes().PlatformDefaults().RGBA().FrameBuffersRGB().DoubleBuffer().EndList())
self.context = wx.glcanvas.GLContext(self, ctxAttrs =
wx.glcanvas.GLContextAttrs().CoreProfile().OGLVersion(4,6).EndList())
if not self.context.IsOK()):
raise RuntimeError("Failed to create GL Context")

View File

@ -1,31 +0,0 @@
# -*- coding: utf-8 -*-
###########################################################################
## Python code generated with wxFormBuilder (version 4.2.1-5faebfea)
## http://www.wxformbuilder.org/
##
## PLEASE DO *NOT* EDIT THIS FILE!
###########################################################################
import wx
import wx.xrc
import gettext
_ = gettext.gettext
###########################################################################
## Class VideoPanel
###########################################################################
class VideoPanel ( wx.Panel ):
def __init__( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 400,300 ), style = wx.BORDER_NONE|wx.FULL_REPAINT_ON_RESIZE|wx.TAB_TRAVERSAL, name = wx.EmptyString ):
wx.Panel.__init__ ( self, parent, id = id, pos = pos, size = size, style = style, name = name )
self.DragAcceptFiles( True )
def __del__( self ):
pass