Ejemplo n.º 1
0
from os.path import join
from multiprocessing import freeze_support
import h5py

# use agg as long no Figure canvas will draw any qwidget
import matplotlib as mpl
mpl.use('Agg')

# special case on windoze
try:
    import PyQt5.sip as sip
except ImportError:
    import sip

# set PyQt API version to 2.0
sip.setapi('QString', 2)
sip.setapi('QVariant', 2)
sip.setapi('QUrl', 2)

from PyQt5 import QtGui
from PyQt5 import QtWidgets


try:
    # if some packages were not included in the bundle
    # especially sklearn
    try:
        import cecog

    except ImportError:
        sys.path.append(os.pardir)
Features :
- The Analog outputs (PV1...PV3) will be configured to output a set of voltage values that are simultaneously monitored
  by the Analog inputs(CH1.. CH3) and 2 degree fitting polynomial coefficients will be extracted and stored in flash memory .
- A unique timestamp in human readable format will be stored along with the calibration data, and raw data will be locally
  stored in a folder with the same name as the timestamp
- All floating points are converted to strings using the struct module . e.g. struct.pack('3f',*fitvals) , where fitvals = [f1,f2,f3]


'''

import os

os.environ['QT_API'] = 'pyqt'
import PyQt5.sip as sip

sip.setapi("QString", 2)
sip.setapi("QVariant", 2)

import templates.ui_ADS1115calibrator as ADS1115calibrator

import numpy as np
from PyQt5 import QtGui, QtCore
import pyqtgraph as pg
import sys, functools, random, struct, time

params = {
    'image':
    'calib.png',
    'name':
    'ADS1115 based\nCalibrator',
    'hint':
Ejemplo n.º 3
0
__author__ = 'Martin Dobias'
__date__ = 'January 2007'
__copyright__ = '(C) 2007, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from PyQt5 import sip

try:
    apis = [
        "QDate", "QDateTime", "QString", "QTextStream", "QTime", "QUrl",
        "QVariant"
    ]
    for api in apis:
        sip.setapi(api, 2)
except ValueError:
    # API has already been set so we can't set it again.
    pass

from qgis.core import QgsFeature, QgsGeometry

try:
    # Add a __nonzero__ method onto QPyNullVariant so we can check for null values easier.
    #   >>> value = QPyNullVariant("int")
    #   >>> if value:
    #   >>>	  print "Not a null value"
    from types import MethodType
    from PyQt4.QtCore import QPyNullVariant

    def __nonzero__(self):
Ejemplo n.º 4
0
            # if string, just insert this into the path
            sys.path.insert(0, path)
        else:
            # if list, then replace the entire sys.path
            ## modify sys.path in place--no idea who already has a reference to the existing list.
            while len(sys.path) > 0:
                sys.path.pop()
            sys.path.extend(path)

    pyqtapis = opts.pop('pyqtapis', None)
    if pyqtapis is not None:
        try:
            from PyQt5 import sip
        except ImportError:
            import sip
            for k,v in pyqtapis.items():
                sip.setapi(k, v)
        
    qt_lib = opts.pop('qt_lib', None)
    if qt_lib is not None:
        globals()[qt_lib] = importlib.import_module(qt_lib)
    
    targetStr = opts.pop('targetStr')
    try:
        target = pickle.loads(targetStr)  ## unpickling the target should import everything we need
    except:
        print("Current sys.path:", sys.path)
        raise
    target(**opts)  ## Send all other options to the target function
    sys.exit(0)
Ejemplo n.º 5
0
from __future__ import print_function
import os

os.environ.setdefault('QT_API', 'pyqt')
assert os.environ['QT_API'] in ('pyqt5', 'pyqt', 'pyside')

API = os.environ['QT_API']
API_NAME = {'pyqt5': 'PyQt5', 'pyqt': 'PyQt4', 'pyside': 'PySide'}[API]

if API == 'pyqt':
    # Spyder 2.3 is compatible with both #1 and #2 PyQt API,
    # but to avoid issues with IPython and other Qt plugins
    # we choose to support only API #2 for 2.4+
    from PyQt5 import sip
    try:
        sip.setapi('QString', 2)
        sip.setapi('QVariant', 2)
        sip.setapi('QDate', 2)
        sip.setapi('QDateTime', 2)
        sip.setapi('QTextStream', 2)
        sip.setapi('QTime', 2)
        sip.setapi('QUrl', 2)        
    except ValueError:
        import sys
        if 'spyder.spyder' in sys.modules:
            #  Spyder v3 is initializing: it's safe to ignore this exception
            from spyder import __version__ as spyder_ver
            if int(spyder_ver.split('.')[1]) < 3:
                print("Warning: deprecated version of Spyder, please upgrade!", 
                      file=sys.stderr)
        elif 'spyderlib.spyder' in sys.modules:
Ejemplo n.º 6
0
from PyQt5 import sip

# import sip
sip.setapi ( "QString", 2 )
sip.setapi ( 'QVariant', 2 )

from .QtSupport import QtSupport
from .QtEditorModule import QtEditorModule
from .TopEditorModule import TopEditorModule, SubEditorModule
Ejemplo n.º 7
0
#
# This is the install script for the eric6 debug client. It may be used
# to just install the debug clients for remote debugging.
#
"""
Installation script for the eric6 debug clients.
"""

from __future__ import unicode_literals, print_function
try:
    import cStringIO as io
    try:
        from PyQt5 import sip
    except ImportError:
        import sip
    sip.setapi('QString', 2)
    sip.setapi('QVariant', 2)
    sip.setapi('QTextStream', 2)
except (ImportError):
    import io  # __IGNORE_WARNING__

import sys
import os
import re
import compileall
import shutil
import fnmatch

# Define the globals.
progName = None
currDir = os.getcwd()
Ejemplo n.º 8
0
*                                                                         *
***************************************************************************
"""

__author__ = 'Martin Dobias'
__date__ = 'January 2007'
__copyright__ = '(C) 2007, Martin Dobias'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from PyQt5 import sip

try:
    apis = ["QDate", "QDateTime", "QString", "QTextStream", "QTime", "QUrl", "QVariant"]
    for api in apis:
        sip.setapi(api, 2)
except ValueError:
    # API has already been set so we can't set it again.
    pass

from qgis.core import QgsFeature, QgsGeometry

try:
    # Add a __nonzero__ method onto QPyNullVariant so we can check for null values easier.
    #   >>> value = QPyNullVariant("int")
    #   >>> if value:
    #   >>>	  print "Not a null value"
    from types import MethodType
    from PyQt4.QtCore import QPyNullVariant

    def __nonzero__(self):