gl canvas and context

This commit is contained in:
2025-10-12 03:01:18 +02:00
parent 26fbdce569
commit d8ff18387f
7 changed files with 42 additions and 102 deletions

View File

@ -17,4 +17,9 @@
from . import preview_generated
class PreviewPanel(preview_generated.PreviewPanel):
pass
def initdialog_event_handler(self, event):
self.video_panel.initialize()
def size_event_handler(self, event):
pass

View File

@ -7,7 +7,7 @@
## PLEASE DO *NOT* EDIT THIS FILE!
###########################################################################
from .video import VideoPanel
from .video import VideoCanvas
import wx
import wx.xrc
@ -45,7 +45,7 @@ class PreviewPanel ( wx.Panel ):
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_panel = 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 )
@ -64,7 +64,19 @@ class PreviewPanel ( wx.Panel ):
self.SetSizer( centering_sizer )
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 ):
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_mode">source_name</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_image_path_wrapper_function_name"></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="use_microsoft_bom">0</property>
<property name="use_native_eol">0</property>

View File

@ -23,11 +23,11 @@
<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_events">0</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="python_skip_events">0</property>
<property name="relative_path">1</property>
<property name="use_microsoft_bom">0</property>
<property name="use_native_eol">0</property>
@ -55,6 +55,8 @@
<property name="window_extra_style"></property>
<property name="window_name"></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">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
@ -157,7 +159,7 @@
<property name="resize">Resizable</property>
<property name="show">1</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="tooltip"></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,19 @@
# 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 video_generated
import wx
import wx.glcanvas
class VideoPanel(video_generated.VideoPanel):
pass
class VideoCanvas(wx.glcanvas.GLCanvas):
__slots__ = 'context'
def __init__(self, parent,
id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.TAB_TRAVERSAL):
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())
def initialize(self):
self.SetCurrent(self.context)
self.SwapBuffers()

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