Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1#!/usr/bin/env python 

2# This file is part of Xpra. 

3# Copyright (C) 2009-2019 Antoine Martin <antoine@xpra.org> 

4# Xpra is released under the terms of the GNU GPL v2, or, at your option, any 

5# later version. See the file COPYING for details. 

6 

7import os.path 

8from gi.repository import Gtk 

9 

10from xpra.version_util import XPRA_VERSION 

11from xpra.scripts.config import get_build_info 

12from xpra.gtk_common.gtk_util import add_close_accel 

13from xpra.log import Logger 

14 

15log = Logger("info") 

16 

17APPLICATION_NAME = "Xpra" 

18SITE_DOMAIN = "xpra.org" 

19SITE_URL = "http://%s/" % SITE_DOMAIN 

20 

21 

22GPL2 = None 

23def load_license(): 

24 global GPL2 

25 if GPL2 is None: 

26 from xpra.platform.paths import get_resources_dir 

27 gpl2_file = os.path.join(get_resources_dir(), "COPYING") 

28 if os.path.exists(gpl2_file): 

29 with open(gpl2_file, mode='rb') as f: 

30 GPL2 = f.read().decode('latin1') 

31 return GPL2 

32 

33 

34about_dialog = None 

35def about(on_close=None): 

36 global about_dialog 

37 if about_dialog: 

38 about_dialog.show() 

39 about_dialog.present() 

40 return 

41 from xpra.platform.paths import get_icon 

42 xpra_icon = get_icon("xpra.png") 

43 dialog = Gtk.AboutDialog() 

44 dialog.set_name("Xpra") 

45 dialog.set_version(XPRA_VERSION) 

46 dialog.set_authors(('Antoine Martin <antoine@xpra.org>', 

47 'Nathaniel Smith <njs@pobox.com>', 

48 'Serviware - Arthur Huillet <ahuillet@serviware.com>')) 

49 _license = load_license() 

50 dialog.set_license(_license or "Your installation may be corrupted," 

51 + " the license text for GPL version 2 could not be found," 

52 + "\nplease refer to:\nhttp://www.gnu.org/licenses/gpl-2.0.txt") 

53 dialog.set_comments("\n".join(get_build_info())) 

54 dialog.set_website(SITE_URL) 

55 dialog.set_website_label(SITE_DOMAIN) 

56 if xpra_icon: 

57 dialog.set_logo(xpra_icon) 

58 if hasattr(dialog, "set_program_name"): 

59 dialog.set_program_name(APPLICATION_NAME) 

60 def close(*_args): 

61 close_about() 

62 #the about function may be called as a widget callback 

63 #so avoid calling the widget as if it was a function! 

64 if on_close and callable(on_close): 

65 on_close() 

66 dialog.connect("response", close) 

67 add_close_accel(dialog, close) 

68 about_dialog = dialog 

69 dialog.show() 

70 

71def close_about(*_args): 

72 global about_dialog 

73 if about_dialog: 

74 about_dialog.destroy() 

75 about_dialog = None 

76 

77 

78def main(): 

79 from xpra.platform import program_context 

80 from xpra.platform.gui import init as gui_init 

81 with program_context("About"): 

82 gui_init() 

83 about(on_close=Gtk.main_quit) 

84 Gtk.main() 

85 

86 

87if __name__ == "__main__": 

88 main()