当前位置: 首页>>代码示例>>Python>>正文


Python wxversion.select函数代码示例

本文整理汇总了Python中wxversion.select函数的典型用法代码示例。如果您正苦于以下问题:Python select函数的具体用法?Python select怎么用?Python select使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了select函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

    def run(self):
        install.run(self)
        import sys

        # check about wxwidgets
        try:
            import wxversion

            wxversion.select("3.0")
        except:
            with open("install-wxpython.sh", "w") as shell_script:
                shell_script.write(
                    """#!/bin/sh
				echo 'Prerrequisites'
				apt-get --yes --force-yes install libgconf2-dev libgtk2.0-dev libgtk-3-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libgconfmm-2.6-dev libwebkitgtk-dev python-gtk2
				mkdir -p external
				cd external
				echo "Downloading wxPython 3.0.2.0"
				wget http://downloads.sourceforge.net/project/wxpython/wxPython/3.0.2.0/wxPython-src-3.0.2.0.tar.bz2
				echo "Done"
				echo 'Uncompressing ...'
				tar -xjvf wxPython-src-3.0.2.0.tar.bz2
				echo 'Patching  ...'
				cd wxPython-src-3.0.2.0
				cd wxPython
				sed -i -e 's/PyErr_Format(PyExc_RuntimeError, mesg)/PyErr_Format(PyExc_RuntimeError, "%s\", mesg)/g' src/gtk/*.cpp contrib/gizmos/gtk/*.cpp
				python ./build-wxpython.py --build_dir=../bld --install
				ldconfig
				cd ../../..
				rm -rf external
			"""
                )
            os.system("sh ./install-wxpython.sh")
开发者ID:melviso,项目名称:beatle,代码行数:33,代码来源:setup.py

示例2: CheckForWx

def CheckForWx(forceVersion=os.getenv('GRASS_WXVERSION', None)):
    """Try to import wx module and check its version

    :param forceVersion: force wxPython version, eg. '2.8'
    """
    if 'wx' in sys.modules.keys():
        return

    minVersion = [2, 8, 10, 1]
    try:
        try:
            import wxversion
        except ImportError as e:
            raise ImportError(e)
        if forceVersion:
            wxversion.select(forceVersion)
        wxversion.ensureMinimal(str(minVersion[0]) + '.' + str(minVersion[1]))
        import wx
        version = wx.__version__

        if map(int, version.split('.')) < minVersion:
            raise ValueError(
                'Your wxPython version is %s.%s.%s.%s' %
                tuple(version.split('.')))

    except ImportError as e:
        print >> sys.stderr, 'ERROR: wxGUI requires wxPython. %s' % str(e)
        sys.exit(1)
    except (ValueError, wxversion.VersionError) as e:
        print >> sys.stderr, 'ERROR: wxGUI requires wxPython >= %d.%d.%d.%d. ' % tuple(
            minVersion) + '%s.' % (str(e))
        sys.exit(1)
    except locale.Error as e:
        print >> sys.stderr, "Unable to set locale:", e
        os.environ['LC_ALL'] = ''
开发者ID:GRASS-GIS,项目名称:grass-ci,代码行数:35,代码来源:globalvar.py

示例3: setup_wx

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()
开发者ID:rprospero,项目名称:sasview,代码行数:32,代码来源:sasview.py

示例4: setWXVersion

def setWXVersion():
    import wxversion
    if (FORCEWXVERSION):
        vforced = '2.8'
        wxversion.select(vforced)
    else:
        wxversion.select(['3.0', '2.8'])
开发者ID:tsartsaris,项目名称:Debreate,代码行数:7,代码来源:common.py

