Exemplo n.º 1
0
def setup_wx():
    # Allow the dynamic selection of wxPython via an environment variable, when devs
    # who have multiple versions of the module installed want to pick between them.
    # This variable does not have to be set of course, and through normal usage will
    # probably not be, but this can make things a little easier when upgrading to a
    # new version of wx.
    logger = logging.getLogger(__name__)
    WX_ENV_VAR = "SASVIEW_WX_VERSION"
    if WX_ENV_VAR in os.environ:
        logger.info("You have set the %s environment variable to %s.",
                    WX_ENV_VAR, os.environ[WX_ENV_VAR])
        import wxversion
        if wxversion.checkInstalled(os.environ[WX_ENV_VAR]):
            logger.info("Version %s of wxPython is installed, so using that version.",
                        os.environ[WX_ENV_VAR])
            wxversion.select(os.environ[WX_ENV_VAR])
        else:
            logger.error("Version %s of wxPython is not installed, so using default version.",
                         os.environ[WX_ENV_VAR])
    else:
        logger.info("You have not set the %s environment variable, so using default version of wxPython.",
                    WX_ENV_VAR)

    import wx

    try:
        logger.info("Wx version: %s", wx.__version__)
    except AttributeError:
        logger.error("Wx version: error reading version")

    from . import wxcruft
    wxcruft.call_later_fix()
Exemplo n.º 2
0
def run():
	""" Run application. """
	# parse options
	options = _parse_opt()

	# logowanie
	from wxgtd.lib.logging_setup import logging_setup
	logging_setup('wxgtd.log', options.debug, options.debug_sql)

	# app config
	from wxgtd.lib import appconfig
	config = appconfig.AppConfig('wxgtd.cfg', 'wxgtd')
	config.load_defaults(config.get_data_file('defaults.cfg'))
	config.load()
	config.debug = options.debug

	# importowanie wx
	try:
		import wxversion
		try:
			wxversion.ensureMinimal("2.8")
		except wxversion.AlreadyImportedError:
			_LOG.warn('Wx Already Imported')
		except wxversion.VersionError:
			_LOG.error("WX version > 2.8 not found; avalable: %s",
				wxversion.checkInstalled())
	except ImportError, err:
		_LOG.error('No wxversion.... (%s)' % str(err))
Exemplo n.º 3
0
def setup_wx():
    # Allow the dynamic selection of wxPython via an environment variable, when devs
    # who have multiple versions of the module installed want to pick between them.
    # This variable does not have to be set of course, and through normal usage will
    # probably not be, but this can make things a little easier when upgrading to a
    # new version of wx.
    logger = logging.getLogger(__name__)
    WX_ENV_VAR = "SASVIEW_WX_VERSION"
    if WX_ENV_VAR in os.environ:
        logger.info("You have set the %s environment variable to %s.",
                    WX_ENV_VAR, os.environ[WX_ENV_VAR])
        import wxversion
        if wxversion.checkInstalled(os.environ[WX_ENV_VAR]):
            logger.info(
                "Version %s of wxPython is installed, so using that version.",
                os.environ[WX_ENV_VAR])
            wxversion.select(os.environ[WX_ENV_VAR])
        else:
            logger.error(
                "Version %s of wxPython is not installed, so using default version.",
                os.environ[WX_ENV_VAR])
    else:
        logger.info(
            "You have not set the %s environment variable, so using default version of wxPython.",
            WX_ENV_VAR)

    import wx

    try:
        logger.info("Wx version: %s", wx.__version__)
    except AttributeError:
        logger.error("Wx version: error reading version")

    from . import wxcruft
    wxcruft.call_later_fix()
