-
Notifications
You must be signed in to change notification settings - Fork 0
/
dummy-client
executable file
·60 lines (51 loc) · 1.67 KB
/
dummy-client
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/python3
# Authors:
# Jason Gerard DeRose <jderose@novacut.com>
#
# dmedia: distributed media library
# Copyright (C) 2011 Jason Gerard DeRose <jderose@novacut.com>
#
# This file is part of `dmedia`.
#
# `dmedia` is free software: you can redistribute it and/or modify it under the
# terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# `dmedia` 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 Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with `dmedia`. If not, see <http://www.gnu.org/licenses/>.
import optparse
parser = optparse.OptionParser()
parser.add_option('--browser',
action='store_true',
default=False,
help='open test in default browser instead of dummy client',
)
parser.add_option('--show',
action='store_true',
default=False,
help='make dummy client open a window instead of running headless',
)
(options, args) = parser.parse_args()
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('WebKit', '3.0')
from gi.repository import Gtk, WebKit
window = Gtk.Window()
window.set_title('test')
window.set_default_size(960, 540)
window.connect('destroy', Gtk.main_quit)
scroll = Gtk.ScrolledWindow()
scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
window.add(scroll)
view = WebKit.WebView()
scroll.add(view)
view.load_uri(args[0])
if options.show:
window.show_all()
Gtk.main()