Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
00048eb9
Commit
00048eb9
authored
May 27, 2004
by
Olivier Aubert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup to prepare CORBA module update
parent
782abd5e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
0 additions
and
789 deletions
+0
-789
modules/control/corba/MediaControl.idl
modules/control/corba/MediaControl.idl
+0
-0
modules/control/corba/client.py
modules/control/corba/client.py
+0
-34
modules/control/corba/launch-vlc-corba
modules/control/corba/launch-vlc-corba
+0
-7
modules/control/corba/pyorbit-1.99.3.patch
modules/control/corba/pyorbit-1.99.3.patch
+0
-48
modules/control/corba/simpleplayer.glade
modules/control/corba/simpleplayer.glade
+0
-402
modules/control/corba/simpleplayer.py
modules/control/corba/simpleplayer.py
+0
-298
No files found.
modules/control/corba/
mediac
ontrol.idl
→
modules/control/corba/
MediaC
ontrol.idl
View file @
00048eb9
File moved
modules/control/corba/client.py
deleted
100644 → 0
View file @
782abd5e
#! /usr/bin/python
# Simple CLI client for the corba module of vlc. Depends on pyorbit.
# Best used with IPython (completion, ...)
import
sys
import
ORBit
,
CORBA
def
quit
():
try
:
mc
.
exit
()
except
:
pass
print
"IDL loading"
ORBit
.
load_typelib
(
"./MediaControl.so"
)
import
VLC
if
len
(
sys
.
argv
)
<
1
:
print
"Usage: %s"
%
sys
.
argv
[
0
]
sys
.
exit
(
1
)
print
"ORB initialization"
orb
=
CORBA
.
ORB_init
()
ior
=
open
(
"/tmp/vlc-ior.ref"
).
readline
()
mc
=
orb
.
string_to_object
(
ior
)
print
"Object mc %s"
%
mc
pos
=
mc
.
get_media_position
(
0
,
0
)
print
"pos = mc.get_media_position (0,0)"
print
pos
modules/control/corba/launch-vlc-corba
deleted
100644 → 0
View file @
782abd5e
#! /bin/sh
# Helper prog
VLCPATH
=
/usr/local/src/vlc
cd
$VLCPATH
${
VLCPATH
}
/vlc
--intf
corba &
exit
0
modules/control/corba/pyorbit-1.99.3.patch
deleted
100644 → 0
View file @
782abd5e
--- pyorbit-1.99.3/src/pycorba-orb.c 2002-11-16 07:51:41.000000000 +0100
+++ pyorbit-1.99.3-modif/src/pycorba-orb.c 2003-01-22 14:43:30.000000000 +0100
@@ -154,6 +154,36 @@
return Py_None;
}
+static PyObject *
+pycorba_orb_work_pending(PyCORBA_ORB *self)
+{
+ CORBA_boolean ret;
+ CORBA_Environment ev;
+ PyObject *py_ret;
+
+ CORBA_exception_init(&ev);
+ ret = CORBA_ORB_work_pending (self->orb, &ev);
+
+ if (pyorbit_check_ex(&ev))
+ return NULL;
+ py_ret = ret ? Py_True : Py_False;
+ Py_INCREF(py_ret);
+ return py_ret;
+}
+
+static PyObject *
+pycorba_orb_perform_work (PyCORBA_ORB *self)
+{
+ CORBA_Environment ev;
+
+ CORBA_exception_init(&ev);
+ CORBA_ORB_perform_work (self->orb, &ev);
+ if (pyorbit_check_ex(&ev))
+ return NULL;
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
static PyMethodDef pycorba_orb_methods[] = {
{ "object_to_string", (PyCFunction)pycorba_orb_object_to_string, METH_VARARGS },
{ "string_to_object", (PyCFunction)pycorba_orb_string_to_object, METH_VARARGS },
@@ -161,6 +191,8 @@
{ "resolve_initial_references", (PyCFunction)pycorba_orb_resolve_initial_references, METH_VARARGS },
{ "run", (PyCFunction)pycorba_orb_run, METH_NOARGS },
{ "shutdown", (PyCFunction)pycorba_orb_shutdown, METH_VARARGS },
+ { "work_pending", (PyCFunction)pycorba_orb_work_pending, METH_VARARGS },
+ { "perform_work", (PyCFunction)pycorba_orb_perform_work, METH_VARARGS },
{ NULL, NULL, 0 }
};
modules/control/corba/simpleplayer.glade
deleted
100644 → 0
View file @
782abd5e
<?xml version="1.0" standalone="no"?>
<!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget
class=
"GtkWindow"
id=
"win"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"title"
translatable=
"yes"
>
DVD Annote
</property>
<property
name=
"type"
>
GTK_WINDOW_TOPLEVEL
</property>
<property
name=
"window_position"
>
GTK_WIN_POS_NONE
</property>
<property
name=
"modal"
>
False
</property>
<property
name=
"resizable"
>
True
</property>
<property
name=
"destroy_with_parent"
>
False
</property>
<signal
name=
"delete_event"
handler=
"on_exit"
object=
"win"
last_modification_time=
"Mon, 27 Jan 2003 14:07:29 GMT"
/>
<signal
name=
"key_press_event"
handler=
"on_win_key_press_event"
last_modification_time=
"Mon, 17 Feb 2003 16:23:35 GMT"
/>
<child>
<widget
class=
"GtkVBox"
id=
"vbox1"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"homogeneous"
>
False
</property>
<property
name=
"spacing"
>
0
</property>
<child>
<widget
class=
"GtkMenuBar"
id=
"menubar"
>
<property
name=
"visible"
>
True
</property>
<child>
<widget
class=
"GtkMenuItem"
id=
"menuitem1"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
_File
</property>
<property
name=
"use_underline"
>
True
</property>
<child>
<widget
class=
"GtkMenu"
id=
"menuitem1_menu"
>
<child>
<widget
class=
"GtkImageMenuItem"
id=
"quit1"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
>
gtk-quit
</property>
<property
name=
"use_stock"
>
True
</property>
<signal
name=
"activate"
handler=
"on_exit"
last_modification_time=
"Mon, 27 Jan 2003 14:07:57 GMT"
/>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget
class=
"GtkMenuItem"
id=
"menuitem4"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
_Help
</property>
<property
name=
"use_underline"
>
True
</property>
<child>
<widget
class=
"GtkMenu"
id=
"menuitem4_menu"
>
<child>
<widget
class=
"GtkMenuItem"
id=
"about1"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
_About
</property>
<property
name=
"use_underline"
>
True
</property>
<signal
name=
"activate"
handler=
"on_about1_activate"
last_modification_time=
"Mon, 27 Jan 2003 14:07:57 GMT"
/>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property
name=
"padding"
>
0
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
</packing>
</child>
<child>
<widget
class=
"GtkHButtonBox"
id=
"hbuttonbox2"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"layout_style"
>
GTK_BUTTONBOX_SPREAD
</property>
<property
name=
"spacing"
>
0
</property>
<child>
<widget
class=
"GtkButton"
id=
"b_rewind"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"tooltip"
translatable=
"yes"
>
Rewind
</property>
<property
name=
"can_default"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
Rewind
</property>
<property
name=
"use_underline"
>
True
</property>
<property
name=
"relief"
>
GTK_RELIEF_NORMAL
</property>
<signal
name=
"clicked"
handler=
"on_b_rewind_clicked"
last_modification_time=
"Mon, 27 Jan 2003 14:19:30 GMT"
/>
</widget>
</child>
<child>
<widget
class=
"GtkButton"
id=
"b_play"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"tooltip"
translatable=
"yes"
>
Play
</property>
<property
name=
"can_default"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
Play
</property>
<property
name=
"use_underline"
>
True
</property>
<property
name=
"relief"
>
GTK_RELIEF_NORMAL
</property>
<signal
name=
"clicked"
handler=
"on_b_play_clicked"
last_modification_time=
"Mon, 27 Jan 2003 14:19:50 GMT"
/>
</widget>
</child>
<child>
<widget
class=
"GtkButton"
id=
"b_pause"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"tooltip"
translatable=
"yes"
>
Pause
</property>
<property
name=
"can_default"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
Pause
</property>
<property
name=
"use_underline"
>
True
</property>
<property
name=
"relief"
>
GTK_RELIEF_NORMAL
</property>
<signal
name=
"clicked"
handler=
"on_b_pause_clicked"
last_modification_time=
"Mon, 27 Jan 2003 14:19:56 GMT"
/>
</widget>
</child>
<child>
<widget
class=
"GtkButton"
id=
"b_stop"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"tooltip"
translatable=
"yes"
>
Stop
</property>
<property
name=
"can_default"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
Stop
</property>
<property
name=
"use_underline"
>
True
</property>
<property
name=
"relief"
>
GTK_RELIEF_NORMAL
</property>
<signal
name=
"clicked"
handler=
"on_b_stop_clicked"
last_modification_time=
"Mon, 27 Jan 2003 14:20:03 GMT"
/>
</widget>
</child>
<child>
<widget
class=
"GtkButton"
id=
"b_forward"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"tooltip"
translatable=
"yes"
>
Forward
</property>
<property
name=
"can_default"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
Forward
</property>
<property
name=
"use_underline"
>
True
</property>
<property
name=
"relief"
>
GTK_RELIEF_NORMAL
</property>
<signal
name=
"clicked"
handler=
"on_b_forward_clicked"
last_modification_time=
"Mon, 27 Jan 2003 14:20:10 GMT"
/>
</widget>
</child>
<child>
<widget
class=
"GtkButton"
id=
"b_addfile"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"tooltip"
translatable=
"yes"
>
Add file
</property>
<property
name=
"can_default"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
Add file...
</property>
<property
name=
"use_underline"
>
True
</property>
<property
name=
"relief"
>
GTK_RELIEF_NORMAL
</property>
<signal
name=
"clicked"
handler=
"on_b_addfile_clicked"
last_modification_time=
"Mon, 27 Jan 2003 14:20:15 GMT"
/>
</widget>
</child>
<child>
<widget
class=
"GtkButton"
id=
"b_selectdvd"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"tooltip"
translatable=
"yes"
>
Select DVD
</property>
<property
name=
"can_default"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
Play DVD
</property>
<property
name=
"use_underline"
>
True
</property>
<property
name=
"relief"
>
GTK_RELIEF_NORMAL
</property>
<signal
name=
"clicked"
handler=
"on_b_selectdvd_clicked"
last_modification_time=
"Mon, 27 Jan 2003 14:20:15 GMT"
/>
</widget>
</child>
<child>
<widget
class=
"GtkButton"
id=
"b_exit"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"tooltip"
translatable=
"yes"
>
Exit
</property>
<property
name=
"can_default"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"label"
>
gtk-quit
</property>
<property
name=
"use_stock"
>
True
</property>
<property
name=
"relief"
>
GTK_RELIEF_NORMAL
</property>
<signal
name=
"clicked"
handler=
"on_b_exit_clicked"
last_modification_time=
"Mon, 27 Jan 2003 14:20:26 GMT"
/>
</widget>
</child>
</widget>
<packing>
<property
name=
"padding"
>
0
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
</packing>
</child>
<child>
<widget
class=
"GtkFrame"
id=
"Information"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label_xalign"
>
0
</property>
<property
name=
"label_yalign"
>
0.5
</property>
<property
name=
"shadow_type"
>
GTK_SHADOW_ETCHED_IN
</property>
<child>
<widget
class=
"GtkTable"
id=
"table1"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"n_rows"
>
1
</property>
<property
name=
"n_columns"
>
2
</property>
<property
name=
"homogeneous"
>
True
</property>
<property
name=
"row_spacing"
>
0
</property>
<property
name=
"column_spacing"
>
10
</property>
<child>
<widget
class=
"GtkLabel"
id=
"label5"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
Position
</property>
<property
name=
"use_underline"
>
False
</property>
<property
name=
"use_markup"
>
False
</property>
<property
name=
"justify"
>
GTK_JUSTIFY_LEFT
</property>
<property
name=
"wrap"
>
False
</property>
<property
name=
"selectable"
>
False
</property>
<property
name=
"xalign"
>
0
</property>
<property
name=
"yalign"
>
0.5
</property>
<property
name=
"xpad"
>
10
</property>
<property
name=
"ypad"
>
2
</property>
</widget>
<packing>
<property
name=
"left_attach"
>
0
</property>
<property
name=
"right_attach"
>
1
</property>
<property
name=
"top_attach"
>
0
</property>
<property
name=
"bottom_attach"
>
1
</property>
<property
name=
"x_options"
>
fill
</property>
<property
name=
"y_options"
></property>
</packing>
</child>
<child>
<widget
class=
"GtkLabel"
id=
"position_label"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
N/C
</property>
<property
name=
"use_underline"
>
False
</property>
<property
name=
"use_markup"
>
False
</property>
<property
name=
"justify"
>
GTK_JUSTIFY_LEFT
</property>
<property
name=
"wrap"
>
False
</property>
<property
name=
"selectable"
>
False
</property>
<property
name=
"xalign"
>
0
</property>
<property
name=
"yalign"
>
0.5
</property>
<property
name=
"xpad"
>
0
</property>
<property
name=
"ypad"
>
0
</property>
</widget>
<packing>
<property
name=
"left_attach"
>
1
</property>
<property
name=
"right_attach"
>
2
</property>
<property
name=
"top_attach"
>
0
</property>
<property
name=
"bottom_attach"
>
1
</property>
<property
name=
"x_options"
>
fill
</property>
<property
name=
"y_options"
></property>
</packing>
</child>
</widget>
</child>
<child>
<widget
class=
"GtkLabel"
id=
"label1"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
Information
</property>
<property
name=
"use_underline"
>
False
</property>
<property
name=
"use_markup"
>
False
</property>
<property
name=
"justify"
>
GTK_JUSTIFY_LEFT
</property>
<property
name=
"wrap"
>
False
</property>
<property
name=
"selectable"
>
False
</property>
<property
name=
"xalign"
>
0.5
</property>
<property
name=
"yalign"
>
0.5
</property>
<property
name=
"xpad"
>
0
</property>
<property
name=
"ypad"
>
0
</property>
</widget>
<packing>
<property
name=
"type"
>
label_item
</property>
</packing>
</child>
</widget>
<packing>
<property
name=
"padding"
>
0
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
</packing>
</child>
<child>
<widget
class=
"GtkScrolledWindow"
id=
"scrolledwindow1"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"hscrollbar_policy"
>
GTK_POLICY_NEVER
</property>
<property
name=
"vscrollbar_policy"
>
GTK_POLICY_ALWAYS
</property>
<property
name=
"shadow_type"
>
GTK_SHADOW_NONE
</property>
<property
name=
"window_placement"
>
GTK_CORNER_TOP_LEFT
</property>
<child>
<widget
class=
"GtkTextView"
id=
"logmessages"
>
<property
name=
"height_request"
>
100
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"editable"
>
False
</property>
<property
name=
"justification"
>
GTK_JUSTIFY_LEFT
</property>
<property
name=
"wrap_mode"
>
GTK_WRAP_CHAR
</property>
<property
name=
"cursor_visible"
>
False
</property>
<property
name=
"pixels_above_lines"
>
0
</property>
<property
name=
"pixels_below_lines"
>
0
</property>
<property
name=
"pixels_inside_wrap"
>
0
</property>
<property
name=
"left_margin"
>
0
</property>
<property
name=
"right_margin"
>
0
</property>
<property
name=
"indent"
>
0
</property>
<property
name=
"text"
translatable=
"yes"
></property>
<signal
name=
"insert_at_cursor"
handler=
"on_logmessages_insert_at_cursor"
last_modification_time=
"Mon, 27 Jan 2003 14:09:43 GMT"
/>
</widget>
</child>
</widget>
<packing>
<property
name=
"padding"
>
0
</property>
<property
name=
"expand"
>
True
</property>
<property
name=
"fill"
>
True
</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget
class=
"GtkWindow"
id=
"about"
>
<property
name=
"title"
translatable=
"yes"
>
About
</property>
<property
name=
"type"
>
GTK_WINDOW_POPUP
</property>
<property
name=
"window_position"
>
GTK_WIN_POS_CENTER
</property>
<property
name=
"modal"
>
False
</property>
<property
name=
"resizable"
>
True
</property>
<property
name=
"destroy_with_parent"
>
False
</property>
<child>
<widget
class=
"GtkFrame"
id=
"frame2"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label_xalign"
>
0
</property>
<property
name=
"label_yalign"
>
0.5
</property>
<property
name=
"shadow_type"
>
GTK_SHADOW_ETCHED_IN
</property>
<child>
<widget
class=
"GtkVBox"
id=
"vbox2"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"homogeneous"
>
False
</property>
<property
name=
"spacing"
>
0
</property>
<child>
<widget
class=
"GtkLabel"
id=
"label4"
>
<property
name=
"width_request"
>
280
</property>
<property
name=
"height_request"
>
64
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
DVD Annotation
En cours de developpement...
</property>
<property
name=
"use_underline"
>
False
</property>
<property
name=
"use_markup"
>
True
</property>
<property
name=
"justify"
>
GTK_JUSTIFY_CENTER
</property>
<property
name=
"wrap"
>
True
</property>
<property
name=
"selectable"
>
False
</property>
<property
name=
"xalign"
>
0.5
</property>
<property
name=
"yalign"
>
0.5
</property>
<property
name=
"xpad"
>
0
</property>
<property
name=
"ypad"
>
0
</property>
</widget>
<packing>
<property
name=
"padding"
>
0
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
</packing>
</child>
<child>
<widget
class=
"GtkButton"
id=
"button1"
>
<property
name=
"border_width"
>
1
</property>
<property
name=
"width_request"
>
54
</property>
<property
name=
"height_request"
>
34
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"tooltip"
translatable=
"yes"
>
Close about box
</property>
<property
name=
"can_default"
>
True
</property>
<property
name=
"has_default"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"has_focus"
>
True
</property>
<property
name=
"label"
>
gtk-ok
</property>
<property
name=
"use_stock"
>
True
</property>
<property
name=
"relief"
>
GTK_RELIEF_NORMAL
</property>
<signal
name=
"clicked"
handler=
"about_hide"
object=
"about"
last_modification_time=
"Wed, 29 Jan 2003 12:52:15 GMT"
/>
<accelerator
key=
"Escape"
modifiers=
"0"
signal=
"clicked"
/>
<accelerator
key=
"Return"
modifiers=
"0"
signal=
"clicked"
/>
</widget>
<packing>
<property
name=
"padding"
>
0
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</glade-interface>
modules/control/corba/simpleplayer.py
deleted
100644 → 0
View file @
782abd5e
#!/usr/bin/env python
import
sys
,
time
# For gtk/glade
import
pygtk
pygtk
.
require
(
'2.0'
)
import
gtk
import
gtk.glade
# For CORBA
import
ORBit
,
CORBA
# FIXME: How do we make this portable to windows ?
ORBit
.
load_typelib
(
"./MediaControl.so"
)
import
VLC
class
Connect
:
"""Abstract class defining helper functions to interconnect
glade XML files and methods of a python class."""
def
create_dictionary
(
self
):
"""Create a (name, function) dictionnary for the current class"""
dict
=
{}
self
.
create_dictionary_for_class
(
self
.
__class__
,
dict
)
return
dict
def
create_dictionary_for_class
(
self
,
a_class
,
dict
):
"""Create a (name, function) dictionnary for the specified class"""
bases
=
a_class
.
__bases__
for
iteration
in
bases
:
self
.
create_dictionary_for_class
(
iteration
,
dict
)
for
iteration
in
dir
(
a_class
):
dict
[
iteration
]
=
getattr
(
self
,
iteration
)
def
connect
(
self
):
"""Connects the class methods with the UI"""
self
.
gui
.
signal_autoconnect
(
self
.
create_dictionary
())
def
gtk_widget_hide
(
self
,
widget
):
widget
.
hide
()
return
gtk
.
TRUE
def
on_exit
(
self
,
source
=
None
,
event
=
None
):
"""Generic exit callback"""
gtk
.
main_quit
()
class
DVDControl
(
Connect
):
def
__init__
(
self
,
gladefile
):
"""Initializes the GUI and other attributes"""
# Glade init.
self
.
gui
=
gtk
.
glade
.
XML
(
gladefile
)
self
.
connect
()
# Frequently used GUI widgets
self
.
gui
.
logmessages
=
self
.
gui
.
get_widget
(
"logmessages"
)
self
.
gui
.
position_label
=
self
.
gui
.
get_widget
(
"position_label"
)
self
.
gui
.
fs
=
gtk
.
FileSelection
(
"Select a file"
)
self
.
gui
.
fs
.
ok_button
.
connect_after
(
"clicked"
,
lambda
win
:
self
.
gui
.
fs
.
hide
())
self
.
gui
.
fs
.
cancel_button
.
connect
(
"clicked"
,
lambda
win
:
self
.
gui
.
fs
.
destroy
())
# CORBA init.
self
.
mc
=
None
self
.
currentpos
=
None
self
.
status
=
None
# FIXME: portability
self
.
iorfile
=
"/tmp/vlc-ior.ref"
# Various
# Default FF/RW time : 5 seconds
self
.
default_time_increment
=
5
def
update_title
(
self
,
title
):
# Update the title of the main window
self
.
gui
.
get_widget
(
"win"
).
set_title
(
title
)
def
launch_player
(
self
):
"""Launch the VLC corba module"""
#print "Launching vlc server..."
# FIXME: spawn is portable, but how can we make sure that
# launch-vlc-corba launches the application in the background ?
# FIXME: portability
import
distutils.spawn
distutils
.
spawn
.
spawn
([
"launch-vlc-corba"
],
True
,
True
)
# Wait a little for the server to initialize. We could instead test
# on the existence and validity of self.iorfile
time
.
sleep
(
2
)
return
def
main
(
self
):
"""Mainloop : CORBA initalization and Gtk mainloop setup"""
self
.
orb
=
CORBA
.
ORB_init
(
sys
.
argv
)
errormessage
=
"""Unable to get a MediaControl object
Please try to run the following command:
vlc --intf corba"""
try
:
ior
=
open
(
self
.
iorfile
).
readline
()
except
:
# The iorfile does not existe : the player is maybe not active
self
.
launch_player
()
try
:
ior
=
open
(
self
.
iorfile
).
readline
()
except
:
print
errormessage
sys
.
exit
(
1
)
self
.
mc
=
self
.
orb
.
string_to_object
(
ior
)
if
self
.
mc
.
_non_existent
():
# The remote object is not available. Let's run the
# VLC server
self
.
launch_player
()
try
:
ior
=
open
(
self
.
iorfile
).
readline
()
except
:
print
errormessage
sys
.
exit
(
1
)
self
.
mc
=
self
.
orb
.
string_to_object
(
ior
)
if
self
.
mc
.
_non_existent
():
print
errormessage
sys
.
exit
(
1
)
self
.
currentpos
=
VLC
.
Position
()
self
.
currentpos
.
value
=
0
self
.
currentpos
.
key
=
VLC
.
MediaTime
self
.
currentpos
.
origin
=
VLC
.
RelativePosition
gtk
.
timeout_add
(
20
,
self
.
update_display
,
self
.
orb
)
gtk
.
main
()
def
log
(
self
,
msg
):
"""Adds a new log message to the logmessage window"""
buf
=
self
.
gui
.
logmessages
.
get_buffer
()
mes
=
str
(
msg
)
+
"
\
n
"
buf
.
insert_at_cursor
(
mes
,
len
(
mes
))
endmark
=
buf
.
create_mark
(
"end"
,
buf
.
get_end_iter
(),
gtk
.
TRUE
)
self
.
gui
.
logmessages
.
scroll_mark_onscreen
(
endmark
)
return
def
on_exit
(
self
,
source
=
None
,
event
=
None
):
"""General exit callback"""
self
.
status
=
"Stop"
# Terminate the VLC server
try
:
self
.
mc
.
exit
()
except
:
pass
gtk
.
main_quit
()
def
file_selector
(
self
,
callback
=
None
,
label
=
"Select a file"
,
default
=
""
):
"""Display the file selector"""
self
.
gui
.
fs
.
set_property
(
"title"
,
label
)
self
.
gui
.
fs
.
set_property
(
"filename"
,
default
)
self
.
gui
.
fs
.
set_property
(
"select-multiple"
,
False
)
self
.
gui
.
fs
.
set_property
(
"show-fileops"
,
False
)
if
callback
:
# Disconnecting the old callback
try
:
self
.
gui
.
fs
.
ok_button
.
disconnect
(
self
.
gui
.
fs
.
connect_id
)
except
:
pass
# Connecting the new one
self
.
gui
.
fs
.
connect_id
=
self
.
gui
.
fs
.
ok_button
.
connect
(
"clicked"
,
callback
,
self
.
gui
.
fs
)
self
.
gui
.
fs
.
show
()
return
gtk
.
TRUE
def
file_selected_cb
(
self
,
button
,
fs
):
"""Open and play the selected movie file"""
file
=
self
.
gui
.
fs
.
get_property
(
"filename"
)
self
.
mc
.
add_to_playlist
(
file
)
self
.
status
=
"Play"
return
gtk
.
TRUE
def
move_position
(
self
,
value
):
"""Helper function : fast forward or rewind by value seconds"""
print
"Moving by %d seconds"
%
value
pos
=
VLC
.
Position
()
pos
.
value
=
value
pos
.
key
=
VLC
.
MediaTime
pos
.
origin
=
VLC
.
RelativePosition
self
.
mc
.
set_media_position
(
pos
)
return
def
update_display
(
self
,
orb
):
"""Update the interface"""
if
self
.
status
==
"Play"
:
pos
=
self
.
mc
.
get_media_position
(
VLC
.
AbsolutePosition
,
VLC
.
ByteCount
)
self
.
gui
.
position_label
.
set_text
(
str
(
pos
.
value
))
elif
self
.
status
==
"Stop"
:
self
.
gui
.
position_label
.
set_text
(
"N/C"
)
return
gtk
.
TRUE
# Callbacks function. Skeletons can be generated by glade2py
def
on_win_key_press_event
(
self
,
win
=
None
,
event
=
None
):
# Navigation keys
if
event
.
keyval
==
gtk
.
keysyms
.
Tab
:
self
.
on_b_pause_clicked
(
win
,
event
)
return
gtk
.
TRUE
elif
event
.
keyval
==
gtk
.
keysyms
.
Right
:
self
.
on_b_forward_clicked
(
win
,
event
)
return
gtk
.
TRUE
elif
event
.
keyval
==
gtk
.
keysyms
.
Left
:
self
.
on_b_rewind_clicked
(
win
,
event
)
return
gtk
.
TRUE
elif
event
.
keyval
==
gtk
.
keysyms
.
Home
:
pos
=
VLC
.
Position
()
pos
.
value
=
0
pos
.
key
=
VLC
.
MediaTime
pos
.
origin
=
VLC
.
AbsolutePosition
self
.
mc
.
set_media_position
(
pos
)
return
gtk
.
TRUE
elif
event
.
keyval
==
gtk
.
keysyms
.
End
:
pos
=
VLC
.
Position
()
pos
.
value
=
-
self
.
default_time_increment
pos
.
key
=
VLC
.
MediaTime
pos
.
origin
=
VLC
.
ModuloPosition
self
.
mc
.
set_media_position
(
pos
)
return
gtk
.
TRUE
elif
event
.
keyval
==
gtk
.
keysyms
.
Page_Down
:
# FIXME: Next chapter
return
gtk
.
TRUE
elif
event
.
keyval
==
gtk
.
keysyms
.
Page_Up
:
# FIXME: Previous chapter
return
gtk
.
TRUE
return
gtk
.
TRUE
def
on_quit1_activate
(
self
,
button
=
None
,
data
=
None
):
"""Gtk callback to quit"""
self
.
on_exit
(
button
,
data
)
return
gtk
.
TRUE
def
on_about1_activate
(
self
,
button
=
None
,
data
=
None
):
self
.
gui
.
get_widget
(
"about"
).
show
()
return
gtk
.
TRUE
def
about_hide
(
self
,
button
=
None
,
data
=
None
):
self
.
gui
.
get_widget
(
"about"
).
hide
()
return
gtk
.
TRUE
def
on_b_rewind_clicked
(
self
,
button
=
None
,
data
=
None
):
if
self
.
status
==
"Play"
:
self
.
move_position
(
-
self
.
default_time_increment
)
return
gtk
.
TRUE
def
on_b_play_clicked
(
self
,
button
=
None
,
data
=
None
):
if
self
.
status
!=
"Play"
:
self
.
mc
.
start
(
self
.
currentpos
)
self
.
status
=
"Play"
return
gtk
.
TRUE
def
on_b_pause_clicked
(
self
,
button
=
None
,
data
=
None
):
if
self
.
status
==
"Play"
:
self
.
mc
.
pause
(
self
.
currentpos
)
self
.
status
=
"Pause"
elif
self
.
status
==
"Pause"
:
self
.
mc
.
pause
(
self
.
currentpos
)
self
.
status
=
"Play"
return
gtk
.
TRUE
def
on_b_stop_clicked
(
self
,
button
=
None
,
data
=
None
):
self
.
mc
.
stop
(
self
.
currentpos
)
self
.
status
=
"Stop"
return
gtk
.
TRUE
def
on_b_forward_clicked
(
self
,
button
=
None
,
data
=
None
):
if
self
.
status
==
"Play"
:
self
.
move_position
(
self
.
default_time_increment
)
return
gtk
.
TRUE
def
on_b_addfile_clicked
(
self
,
button
=
None
,
data
=
None
):
self
.
file_selector
(
callback
=
self
.
file_selected_cb
,
label
=
"Play a movie file"
)
return
gtk
.
TRUE
def
on_b_selectdvd_clicked
(
self
,
button
=
None
,
data
=
None
):
"""Play a DVD"""
self
.
mc
.
add_to_playlist
(
"dvd:///dev/dvd at 1,1"
)
self
.
mc
.
start
(
self
.
currentpos
)
self
.
status
=
"Play"
return
gtk
.
TRUE
def
on_b_exit_clicked
(
self
,
button
=
None
,
data
=
None
):
self
.
on_exit
(
button
,
data
)
return
gtk
.
TRUE
def
on_logmessages_insert_at_cursor
(
self
,
button
=
None
,
data
=
None
):
print
"on_logmessages_insert_at_cursor activated (%s, %s, %s)"
%
(
self
,
button
,
data
)
# FIXME: faire dfiler la scrollmark (cf gtkshell)
return
gtk
.
TRUE
if
__name__
==
'__main__'
:
v
=
DVDControl
(
"simpleplayer.glade"
)
v
.
main
()
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