Exemplo n.º 4
0
def ensure(recommended, minimal):
    """Ensures the minimal version of wxPython is installed.
    - minimal: as string (eg. '2.6')"""

    #wxversion
    try:
        import wxversion
        if wxversion.checkInstalled(recommended):
            wxversion.select(recommended)
        else:
            wxversion.ensureMinimal(minimal)
        import wx
        return wx
    except ImportError:
        sys.stdout.write(_t('Warning: python-wxversion is not installed.\n'))

    #wxversion failed, import wx anyway
    params = {'recommended': recommended, 'minimal': minimal}
    try:
        import wx
    except ImportError:
        message = _t('Error: wxPython %(recommended)s' \
                                ' (or at least %(minimal)s) can not' \
                                ' be found, but is required.'
                            ) % params +\
            '\n\n' + _t('Please (re)install it.')
        sys.stderr.write(message)
        if sys.platform.startswith('linux') and \
                os.path.exists('/usr/bin/zenity'):
            call('''zenity --error --text="%s"\n\n''' % message + \
                _t("This application needs 'python-wxversion' " \
                    "and 'python-wxgtk%(recommended)s' " \
                    "(or at least 'python-wxgtk%(minimal)s')."
                    ) % params, shell=True)
        sys.exit()

    #wxversion failed but wx is available, check version again
    params['version'] = wx.VERSION_STRING
    if wx.VERSION_STRING < minimal:

        class MyApp(wx.App):
            def OnInit(self):
                result = wx.MessageBox(
                    _t("This application is known to be compatible" \
                        " with\nwxPython version(s) %(recommended)s" \
                        " (or at least %(minimal)s),\nbut you have " \
                        "%(version)s installed."
                        ) % params + "\n\n" +\
                    _t("Please upgrade your wxPython."),
                    _t("wxPython Version Error"),
                    style=wx.ICON_ERROR)
                return False

        app = MyApp()
        app.MainLoop()
        sys.exit()
    #wxversion failed, but wx is the right version anyway
    return wx
Exemplo n.º 5
0
def ensure(recommended, minimal):
    """Ensures the minimal version of wxPython is installed.
    - minimal: as string (eg. '2.6')"""

    #wxversion
    try:
        import wxversion
        if wxversion.checkInstalled(recommended):
            wxversion.select(recommended)
        else:
            wxversion.ensureMinimal(minimal)
        import wx
        return wx
    except ImportError:
        sys.stdout.write(_t('Warning: python-wxversion is not installed.\n'))

    #wxversion failed, import wx anyway
    params = {'recommended': recommended, 'minimal': minimal}
    try:
        import wx
    except ImportError:
        message = _t('Error: wxPython %(recommended)s' \
                                ' (or at least %(minimal)s) can not' \
                                ' be found, but is required.'
                            ) % params +\
            '\n\n' + _t('Please (re)install it.')
        sys.stderr.write(message)
        if sys.platform.startswith('linux') and \
                os.path.exists('/usr/bin/zenity'):
            call('''zenity --error --text="%s"\n\n''' % message + \
                _t("This application needs 'python-wxversion' " \
                    "and 'python-wxgtk%(recommended)s' " \
                    "(or at least 'python-wxgtk%(minimal)s')."
                    ) % params, shell=True)
        sys.exit()

    #wxversion failed but wx is available, check version again
    params['version'] = wx.VERSION_STRING
    if wx.VERSION_STRING < minimal:

        class MyApp(wx.App):
            def OnInit(self):
                result = wx.MessageBox(
                    _t("This application is known to be compatible" \
                        " with\nwxPython version(s) %(recommended)s" \
                        " (or at least %(minimal)s),\nbut you have " \
                        "%(version)s installed."
                        ) % params + "\n\n" +\
                    _t("Please upgrade your wxPython."),
                    _t("wxPython Version Error"),
                    style=wx.ICON_ERROR)
                return False
        app = MyApp()
        app.MainLoop()
        sys.exit()
    #wxversion failed, but wx is the right version anyway
    return wx
Exemplo n.º 6
0
def validateVersions():
    import sys
    from pyo import getVersion
    import wxversion
    if sys.version_info[0] > VERSIONS['python'][0]:
        printMessage("python {}.x must be used to run Pyo Synth from sources".format(VERSIONS['python'][0]), 2)
    if getVersion() != VERSIONS['pyo']:
        printMessage("pyo version installed: {}.{}.{} ; pyo version required {}.{}.{}".format(*getVersion()+VERSIONS['pyo']), 1)
        printMessage("Installed pyo version doesn't match what Pyo Synth uses. Some objects might not be available.", 1)
    if not wxversion.checkInstalled('2.8'):
        printMessage("wxPython version required {}.{}.{}".format(*VERSIONS['wx']), 1)
Exemplo n.º 7
0
import os

if 'WXVER' in os.environ:
    version = os.environ["WXVER"]
else:
    try:
        import wx
    except ImportError:
        version = '2.6'
    else:
        version = None
if version is not None:
    import wxversion
    try:
        ok = wxversion.checkInstalled(version)
    except ValueError:
        ok = False
    if ok:
        wxversion.select(version)
    else:
        import sys
        sys.stderr.write("Invalid wx version: %s\nInstalled versions are: %s\n" % \
                         (version, ', '.join(wxversion.getInstalled())))

_list = list

from event import *
from command import *
from screen import *
from dialog import *
Exemplo n.º 8
0
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU 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

import traceback

from .. import param

