/usr/share/pyshared/pyhoca/wxgui/about.py is in pyhoca-gui 0.4.0.8-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | # -*- coding: utf-8 -*-
# Copyright (C) 2010-2013 by Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
# Copyright (C) 2010-2013 by Dick Kniep <dick.kniep@lindix.nl>
#
# PyHoca GUI 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.
#
# PyHoca GUI 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 this program; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
modules ={}
import os
try:
import wxversion
wxversion.select('2.9')
except: pass
try:
import wxversion
wxversion.select('2.8')
except: pass
# Python X2Go
import x2go
# wxPython
import wx
# PyHoca-GUI modules
import basepath
class PyHocaGUI_AboutFrame(wx.Frame):
"""\
wxWidget displaying an ,,About'' window for this application.
"""
def __init__(self, _PyHocaGUI, caller=None, about_image=None, icon_name='pyhoca-winicon.png', about_what=None, ):
"""\
About window (constructor).
@param _PyHocaGUI: main application instance
@type _PyHocaGUI: C{obj}
@param caller: unused
@type caller: C{None}
@param about_image: full image path for background image of About window
@type about_image: C{str}
@param icon_name: icon name for window icon
@type icon_name: C{str}
@param about_what: about what is this about window?
@type about_what: C{str}
"""
self._PyHocaGUI = _PyHocaGUI
self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
fallback_about_image = 'pyhoca-about-logo.png'
if about_image is None:
about_image = fallback_about_image
if os.path.basename(about_image) == about_image:
about_image = os.path.join(basepath.images_basepath, about_image)
if not (os.path.isfile(about_image) or os.path.islink(about_image)):
about_image = os.path.join(basepath.images_basepath, fallback_about_image)
if about_what is None:
about_what = self._PyHocaGUI.appname
if x2go.X2GOCLIENT_OS == 'Windows':
wx.Frame.__init__(self, None, -1, _(u'About %s ...') % about_what, size=(403,340))
else:
wx.Frame.__init__(self, None, -1, _(u'About %s ...') % about_what, size=(400,298))
self.Bind(wx.EVT_CLOSE, self.OnHide)
panel = wx.Panel(self, -1, pos=(0,0), size=(0,0), )
panel.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
panel.SetFocus()
about_wximage = wx.Image(about_image, wx.BITMAP_TYPE_PNG, )
about_wximage.Rescale(400, int(float(400)/about_wximage.Width*about_wximage.Height))
about_wxbitmap = about_wximage.ConvertToBitmap()
_logo_bitmap = wx.StaticBitmap(self, wx.ID_ANY, about_wxbitmap, (0, 0))
self.bitmap = _logo_bitmap
if "wxMSW" in wx.PlatformInfo:
icon_size = '16x16'
elif "wxGTK" in wx.PlatformInfo:
icon_size = '22x22'
elif "wxMAC" in wx.PlatformInfo:
icon_size = '128x128'
icon_file = os.path.normpath('%s/PyHoca/%s/%s.png' % (basepath.icons_basepath, icon_size, icon_name))
if not (os.path.isfile(str(icon_file)) or os.path.islink(str(icon_file))):
icon_file = os.path.normpath('%s/PyHoca/%s/%s.png' % (basepath.icons_basepath, icon_size, 'pyhoca-winicon'))
img = wx.Image(icon_file)
icon = wx.IconFromBitmap(img.ConvertToBitmap())
self.icon = self.SetIcon(icon)
self.CenterOnScreen()
def OnHide(self, evt):
"""\
Hide the About window (never close it as it is the main window of the application.
"""
self.Show(False)
def OnKeyDown(self, evt):
"""\
Handle keyboard requests, so that pressing ESC can hide the About window.
"""
keycode = evt.GetKeyCode()
if keycode == wx.WXK_ESCAPE:
self.Show(False)
evt.Skip()
|