示例5: run

    def run(self):
        # Note(Kevin): On Python 2, Bajoo should uses the stable 'Classic'
        # version. This version must be installed manually by the user
        # (usually the package manager of the distribution).
        # On python 3, Bajoo uses the 'Phoenix' version of wxPython.
        # At this time, the Phoenix version is not stable yet, and only daily
        # snapshots are available.

        # About wxVersion:
        # Some systems allowed several version of wxPython to be installed
        # wxVersion allows to pick a version.
        # If wxVersion is not available, either wxPython is not installed,
        # either the system only allows only one version of wxPython.

        if not self.force and sys.version_info[0] is 2:
            try:
                import wxversion
                try:
                    wxversion.select(['3.0', '2.9', '2.8'])
                except wxversion.VersionError:
                    pass
            except ImportError:
                pass

            try:
                import wx  # noqa
            except ImportError:
                print("""\
Bajoo depends on the library wxPython. This library is not available in the
Python Package Index (pypi), and so can't be automatically installed.
On Linux, you can install it from your distribution's package repositories.
On Windows, you can download it from http://wxpython.org/download.php""")
                raise Exception('wxPython not found.')
        InstallCommand.run(self)
开发者ID:Bajoo,项目名称:client-pc,代码行数:34,代码来源:setup.py

示例6: _OnStart

 def _OnStart(self):
     if not getattr(sys, 'frozen', False):
         import wxversion
         wxversion.select("3.0")
 
     from photofilmstrip.gui.PhotoFilmStripApp import PhotoFilmStripApp
     app = PhotoFilmStripApp(0)
     app.MainLoop()
开发者ID:PhotoFilmStrip,项目名称:PFS,代码行数:8,代码来源:GUI.py

示例7: ensure

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
开发者ID:CamelliaDPG,项目名称:Camellia,代码行数:57,代码来源:wxcheck.py

示例8: run_gui

def run_gui(filename):
	if not appconfig.is_frozen():
		try:
			import wxversion
			try:
				wxversion.select('2.8')
			except wxversion.AlreadyImportedError:
				pass
		except ImportError, err:
			print 'No wxversion.... (%s)' % str(err)
开发者ID:KarolBedkowski,项目名称:photomagic,代码行数:10,代码来源:main.py

示例9: select_version

def select_version():
   # This function is no longer called
   try:
      import wxversion
      wxversion.select(["3.0", "2.9", "2.8", "2.6", "2.5", "2.4"])
   except ImportError as e:
      version = __get_version()
      # Check that the version is correct
      if version < (2, 4) or version > (4, 0):
         raise RuntimeError("""This version of Gamera requires wxPython 2.4.x, 2.6.x, 2.8.x, 2.9.x, 3.0.x or 4.0.x.  
         However, it seems that you have wxPython %s installed.""" % ".".join([str(x) for x in version]))
开发者ID:hsnr-gamera,项目名称:gamera,代码行数:11,代码来源:compat_wx.py

示例10: _check_wx

def _check_wx():
    try:
        import wxversion
    except ImportError as exc:
        raise ImportError('{exc}; is wxPython installed?'.format(exc=exc))
    for ver in ['2.8-unicode', '3.0']:
        try:
            wxversion.select(ver, optionsRequired=True)
        except wxversion.VersionError:
            continue
        else:
            break
    else:
        raise ImportError('wxPython 3.0 or 2.8 in Unicode mode is required')
开发者ID:jwilk,项目名称:djvusmooth,代码行数:14,代码来源:dependencies.py

示例11: resolve_wxversion

def resolve_wxversion():
    patt = "%d\.%d[0-9\-\.A-Za-z]*-unicode"
    patts = "-unicode"

    versions = wxversion.getInstalled()
    if verbose:
        print 'wxPython Installed :',versions

    # need to select the more recent one with 'unicode'
    vSelected = None
    vSelectedMsg = ''
    for eachVersion in versions:
        for min in range(WXVERSION_MINOR1,WXVERSION_MINOR2+1):
            m = re.search( patt % (WXVERSION_MAJOR,min), eachVersion)
            if m:
                if min == WXVERSION_MINOR2:
                    vSelectedMsg = ''
                else:
                    vSelectedMsg = ' (deprecated version - think to update)'
                vSelected = eachVersion
                break
        if m:
            break

    if vSelected:
        print 'wxPython Selected  :',vSelected,vSelectedMsg
        wxversion.select(vSelected)
        return

    # no compatible version :-( : try to select any release
    bUnicode = False
    for eachVersion in versions:
        m = re.search(patts, eachVersion)
        if m:
            print 'wxPython Selected  :',eachVersion
            wxversion.select(eachVersion)
            bUnicode = True
            break

    if not bUnicode:
        # only ansi release :-( => use US lang
        setLang('us')

    import sys, wx, webbrowser
    app = wx.PySimpleApp()
    wx.MessageBox(message('wxversion_msg') % (WXVERSION_MAJOR,WXVERSION_MINOR2), message('wxversion_title'))
    app.MainLoop()
    webbrowser.open("http://wxpython.org/")
    sys.exit()