if not param.py2exe:
    import wxversion
    try:
        if wxversion.checkInstalled(param.version_wxpython):
            wxversion.select(param.version_wxpython) # version a utiliser de preference
        else:  # ou bien la version n'est pas trouvee, ou bien on est dans py2exe
            print u"Attention : impossible de charger la version %s de WxPython." %param.version_wxpython
    except Exception:
        if param.debug:
            print traceback.format_exc()

try:
    import matplotlib
    matplotlib.use(param.moteur_de_rendu, warn = False)
    #import pylab # cette ligne semble nécessaire sous Ubuntu Feisty (python 2.5 - matplotlib 0.87.7) ??
except Exception:
    print "Warning : Erreur lors de l'import de pylab.\n"
    if param.debug:
        print traceback.format_exc()
Exemplo n.º 9
0
# Log the start of the session
logger.info(" --- SasView session started ---")
# Log the python version
logger.info("Python: %s" % sys.version)

# Allow the dynamic selection of wxPython via an environment variable, when devs
# who have multiple versions of the module installed want to pick between them.
# This variable does not have to be set of course, and through normal usage will
# probably not be, but this can make things a little easier when upgrading to a
# new version of wx.
WX_ENV_VAR = "SASVIEW_WX_VERSION"
if WX_ENV_VAR in os.environ:
    logger.info("You have set the %s environment variable to %s." % \
                 (WX_ENV_VAR, os.environ[WX_ENV_VAR]))
    import wxversion
    if wxversion.checkInstalled(os.environ[WX_ENV_VAR]):
        logger.info(
            "Version %s of wxPython is installed, so using that version." %
            os.environ[WX_ENV_VAR])
        wxversion.select(os.environ[WX_ENV_VAR])
    else:
        logger.error(
            "Version %s of wxPython is not installed, so using default version."
            % os.environ[WX_ENV_VAR])
else:
    logger.info(
        "You have not set the %s environment variable, so using default version of wxPython."
        % WX_ENV_VAR)

import wx
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

##\author Josh Faust

import os
import sys

WXVER = '2.8'
import wxversion
if wxversion.checkInstalled(WXVER):
  wxversion.select(WXVER)
else:
  print >> sys.stderr, "This application requires wxPython version %s"%(WXVER)
  sys.exit(1)

import wx

PKG = 'qualification'
import roslib
roslib.load_manifest(PKG)

from optparse import OptionParser
#import shutil
#import glob
import traceback
Exemplo n.º 11
0
import rospkg

from smach_msgs.msg import SmachContainerStatus,SmachContainerInitialStatusCmd,SmachContainerStructure

import sys
import os
import threading
import pickle
import pprint
import copy
import StringIO
import colorsys
import time

import wxversion
if wxversion.checkInstalled("2.8"):
    wxversion.select("2.8")
else:
    print("wxversion 2.8 is not installed, installed versions are {}".format(wxversion.getInstalled()))
import wx
import wx.richtext

import textwrap

## this import system (or ros-released) xdot
# import xdot
## need to import currnt package, but not to load this file
# http://stackoverflow.com/questions/6031584/importing-from-builtin-library-when-module-with-same-name-exists
def import_non_local(name, custom_name=None):
    import imp, sys
Exemplo n.º 12
0
# Copyright (c) 2007-2010 Bernd Kreuss <*****@*****.**>                  #
#                                                                            #
# This program is licensed under the GNU General Public License V3,          #
# the full source code is included in the binary distribution.               #
#                                                                            #
# Included in the distribution are files from other open source projects:    #
# - TOR Onion Router (c) The Tor Project, 3-clause-BSD                       #
# - SocksiPy (c) Dan Haim, BSD Style License                                 #
# - Gajim buddy status icons (c) The Gajim Team, GNU GPL                     #
#                                                                            #
##############################################################################

import config
import wxversion
if config.isMac():
    if wxversion.checkInstalled('2.9'):
        wxversion.select('2.9') # For Mac it is tweaked and optimized with 2.9
    else:
        print "(1) wxPython-2.9 is not installed"
        
else:
    try:
        if wxversion.checkInstalled('2.8'):
            wxversion.select('2.8') # On MSW and GTK we stick with 2.8 for now
        else:
            print "(1) wxPython-2.8 is not installed"
        
    except:
        # continue anyways. 
        # in the pyinstaller binary wxversion can screw up and throw exceptions 
        # so we ignore the error and just use the wx that happens to be available.
Exemplo n.º 13
0
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU 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

import traceback

from .. import param

if not param.py2exe:
    import wxversion
    try:
        if wxversion.checkInstalled(param.version_wxpython):
            wxversion.select(
                param.version_wxpython)  # version a utiliser de preference
        else:  # ou bien la version n'est pas trouvee, ou bien on est dans py2exe
            print u"Attention : impossible de charger la version %s de WxPython." % param.version_wxpython
    except Exception:
        if param.debug:
            print traceback.format_exc()

try:
    import matplotlib
    matplotlib.use(param.moteur_de_rendu, warn=False)
    #import pylab # cette ligne semble nécessaire sous Ubuntu Feisty (python 2.5 - matplotlib 0.87.7) ??
except Exception:
    print "Warning : Erreur lors de l'import de pylab.\n"
    if param.debug:
Exemplo n.º 14
0
try:
    from PIL import Image, ImageDraw, ImageTk
    WITH_PIL = True
except:
    WITH_PIL = False

use_wx = 1
if "PYO_GUI_WX" in os.environ:
    use_wx = int(os.environ["PYO_GUI_WX"])

if use_wx:
    try:
        try:
            import wxversion
            if (wxversion.checkInstalled("2.8")):
                wxversion.ensureMinimal("2.8")
        except:
            pass
        import wx
        from ._wxwidgets import *
        PYO_USE_WX = True
    except:
        PYO_USE_WX = False
        print("""
WxPython is not found for the current python version.
Pyo will use a minimal GUI toolkit written with Tkinter (if available).
This toolkit has limited functionnalities and is no more
maintained or updated. If you want to use all of pyo's
GUI features, you should install WxPython, available here:
http://www.wxpython.org/
Exemplo n.º 15
0
along with pyo.  If not, see <http://www.gnu.org/licenses/>.
"""
from types import ListType, FloatType, IntType
import math, sys, os, random

try:
    from PIL import Image, ImageDraw, ImageTk

    WITH_PIL = True
except:
    WITH_PIL = False

try:
    import wxversion

    if wxversion.checkInstalled("2.8"):
        wxversion.ensureMinimal("2.8")
    import wx
    from _wxwidgets import *

    PYO_USE_WX = True
except:
    PYO_USE_WX = False

if not PYO_USE_WX:
    try:
        from Tkinter import *
        from _tkwidgets import *
    except:
        if sys.platform == "linux2":
            response = raw_input(
Exemplo n.º 16
0
import os

if 'WXVER' in os.environ:
    version = os.environ["WXVER"]
else:
    try:
        import wx
    except ImportError:
        version = '2.6'
    else:
        version = None
if version is not None:
    import wxversion
    try:
        ok = wxversion.checkInstalled(version)
    except ValueError:
        ok = False
    if ok:
        wxversion.select(version)
    else:
        import sys
        sys.stderr.write("Invalid wx version: %s\nInstalled versions are: %s\n" % \
                         (version, ', '.join(wxversion.getInstalled())))

_list = list

from event import *
from command import *
from screen import *
from dialog import *
Exemplo n.º 17
0
You should have received a copy of the GNU Lesser General Public
License along with pyo.  If not, see <http://www.gnu.org/licenses/>.
"""
from types import ListType, FloatType, IntType
import math, sys, os, random

try:
    from PIL import Image, ImageDraw, ImageTk
    WITH_PIL = True
except:
    WITH_PIL = False

try:
    try:
        import wxversion
        if (wxversion.checkInstalled("2.8")):
            wxversion.ensureMinimal("2.8")
    except:
        pass
    import wx
    from _wxwidgets import *
    PYO_USE_WX = True
except:
    PYO_USE_WX = False

PYO_USE_TK = False
if not PYO_USE_WX:
    try:
        from Tkinter import *
        from _tkwidgets import *
        PYO_USE_TK = True
Exemplo n.º 18
0
from swap.protocol.SwapPacket import SwapPacket
from swap.SwapException import SwapException
from swap.xmltools.XmlDevice import XmlDeviceDir
from swap.xmltools.XmlSettings import XmlSettings
from swap.xmltools.XmlNetwork import XmlNetwork
from swap.modem.CcPacket import CcPacket

import time
import os
import sys

import wx.lib.agw.aui as aui
import wx
import wxversion

if wxversion.checkInstalled("2.8"):
    wx_version = "2.8"
    from wx.lib.pubsub import setupkwargs
    from wx.lib.pubsub import pub
elif wxversion.checkInstalled("2.9"):
    wx_version = "2.9"
    from wx.lib.pubsub import setupkwargs
    from wx.lib.pubsub import pub
elif wxversion.checkInstalled("3.0"):
    wx_version = "3.0"
    from wx.lib.pubsub import setupkwargs
    from wx.lib.pubsub import pub
else:
    print "version of wxpython not supported"

Exemplo n.º 19
0
from swap.protocol.SwapPacket import SwapPacket
from swap.SwapException import SwapException
from swap.xmltools.XmlDevice import XmlDeviceDir
from swap.xmltools.XmlSettings import XmlSettings
from swap.xmltools.XmlNetwork import XmlNetwork
from swap.modem.CcPacket import CcPacket

import time
import os
import sys

import wx.lib.agw.aui as aui
import wx
import wxversion

if wxversion.checkInstalled("2.8"):
    wx_version = "2.8"
    from wx.lib.pubsub import Publisher
    pub = Publisher()
elif wxversion.checkInstalled("2.9"):
    wx_version = "2.9"
    from wx.lib.pubsub import pub
elif wxversion.checkInstalled("3.0"):
    wx_version = "3.0"
    from wx.lib.pubsub import pub
else:
    print "version of wxpython not supported"


class MainFrame(wx.Frame):
    '''
Exemplo n.º 20
0
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Revision $Id$

from __future__ import print_function

import sys

WXVER = ['2.8', '2.9']
import wxversion
if wxversion.checkInstalled(WXVER):
    wxversion.select(WXVER)
else:
    sys.stderr.write("This application requires wxPython version %s\n" %
                     (WXVER))
    sys.exit(1)
import wx

import rospy
import rosgraph.names

import rxtools.rxplot


# TODO: poll for rospy.is_shutdown()
def rxplot_main():
Exemplo n.º 21
0
# Log the start of the session
logger.info(" --- SasView session started ---")
# Log the python version
logger.info("Python: %s" % sys.version)

# Allow the dynamic selection of wxPython via an environment variable, when devs
# who have multiple versions of the module installed want to pick between them.
# This variable does not have to be set of course, and through normal usage will
# probably not be, but this can make things a little easier when upgrading to a
# new version of wx.
WX_ENV_VAR = "SASVIEW_WX_VERSION"
if WX_ENV_VAR in os.environ:
    logger.info("You have set the %s environment variable to %s." % \
                 (WX_ENV_VAR, os.environ[WX_ENV_VAR]))
    import wxversion
    if wxversion.checkInstalled(os.environ[WX_ENV_VAR]):
        logger.info("Version %s of wxPython is installed, so using that version." % os.environ[WX_ENV_VAR])
        wxversion.select(os.environ[WX_ENV_VAR])
    else:
        logger.error("Version %s of wxPython is not installed, so using default version." % os.environ[WX_ENV_VAR])
else:
    logger.info("You have not set the %s environment variable, so using default version of wxPython." % WX_ENV_VAR)

import wx

try:
    logger.info("Wx version: %s" % wx.__version__)
except:
    logger.error("Wx version: error reading version")

import wxcruft
Exemplo n.º 22
0
#!/usr/bin/env python
# -*- coding: ISO-8859-1 -*-
#
# generated by wxGlade 0.7.0 on Sat Apr 16 23:14:31 2016
#

# This is an automatically generated file.
# Manual changes will be overwritten without warning!

import warnings
try:
    import wxversion

    if wxversion.checkInstalled('2.8'):
        wxversion.select('2.8')
    else:
        warnings.warn(
            "You are running an unsupported Version of wx. Please test this with wx Version 2.8 before reporting errors!"
        )
except ImportError:
    warnings.warn(
        "You either don't have wx installed or you are using wxphoenix. Please test this with wx Version 2.8 before reporting errors!"
    )
import wx
import os
import sys
import gettext
from LipsyncFrame import LipsyncFrame


class LipsyncApp(wx.App):
Exemplo n.º 23
0
#                                                                            #
# This program is licensed under the GNU General Public License V3,          #
# the full source code is included in the binary distribution.               #
#                                                                            #
# Included in the distribution are files from other open source projects:    #
# - TOR Onion Router (c) The Tor Project, 3-clause-BSD                       #
# - SocksiPy (c) Dan Haim, BSD Style License                                 #
# - Gajim buddy status icons (c) The Gajim Team, GNU GPL                     #
#                                                                            #
##############################################################################

import config
#import buddyconfig
import wxversion
if config.isMac():
    if wxversion.checkInstalled('3.0'):
        wxversion.select('3.0') # For Mac it is tweaked and optimized with 3.0
    else:
        print "(1) wxPython-3.0 is not installed"
        
else:
    try:
        if wxversion.checkInstalled('3.0'):
            wxversion.select('3.0') # On MSW and GTK we stick with 3.0 for now
        else:
            print "(1) wxPython-3.0 is not installed"
        
    except:
        # continue anyways. 
        # in the pyinstaller binary wxversion can screw up and throw exceptions 
        # so we ignore the error and just use the wx that happens to be available.