Changeset 300 for trunk


Ignore:
Timestamp:
10/11/11 04:36:49 (10 years ago)
Author:
sc
Message:
  • Supports enabling/disabling PySide? import via Configuration
Location:
trunk/Puzzlebox/Synapse
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Puzzlebox/Synapse/Client.py

    r299 r300  
    1111 
    1212__changelog__ = """\ 
    13 Last Update: 2011.09.30 
     13Last Update: 2011.10.10 
    1414""" 
    1515 
    1616import os, sys 
    1717import signal 
    18  
    19 try: 
    20         import PySide as PyQt4 
    21         from PySide import QtCore, QtGui, QtNetwork 
    22 except: 
     18import simplejson as json 
     19 
     20import Configuration as configuration 
     21 
     22if configuration.ENABLE_PYSIDE: 
     23        try: 
     24                import PySide as PyQt4 
     25                from PySide import QtCore, QtGui, QtNetwork 
     26        except Exception, e: 
     27                print "ERROR: Excetion importing PySide:", 
     28                print e 
     29                configuration.ENABLE_PYSIDE = False 
     30        else: 
     31                print "Using PySide module" 
     32 
     33if not configuration.ENABLE_PYSIDE: 
    2334        print "Using PyQt4 module" 
    2435        from PyQt4 import QtCore, QtGui, QtNetwork 
    25 else: 
    26         print "Using PySide module" 
     36 
     37 
     38#try: 
     39        #import PySide as PyQt4 
     40        #from PySide import QtCore, QtGui, QtNetwork 
     41#except: 
     42        #print "Using PyQt4 module" 
     43        #from PyQt4 import QtCore, QtGui, QtNetwork 
     44#else: 
     45        #print "Using PySide module" 
    2746 
    2847#from PyQt4 import QtNetwork 
    29 import simplejson as json 
    30 import Configuration as configuration 
     48#import simplejson as json 
     49#import Configuration as configuration 
    3150#import puzzlebox_logger 
    3251 
  • trunk/Puzzlebox/Synapse/Configuration.py

    r272 r300  
    22# -*- coding: utf-8 -*- 
    33 
    4 # Copyright Puzzlebox Productions, LLC (2010) 
     4# Copyright Puzzlebox Productions, LLC (2010-2011) 
    55# 
    66# This code is released under the GNU Pulic License (GPL) version 2 
     
    88 
    99__changelog__ = """\ 
    10 Last Update: 2010.08.09 
    11  
     10Last Update: 2011.10.10 
    1211""" 
    1312 
     
    2625                CONFIGURATION_FILE_PATH = \ 
    2726                        os.path.join('/etc/puzzlebox_synapse', CONFIGURATION_FILE_PATH) 
     27 
     28ENABLE_PYSIDE = False 
    2829 
    2930INTERFACE_CHART_STYLES = { \ 
  • trunk/Puzzlebox/Synapse/Interface.py

    r299 r300  
    1010 
    1111__changelog__ = """\ 
    12 Last Update: 2011.09.30 
     12Last Update: 2011.10.10 
    1313""" 
    1414 
     
    2121import simplejson as json 
    2222 
     23 
     24import Configuration as configuration 
     25 
     26if configuration.ENABLE_PYSIDE: 
     27        try: 
     28                import PySide as PyQt4 
     29                from PySide import QtCore, QtGui, QtNetwork 
     30        except Exception, e: 
     31                print "ERROR: Excetion importing PySide:", 
     32                print e 
     33                configuration.ENABLE_PYSIDE = False 
     34        else: 
     35                print "Using PySide module" 
     36 
     37if not configuration.ENABLE_PYSIDE: 
     38        print "Using PyQt4 module" 
     39        from PyQt4 import QtCore, QtGui, QtNetwork 
     40 
     41 
    2342try: 
    2443        from Interface_Plot import * 
    2544        MATPLOTLIB_AVAILABLE = True 
    26 except: 
     45except Exception, e: 
     46        print "ERROR: Exception importing Interface_Plot:", 
     47        print e 
    2748        MATPLOTLIB_AVAILABLE = False 
    2849 
    29 MATPLOTLIB_AVAILABLE = False 
     50 
     51#try: 
     52        #from Interface_Plot import * 
     53        #MATPLOTLIB_AVAILABLE = True 
     54#except: 
     55        #MATPLOTLIB_AVAILABLE = False 
     56 
     57#MATPLOTLIB_AVAILABLE = False 
    3058 
    3159if (sys.platform != 'win32'): 
     
    3967        DEFAULT_IMAGE_PATH = 'images' 
    4068 
    41 try: 
    42         import PySide as PyQt4 
    43         from PySide import QtCore, QtGui 
    44 except: 
    45         print "Using PyQt4 module" 
    46         from PyQt4 import QtCore, QtGui 
    47 else: 
    48         print "Using PySide module" 
     69#try: 
     70        #import PySide as PyQt4 
     71        #from PySide import QtCore, QtGui 
     72#except: 
     73        #print "Using PyQt4 module" 
     74        #from PyQt4 import QtCore, QtGui 
     75#else: 
     76        #print "Using PySide module" 
    4977 
    5078try: 
     
    5684from Interface_Design import Ui_Form as Design 
    5785 
    58 import Configuration as configuration 
     86#import Configuration as configuration 
    5987import Server as synapse_server 
    6088import Client as thinkgear_client 
  • trunk/Puzzlebox/Synapse/Interface_Design.py

    r192 r300  
    88# WARNING! All changes made in this file will be lost! 
    99 
    10 try: 
    11         import PySide as PyQt4 
    12         from PySide import QtCore, QtGui 
    13 except: 
     10import Configuration as configuration 
     11 
     12if configuration.ENABLE_PYSIDE: 
     13        try: 
     14                import PySide as PyQt4 
     15                from PySide import QtCore, QtGui, QtNetwork 
     16        except Exception, e: 
     17                print "ERROR: Excetion importing PySide:", 
     18                print e 
     19                configuration.ENABLE_PYSIDE = False 
     20        else: 
     21                print "Using PySide module" 
     22 
     23if not configuration.ENABLE_PYSIDE: 
    1424        print "Using PyQt4 module" 
    15         from PyQt4 import QtCore, QtGui 
    16 else: 
    17         print "Using PySide module" 
     25        from PyQt4 import QtCore, QtGui, QtNetwork 
     26 
     27#try: 
     28#       import PySide as PyQt4 
     29#       from PySide import QtCore, QtGui 
     30#except: 
     31#       print "Using PyQt4 module" 
     32#       from PyQt4 import QtCore, QtGui 
     33#else: 
     34#       print "Using PySide module" 
    1835 
    1936#from PyQt4 import QtCore, QtGui 
  • trunk/Puzzlebox/Synapse/Interface_Plot.py

    r176 r300  
    11# -*- coding: utf-8 -*- 
    22 
    3 # Copyright Puzzlebox Productions, LLC (2010) 
     3# Copyright Puzzlebox Productions, LLC (2010-2011) 
    44# 
    55# This code is released under the GNU Pulic License (GPL) version 2 
     
    77 
    88__changelog__ = """\ 
    9 Last Update: 2010.09.15 
    10  
     9Last Update: 2011.10.10 
    1110""" 
    1211 
     
    1615from numpy import arange, sin, pi 
    1716 
    18 try: 
    19         import PySide as PyQt4 
    20         from PySide import QtCore, QtGui 
    21 except: 
     17 
     18#import Puzzlebox.Jigsaw.Configuration as configuration 
     19import Configuration as configuration 
     20 
     21if configuration.ENABLE_PYSIDE: 
     22        try: 
     23                import PySide as PyQt4 
     24                from PySide import QtCore, QtGui 
     25        except: 
     26                configuration.ENABLE_PYSIDE = False 
     27        else: 
     28                print "Using PySide module" 
     29 
     30if not configuration.ENABLE_PYSIDE: 
    2231        print "Using PyQt4 module" 
    2332        from PyQt4 import QtCore, QtGui 
    24 else: 
    25         print "Using PySide module" 
    26  
    27 import Configuration as configuration 
     33 
     34 
     35#try: 
     36        #import PySide as PyQt4 
     37        #from PySide import QtCore, QtGui 
     38#except: 
     39        #print "Using PyQt4 module" 
     40        #from PyQt4 import QtCore, QtGui 
     41#else: 
     42        #print "Using PySide module" 
     43 
     44#import Configuration as configuration 
    2845 
    2946### GLOBALS ### 
  • trunk/Puzzlebox/Synapse/Protocol.py

    r299 r300  
    1111 
    1212__changelog__ = """\ 
    13 Last Update: 2011.09.30 
     13Last Update: 2011.10.10 
    1414""" 
    1515 
     
    8989        import bluetooth 
    9090 
    91 try: 
    92         import PySide as PyQt4 
    93         from PySide import QtCore 
    94 except: 
     91 
     92import Configuration as configuration 
     93 
     94if configuration.ENABLE_PYSIDE: 
     95        try: 
     96                import PySide as PyQt4 
     97                from PySide import QtCore 
     98        except Exception, e: 
     99                print "ERROR: Excetion importing PySide:", 
     100                print e 
     101                configuration.ENABLE_PYSIDE = False 
     102        else: 
     103                print "Using PySide module" 
     104 
     105if not configuration.ENABLE_PYSIDE: 
    95106        print "Using PyQt4 module" 
    96107        from PyQt4 import QtCore 
    97 else: 
    98         print "Using PySide module" 
    99  
    100 import Configuration as configuration 
     108 
     109 
     110#try: 
     111        #import PySide as PyQt4 
     112        #from PySide import QtCore 
     113#except: 
     114        #print "Using PyQt4 module" 
     115        #from PyQt4 import QtCore 
     116#else: 
     117        #print "Using PySide module" 
     118 
     119#import Configuration as configuration 
    101120 
    102121### GLOBALS ### 
  • trunk/Puzzlebox/Synapse/Server.py

    r299 r300  
    2020import simplejson as json 
    2121 
    22 try: 
    23         import PySide as PyQt4 
    24         from PySide import QtCore, QtGui, QtNetwork 
    25 except: 
     22import Configuration as configuration 
     23 
     24if configuration.ENABLE_PYSIDE: 
     25        try: 
     26                import PySide as PyQt4 
     27                from PySide import QtCore, QtGui, QtNetwork 
     28        except Exception, e: 
     29                print "ERROR: Excetion importing PySide:", 
     30                print e 
     31                configuration.ENABLE_PYSIDE = False 
     32        else: 
     33                print "Using PySide module" 
     34 
     35if not configuration.ENABLE_PYSIDE: 
    2636        print "Using PyQt4 module" 
    2737        from PyQt4 import QtCore, QtGui, QtNetwork 
    28 else: 
    29         print "Using PySide module" 
    30  
    31 #from PyQt4 import QtNetwork 
    32  
    33 import Configuration as configuration 
     38 
     39 
     40#try: 
     41        #import PySide as PyQt4 
     42        #from PySide import QtCore, QtGui, QtNetwork 
     43#except: 
     44        #print "Using PyQt4 module" 
     45        #from PyQt4 import QtCore, QtGui, QtNetwork 
     46#else: 
     47        #print "Using PySide module" 
     48 
     49##from PyQt4 import QtNetwork 
     50 
     51#import Configuration as configuration 
    3452import Protocol as serial_interface 
    3553 
Note: See TracChangeset for help on using the changeset viewer.