psychopy_post_inst.py :  » Game-2D-3D » PsychoPy » PsychoPy-0.96.02 » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Game 2D 3D » PsychoPy 
PsychoPy » PsychoPy 0.96.02 » psychopy_post_inst.py
##-----------------------------
##Windows post install (shortcuts etc...)
##-----------------------------
import sys, glob
def install():
    import os
    try:
        print "Adding shortcuts to >>Start>Programs>PsychoPy"
        progsFolder= get_special_folder_path("CSIDL_COMMON_PROGRAMS")
        sitePackages = os.path.join(sys.prefix , 'lib','site-packages')
        demosFolder = os.path.join(sys.prefix , 'lib','site-packages', 'psychopy', 'demos')
        
        #Psychopy Programs folder
        psychopyShortcuts = os.path.join(progsFolder, 'PsychoPy')
        if not os.path.isdir(psychopyShortcuts):
            os.mkdir(psychopyShortcuts)
            directory_created(psychopyShortcuts)
             
        #PsychoStation center
        PsychoIDELink= os.path.join(psychopyShortcuts, "PsychoPy IDE.lnk")
        if os.path.isfile(PsychoIDELink):    
            os.remove(PsychoIDELink)#we want to make a new one
        psychoIDEloc = os.path.join(sitePackages,'psychopyIDE', "PsychoPyIDE.py")
        pythonLoc = os.path.join(sys.prefix, 'pythonw.exe')
        if os.path.isfile(PsychoIDELink):    
            os.remove(PsychoIDELink)#we want to make a new one
        create_shortcut('"'+pythonLoc+'"',  #target
                        'PsychoPy IDE',   #description
                        PsychoIDELink,  #filename
                        '"' + psychoIDEloc + '"', #args
                        '', #working directory (blank)  os.path.join(sitePackages,'psychopy','PsychoCentral'),
                        os.path.join(sitePackages,'psychopyIDE','psychopy.ico'))    
        file_created(PsychoIDELink)
        
        #monitor center
        #monitorCenterLink= "c://python24//python.exe" + os.path.join(psychopyShortcuts, "MonitorCenter.lnk")
        #if os.path.isfile(monitorCenterLink):    
            #os.remove(monitorCenterLink)#we want to make a new one
        #create_shortcut(os.path.join(sitePackages,'monitors', "MonitorCenter.py"),
                        #'PsychoPy Monitor Center', monitorCenterLink,
                        #'',#args
                        #os.path.join(sitePackages,'monitors'),
                        #os.path.join(sitePackages,'monitors','psychopy.ico'))
        #file_created(monitorCenterLink)
        
        #homepage
        homePageLink = os.path.join(psychopyShortcuts, "PsychoPyHome.lnk")
        if os.path.isfile(homePageLink):    
            os.remove(homePageLink)#we want to make a new one
        create_shortcut(r"http://www.psychopy.org",
                            'PsychoPy HomePage', homePageLink)
        file_created(homePageLink)
        
        print "All done. Enjoy!"
        
        #remove outdated demo files
        oldDemos = glob.glob(demosFolder+"//demo_*")
        for file in oldDemos:
            os.remove(file)
        
    except:
        print "failed to install shortcuts"
        exc = sys.exc_info()
        print exc[0],exc[1]
    
    print ""
    print """TOP TIP: It's a good idea to add PsychoPyIDE to your handlers for *.py files.
    To do that, open a windows explorer window, go to >Tools>FoldersOptions>FileTypes.
    Find .py file type, click 'Advanced' and add the command:
        "C:\Python25\pythonw.exe" "C:\Python25\Lib\site-packages\PsychoPyIDE\PsychoPyIDE.py" "%1"
    Now you can right-click files and open them in PsychoPy, ready-to-run :-)
    """
if len(sys.argv) > 1:
    if sys.argv[1] == '-install':
        install()
    else:
        print "Script was called with option %s" % sys.argv[1]
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.