Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
7df78c9f
Commit
7df78c9f
authored
Sep 22, 2006
by
Olivier Aubert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mediacontrol-python: implement a VLCWidget/DecoratedVLCWidget for python-gtk
parent
bac2218e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
1 deletion
+113
-1
bindings/mediacontrol-python/Makefile.am
bindings/mediacontrol-python/Makefile.am
+1
-1
bindings/mediacontrol-python/vlcwidget.py
bindings/mediacontrol-python/vlcwidget.py
+112
-0
No files found.
bindings/mediacontrol-python/Makefile.am
View file @
7df78c9f
...
...
@@ -2,7 +2,7 @@
# Building the Python binding
###############################################################################
EXTRA_DIST
=
vlcglue.h setup.py vlcwrapper.py
\
EXTRA_DIST
=
vlcglue.h setup.py vlcwrapper.py
vlcwidget.py
\
vlc_module.c vlc_object.c
\
vlc_mediacontrol.c vlc_position.c
\
vlc_instance.c vlc_input.c
...
...
bindings/mediacontrol-python/vlcwidget.py
0 → 100755
View file @
7df78c9f
#! /usr/bin/python
"""VLC Widget classes.
This module provides two helper classes, to ease the embedding of a
VLC component inside a pygtk application.
VLCWidget is a simple VLC widget.
DecoratedVLCWidget provides simple player controls.
"""
import
gtk
import
sys
import
vlc
from
gettext
import
gettext
as
_
class
VLCWidget
(
gtk
.
DrawingArea
):
"""Simple VLC widget.
Its player can be controlled through the 'player' attribute, which
is a MediaControl instance.
"""
def
__init__
(
self
,
*
p
):
gtk
.
DrawingArea
.
__init__
(
self
)
self
.
player
=
vlc
.
MediaControl
(
*
p
)
def
handle_embed
(
*
p
):
if
sys
.
platform
==
'win32'
:
xidattr
=
'handle'
else
:
xidattr
=
'xid'
self
.
player
.
set_visual
(
getattr
(
self
.
window
,
xidattr
))
return
True
self
.
connect
(
"map-event"
,
handle_embed
)
self
.
set_size_request
(
320
,
200
)
class
DecoratedVLCWidget
(
gtk
.
VBox
):
"""Decorated VLC widget.
VLC widget decorated with a player control toolbar.
Its player can be controlled through the 'player' attribute, which
is a MediaControl instance.
"""
def
__init__
(
self
,
*
p
):
gtk
.
VBox
.
__init__
(
self
)
self
.
_vlc_widget
=
VLCWidget
(
*
p
)
self
.
player
=
self
.
_vlc_widget
.
player
self
.
pack_start
(
self
.
_vlc_widget
,
expand
=
True
)
self
.
_toolbar
=
self
.
get_player_control_toolbar
()
self
.
pack_start
(
self
.
_toolbar
,
expand
=
False
)
def
get_player_control_toolbar
(
self
):
"""Return a player control toolbar
"""
tb
=
gtk
.
Toolbar
()
tb
.
set_style
(
gtk
.
TOOLBAR_ICONS
)
def
on_play
(
b
):
self
.
player
.
start
(
0
)
return
True
def
on_stop
(
b
):
self
.
player
.
stop
(
0
)
return
True
def
on_pause
(
b
):
self
.
player
.
pause
(
0
)
return
True
tb_list
=
(
(
_
(
"Play"
),
_
(
"Play"
),
gtk
.
STOCK_MEDIA_PLAY
,
on_play
),
(
_
(
"Pause"
),
_
(
"Pause"
),
gtk
.
STOCK_MEDIA_PAUSE
,
on_pause
),
(
_
(
"Stop"
),
_
(
"Stop"
),
gtk
.
STOCK_MEDIA_STOP
,
on_stop
),
)
for
text
,
tooltip
,
stock
,
callback
in
tb_list
:
b
=
gtk
.
ToolButton
(
stock
)
b
.
connect
(
"clicked"
,
callback
)
tb
.
insert
(
b
,
-
1
)
tb
.
show_all
()
return
tb
class
VideoPlayer
:
"""Example video player.
"""
def
__init__
(
self
):
self
.
vlc
=
DecoratedVLCWidget
()
def
main
(
self
,
fname
):
self
.
vlc
.
player
.
playlist_add_item
(
fname
)
self
.
popup
()
gtk
.
main
()
def
popup
(
self
):
w
=
gtk
.
Window
()
w
.
add
(
self
.
vlc
)
w
.
show_all
()
w
.
connect
(
"destroy"
,
gtk
.
main_quit
)
return
w
if
__name__
==
'__main__'
:
if
not
sys
.
argv
[
1
:]:
print
"You must provide a movie filename"
sys
.
exit
(
1
)
p
=
VideoPlayer
()
p
.
main
(
sys
.
argv
[
1
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment