Skip to content

Commit

Permalink
#1568 convert some examples to support python3, bundle them and provi…
Browse files Browse the repository at this point in the history
…de test applications shortcuts to launch them

git-svn-id: https://xpra.org/svn/Xpra/trunk@16307 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 13, 2017
1 parent 10bfb93 commit 0f2819f
Show file tree
Hide file tree
Showing 18 changed files with 257 additions and 215 deletions.
8 changes: 8 additions & 0 deletions osx/Helpers/Example-Colors
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

#call the "Python" wrapper:
exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.client.gtk_base.example.colors import main;sys.exit(main())" "$@"
8 changes: 8 additions & 0 deletions osx/Helpers/Example-Colors-Plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

#call the "Python" wrapper:
exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.client.gtk_base.example.colors_plain import main;sys.exit(main())" "$@"
8 changes: 8 additions & 0 deletions osx/Helpers/Example-Gradient
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

#call the "Python" wrapper:
exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.client.gtk_base.example.colors_gradient import main;sys.exit(main())" "$@"
8 changes: 8 additions & 0 deletions osx/Helpers/Example-Transparent-Colors
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

#call the "Python" wrapper:
exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.client.gtk_base.example.transparent_colors import main;sys.exit(main())" "$@"
8 changes: 8 additions & 0 deletions osx/Helpers/Example-Transparent-Window
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

#call the "Python" wrapper:
exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.client.gtk_base.example.transparent_window import main;sys.exit(main())" "$@"
Binary file added src/icons/bell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icons/transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ def is_RH():
cuda_kernels_ENABLED = DEFAULT
cuda_rebuild_ENABLED = DEFAULT
csc_libyuv_ENABLED = DEFAULT and pkg_config_ok("--exists", "libyuv")
example_ENABLED = DEFAULT

#Cython / gcc / packaging build options:
annotate_ENABLED = True
Expand All @@ -216,7 +217,7 @@ def is_RH():
"clipboard",
"server", "client", "dbus", "x11", "xinput", "sd_listen",
"gtk_x11", "service",
"gtk2", "gtk3",
"gtk2", "gtk3", "example",
"html5", "minify", "html5_gzip", "html5_brotli",
"pam",
"sound", "opengl", "printing", "webcam",
Expand Down Expand Up @@ -1428,6 +1429,14 @@ def add_service_exe(script, icon, base_name):
if nvfbc_ENABLED or nvenc_ENABLED:
add_console_exe("xpra/codecs/cuda_common/cuda_context.py", "cuda.ico", "CUDA_info")

if example_ENABLED:
add_gui_exe("xpra/client/gtk_base/example/colors.py", "encoding.ico", "Colors")
add_gui_exe("xpra/client/gtk_base/example/colors_gradient.py", "encoding.ico", "Colors-Gradient")
add_gui_exe("xpra/client/gtk_base/example/colors_plain.py", "encoding.ico", "Colors-Plain")
add_gui_exe("xpra/client/gtk_base/example/bell.py", "bell.ico", "Bell")
add_gui_exe("xpra/client/gtk_base/example/transparent_colors.py", "transparent.ico", "Transparent_Colors")
add_gui_exe("xpra/client/gtk_base/example/transparent_window.py", "transparent.ico", "Transparent_Window")

#FIXME: how do we figure out what target directory to use?
print("calling build_xpra_conf in-place")
#building etc files in-place:
Expand Down Expand Up @@ -1866,6 +1875,7 @@ def osx_pkgconfig(*pkgs_options, **ekw):
toggle_packages(client_ENABLED and (gtk2_ENABLED or gtk3_ENABLED), "xpra.client.gtk_base")
toggle_packages(client_ENABLED and opengl_ENABLED and gtk2_ENABLED, "xpra.client.gl.gtk2")
toggle_packages(client_ENABLED and opengl_ENABLED and gtk3_ENABLED, "xpra.client.gl.gtk3")
toggle_packages(client_ENABLED and (gtk2_ENABLED or gtk3_ENABLED) and example_ENABLED, "xpra.client.gtk_base.example")
if client_ENABLED and WIN32 and MINGW_PREFIX:
propsys_pkgconfig = pkgconfig()
if debug_ENABLED:
Expand Down
29 changes: 0 additions & 29 deletions src/tests/xpra/test_apps/test_bell.py

This file was deleted.

64 changes: 0 additions & 64 deletions src/tests/xpra/test_apps/transparent_colors.py

This file was deleted.

121 changes: 0 additions & 121 deletions src/tests/xpra/test_apps/transparent_window.py

This file was deleted.

37 changes: 37 additions & 0 deletions src/xpra/client/gtk_base/example/bell.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python
# Copyright (C) 2017 Antoine Martin <antoine@devloop.org.uk>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.


from xpra.gtk_common.gobject_compat import import_gtk
gtk = import_gtk()
from xpra.gtk_common.gtk_util import WIN_POS_CENTER
from xpra.x11.gtk_x11.gdk_display_source import init_display_source
init_display_source()


class BellWindow(gtk.Window):
def __init__(self):
super(BellWindow, self).__init__()
self.set_position(WIN_POS_CENTER)
self.set_default_size(320, 120)
self.set_title("Test System Bell")
self.connect("destroy", gtk.main_quit)
btn = gtk.Button("default bell")
btn.connect('clicked', self.bell)
self.add(btn)
self.show_all()

def bell(self, *args):
from xpra.platform.gui import system_bell
system_bell(self.get_window(), 0, 100, 2000, 1000, 0, 0, "test")

def main():
BellWindow()
gtk.main()
return 0


if __name__ == "__main__":
main()
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 0f2819f

Please sign in to comment.