Changeset 7f291a3 in sasview for sansview


Ignore:
Timestamp:
Jul 14, 2011 4:26:17 PM (13 years ago)
Author:
Jae Cho <jhjcho@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
19b5c5c9
Parents:
e5df560
Message:

implemented SANSVIEWPATH env.

Location:
sansview
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sansview/installer_generator.py

    rf5f257b r7f291a3  
    11""" 
    2 this module generate .ss file according to the local config of 
     2This module generates .ss file according to the local config of 
    33the current application. Please make sure a file named "local_config.py" 
    44exists in the current directory. Edit local_config.py according to your needs. 
     
    1010REG_PROGRAM = """{app}\MYPROG.EXE"" ""%1""" 
    1111APPLICATION = str(local_config.__appname__ )+ '.exe' 
    12 AppName  = str(local_config.__appname__ ) + '-'+ str(local_config.__version__) 
     12AppName  = str(local_config.__appname__ ) # + '-'+ str(local_config.__version__) 
    1313AppVerName = str(local_config.__appname__ ) + '-'+ str(local_config.__version__) 
     14Dev = '' 
     15if AppVerName.lower().count('dev') > 0: 
     16    Dev = '-Dev' 
    1417AppPublisher = local_config._copyright 
    1518AppPublisherURL = local_config._homepage 
    1619AppSupportURL = local_config._homepage 
    1720AppUpdatesURL = local_config._homepage 
    18 DefaultDirName = os.path.join("{pf}" , AppVerName)  
     21ChangesEnvironment = 'true' 
     22DefaultDirName = os.path.join("{pf}" , AppName+Dev)  
    1923DefaultGroupName = os.path.join(local_config.DefaultGroupName, AppVerName) 
    2024                                 
     
    8791        msg += """ValueName: "%s";\t""" % str('')  
    8892        msg += """ValueData: "{app}\%s,0"\n""" % str(APPLICATION) 
     93         
    8994        #execute the file on double-click 
    9095        msg += """Root: HKCR; Subkey: "{app}\%s\shell\open\command";\t"""  %  str(APPLICATION) 
     
    9398        msg += """ValueData: \"""{app}\%s""  ""%s1\"""\n"""% (str(APPLICATION), 
    9499                                                              str('%')) 
    95  
     100         
     101        #SANSVIEWPATH 
     102        msg += """Root: HKCU; Subkey: "%s";\t"""  %  str('Environment') 
     103        msg += """ValueType: %s; """ % str('expandsz') 
     104        msg += """ValueName: "%s";\t""" % str('SANSVIEWPATH')  
     105        msg += """ValueData: "{app}";\t""" 
     106        msg += """ Flags: %s""" % str('uninsdeletevalue') 
     107        msg += "\n" 
     108         
     109        #PATH 
     110        msg += """; Write to PATH (below) is disabled; need more work\n""" 
     111        msg += """;Root: HKCU; Subkey: "%s";\t"""  %  str('Environment') 
     112        msg += """ValueType: %s; """ % str('expandsz') 
     113        msg += """ValueName: "%s";\t""" % str('PATH')  
     114        msg += """ValueData: "%s;{olddata}";\t""" % str('%SANSVIEWPATH%') 
     115        msg += """ Check: %s""" % str('NeedsAddPath()') 
     116        msg += "\n" 
     117         
    96118    return msg 
    97119 
     
    156178    msg += """Description: "{cm:LaunchProgram, %s}";\t""" %str(AppName)  
    157179    msg += """Flags: nowait postinstall skipifsilent\n""" 
     180    return msg 
     181 
     182def write_code(): 
     183    """ 
     184    Code that checks the existing path and snaviewpath  
     185    in the environmental viriables/PATH 
     186    """ 
     187    msg = """\n\n[Code]\n""" 
     188    msg += """function NeedsAddPath(): boolean;\n"""  
     189    msg += """var\n"""  
     190    msg += """  oldpath: string;\n""" 
     191    msg += """  newpath: string;\n"""  
     192    msg += """  pathArr:    TArrayOfString;\n"""  
     193    msg += """  i:        Integer;\n"""  
     194    msg += """begin\n"""  
     195    msg += """  RegQueryStringValue(HKEY_CURRENT_USER,'Environment',""" 
     196    msg += """'PATH', oldpath)\n""" 
     197    msg += """  oldpath := oldpath + ';';\n""" 
     198    msg += """  newpath := '%SANSVIEWPATH%';\n""" 
     199    msg += """  i := 0;\n""" 
     200    msg += """  while (Pos(';', oldpath) > 0) do begin\n""" 
     201    msg += """    SetArrayLength(pathArr, i+1);\n""" 
     202    msg += """    pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1);\n""" 
     203    msg += """    oldpath := Copy(oldpath, Pos(';', oldpath)+1,""" 
     204    msg += """ Length(oldpath));\n""" 
     205    msg += """    i := i + 1;\n""" 
     206    msg += """    // Check if current directory matches app dir\n""" 
     207    msg += """    if newpath = pathArr[i-1] \n""" 
     208    msg += """    then begin\n""" 
     209    msg += """      Result := False;\n""" 
     210    msg += """      exit;\n""" 
     211    msg += """    end;\n""" 
     212    msg += """  end;\n""" 
     213    msg += """  Result := True;\n""" 
     214    msg += """end;\n""" 
     215    msg += """\n""" 
     216     
     217     
     218     
     219     
    158220    return msg 
    159221 
     
    171233    TEMPLATE += "AppSupportURL=%s\n" % str(AppSupportURL) 
    172234    TEMPLATE += "AppUpdatesURL=%s \n" % str(AppUpdatesURL) 
     235    TEMPLATE += "ChangesEnvironment=%s \n" % str(ChangesEnvironment) 
    173236    TEMPLATE += "DefaultDirName=%s\n" % str(DefaultDirName) 
    174237    TEMPLATE += "DefaultGroupName=%s\n" % str(DefaultGroupName) 
     
    187250    TEMPLATE += write_icon() 
    188251    TEMPLATE += write_run() 
     252    TEMPLATE += write_code() 
    189253    path = '%s.iss' % str(INSTALLER_FILE) 
    190254    f = open(path,'w')  
  • sansview/installer_new.iss

    r4356634 r7f291a3  
    77 
    88ChangesAssociations=yes 
    9 AppName=SansView-1.9.1 
    10 AppVerName=SansView-1.9.1 
     9AppName=SansView 
     10AppVerName=SansView-1.9.2dev_JUN 
    1111AppPublisher=(c) 2009, University of Tennessee 
    1212AppPublisherURL=http://danse.chem.utk.edu 
    1313AppSupportURL=http://danse.chem.utk.edu 
    1414AppUpdatesURL=http://danse.chem.utk.edu  
    15 DefaultDirName={pf}\SansView-1.9.1 
    16 DefaultGroupName=DANSE\SansView-1.9.1 
     15ChangesEnvironment=true  
     16DefaultDirName={pf}\SansView-Dev 
     17DefaultGroupName=DANSE\SansView-1.9.2dev_JUN 
    1718DisableProgramGroupPage=yes 
    1819LicenseFile=license.txt 
     
    3738Root: HKCR; Subkey: "{app}\images\ball.ico";    ValueType: string; ValueName: "";       ValueData: "{app}\SansView.exe,0" 
    3839Root: HKCR; Subkey: "{app}\SansView.exe\shell\open\command";    ValueType: string; ValueName: "";       ValueData: """{app}\SansView.exe""  ""%1""" 
     40Root: HKCU; Subkey: "Environment";      ValueType: expandsz; ValueName: "SANSVIEWPATH"; ValueData: "{app}";      Flags: uninsdeletevalue 
     41; Write to PATH (below) is disabled; need more work 
     42;Root: HKCU; Subkey: "Environment";     ValueType: expandsz; ValueName: "PATH"; ValueData: "%SANSVIEWPATH%;{olddata}";   Check: NeedsAddPath() 
    3943 
    4044 
     
    5559 
    5660[Icons] 
    57 Name: "{group}\SansView-1.9.1"; Filename: "{app}\SansView.exe"; WorkingDir: "{app}"  
    58 Name: "{group}\{cm:UninstallProgram, SansView-1.9.1}";   Filename: "{uninstallexe}"  
    59 Name: "{commondesktop}\SansView-1.9.1"; Filename: "{app}\SansView.exe"; Tasks: desktopicon; WorkingDir: "{app}"  
     61Name: "{group}\SansView";       Filename: "{app}\SansView.exe"; WorkingDir: "{app}"  
     62Name: "{group}\{cm:UninstallProgram, SansView}";         Filename: "{uninstallexe}"  
     63Name: "{commondesktop}\SansView-1.9.2dev_JUN";  Filename: "{app}\SansView.exe"; Tasks: desktopicon; WorkingDir: "{app}"  
    6064 
    6165 
    6266[Run] 
    63 Filename: "{app}\SansView.exe"; Description: "{cm:LaunchProgram, SansView-1.9.1}";      Flags: nowait postinstall skipifsilent 
     67Filename: "{app}\SansView.exe"; Description: "{cm:LaunchProgram, SansView}";    Flags: nowait postinstall skipifsilent 
     68 
     69 
     70[Code] 
     71function NeedsAddPath(): boolean; 
     72var 
     73  oldpath: string; 
     74  newpath: string; 
     75  pathArr:    TArrayOfString; 
     76  i:        Integer; 
     77begin 
     78  RegQueryStringValue(HKEY_CURRENT_USER,'Environment','PATH', oldpath) 
     79  oldpath := oldpath + ';'; 
     80  newpath := '%SANSVIEWPATH%'; 
     81  i := 0; 
     82  while (Pos(';', oldpath) > 0) do begin 
     83    SetArrayLength(pathArr, i+1); 
     84    pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1); 
     85    oldpath := Copy(oldpath, Pos(';', oldpath)+1, Length(oldpath)); 
     86    i := i + 1; 
     87    // Check if current directory matches app dir 
     88    if newpath = pathArr[i-1]  
     89    then begin 
     90      Result := False; 
     91      exit; 
     92    end; 
     93  end; 
     94  Result := True; 
     95end; 
     96 
  • sansview/local_config.py

    r4356634 r7f291a3  
    77# Version of the application 
    88__appname__ = "SansView" 
    9 __version__ = '1.9.1' 
     9__version__ = '1.9.2dev_JUN' 
    1010__download_page__ = 'http://danse.chem.utk.edu' 
    1111__update_URL__ = 'http://danse.chem.utk.edu/sansview_version.php' 
     
    6565SPLASH_SCREEN_WIDTH = 512 
    6666SPLASH_SCREEN_HEIGHT = 366 
    67 SS_MAX_DISPLAY_TIME = 5000 #5 sec 
     67SS_MAX_DISPLAY_TIME = 6000 #6 sec 
    6868WELCOME_PANEL_SHOW = False 
    6969CLEANUP_PLOT = False 
Note: See TracChangeset for help on using the changeset viewer.