开发者ID:amremam2004,项目名称:itrade,代码行数:49,代码来源:itrade_wxversion.py

示例12: plot_recon

def plot_recon(
    loc, 
    actual, 
    recon,
    thetitle="Actual vs reconstruction", 
    showlegend=True):
    if not WXVER_SET:
        import wxversion
        wxversion.select('2.8')
        import wx
        wxverset = True

    figure()
    plot(actual, 'r-')
    plot(recon, 'b--')
    title(thetitle)
    if showlegend:
        legend(['actual','reconstructed'],'lower right')
    xlabel('Time Tick')
    ylabel('Value')
    savefig(loc,format='png')
开发者ID:cmiller8,项目名称:rainmon,代码行数:21,代码来源:analysis.py

示例13: __init__

    def __init__(self,argv=None,user_ns=None,user_global_ns=None,
                 debug=1,shell_class=MTInteractiveShell):

        self.IP = make_IPython(argv,user_ns=user_ns,
                               user_global_ns=user_global_ns,
                               debug=debug,
                               shell_class=shell_class,
                               on_kill=[self.wxexit])

        wantedwxversion=self.IP.rc.wxversion
        if wantedwxversion!="0":
            try:
                import wxversion
            except ImportError:
                error('The wxversion module is needed for WX version selection')
            else:
                try:
                    wxversion.select(wantedwxversion)
                except:
                    self.IP.InteractiveTB()
                    error('Requested wxPython version %s could not be loaded' %
                                                               wantedwxversion)

        import wx

        threading.Thread.__init__(self)
        self.wx = wx
        self.wx_mainloop = hijack_wx()

        # Allows us to use both Tk and GTK.
        self.tk = get_tk()
        
        # HACK: slot for banner in self; it will be passed to the mainloop
        # method only and .run() needs it.  The actual value will be set by
        # .mainloop().
        self._banner = None 

        self.app = None
开发者ID:CVL-dev,项目名称:StructuralBiology,代码行数:38,代码来源:Shell.py

示例14: run

def run():
    """
    A wrapper around main(), which handles profiling if requested.
    """
    import polymer.options
    opts = polymer.options.handle_options()[0]
    if opts.wxversion is not None:
        import wxversion
        if opts.wxversion == 'help':
            for x in wxversion.getInstalled():
                print "Installed:", x
            import sys
            sys.exit()
        else:
            wxversion.select( opts.wxversion )
    if opts.profile:
        import profile
        profile.run( 'main()', opts.profile )
        import pstats
        prof = pstats.Stats( opts.profile )
        prof.sort_stats( 'cumulative', 'calls' ).print_stats( 50 )
    else:
        main()
    return opts.debug
开发者ID:dwd,项目名称:Polymer,代码行数:24,代码来源:polymer.py

示例15:

# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# EPlatform 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with EPlatform. If not, see <http://www.gnu.org/licenses/>.



import wxversion
wxversion.select('2.8')

import glob, os, time
import time
from random import shuffle

import wx
import wx.lib.buttons as bt
from pymouse import PyMouse
import Tkinter
import numpy as np

import subprocess as sp
import shlex
import pygame
from pygame import mixer
开发者ID:bjura,项目名称:EPlatform,代码行数:31,代码来源:EPlatform.py


注:本文中的wxversion.select函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。