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'] = ''
def Run(): if not hasattr(sys, 'frozen'): import wxversion wxversion.select('2.8') import wx import PyreGui as PyreGui readmetxt = resources.README() print readmetxt global app global Windows args = pyre.ProcessArgs() arg_values = args.parse_args() app = wx.App(False) Windows["Fixed"] = PyreGui.StosWindow(None, "Fixed", 'Fixed Image', showFixed=True) Windows["Warped"] = PyreGui.StosWindow(None, "Warped", 'Warped Image') Windows["Composite"] = PyreGui.StosWindow(None, "Composite", 'Composite', showFixed=True, composite=True) #Windows["Mosaic"] = PyreGui.MosaicWindow(None, "Mosaic", 'Mosaic') LoadDataFromArgs(arg_values) app.MainLoop() print "Exiting main loop"
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()
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'] = ''
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")
def setWXVersion(): import wxversion if (FORCEWXVERSION): vforced = '2.8' wxversion.select(vforced) else: wxversion.select(['3.0', '2.8'])
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()
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)
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()
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
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)
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]))
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]))
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()
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')
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()
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 wxPython.wx as 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
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: # Note that Phoenix doesn't have wxversion anymore import wxversion except ImportError as e: # if there is no wx raises ImportError import wx return 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('ERROR: wxGUI requires wxPython. %s' % str(e), file=sys.stderr) print( 'You can still use GRASS GIS modules in' ' the command line or in Python.', file=sys.stderr) sys.exit(1) except (ValueError, wxversion.VersionError) as e: print('ERROR: wxGUI requires wxPython >= %d.%d.%d.%d. ' % tuple(minVersion) + '%s.' % (str(e)), file=sys.stderr) sys.exit(1) except locale.Error as e: print("Unable to set locale:", e, file=sys.stderr) os.environ['LC_ALL'] = ''
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: # Note that Phoenix doesn't have wxversion anymore import wxversion except ImportError as e: # if there is no wx raises ImportError import wx return if forceVersion: wxversion.select(forceVersion) wxversion.ensureMinimal(str(minVersion[0]) + '.' + str(minVersion[1])) import wx # noqa: F811 version = parse_version_string(wx.__version__) if version < minVersion: raise ValueError("Your wxPython version is {}".format( wx.__version__)) except ImportError as e: print('ERROR: wxGUI requires wxPython. %s' % str(e), file=sys.stderr) print( 'You can still use GRASS GIS modules in' ' the command line or in Python.', file=sys.stderr) sys.exit(1) except (ValueError, wxversion.VersionError) as e: message = "ERROR: wxGUI requires wxPython >= {version}: {error}".format( version=version_as_string(minVersion), error=e) print(message, file=sys.stderr) sys.exit(1) except locale.Error as e: print("Unable to set locale:", e, file=sys.stderr) os.environ['LC_ALL'] = ''
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')
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')
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
def CreateApplication(self): if os.path.exists("BEREMIZ_DEBUG"): __builtin__.__dict__["BMZ_DBG"] = True else: __builtin__.__dict__["BMZ_DBG"] = False global wxversion, wx import wxversion wxversion.select(['2.8', '3.0']) import wx if wx.VERSION >= (3, 0, 0): self.app = wx.App(redirect=BMZ_DBG) else: self.app = wx.PySimpleApp(redirect=BMZ_DBG) self.app.SetAppName('beremiz') if wx.VERSION < (3, 0, 0): wx.InitAllImageHandlers() self.ShowSplashScreen() self.BackgroundInitialization() self.app.MainLoop()
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
def main(wx_version, cli_options): if platform.system() == 'Linux': try: # to fix some KDE display issues: del os.environ['GTK_RC_FILES'] del os.environ['GTK2_RC_FILES'] except (ValueError, KeyError): pass if not hasattr(sys, "frozen"): try: wxversion.select(wx_version) except wxversion.VersionError: print("\nFailed to load wxPython version %s!\n" % wx_version) sys.exit() import wx if 'unicode' not in wx.PlatformInfo: print( "\nInstalled version: %s\nYou need a unicode build of wxPython to run Metamorphose 2.\n" % wxversion.getInstalled()) # wxversion changes path sys.path[0] = syspath import MainWindow class BoaApp(wx.App): def OnInit(self): self.main = MainWindow.create(None, cli_options) self.main.Show() self.SetTopWindow(self.main) return True application = BoaApp(0) application.MainLoop()
# This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program 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 this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. import wxversion, os, sys, codecs, string, socket, urllib, urllib2 wxversion.select("2.8") import wx, wx.html, threading, time, wx.animate import lib.Variables as Variables import lib.lng class getDescription(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.getDescription = "" self.getDescription_bis = "" self.htmlContent = "" self.htmlwait = "###WAIT###" self.stars = 0 self.cat = 0
#Boa:Frame:Frame1 """ Frame containing all controls available on the Palette. """ import wxversion wxversion.select('2.5') import wx from wx.lib.anchors import LayoutAnchors import wx.grid import wx.lib.buttons import wx.html import wx.gizmos import Everything_img def create(parent): return Frame1(parent) [wxID_FRAME1, wxID_FRAME1BITMAPBUTTON1, wxID_FRAME1BUTTON1, wxID_FRAME1CHECKBOX1, wxID_FRAME1CHECKLISTBOX1, wxID_FRAME1CHOICE1, wxID_FRAME1COMBOBOX1, wxID_FRAME1CONTEXTHELPBUTTON1, wxID_FRAME1DYNAMICSASHWINDOW1, wxID_FRAME1EDITABLELISTBOX1, wxID_FRAME1GAUGE1, wxID_FRAME1GENBITMAPBUTTON1, wxID_FRAME1GENBITMAPTEXTTOGGLEBUTTON1, wxID_FRAME1GENBITMAPTOGGLEBUTTON1, wxID_FRAME1GENBUTTON1, wxID_FRAME1GENTOGGLEBUTTON1, wxID_FRAME1GRID1, wxID_FRAME1HTMLWINDOW1, wxID_FRAME1LEDNUMBERCTRL1, wxID_FRAME1LISTBOX1, wxID_FRAME1LISTCTRL1, wxID_FRAME1NOTEBOOK1, wxID_FRAME1PANEL1, wxID_FRAME1PANEL2, wxID_FRAME1PANEL3, wxID_FRAME1PANEL4, wxID_FRAME1PANEL5, wxID_FRAME1PANEL6, wxID_FRAME1RADIOBOX1, wxID_FRAME1RADIOBUTTON1, wxID_FRAME1SASHLAYOUTWINDOW1, wxID_FRAME1SASHWINDOW1, wxID_FRAME1SCROLLBAR1,
# -*- coding: utf-8 -*- #!python """Signal UI component .""" import wxversion wxversion.select("3.0") import wx import wx.grid import wx.lib.sheet import re import time import config_db import sqlite3 as sqlite #from util import gAuthen,gZip,gZpickle import util from refer_entry import Refer_Entry from thermo_sensor import * #index for named cells _VALUE = int(0) _RC = int(1) _STR = int(2) #index for refer table RC REF_ROW = 6 REF_COL = 6 class Eut(): #__slots__ = {'ID':str, 'field': dict, 'Refer_Table': list} table_name = config_db.eut_table_name db_name = config_db.eut_db
# 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
#!/usr/bin/env python """review.py Alberto Gomez-Casado (c) 2010 University of Twente """ from libhooke import WX_GOOD import wxversion wxversion.select(WX_GOOD) from wx import PostEvent import numpy as np import shutil import libinput as linp import copy import os.path import warnings warnings.simplefilter("ignore", np.RankWarning) class reviewCommands: def do_review(self, args): """ REVIEW (review.py) Presents curves (in current playlist) in groups of ten. User can indicate which curves will be selected to be saved in a separate directory for further analysis. By default curves are presented separated -30 nm in x and -100 pN in y. Curve number one of each set is the one showing the approach. ------------
from __future__ import division from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals import sys if not hasattr(sys, "frozen"): try: import wxversion except ImportError: pass else: try: wxversion.select(["2.8"]) except wxversion.VersionError, e: # if a new interpreter is started with sys.executable on # Mac, sys.frozen may not be set, so we allow/ignore # this error print(repr(e)) import wx def call_after(function): import wx wx.CallAfter(function) def call_later(ms, function): import wx wx.CallLater(ms, function) def show_error(message): import wx
# -*- coding: utf-8 -*- import os import sys import datetime import wxversion wxversion.select("2.8-unicode") import wx sys.path.append('/home/pi/xiaolan/') from Base import xiaolanBase class BaseDisplay(wx.Frame): def __init__(self): """ 展示基类 """ super(BaseDisplay, self).__init__() self.frame = wx.Frame(self, None, -1, "Xiaolan-V2.0-MainPage", (0, 0), size=(1024, 600)) from ButtonProcess import ButtonProcess self.button_process = ButtonProcess() self.xiaolan_base = xiaolanBase() def update(self, type): """ 更新
import sql_keyword as keyword if 0: import wxversion import wxversion as wv wv.select("3.0") import wx import wx.stc as stc import images #from wx.lib.pubsub import Publisher from tc_lib import send #---------------------------------------------------------------------- demoText = """\ ## This version of the editor has been set up to edit SQL source ## code. Here is a copy of wxPython/demo/Main.py to play with. """ #---------------------------------------------------------------------- if wx.Platform == '__WXMSW__': faces = { 'times': 'Times New Roman', 'mono': 'Courier New', 'helv': 'Arial', 'other': 'Comic Sans MS', 'size': 10,
# Workaround for a bug in Ubuntu 10.10 os.environ['XLIB_SKIP_ARGB_VISUALS'] = '1' # This prevents a message printed to the console when wx.lib.masked # is imported from taskcoachlib.widgets on Ubuntu 12.04 64 bits... try: from mx import DateTime except ImportError: pass if not hasattr(sys, "frozen"): # These checks are only necessary in a non-frozen environment, i.e. we # skip these checks when run from a py2exe-fied application import wxversion wxversion.select(["2.8-unicode", "3.0"], optionsRequired=True) try: import taskcoachlib # pylint: disable=W0611 except ImportError: # On Ubuntu 12.04, taskcoachlib is installed in /usr/share/pyshared, # but that folder is not on the python path. Don't understand why. # We'll add it manually so the application can find it. sys.path.insert(0, '/usr/share/pyshared') try: import taskcoachlib # pylint: disable=W0611 except ImportError: sys.stderr.write( '''ERROR: cannot import the library 'taskcoachlib'. Please see https://answers.launchpad.net/taskcoach/+faq/1063 for more information and possible resolutions. ''')
try: import numpy except ImportError: if system == "debian-based": notfound.append("python-numpy") notfound.append("python-numpy-ext") else: notfound.append("NumPy or SciPy") if not hasattr(sys, "frozen"): wx_version = (2, 8, 0, 0) wx_version_str = '.'.join([str(x) for x in wx_version[0:2]]) try: import wxversion if os.path.exists("wxversion"): wxversion.select(open("wxversion").read()) else: wxversion.ensureMinimal(wx_version_str) except ImportError, e: pass try: import wx if not cmp(wx_version, wx.__version__.split('.')): raise ImportError("wxPython was too old") print "wxPython version is", wx.__version__ except (ImportError, KeyError), e: print e if system == "debian-based":
#-*- coding: iso-8859-1 -*- """ On cherche à obtenir des données horaire d'épaisseur optiques que nous pourrons comparer avec les courbes de rayonnement obtenues par le traitement des données obtenues par l'inra """ import wxversion wxversion.select("2.8-msw-unicode'") import wx import os, sys, string #from flatten import flatten #from Numeric import * from numpy import * dirtoconv = os.path.join("D:\\", "dvpt", "pm_aot_tfeuilla","gen") os.chdir(dirtoconv) # Valeurs des différentes colonnes nblignes = 18 g0annee, g0mois, g0jour, g0numjour, g0heure, g0tsv, g0rayglob, g0raydif, g0G0, globM1, globM2, globM3tl2,globM3tl4, globM3tl6, globM4tl2, globM5tl2, gAOT,g0IR = range(nblignes) class selmat: """ Renvoyer un extrait de matrice (array) """ def __init__(self,sourcemat,lstlimits): self.sourcemat = sourcemat self.lstlimits = lstlimits # Les données du photomètre doivent exister pour pouvoir les comparer # ce sont donc ces jours seulement que nous considérerons
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ # begin wxGlade: dependencies import gettext # end wxGlade import sys, time, os sys.path.append("tools")#imports everything from tools folder import wxversion wxversion.select('3.0') import wx print wx.VERSION_STRING import serial from ax12 import * from driver import Driver #from Pose_Editor import * #from SeqEditor import * from project import * from wx.lib.masked import NumCtrl VERSION = "PyPincher2"
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ Unit-тесты """ import os from outwiker.core.defines import WX_VERSION import wxversion try: wxversion.select(WX_VERSION) except wxversion.VersionError: if os.name == "nt": pass else: raise import wx if __name__ == '__main__': from outwiker.core.application import Application Application.init("../test/testconfig.ini") app = wx.App(redirect=False) def emptyFunc(): pass
#!/usr/bin/env python2.4 # I Always specify the python version in the #! line, it makes it much # easier to have multiple versions on your system import wxversion wxversion.select("2.6") ## Note: it may well work with other versions, but it's been tested on 2.6. import wx import os, time class MySplashScreen(wx.SplashScreen): def __init__(self, imageFileName): bmp = wx.Bitmap(imageFileName) wx.SplashScreen.__init__(self, bitmap=bmp, splashStyle=wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, milliseconds=5000, parent=None) #self.Bind(wx.EVT_CLOSE, self.OnClose) #self.fc = wx.FutureCall(2000, self.ShowMain) def OnClose(self, evt): print "OnClose Called" # Make sure the default handler runs too so this window gets # destroyed #evt.Skip() #self.Hide()
import os from string import Template import traceback import threading errorMessageTemplate = Template("""$reason You need to install wxPython $versions toolkit with unicode support to run RIDE. wxPython 2.8.12.1 can be downloaded from http://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/""") supported_versions = ["2.8"] try: import wxversion from wxversion import VersionError if sys.platform == 'darwin': # CAN NOT IMPORT IS_MAC AS THERE IS A wx IMPORT supported_versions.append("2.9") wxversion.select(supported_versions) import wx if "ansi" in wx.PlatformInfo: print errorMessageTemplate.substitute(reason="wxPython with ansi encoding is not supported", versions=" or ".join(supported_versions)) sys.exit(1) except ImportError as e: if "no appropriate 64-bit architecture" in e.message.lower() and sys.platform == 'darwin': print "python should be executed in 32-bit mode to support wxPython on mac. Check BUILD.rest for details" else: print errorMessageTemplate.substitute(reason="wxPython not found.", versions=" or ".join(supported_versions)) sys.exit(1) except VersionError: print errorMessageTemplate.substitute(reason="Wrong wxPython version.", versions=" or ".join(supported_versions)) sys.exit(1) # Insert bundled robot to path before anything else
# 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(): from optparse import OptionParser
import wxversion wxversion.select("2.9") import wx import matplotlib if matplotlib.get_backend() != 'WXAgg': # this is actually just to check if it's loaded. if it already was loaded # and set to a different backend, then we couldn't change it anyway. matplotlib.use('WXAgg') from matplotlib.figure import Figure as MatplotlibFigure from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as MatplotlibFigureCanvas from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as MatplotlibToolbar class Figure(): """ Class for easier embedding a matplotlib canvas in a wxPython window. A WxAgg version of the Matplotlib figure. Pass it a wx.Panel as a parent, and then you can access axes, etc. I tried directly inheriting from MatplotlibFigure but I kept getting an error about the axes not being iterable... """ def __init__(self, parent, **kwargs): self.fig = MatplotlibFigure(facecolor=(0.94117, 0.92156, 0.88627), figsize=(4, 4)) self.fig.clf() self.axes = self.fig.add_subplot(111) if 'xlabel' in kwargs.keys(): self.axes.set_xlabel(kwargs['xlabel'])
#!/usr/bin/env python from ...bibiparrot.Constants.constants import __required_wx_version__ import unittest import logging import wxversion wxversion.select(__required_wx_version__) import wx import wx.tools.img2py from ...bibiparrot.UIElements.MainFrame import MainFrame from ...bibiparrot.UIElements.MainMenu import MainMenu from ...bibiparrot.UIElements.MainToolbar import MainToolbar from ...bibiparrot.UIElements.Editor import Editor from ...bibiparrot.UIElements.MainTabs import MainTabs from ...bibiparrot.UIElements.MainStatusbar import MainStatusbar from ...bibiparrot.Configurations.Configuration import log class TestMainStatusbar(unittest.TestCase): def setUp(self): # fimg = "/Users/shi/Project/github_bibiparrot/bibiparrot/image/themes/default/1389875652_format-text-strikethrough.png" # fpy = "/Users/shi/Project/github_bibiparrot/bibiparrot/image/themes/default/1389875652_format-text-strikethrough.png.py" # fimg = "/Users/shi/Project/github_bibiparrot/bibiparrot/image/themes/default/1389894439_format-text-strikethrough.png" # fpy = "/Users/shi/Project/github_bibiparrot/bibiparrot/image/themes/default/1389894439_format-text-strikethrough.png.py" # wx.tools.img2py.img2py(fimg, fpy) self.app = wx.App(False) mainframe = MainFrame(None)
"email.iterators" ] # ----- some basic checks if __debug__: print "WARNING: Non optimised python bytecode (.pyc) will be produced. Run with -OO instead to produce and bundle .pyo files." if sys.platform != "darwin": print "WARNING: You do not seem to be running Mac OS/X." # ----- import and verify wxPython import wxversion wxversion.select('2.8-unicode') import wx v = wx.__version__ if v < "2.6": print "WARNING: You need wxPython 2.6 or higher but are using %s." % v if v < "2.8.4.2": print "WARNING: wxPython before 2.8.4.2 could crash when loading non-present fonts. You are using %s." % v # ----- import and verify M2Crypto import M2Crypto import M2Crypto.m2
# Builtins import re # wxpython import wxversion wxversion.select("3.0") import wx class AddFTPSourceDialog(wx.Dialog): def __init__(self, parent): super(AddFTPSourceDialog, self).__init__(parent=parent, style=wx.CAPTION | wx.CLOSE_BOX | wx.SYSTEM_MENU, title='Add Source') self.parent = parent self.ip = None self.path = None self.canceled = True self.ip_textctrl = None self.path_textctrl = None self.init_ui() def init_ui(self): ip_label = wx.StaticText(parent=self, label='IP:') self.ip_textctrl = wx.TextCtrl(parent=self) path_label = wx.StaticText(parent=self, label='Path:')
RIDE can be started either without any arguments or by giving a path to a test data file or directory to be opened. RIDE's API is still evolving while the project is moving towards the 1.0 release. The most stable, and best documented, module is `robotide.pluginapi`. """ import sys import os try: import wxversion from wxversion import VersionError if sys.platform == 'darwin': # CAN NOT IMPORT IS_MAC AS THERE IS A wx IMPORT wxversion.select(['2.8', '2.9']) else: wxversion.select('2.8') except ImportError: print """wxPython not found. You need to install wxPython 2.8 toolkit with unicode support to run RIDE. See http://wxpython.org for more information.""" sys.exit(1) except VersionError: print """Wrong wxPython version. You need to install wxPython 2.8 toolkit with unicode support to run RIDE. See http://wxpython.org for more information.""" sys.exit(1) # Insert bundled robot to path before anything else sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib'))
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('pyspread') except AttributeError: # Probably not on Windows pass # Patch for using with PyScripter thanks to Colin J. Williams # If wx exists in sys,modules, we dont need to import wx version. # wx is already imported if the PyScripter wx engine is used. try: sys.modules['wx'] except KeyError: # Select wx version 3.0 if possible try: import wxversion wxversion.select(['3.0', '2.8', '2.9']) except ImportError: pass from src.gui._events import post_command_event, GridActionEventMixin DEBUG = False class Commandlineparser(object): """ Command line handling Methods: --------
############################################################################# # Name : PyLookInside.py # # Version : 4.0 # # Authors : JCie & Beatrix # # Created : December 2009 # # Copyright : © Copyright 2009-2010 | BeatriX # # License : wxWindows License Version 3.1 # # About : PyLookInside was built using Python 2.6.4, # # wxPython 2.8.10.1 unicode, and wxWindows # ############################################################################# # Import packages import wxversion wxversion.select("2.8-unicode") # Launch the script only from wx.Python 2.8 try: import wx # This module uses the new wx namespace except ImportError: raise ImportError, u"The wxPython unicode module is required to run this program." import sys import VersionInfos import SplashScreen import MenuBar import ToolBar import StatusBar import TaskBarIcon import wx.aui import ListCtrlVirtual
#------------------------------------------------------------------------- import multiprocessing import optparse as op import os import sys import shutil if sys.platform == 'win32': import _winreg else: if sys.platform != 'darwin': import wxversion wxversion.ensureMinimal('2.8-unicode', optionsRequired=True) wxversion.select('2.8-unicode', optionsRequired=True) import wx #from wx.lib.pubsub import setupv1 #new wx from wx.lib.pubsub import setuparg1# as psv1 #from wx.lib.pubsub import Publisher #import wx.lib.pubsub as ps from wx.lib.pubsub import pub as Publisher #import wx.lib.agw.advancedsplash as agw #if sys.platform == 'linux2': # _SplashScreen = agw.AdvancedSplash #else: # if sys.platform != 'darwin': # _SplashScreen = wx.SplashScreen
import wxversion wxversion.select("2.8") import wx import matplotlib if matplotlib.get_backend() != 'WXAgg': # this is actually just to check if it's loaded. if it already was loaded # and set to a different backend, then we couldn't change it anyway. matplotlib.use('WXAgg') from matplotlib.figure import Figure as MatplotlibFigure from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as MatplotlibFigureCanvas from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as MatplotlibToolbar class Figure(): """ Class for easier embedding a matplotlib canvas in a wxPython window. A WxAgg version of the Matplotlib figure. Pass it a wx.Panel as a parent, and then you can access axes, etc. I tried directly inheriting from MatplotlibFigure but I kept getting an error about the axes not being iterable... """ def __init__( self, parent, **kwargs ): self.fig = MatplotlibFigure( facecolor=(0.94117,0.92156,0.88627), figsize=(4,4) ) self.fig.clf() self.axes = self.fig.add_subplot(111) if 'xlabel' in kwargs.keys(): self.axes.set_xlabel( kwargs['xlabel'] )
# -*- coding: utf-8 -*- import os, sys import wxversion __dir__ = os.path.realpath(os.path.abspath(os.path.dirname(__file__))) if __dir__ not in sys.path: sys.path.insert(0, __dir__) wxversion.select('3.0') import lib import tran import analytic import ctx import ostools import app import model import activity import plugin
print 'using encoding %s'%unicodeEncoding if hasattr(sys, 'frozen'): sys.setdefaultencoding(unicodeEncoding) else: reload(sys) sys.setdefaultencoding(unicodeEncoding) del sys.setdefaultencoding try: # See if there is a multi-version install of wxPython if not hasattr(sys, 'frozen'): import wxversion if wxVersionSelect is None: wxversion.ensureMinimal('2.5') else: wxversion.select(wxVersionSelect) except ImportError: # Otherwise assume a normal 2.4 install, if it isn't 2.4 it will # be caught below pass import wx wx.RegisterId(15999) #warnings.filterwarnings('ignore', '', DeprecationWarning, 'wxPython.imageutils') # Use package version string as it is the only one containing bugfix version number # Remove non number/dot characters wxVersion = wx.__version__ for c in wxVersion: if c not in string.digits+'.':
# 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
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # """ This implements the Transana Font Formatting Panel class. The wxPython wxFontDialog proved inadequate for my needs, especially on the Mac. It is modeled after wxFontDialog. """ __author__ = 'David Woods <*****@*****.**>' # Enable (True) or Disable (False) debugging messages DEBUG = False if DEBUG: print "FormatFontPanel DEBUG is ON" # For testing purposes, this module can run stand-alone. if __name__ == '__main__': import wxversion wxversion.select(['2.6-unicode']) # import wxPython import wx # Import the FormatDialog object (for constant definitions) import FormatDialog if __name__ == '__main__': # This module expects i18n. Enable it here. __builtins__._ = wx.GetTranslation # import the TransanaGlobal variables import TransanaGlobal
#!/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):
pyfalog.info("Python version: {0}", sys.version) if sys.version_info < (2, 7) or sys.version_info > (3, 0): exit_message = "Pyfa requires python 2.x branch ( >= 2.7 )." raise PreCheckException(exit_message) if hasattr(sys, 'frozen'): pyfalog.info("Running in a frozen state.") else: pyfalog.info("Running in a thawed state.") if not hasattr(sys, 'frozen') and wxversion: try: if options.force28 is True: pyfalog.info("Selecting wx version: 2.8. (Forced)") wxversion.select('2.8') else: pyfalog.info("Selecting wx versions: 3.0, 2.8") wxversion.select(['3.0', '2.8']) except: pyfalog.warning( "Unable to select wx version. Attempting to import wx without specifying the version." ) else: if not wxversion: pyfalog.warning( "wxVersion not found. Attempting to import wx without specifying the version." ) try: # noinspection PyPackageRequirements