diff options
author | Derrick Hendricks <derrick@nanorex.com> | 2008-03-25 20:05:50 +0000 |
---|---|---|
committer | Derrick Hendricks <derrick@nanorex.com> | 2008-03-25 20:05:50 +0000 |
commit | 820df467d163d8c95500bf43bb6180dd6b1a3cf8 (patch) | |
tree | ac97b3dd78924abc20f15234c80771e59f3109ed | |
parent | 5cfde81b65a4b523c2889c89634d51c13f4151c2 (diff) | |
download | nanoengineer-820df467d163d8c95500bf43bb6180dd6b1a3cf8.tar.gz nanoengineer-820df467d163d8c95500bf43bb6180dd6b1a3cf8.zip |
Checkin of preferences modifier program. Install files for NE1 Suite. FlashDrive tree
-rw-r--r-- | packaging/Pref_Mod/pref_modifier.py | 97 | ||||
-rw-r--r-- | packaging/Pref_Mod/preferences.py | 785 | ||||
-rw-r--r-- | packaging/Pref_Mod/prefs_constants.py | 312 | ||||
-rw-r--r-- | packaging/Pref_Mod/setup_win.py | 4 | ||||
-rw-r--r-- | packaging/Suite/Win32/NE1.ico | bin | 0 -> 5430 bytes | |||
-rw-r--r-- | packaging/Suite/Win32/gle32.dll | bin | 0 -> 143360 bytes | |||
-rw-r--r-- | packaging/Suite/Win32/glut32.dll | bin | 0 -> 237568 bytes | |||
-rw-r--r-- | packaging/Suite/Win32/install-header.bmp | bin | 0 -> 34256 bytes | |||
-rw-r--r-- | packaging/Suite/Win32/install.ico | bin | 0 -> 5390 bytes | |||
-rw-r--r-- | packaging/Suite/Win32/suite_installer.nsi | 482 | ||||
-rw-r--r-- | packaging/Suite/Win32/uninstall.ico | bin | 0 -> 5390 bytes | |||
-rw-r--r-- | packaging/Suite/Win32/wizard-sidebar.bmp | bin | 0 -> 206040 bytes |
12 files changed, 1680 insertions, 0 deletions
diff --git a/packaging/Pref_Mod/pref_modifier.py b/packaging/Pref_Mod/pref_modifier.py new file mode 100644 index 000000000..26e6817e3 --- /dev/null +++ b/packaging/Pref_Mod/pref_modifier.py @@ -0,0 +1,97 @@ +import os
+from preferences import prefs_context
+import sys
+import getopt
+
+prefs = prefs_context()
+
+if os.name=="nt": #Windows machines spawn and remove the shell, so no info is normally captured
+ try: #The next lines until the sys.stdout were taken and modified from PlatformDependent.py
+ capture_con=True
+ tmpFilePath = os.path.normpath(os.path.expanduser("~/Nanorex/")) #Find the default user path
+ if not os.path.exists(tmpFilePath): #If it doesn't exist
+ try:
+ os.mkdir(tmpFilePath) #Try making one
+ except:
+ capture_con=False # we tried, but there's no easy way to capture the console
+ if capture_con:
+ sys.stdout = open(os.path.normpath(tmpFilePath+"/prefs-run.log"), 'w')
+ sys.stderr = open(os.path.normpath(tmpFilePath+"/prefs-err.log"), 'w')
+ except:
+ pass
+
+from prefs_constants import qutemol_enabled_prefs_key
+from prefs_constants import qutemol_path_prefs_key
+from prefs_constants import nanohive_enabled_prefs_key
+from prefs_constants import nanohive_path_prefs_key
+from prefs_constants import povray_enabled_prefs_key
+from prefs_constants import povray_path_prefs_key
+from prefs_constants import megapov_enabled_prefs_key
+from prefs_constants import megapov_path_prefs_key
+from prefs_constants import povdir_enabled_prefs_key
+from prefs_constants import gamess_enabled_prefs_key
+from prefs_constants import gmspath_prefs_key
+from prefs_constants import gromacs_enabled_prefs_key
+from prefs_constants import gromacs_path_prefs_key
+from prefs_constants import cpp_enabled_prefs_key
+from prefs_constants import cpp_path_prefs_key
+
+def parseopts(optslist):
+ global keyset,valueset,exitset
+ #use of globals is generally bad. If this program gets bigger, this
+ #should be rewritten
+ for oneopt in optslist:
+ if oneopt[0]=="-K" or oneopt[0]=="-k":
+ keyset=oneopt[1]
+ if oneopt[0]=="-V" or oneopt[0]=="-v":
+ valueset=oneopt[1]
+ if valueset.upper()=="TRUE":
+ valueset=True
+ elif valueset.upper()=="FALSE":
+ valueset=False
+ if keyset=="" or valueset=="":
+ exitset=True
+
+#re-define the variables needed into a dictionary to make calling them
+#easier from the command line input
+prefkeys={}
+prefkeys["qutemol_enabled"]=qutemol_enabled_prefs_key
+prefkeys["qutemol_path"]=qutemol_path_prefs_key
+prefkeys["nanohive_enabled"]=nanohive_enabled_prefs_key
+prefkeys["nanohive_path"]=nanohive_path_prefs_key
+prefkeys["povray_enabled"]=povray_enabled_prefs_key
+prefkeys["povray_path"]=povray_path_prefs_key
+prefkeys["megapov_enabled"]=megapov_enabled_prefs_key
+prefkeys["megapov_path"]=megapov_path_prefs_key
+prefkeys["povdir_enabled"]=povdir_enabled_prefs_key
+prefkeys["gamess_enabled"]=gamess_enabled_prefs_key
+prefkeys["gamess_path"]=gmspath_prefs_key
+prefkeys["gromacs_enabled"]=gromacs_enabled_prefs_key
+prefkeys["gromacs_path"]=gromacs_path_prefs_key
+prefkeys["cpp_enabled"]=cpp_enabled_prefs_key
+prefkeys["cpp_path"]=cpp_path_prefs_key
+
+#determining if everything needed from the command line is there.
+keyset=valueset=""
+exitset=False
+#progopts stores the arguments passed to it from the command line
+try:
+ progopts=getopt.getopt(sys.argv[1:],"k:K:v:V:")
+except:
+ exitset=True
+
+#start of actual main program
+progopts=progopts[0]
+parseopts(progopts)
+if exitset:
+ print "Usage: pref_modifier -K <key value> -V <value to store>"
+ sys.exit(0)
+
+key=prefkeys[keyset] #set the key value to that used by the database
+print keyset
+print valueset
+print key
+
+prefstmp={}
+prefstmp[key]=valueset #set up the dict for the database update funtion
+prefs.update(prefstmp)
diff --git a/packaging/Pref_Mod/preferences.py b/packaging/Pref_Mod/preferences.py new file mode 100644 index 000000000..3b2b2a6d8 --- /dev/null +++ b/packaging/Pref_Mod/preferences.py @@ -0,0 +1,785 @@ +# Copyright 2005-2008 Nanorex, Inc. See LICENSE file for details.
+"""
+preferences.py -- Preferences system.
+
+@author: bruce
+@version: $Id: preferences.py 11951 2008-03-14 04:44:50Z ericmessick $
+@copyright: 2005-2008 Nanorex, Inc. See LICENSE file for details.
+
+Module classification: [bruce 071215]
+
+At least foundation, due to integral use of "from changes import UsageTracker".
+But also could be construed to have lots of app-specific knowledge,
+due to "from prefs_constants import prefs_table". But for now, experiment
+with pretending that's not app-specific, which we can get away with since
+it's pure data... and this might even make sense, if different apps
+share code which references the same prefs_keys from that table,
+as long as we make sure they can use different (per-app) prefs files.
+(For the same reason, we'll also classify prefs_constants as foundation
+or lower. In fact, it'll be utilities or constants for now, as explained
+in its docstring.)
+
+A desirable refactoring might be to classify prefs_constants higher
+(model or a specific app) and pass it to a prefs singleton as an argument.
+Then it'd be more clearly ok to call this module "foundation", but let
+prefs_constants be higher. OTOH, the reason explained above may make it
+perfectly ok for prefs_constants to be very low.
+
+==
+
+Prototype for Alpha.
+
+See lower-down docstrings for usage.
+
+==
+
+History:
+
+bruce 050106 or so: created it.
+
+[some minor changes since then]
+
+bruce 050804: added prefs usage/change tracking.
+
+==
+
+Should be used with bsddb,
+but works without it too, after printing a warning.
+The module bsddb is present in our standard installations
+of windows and linux python, but not yet Mac python;
+but we can add it, since it's easily available from
+
+ http://undefined.org/python/pimp/darwin-7.0.0-Power_Macintosh.html
+
+(package bsddb3 4.1.6)
+
+BUT WE SHOULD LOOK INTO THE LICENSE TO MAKE SURE IT'S OK!
+(It probably is, and [050804] I think Huaicai investigated this
+ and confirmed that it is.)
+"""
+
+import os
+import time
+import sys
+
+#from utilities import debug_flags
+
+#try:
+# atom_debug # don't disturb it if already set (e.g. by .atom-debug-rc)
+#except:
+# try:
+# atom_debug = os.environ['ATOM_DEBUG'] # as a string; should be "1" or "0"
+# except:
+# atom_debug = 0
+# try:
+# atom_debug = int(atom_debug)
+# except:
+# pass
+# atom_debug = not not atom_debug
+
+#if atom_debug:
+# print "fyi: user has requested ATOM_DEBUG feature; extra debugging code enabled; might be slower"
+
+# ==
+
+# debug flags for dna updater, controlled by debug_prefs
+# in dna_updater.dna_updater_prefs.
+# The default values set here don't matter, afaik,
+# since they are replaced by debug_pref values before use.
+# [bruce 080228 moved these here]
+
+DEBUG_DNA_UPDATER_MINIMAL = True
+
+DEBUG_DNA_UPDATER = True
+
+DEBUG_DNA_UPDATER_VERBOSE = False
+
+DNA_UPDATER_SLOW_ASSERTS = True
+
+
+def mkdirs_in_filename(filename):
+ """
+ Make all directories needed for the directory part of this filename,
+ if nothing exists there. Never make the filename itself (even if it's
+ intended to be a directory, which we have no way of knowing anyway).
+ If something other than a directory exists at one of the dirs we might
+ otherwise make, we don't change it, which will probably lead to errors
+ in this function or in the caller, which is fine.
+ """
+ dir, file = os.path.split(filename)
+ if not os.path.exists(dir):
+ mkdirs_in_filename(dir)
+ os.mkdir(dir)
+ return
+
+# Finding or making special directories and files (e.g. in user's homedir):
+
+# code which contains hardcoded filenames in the user's homedir, etc
+# (moved into this module from MWsemantics.py by bruce 050104,
+# since not specific to one window, might be needed before main window init,
+# and the directory names might become platform-specific.)
+
+_tmpFilePath = None
+
+def find_or_make_Nanorex_directory():
+ """
+ Find or make the directory ~/Nanorex, in which we will store
+ important subdirectories such as Preferences, temporary files, etc.
+ If it doesn't exist and can't be made, try using /tmp.
+ [#e Future: for Windows that backup dir should be something other than /tmp.
+ And for all OSes, we should use a more conventional place to store prefs
+ if there is one (certainly there is on Mac).]
+ """
+ global _tmpFilePath
+ if _tmpFilePath:
+ return _tmpFilePath # already chosen, always return the same one
+ _tmpFilePath = _find_or_make_nanorex_dir_0()
+ assert _tmpFilePath
+ return _tmpFilePath
+
+def _find_or_make_nanorex_dir_0():
+ """
+ private helper function for find_or_make_Nanorex_directory
+ """
+ #Create the temporary file directory if not exist [by huaicai ~041201]
+ # bruce 041202 comments about future changes to this code:
+ # - we'll probably rename this, sometime before Alpha goes out,
+ # since its purpose will become more user-visible and general.
+ # - it might be good to create a README file in the directory
+ # when we create it. And maybe to tell the user we created it,
+ # in a dialog.
+ # - If creating it fails, we might want to create it in /tmp
+ # (or wherever some python function says is a good temp dir)
+ # rather than leaving an ususable path in tmpFilePath. This
+ # could affect someone giving a demo on a strange machine!
+ # - If it exists already, we might want to test that it's a
+ # directory and is writable. If we someday routinely create
+ # a new file in it for each session, that will be a good-
+ # enough test.
+ tmpFilePath = os.path.normpath(os.path.expanduser("~/Nanorex/"))
+ if not os.path.exists(tmpFilePath):
+ try:
+ os.mkdir(tmpFilePath)
+ except:
+ sys.exit
+ #bruce 041202 fixed minor bug in next line; removed return statement
+ #print_compact_traceback("exception in creating temporary directory: \"%s\"" % tmpFilePath)
+ #bruce 050104 new feature [needs to be made portable so it works on Windows ###@@@]
+ os_tempdir = "/tmp"
+ print "warning: using \"%s\" for temporary directory, since \"%s\" didn't work" % (os_tempdir, tmpFilePath)
+ tmpFilePath = os_tempdir
+ #e now we should create or update a README file in there [bruce 050104]
+ return tmpFilePath
+
+#import foundation.env as env
+#import utilities.EndUser as EndUser
+#from utilities.debug import print_compact_traceback
+
+#from foundation.changes import UsageTracker
+
+#from prefs_constants import prefs_table
+
+# some imports remain lower down, for now: bsddb and shelve
+
+
+"""
+Some internal & client-code documentation, as of 050106:
+
+We store prefs in a shelf. Restrictions imposed by the shelve module:
+Keys must be strings, values can be any pickleable python exprs,
+and neither can be extremely long (exact limits are not made clear).
+
+When these restrictions become a problem, we will make our intermediating
+layer handle them (for example, by translating long keys to short ones).
+
+==
+
+Concurrent access:
+
+We usually keep the shelf closed, in case other processes want to access or modify it too.
+This only works if we assume that these processes only open it briefly when processing
+some user event (typed command or clicked button), and this doesn't happen in two processes
+at once since the user can only give events to one process at a time. For this reason,
+it's important to only open it briefly during a user event (and only at the beginning
+if the processing takes a long time), and never any other time!
+
+Also, if you (a process) start another process which might access the prefs when it starts,
+you should only access them yourself just before it starts (and during subsequent user events,
+assuming that subprocess follows the same rule).
+
+We rely on the client code to follow these rules; we don't try to enforce them.
+Breaking them might conceivably trash the entire prefs database, or perhaps more likely,
+cause an error in the process trying to access it while another process is doing so.
+(This depends on the db module, and I don't know what bsddb does in this case.)
+
+We make no attempt yet to handle these errors or back up the prefs database.
+
+==
+
+Internal shelf key usage:
+
+Current internal shelf key usage (this might change at any time,
+without the client-code keys changing):
+
+Keys starting "k " are translated versions of client-code keys;
+see internal _attr2key method (which will be renamed).
+
+Keys starting '_' or with a digit are reserved for use by this code.
+In fact, all other keys are reserved. Presently used: see the code.
+The most important one is _format_version.
+
+==
+
+High-level keys and values:
+
+Keys supplied by client code (translated through _attr2key into shelf keys)
+are presently just strings, using conventions still mostly to be invented,
+but in the future will be able to be more kinds of objects.
+
+Values supplied by client code will in the future be translated, and have
+metainfo added, but this is not yet done. Values must be pickleable, and
+also should not include instances of classes until we decide which of
+those are ok. (But Numeric arrays are ok.)
+
+For now, all modules use the same global namespace of high-level keys,
+but this might change. To permit this, the module defining the key
+needs to be detectable by this code... basically this means any given key
+should be passed into this module from the same external module.
+Details to be documented when they are implemented and become relevant.
+
+==
+
+Usage by client code (for now -- this might change!):
+
+ from foundation.preferences import prefs_context
+
+ prefs = prefs_context()
+
+ key = "some string" # naming conventions to be introduced later
+
+ prefs[key] = value
+
+ value = prefs[key] # raises KeyError if not there
+
+ # these dict-like operations might or might not work
+ # (not yet tested; someday we will probably suppport them
+ # and make them more efficient than individual operations
+ # when several prefs are changed at once)
+
+ prefs.get(key, defaultvalue)
+
+ prefs.update(dict1)
+
+ dict1.update(prefs)
+
+"""
+
+# ===
+
+# This module wants bsddb, just to make sure the shelf is stored in a format
+# that (we hope) all platforms can open. (It also might be more reliable,
+# be better at concurrent access, and/or permit longer keys and (especially)
+# values than other db packages.)
+
+# But, we'll run without it if necessary, but when we do, we'll use a different
+# shelf name, in case the binary formats are incompatible. (Not a perfect solution,
+# since there's no guarantee the db format without bsddb is always the same...
+# but I don't know a good-enough way to find out which db module shelve is actually using.)
+
+try:
+ import bsddb3 as _junk
+ _junk # try to tell pylint we need this import [bruce 071023]
+except:
+ sys.exit(1)
+else:
+ dbname = "bsddb"
+
+# And this module requires shelve. We assume without checking that if bsddb is available,
+# shelve will use it. (I don't know any straightforward way to check this. But the
+# docs for shelve say it will use it, I think. #k check this ###@@@)
+
+from bsddb3 import dbshelve
+
+# (For the actual filename of the prefs file, see the code of _make_prefs_shelf()
+# below, which specifies the basename only; the db module decides what extension
+# to add. This is one reason we store the prefs in a subdirectory.)
+
+# ===
+
+_shelfname = _shelf = _cache = None
+
+_defaults = _trackers = None #bruce 050804 new features
+
+def _make_prefs_shelf():
+ """[private function]
+ call this once per session,
+ to create or find the shelf (whose name depends only on the dbm format we'll use for it),
+ and create the cache of its contents,
+ and store a comment there about this process,
+ and close the shelf again in case a concurrent process is sharing the same shelf with us.
+ """
+ global _shelfname, _shelf, _cache, _defaults, _trackers
+ nanorex = find_or_make_Nanorex_directory()
+ global dbname
+ _shelfname = os.path.join( nanorex, "Preferences", "%s-shelf" % dbname )
+ # This name should differ when db format differs.
+ # Note: the actual filename used might have an extension added
+ # by the db module (in theory, it might even create two files
+ # with different extentions from the given basename).
+ # By experiment, on the Mac, with bsddb there is no extension added,
+ # and without it there is '.db' added. [bruce 050105]
+ mkdirs_in_filename(_shelfname)
+ _shelf = dbshelve.open(_shelfname)
+ _cache = {}
+ _cache.update(_shelf) # will this work?
+ _defaults = {}
+ _trackers = {}
+ # zap obsolete contents
+ obskeys = []
+ for key in _cache.keys():
+ if key.isdigit() or key in ['_session_counter']:
+ obskeys.append(key)
+ for key in obskeys:
+ del _shelf[key]
+ del _cache[key]
+ ###@@@ following should be revised to handle junk contents gracefully,
+ # and to notice the existing format version and handle older formats appropriately
+ # or reject them gracefully.
+ _store_while_open('_format_version', 'preferences.py/v050106')
+ # storing this blindly is only ok since the only prior version is one
+ # we can transparently convert to this one by the "zap obskeys" above.
+
+ # store a comment about the last process to start using this shelf
+ # (nothing yet looks at this comment)
+ proc_info = "process: pid = %d, starttime = %r" % (os.getpid(), time.asctime())
+ _store_while_open( '_fyi/last_proc', proc_info ) # (nothing yet looks at this)
+ _close()
+ return
+
+def _close():
+ global _shelf
+ _shelf.close()
+ _shelf = None
+ return
+
+def _reopen():
+ _ensure_shelf_exists()
+ global _shelf
+ assert _shelf is None
+ _shelf = dbshelve.open(_shelfname)
+ # don't bother to re-update our _cache! This would be too slow to do every time.
+ return
+
+def _store_new_while_open(key, val): # [not used as of 050804]
+ assert not _shelf.has_key(key) # checks _shelf, not merely _cache
+ assert not _cache.has_key(key)
+ _cache[key] = val
+ _shelf[key] = val
+ return
+
+def _store_while_open(key, val): # [used only when initializing the shelf, as of 050804]
+ # don't assert _cache and _shelf are the same at this key -- it's not an error if they are not,
+ # or if shelf has a value and cache does not, since a concurrent process is allowed to write
+ # a prefs value on its own.
+ _cache[key] = val
+ _shelf[key] = val
+ return
+
+def _ensure_shelf_exists():
+ if not _shelfname:
+ _make_prefs_shelf()
+ return
+
+#bruce 050804/050805 new features:
+
+def _track_change(pkey):
+ _tracker_for_pkey( pkey).track_change()
+
+def _track_use(pkey):
+ _tracker_for_pkey( pkey).track_use()
+
+def _tracker_for_pkey(pkey):
+ try:
+ return _trackers[pkey]
+ except KeyError:
+ sys.exit(1)
+ #tracker = _trackers[pkey] = UsageTracker()
+ #return tracker
+ pass
+
+def _get_pkey_key(pkey, key): #bruce 050804 split this out of __getitem__ so I can also use it in get (both methods)
+ "[#doc better; note: pkey and key args are redundant; they're both provided just for this implem's convenience]"
+ _track_use(pkey) # note, this is done even if we raise KeyError below (which is good)
+ try:
+ return _cache[pkey]
+ except KeyError:
+ raise KeyError, key # note: exception detail is key, not pkey as it would be if we just said "raise"
+ pass
+
+def _get_pkey_faster(pkey): # optimization of _get_pkey_key(pkey, key) when the KeyError exception detail doesn't matter
+ _track_use(pkey)
+ return _cache[pkey]
+
+def _record_default( pkey, dflt):
+ """Record this default value (if none is yet known for pkey),
+ so other code can find out what the default value is,
+ for use in "restore defaults" buttons in prefs UI.
+ In debug version, also ensure this is the same as any previously recorded default value.
+ Note, dflt can be anything, even None, though some callers have a special case
+ which avoids calling this when dflt is None.
+ """
+ _defaults.setdefault( pkey, dflt) # only affects it the first time, for a given pkey
+ if debug_flags.atom_debug:
+ # also check consistency each time
+ if dflt != _defaults[pkey]:
+ print "atom_debug: bug: ignoring inconsistent default %r for pref %r; retaining %r" % \
+ ( dflt, pkey, _defaults[pkey] ) #e also print key if in future the key/pkey relation gets more complex
+ return
+
+def _restore_default_while_open( pkey): #bruce 050805
+ """Remove the pref for pkey from the prefs db (but no error if it's not present there).
+ As for the internal value of the pref (in _cache, and for track_change, and for subscriptions to its value):
+ If a default value has been recorded, change the cached value to that value
+ (as it would be if this pref had originally been missing from the db, and a default value was then recorded).
+ If not, remove it from _cache as well, and use the internal value of None.
+ Either way, if the new internal value differs from the one before this function was called,
+ track the change and fulfill any subscriptions to it.
+ If possible, don't track a use of the prefs value.
+ """
+ priorval = _cache.get(pkey) # might be None
+ if _shelf.has_key(pkey):
+ del _shelf[pkey]
+ try:
+ dflt = _defaults[pkey]
+ except KeyError:
+ if debug_flags.atom_debug:
+ print "atom_debug: fyi: restore defaults finds no default yet recorded for %r; using None" % pkey
+ _cache[pkey] = dflt = None
+ del _cache[pkey]
+ else:
+ _cache[pkey] = dflt
+ if dflt != priorval:
+ _track_change(pkey)
+ #e fulfill any subscriptions to this value (if this is ever done by something other than track_change itself)
+ return
+
+def keys_list( keys): #bruce 050805
+ """Given a key or a list of keys (or a nested list), return an equivalent list of keys.
+ Note: tuples of keys are not allowed (someday they might be a new kind of primitive key).
+ """
+ res = []
+ if type(keys) == type([]):
+ for sub in keys:
+ res.extend( keys_list( sub) )
+ #e could be optimized (trivially, if we disallowed nested lists)
+ else:
+ assert type(keys) == type("a")
+ res.append(keys)
+ return res
+
+# ==
+
+# Now make a prefs function, which returns a prefs object [someday] customized for the calling module,
+# in which prefs can be accessed or stored using attributes, whose names are interpreted in a context
+# which might differ for each module.
+
+_NOT_PASSED = [] # private object for use as keyword arg default [bruce 070110, part of fixing bug of None as Choice value]
+ # (note, the same global name is used for different objects in preferences.py and debug_prefs.py)
+
+class _prefs_context:
+ """Represents a symbol context for prefs names, possibly [someday] customized for one module.
+ """
+ def __init__(self, modname):
+ # modname is not presently used
+ _ensure_shelf_exists() # needed before __getattr__ and __getitem__ are called
+ self.trackers = {}
+ def _attr2key(self, attr):
+ return "k " + attr # stub! (i guess)
+ #e Someday we will support more complex keys,
+ # which are like exprs whose heads (at all levels) are in our context.
+ # For now, just support arbitrary strings as items.
+ def __setitem__(self, key, val):
+ assert type(key) == type("a") # not unicode, numbers, lists, ... for now
+ pkey = self._attr2key(key) # but we might use a more general func for this, at some point
+ try:
+ #bruce 050804 new feature: detect "change with no effect" (where new value equals existing value),
+ # so we can avoid tracking that as an actual change.
+ # We also avoid tracking this as a use (even though we do use the value for the comparison).
+ # And, while we're at it, optimize by not changing the prefs db in this case.
+ # This is not just an optimization, since if the prefs db contains no value for this pref,
+ # and no value other than the default value (according to the current code) has been stored during this session
+ # and if this remains true in the present call (i.e. val equals the default value),
+ # then (due to some of today's changes to other code here, particularly self.get storing dflt in cache), #####IMPLEM
+ # we won't store anything in the prefs db now.
+ cached_val = _cache[pkey] # this might be a default value from the present code which is not in the prefs db
+ except KeyError:
+ same = False
+ else:
+ # If no default value is known, we consider any value to differ from it.
+ # [##e Would it be better to treat this as if the default value was None (like prefs.get does)??]
+ same = (val == cached_val)
+ if same:
+ if 0 and debug_flags.atom_debug:
+ print "atom_debug: fyi: returning early from prefs.__setitem__(%r) since val == cached_val, %r == %r" % (key, val, cached_val)
+ return # see long comment above
+ if _shelf:
+ _shelf[pkey] = _cache[pkey] = val
+ #Next line removed because I don't care about tracking changes right now. (Derrick)
+# _track_change(pkey) # do this only after the change happens, for the sake of formulas...
+ #e (someday we might pass an arg saying the change is done, or the curval is merely invalid,
+ # and if the latter, whether another track_change will occur when the change is done.)
+ else:
+ try:
+ _reopen()
+ _shelf[pkey] = _cache[pkey] = val
+ _track_change(pkey)
+ finally:
+ _close()
+ return
+ def __getitem__(self, key):
+ assert type(key) == type("a")
+ pkey = self._attr2key(key)
+ return _get_pkey_key( pkey, key)
+ def get(self, key, dflt = _NOT_PASSED): #bruce 050117; revised 050804, and 070110 to use _NOT_PASSED
+ assert type(key) == type("a")
+ pkey = self._attr2key(key)
+ if dflt is not _NOT_PASSED:
+ _record_default( pkey, dflt)
+ #bruce 070110 bugfix: use _NOT_PASSED rather than None.
+ # Before this fix, passing None explicitly as dflt would fail to record it, which could cause later exceptions
+ # when client code used env.prefs[key] if the pref had never been saved. This was one of two bugs in
+ # using a Choice value of None in debug_prefs.py. The other part is fixed in debug_prefs.py dated today.
+ del dflt # [if dflt was used below and we removed this del, we'd need to replace _NOT_PASSED with None in this localvar]
+ try:
+ return _get_pkey_faster( pkey) # optim of self[key]
+ # note: usage of this pref is tracked in _get_pkey_faster even if it then raises KeyError.
+ except KeyError:
+ #bruce 050804 new features (see long comment in __setitem__ for partial explanation):
+ # if default value must be used, then
+ # (1) let it be the first one recorded regardless of the one passed to this call, for consistency;
+ # (2) store it in _cache (so this isn't called again, and for other reasons mentioned in __setitem__)
+ # but not in the prefs db itself.
+ try:
+ dflt = _defaults[pkey] # might be None, if that was explicitly recorded by a direct call to _record_default
+ except KeyError:
+ # no default value was yet recorded
+ dflt = None # but don't save None in _cache in this case
+ if debug_flags.atom_debug:
+ print "atom_debug: warning: prefs.get(%r) returning None since no default value was yet recorded" % (key,)
+ else:
+ _cache[pkey] = dflt # store in cache but not in prefs-db
+ return dflt
+ pass
+ def update(self, dict1): #bruce 050117
+ # note: unlike repeated setitem, this only opens and closes once.
+ if _shelf:
+ for key, val in dict1.items():
+ #e (on one KeyError, should we store the rest?)
+ #e (better, should we check all keys before storing anything?)
+ self[key] = val #e could optimize, but at least this leaves it open
+ # that will do _track_use(pkey); if we optimize this, remember to do that here.
+ else:
+ try:
+ _reopen()
+ self.update(dict1)
+ finally:
+ _close()
+ return
+ def suspend_saving_changes(self): #bruce 051205 new feature
+ """Let prefs changes after this point be saved in RAM and take full effect
+ (including notifying subscribers),
+ but not be saved to disk until the next call to resume_saving_changes
+ (which should be called within the same user command or mouse drag,
+ but not for every mouse motion during a drag).
+ Use this to prevent constant updates to disk for every mouse motion
+ during a drag (e.g. as a prefs slider is adjusted).
+ Warn if called when changes are already suspended,
+ but as a special case to mitigate bugs of failing to call resume,
+ save all accumulated changes whenever called.
+ """
+ if _shelf:
+ # already suspended -- briefly resume (so they're saved) before suspending (again)
+ print "bug: suspend_saving_changes when already suspended -- probably means resume was missing; saving them now"
+ _close()
+ _reopen()
+ return
+ def resume_saving_changes(self, redundant_is_ok = False): #bruce 051205 new feature
+ """Resume saving changes, after a call of suspend_saving_changes.
+ Optional redundant_is_ok = True prevents a warning about a redundant call;
+ this is useful for letting callers make sure changes are being saved
+ when they should be (and probably already are).
+ """
+ if _shelf:
+ if redundant_is_ok: # this case untested (no immediate use is planned as of 051205)
+ print "Warning: resume_saving_changes(redundant_is_ok = True) was in fact redundant --"
+ print " i.e. it may have been necessary to work around a bug and save prefs."
+ _close()
+ else:
+ if not redundant_is_ok:
+ print "warning: redundant resume_saving_changes ignored"
+ return
+ def restore_defaults(self, keys): #bruce 050805
+ """Given a key or a list of keys,
+ restore the default value of each given preference
+ (if one has yet been recorded, e.g. if prefs.get has been provided with one),
+ with all side effects as if the user set it to that value,
+ but actually remove the value from the prefs db as well
+ (so if future code has a different default value for the same pref,
+ that newer value will be used by that future code).
+ [#e we might decide to make that prefs-db-removal feature optional.]
+ """
+ if _shelf:
+ for key in keys_list( keys):
+ pkey = self._attr2key(key)
+ _restore_default_while_open( pkey)
+ else:
+ try:
+ _reopen()
+ self.restore_defaults( keys)
+ finally:
+ _close()
+ return
+
+ def get_default_values(self, keys): #bruce 080131 UNTESTED @@@@
+ """
+ @param keys: a list of key strings (tuple not allowed; nested list not allowed)
+ """
+ assert type(keys) == type([])
+ return map( self.get_default_value, keys)
+
+ def get_default_value(self, key, _default_return_value = None): #bruce 080131/080201 UNTESTED @@@@
+ """
+ @param key: a key string
+ """
+ # review: should default value of _default_return_value be None (as now), or _NOT_PASSED?
+ assert type(key) == type("")
+ pkey = self._attr2key(key)
+ dflt = _defaults.get(pkey, _default_return_value)
+ return dflt
+
+ def has_default_value(self, key): #bruce 080131/080201 UNTESTED @@@@
+ """
+ @param key: a key string
+ """
+ # This is a ###STUB in a few ways:
+ # - it ought to compare using same_vals, not != (also in setitem??)
+ # - the specification doesn't say what to do when no default is yet recorded
+ # - old version without _NOT_PASSED:
+ # it might record a default of None if no default is yet recorded (not sure)
+ # - new version with _NOT_PASSED: correctness not fully reviewed
+ dflt = self.get_default_value(key, _NOT_PASSED)
+ current = self.get(key, dflt) # does usage tracking (good)
+ same = not (dflt != current)
+ # (note: this is a safer comparison than ==, but not perfect,
+ # re Numeric arrays)
+ return same
+
+ def have_default_values(self, keys): #bruce 080201 UNTESTED @@@@
+ """
+ Return True if every prefs key in the given list currently has
+ its default value (i.e. if restore_defaults would not
+ change their current values).
+
+ @param keys: a list of key strings (tuple not allowed; nested list not allowed)
+ """
+ assert type(keys) == type([])
+ # note: I think this does not access the shelf,
+ # so we don't need to optimize it to only open the shelf once.
+ for key in keys:
+ if not self.has_default_value(key):
+ return False
+ return True
+
+ pass # end of class _prefs_context
+
+# for now, in this stub code, all modules use one context:
+_global_context = _prefs_context("allmodules")
+
+def prefs_context():
+ ###@@@ stub: always use the same context, not customized to the calling module.
+ return _global_context
+
+# ==
+
+# initialization code [bruce 050805] (includes the set of env.prefs)
+
+def declare_pref( attrname, typecode, prefskey, dflt = None ): # arg format is same as prefs_table record format
+ assert typecode in ['color','boolean','string','int', 'float'] or type(typecode) == type([]) #e or others as we define them
+ #e create type object from typecode
+ #e get dflt from type object if it's None here, otherwise tell this dflt to type object
+ #e record type object
+ #e use attrname to set up faster/cleaner access to this pref?
+ #e etc.
+
+ # Record the default value now, before any other code can define it or ask for the pref.
+ # (This value is used if that pref is not yet in the db;
+ # it's also used by "reset to default values" buttons in the UI,
+ # though those will have the side effect of defining that value in the db.)
+ prefs = prefs_context()
+ if dflt is not None:
+ curvaljunk = prefs.get( prefskey, dflt)
+ return
+
+#def init_prefs_table( prefs_table): # sets env.prefs
+# for prefrec in prefs_table:
+# try:
+# declare_pref(*prefrec)
+# except:
+# sys.exit(1)
+# #print_compact_traceback( "ignoring prefs_table entry %r with this exception: " % (prefrec,) )
+# pass
+
+# env.prefs = prefs_context() # this is only ok because all modules use the same prefs context.
+
+# if 0 and debug_flags.atom_debug:
+# print "atom_debug: done with prefs_table" # remove when works
+# return
+
+#init_prefs_table( prefs_table)
+ # this is guaranteed to be done before any prefs_context object exists, including env.prefs
+ # (but not necessarily just after this module is imported, though presently, it is;
+ # similarly, it's not guaranteed that env.prefs exists arbitrarily early,
+ # though in practice it does after this module is imported, and for now it's ok
+ # to write code which would fail if that changed, since it'll be easy to fix that code
+ # (and to detect that we need to) if it ever does change.)
+
+# ==
+
+'''
+use prefs_context() like this:
+
+prefs = prefs_context() # once per module which uses it (must then use it in the same module)
+
+... prefs['atom_debug'] = 1
+
+... if prefs['atom_debug']:
+ ...
+
+or make up keys as strings and use indexing, prefs[key],
+but try to compute the strings in only one place
+and use them from only one module.
+
+We will gradually introduce naming conventions into the keys,
+for example, module/subname, type:name. These will be documented
+once they are formalized.
+
+[these rules might be revised!]
+'''
+
+# == test code (very incomplete) [revised 050804 since it was out of date]
+
+if __name__ == '__main__':
+## defaults = dict(hi = 2, lo = 1)
+## print "grabbing %r, got %r" % (defaults, grab_some_prefs_from_cache(defaults))
+## new = dict(hi = time.asctime())
+## print "now will store new values %r" % new
+## store_some_prefs(new)
+## print "now we grab in same way %r" % grab_some_prefs_from_cache(defaults) # this failed to get new value, but next proc gets it
+## print "done with this grossly incomplete test; the shelfname was", _shelfname
+
+ # now try this:
+ testprefs = prefs_context()
+ testprefs['x'] = 7
+ print "should be 7:",testprefs['x']
+
+# end
diff --git a/packaging/Pref_Mod/prefs_constants.py b/packaging/Pref_Mod/prefs_constants.py new file mode 100644 index 000000000..5b0eae9a8 --- /dev/null +++ b/packaging/Pref_Mod/prefs_constants.py @@ -0,0 +1,312 @@ +# Copyright 2005-2008 Nanorex, Inc. See LICENSE file for details.
+"""
+prefs_constants.py
+
+Constants and utilities related to user preferences,
+which need to be defined immediately upon startup.
+
+@author: Mark, Bruce, Ninad
+@version: $Id: prefs_constants.py 11951 2008-03-14 04:44:50Z ericmessick $
+@copyright: 2005-2008 Nanorex, Inc. See LICENSE file for details.
+
+History:
+
+Mark 050629 moved some A6 prefs keys he had earlier defined and organized
+in UserPrefs.py, into constants.py.
+
+Bruce 050805 moved those into this new file, and added more.
+
+Module classification:
+
+"utilities" or perhaps "constants" for now, even though it can be
+thought of as containing app-specific knowledge; for reasons and caveats
+and desirable refactoring, see preferences.py docstring. The reason it
+is even lower than foundation is to avoid package import cycles, e.g. if
+foundation -> io -> this, or if utilities.GlobalPreferences imports this.
+[bruce 071215]
+
+Refactoring needed:
+
+- See preferences.py docstring.
+
+- Has a few functions that ought to be split out, like
+getDefaultWorkingDirectory.
+"""
+
+import sys, os # for getDefaultWorkingDirectory
+
+
+# Keys for user preferences
+# (the string constants should start with the first released version they'll appear in)
+
+# General prefs
+displayCompass_prefs_key = 'A6/Display Compass'
+displayCompassLabels_prefs_key = 'A7/Display Compass Label'
+compassPosition_prefs_key = 'A6/Compass Position'
+displayOriginAxis_prefs_key = 'A6/Display Origin Axis'
+displayPOVAxis_prefs_key = 'A6/Display POV Axis'
+defaultProjection_prefs_key = 'A7/Default Projection'
+animateHighQualityGraphics_prefs_key = 'A7/Animate with High Quality Graphics' #mark 060315. NIY.
+animateStandardViews_prefs_key = 'A7/Animate Standard Views'
+animateMaximumTime_prefs_key = 'A7/Maximum Animation Time'
+workingDirectory_prefs_key = 'WorkingDirectory' # Moved here from startup_funcs.py. Mark 060726.
+backgroundColor_prefs_key = 'A9/Background Color' # Mark 060814.
+backgroundGradient_prefs_key = 'A9/Background Gradient' # Mark 060814.
+##defaultDisplayMode_prefs_key = 'A9/Default Display Mode' # Mark 060815.
+ # [disabled since assigned differently below -- bruce 080212]
+mouseSpeedDuringRotation_prefs_key = 'A9/Mouse Speed During Rotation' #Ninad 060906
+displayOriginAsSmallAxis_prefs_key = 'A9/Display Origin As Small Axis' #Ninad 060920
+zoomAboutScreenCenter_prefs_key = 'A9/Zoom To Screen Center' #Ninad 060926
+displayRulers_prefs_key = 'A10/Display rulers'
+displayVertRuler_prefs_key = 'A10/Display vertical ruler'
+displayHorzRuler_prefs_key = 'A10/Display horizontal ruler'
+rulerPosition_prefs_key = 'A10/Ruler Position'
+rulerColor_prefs_key = 'A10/Ruler Color'
+rulerOpacity_prefs_key = 'A10/Ruler Opacity'
+showRulersInPerspectiveView_prefs_key = 'A10/Show Rulers In Perspective View'
+
+#ToolTip Prefs
+dynamicToolTipWakeUpDelay_prefs_key = 'A9/DynamicToolTip Wake Up Delay'
+dynamicToolTipAtomDistancePrecision_prefs_key = 'A9/DynamicToolTip Atom Distance Precision'
+dynamicToolTipBendAnglePrecision_prefs_key = 'A9/DynamicToolTip Bend Angle Precision'
+dynamicToolTipTorsionAnglePrecision_prefs_key = 'A9/DynamicToolTip Torsion Angle Precision'
+dynamicToolTipAtomChunkInfo_prefs_key = 'A9/DynamicToolTip Atom Chunk Info'
+dynamicToolTipBondChunkInfo_prefs_key = 'A9/DynamicToolTip Bond Chunk Info'
+dynamicToolTipAtomPosition_prefs_key = 'A9/DynamicToolTip Atom Position'
+dynamicToolTipAtomDistanceDeltas_prefs_key = 'A9/DynamicToolTip Atom Distance Deltas'
+dynamicToolTipBondLength_prefs_key = 'A9/DynamicToolTip Bond Length'
+dynamicToolTipAtomMass_prefs_key = 'A9/DynamicToolTip Atom Mass'
+dynamicToolTipVdwRadiiInAtomDistance_prefs_key = 'A10/tooltip Vdw Radii In Atom Distance'
+
+
+# Minimize prefs for Adjust All and Adjust Selection (presently on General prefs pane)
+# (note, Adjust Atoms does not yet have its own prefs -- its values are derived from these
+# but differently than for Adjust All/Sel)
+#mark 060627, revised by bruce 060628, 060705 for A8
+Adjust_watchRealtimeMinimization_prefs_key = 'A7/Watch Realtime Minimization' # same key as in A7
+Adjust_endRMS_prefs_key = 'A8/End RMS Adjust'
+Adjust_endMax_prefs_key = 'A8/End Max Adjust'
+Adjust_cutoverRMS_prefs_key = 'A8/Cutover RMS Adjust'
+Adjust_cutoverMax_prefs_key = 'A8/Cutover Max Adjust'
+
+Adjust_minimizationEngine_prefs_key = 'A10/Adjust Minimization Engine'
+
+#Ninad 20070509 Adjust , Minimize and Simulation(Dynamics) Preferences for DNA
+#reduced model(Enable or disable elecrostatics)
+electrostaticsForDnaDuringAdjust_prefs_key = 'A9/ Electrostatics for Dna During Adjust'
+electrostaticsForDnaDuringMinimize_prefs_key = 'A9/ Electrostatics For Dna During Minimize'
+electrostaticsForDnaDuringDynamics_prefs_key = 'A9/ Electrostatics For Dna During Simulation'
+
+# Minimize prefs for Minimize Energy dialog (independent settings, different defaults) [bruce 060705]
+Minimize_watchRealtimeMinimization_prefs_key = 'A8/Watch Realtime Minimization Minimize'
+Minimize_endRMS_prefs_key = 'A8/End RMS Minimize'
+Minimize_endMax_prefs_key = 'A8/End Max Minimize'
+Minimize_cutoverRMS_prefs_key = 'A8/Cutover RMS Minimize'
+Minimize_cutoverMax_prefs_key = 'A8/Cutover Max Minimize'
+
+Minimize_minimizationEngine_prefs_key = 'A10/Minimize Minimization Engine'
+
+# Pref to add potential energy to trace file
+Potential_energy_tracefile_prefs_key = 'A8/Potential energy checkbox'
+
+# Atom prefs
+atomHighlightColor_prefs_key = 'A6/Atom Highlight Color'
+deleteAtomHighlightColor_prefs_key = 'A10/Delete Atom Highlight Color'
+bondpointHighlightColor_prefs_key = 'A7/Bondpoint Highlight Color'
+bondpointHotspotColor_prefs_key = 'A6/Atom Hotspot Color'
+defaultDisplayMode_prefs_key = 'A6/Default Display Mode'
+diBALL_AtomRadius_prefs_key = 'A7/CPK Atom Radius Percentage' # this is about diBALL which as of 060307 is called Ball and Stick in UI
+ #bruce 060607 renamed cpkAtomRadius_prefs_key -> diBALL_AtomRadius_prefs_key ###DOIT
+cpkScaleFactor_prefs_key = 'A7/CPK Scale Factor' # this is about diTrueCPK which as of 060307 is called CPK in UI
+levelOfDetail_prefs_key = 'A7/Level Of Detail'
+keepBondsDuringTransmute_prefs_key = 'A9/Keep Bonds During Transmute'
+
+# Bond prefs
+bondHighlightColor_prefs_key = 'A6/Bond Highlight Color'
+deleteBondHighlightColor_prefs_key = 'A10/Delete Bond Highlight Color'
+bondStretchColor_prefs_key = 'A6/Bond Stretch Color'
+bondVaneColor_prefs_key = 'A6/Bond Vane Color'
+diBALL_bondcolor_prefs_key = 'A6/Bond CPK Color' # this is about diBALL, not CPK [bruce 060607 comment]
+ #bruce 060607 renamed bondCPKColor_prefs_key -> diBALL_bondcolor_prefs_key ###DOIT
+showBondStretchIndicators_prefs_key = 'A9/ Show Bond Stretch Indicators'
+pibondStyle_prefs_key = 'A6/Pi Bond Style'
+pibondLetters_prefs_key = 'A6/Pi Bond Letters'
+showValenceErrors_prefs_key = 'A6/Show Valence Errors'
+#display lines mode line thickness, mark 050831
+linesDisplayModeThickness_prefs_key = 'A7/Line Thickness for Lines Display Mode'
+#CPK cylinder radius (percentage), mark 051003
+diBALL_BondCylinderRadius_prefs_key = 'A7/CPK Cylinder Radius Percentage' # about diBALL, called Ball and Stick as of 060307
+ #bruce 060607 renamed cpkCylinderRadius_prefs_key -> diBALL_BondCylinderRadius_prefs_key ###DOIT
+diDNACYLINDER_BondCylinderRadius_prefs_key = 'A10/DNA Cylinder Bond Radius Percentage'
+
+# DNA prefs
+adnaBasesPerTurn_prefs_key = 'A10/A-DNA bases per turn' # Twist computed from this.
+adnaRise_prefs_key = 'A10/A-DNA rise step'
+bdnaBasesPerTurn_prefs_key = 'A10/B-DNA bases per turn' # Twist computed from this.
+bdnaRise_prefs_key = 'A10/B-DNA rise step'
+zdnaBasesPerTurn_prefs_key = 'A10/Z-DNA bases per turn' # Twist computed from this.
+zdnaRise_prefs_key = 'A10/Z-DNA rise step'
+dnaDefaultSegmentColor_prefs_key = 'A10/DNA default segment color'
+dnaColorBasesBy_prefs_key = 'A10/DNA color bases by'
+dnaStrutScaleFactor_prefs_key = 'A10/DNA strut scale factor'
+arrowsOnBackBones_prefs_key = 'A9/ Show arrows on all directional bonds'
+arrowsOnThreePrimeEnds_prefs_key = 'A9/ Show three prime ends as out arrow heads'
+arrowsOnFivePrimeEnds_prefs_key = 'A9/ Show five prime ends as in arrow heads'
+dnaStyleStrandsShape_prefs_key = 'A10/DNA style strands shape' # DNA style prefs piotr 080310
+dnaStyleStrandsColor_prefs_key = 'A10/DNA style strands color'
+dnaStyleStrandsScale_prefs_key = 'A10/DNA style strands scale'
+dnaStyleStrandsArrows_prefs_key = 'A10/DNA style strands arrows'
+dnaStyleAxisShape_prefs_key = 'A10/DNA style axis shape'
+dnaStyleAxisColor_prefs_key = 'A10/DNA style axis color'
+dnaStyleAxisScale_prefs_key = 'A10/DNA style axis scale'
+dnaStyleAxisTaper_prefs_key = 'A10/DNA style axis taper'
+dnaStyleStrutsShape_prefs_key = 'A10/DNA style struts shape'
+dnaStyleStrutsColor_prefs_key = 'A10/DNA style struts color'
+dnaStyleStrutsScale_prefs_key = 'A10/DNA style struts scale'
+dnaStyleBasesShape_prefs_key = 'A10/DNA style bases shape'
+dnaStyleBasesColor_prefs_key = 'A10/DNA style bases color'
+dnaStyleBasesScale_prefs_key = 'A10/DNA style bases scale'
+
+# Modes prefs [added by mark 050910]
+# The background style and color for each mode is initialized in init_prefs()
+# of the superclass basicMode (modes.py).
+startupMode_prefs_key = 'A7/Startup Mode'
+defaultMode_prefs_key = 'A7/Default Mode'
+buildModeAutobondEnabled_prefs_key = 'A7/Build Mode Autobond Enabled' # mark 060203.
+buildModeWaterEnabled_prefs_key = 'A7/Build Mode Water Enabled' # mark 060203.
+buildModeHighlightingEnabled_prefs_key = 'A7/Build Mode Highlighting Enabled' # mark 060203.
+buildModeSelectAtomsOfDepositedObjEnabled_prefs_key = 'A7/Build Mode Select Atoms of Deposited Obj Enabled' # mark 060304.
+
+# Selection Behavior
+permit_atom_chunk_coselection_prefs_key = 'A9 devel2/permit_atom_chunk_coselection'
+
+# Lighting prefs [most added by mark 051124 or later]
+## old_glpane_lights_prefs_key = "glpane lighting" #bruce 051206 moved this here from GLPane;
+ # it was hardcoded in two methods in GLPane; maybe dates from before prefs_constants module;
+ # in the next commit it was abandoned and changed as a fix of bug 1181; see comments near its uses in GLPane.
+glpane_lights_prefs_key = 'A7/glpane lighting' #bruce 051206 introduced this key to fix bug 1181
+light1Color_prefs_key = 'A7/Light1 Color' #bruce 051206 comment: this looks redundant with elements in GLPane._lights; why?
+light2Color_prefs_key = 'A7/Light2 Color'
+light3Color_prefs_key = 'A7/Light3 Color'
+material_specular_highlights_prefs_key = 'A7/Material Specular Highlights'
+material_specular_finish_prefs_key = 'A7/Material Specular Finish'
+material_specular_shininess_prefs_key = 'A7/Material Specular Shininess'
+material_specular_brightness_prefs_key = 'A7/Material Specular Brightness'
+
+# File management / filename / URL preferences [tentative category, added by bruce 051130, more comments below]
+wiki_help_prefix_prefs_key = 'A7/Wiki Help Prefix'
+
+# Plug-ins prefs [added by mark 050918]
+qutemol_path_prefs_key = 'A9/QuteMol Path'
+qutemol_enabled_prefs_key = 'A9/QuteMol Enabled'
+nanohive_path_prefs_key = 'A7/Nano-Hive Executable Path'
+nanohive_enabled_prefs_key = 'A7/Nano-Hive Enabled'
+povray_path_prefs_key = 'A8/POV-Ray Executable Path'
+povray_enabled_prefs_key = 'A8/POV-Ray Enabled'
+megapov_path_prefs_key = 'A8/MegaPOV Executable Path'
+megapov_enabled_prefs_key = 'A8/MegaPOV Enabled'
+povdir_path_prefs_key = 'A8/POV Include Directory' # only in Mac A8, for Windows will be in A8.1 (Linux??) [bruce 060710]
+povdir_enabled_prefs_key = 'A8/POV Include Directory Enabled' # ditto, and might not end up being used [bruce 060710]
+gmspath_prefs_key = 'A6/GAMESS Path'
+gamess_enabled_prefs_key = 'A7/GAMESS Enabled'
+gromacs_path_prefs_key = 'A10/GROMACS Path'
+gromacs_enabled_prefs_key = 'A10/GROMACS Enabled'
+cpp_path_prefs_key = 'A10/cpp Path'
+cpp_enabled_prefs_key = 'A10/cpp Enabled'
+
+# Undo and History prefs
+undoRestoreView_prefs_key = 'A7/Undo Restore View'
+undoAutomaticCheckpoints_prefs_key = 'A7/Undo Automatic Checkpoints'
+undoStackMemoryLimit_prefs_key = 'A7/Undo Stack Memory Limit'
+historyHeight_prefs_key = 'A6/History Height'
+historyMsgSerialNumber_prefs_key = 'A6/History Message Serial Number'
+historyMsgTimestamp_prefs_key = 'A6/History Message Timestamp'
+
+# Window prefs (used to be called Caption prefs)
+rememberWinPosSize_prefs_key = "A7/Remember Window Pos and Size" #mark 060315. NIY.
+mainwindow_geometry_prefs_key_prefix = "main window/geometry" #bruce 051218 moved this from debug.py
+captionPrefix_prefs_key = 'A6/Caption Prefix'
+captionSuffix_prefs_key = 'A6/Caption Suffix'
+captionFullPath_prefs_key = 'A6/Caption Full Path'
+useSelectedFont_prefs_key = 'A9/Use Selected Font'
+displayFont_prefs_key = 'A9/Display Font'
+displayFontPointSize_prefs_key = 'A9/Display Font Point Size'
+mtColor_prefs_key = 'A9/Model Tree Background Color' # Not yet in Preferences. Mark 2007-06-04
+toolbar_state_prefs_key = 'A10/ Toolbar State '
+displayReportsWidget_prefs_key = 'A10/Display Reports Widget'
+#colorTheme_prefs_key = 'A9/Color Theme'
+
+# Sponsor prefs
+sponsor_download_permission_prefs_key = 'A8/Sponsor download permission'
+sponsor_permanent_permission_prefs_key = 'A8/Sponsor download permission is permanent'
+
+# The following key is not a user preference, it's a state variable that is used
+# to keep track of when the sponsor logos files change. This will go away once
+# Sponsors.py is re-written to incorporate a thread-safe main program
+# event/command queue that can be utilized to throw up a download-permission
+# dialog at the same time new logos files are detected.
+#
+sponsor_md5_mismatch_flag_key = 'A9/Sponsor md5 file mismatch'
+
+#==
+
+# List of prefs keys (strings, not _prefs_key global variable names)
+# which got stored into developers or users prefs dbs (since they were saved in code committed to cvs),
+# but are no longer used now.
+# This list is not yet used by the code, and when it is, its format might be revised,
+# but for now, make sure each line has a comment which gives complete info
+# about whether or not a released version ever stored prefs using the given keys
+# (and if so, exactly which released versions);
+# also, each line should be signed with a name and date of the abandonment of that key.
+
+###@@@ THIS IS NOT COMPLETE since I didn't have time to add the ones I removed from cvs rev 1.62 just before A8.
+# I also forgot to remove some recently when I renamed them from A8 devel to A8 devel2. -- bruce 060705
+
+_abandoned_prefs_keys = [
+ 'A7/Specular Highlights', # never released, superceded by 'A7/Material Specular Highlights' [mark 051205]
+ 'A7/Whiteness', # never released, superceded by 'A7/Material Specular Finish' [mark 051205]
+ 'A7/Shininess', # never released, superceded by 'A7/Material Specular Shininess' [mark 051205]
+ 'A7/Material Brightness', # never released, superceded by 'A7/Material Specular Brightness' [mark 051205]
+ 'glpane lighting', # was released in A6 and maybe some prior versions; superceded by 'A7/glpane lighting' [bruce 051206]
+ 'A7/Selection Behavior', # only released in pre-release snapshots of A7. [mark 060304]
+ 'A7/Select Atoms Mode Highlighting Enabled' # only released in pre-release snapshots of A7. [mark 060404]
+ ]
+
+
+# Do not move getDefaultWorkingDirectory() to platform.py since it might
+# create a recursive import problem. [Mark 060730.]
+# [However, it probably doesn't belong in this file either.
+# Sometime try putting it into a file in a platform-dependent package.
+# bruce 071215 comment]
+def getDefaultWorkingDirectory():
+ """
+ Get the default Working Directory.
+
+ @return: The default working directory, which is platform dependent:
+ - Windows: $HOME\My Documents
+ - MacOS and Linux: $HOME
+ If the default working directory doesn't exist, return ".".
+ @rtype: string
+ """
+ wd = ""
+ if sys.platform == 'win32': # Windows
+ # e.g. "C:\Documents and Settings\Mark\My Documents"
+ wd = os.path.normpath(os.path.expanduser("~/My Documents"))
+ # Check <wd> since some Windows OSes (i.e. Win95) may not have "~\My Documents".
+ if not os.path.isdir(wd):
+ wd = os.path.normpath(os.path.expanduser("~"))
+ else: # Linux and MacOS
+ # e.g. "/usr/mark"
+ wd = os.path.normpath(os.path.expanduser("~"))
+ if os.path.isdir(wd):
+ return wd
+ else:
+ print "getDefaultWorkingDirectory(): default working directory [", \
+ wd , "] does not exist. Setting default working directory to [.]"
+ return "."
+
+_default_workingDirectory = getDefaultWorkingDirectory()
+
+# the actual table (for doc, see the code that interprets it, in preferences.py)
+
+# end
diff --git a/packaging/Pref_Mod/setup_win.py b/packaging/Pref_Mod/setup_win.py new file mode 100644 index 000000000..ac978620f --- /dev/null +++ b/packaging/Pref_Mod/setup_win.py @@ -0,0 +1,4 @@ +# setup.py +from distutils.core import setup +import py2exe +setup(version = "1.0.0", description = "Preferences modifier for databases", name = "pref_modifier", console=["pref_modifier.py"]) diff --git a/packaging/Suite/Win32/NE1.ico b/packaging/Suite/Win32/NE1.ico Binary files differnew file mode 100644 index 000000000..e12e335a7 --- /dev/null +++ b/packaging/Suite/Win32/NE1.ico diff --git a/packaging/Suite/Win32/gle32.dll b/packaging/Suite/Win32/gle32.dll Binary files differnew file mode 100644 index 000000000..f3d4c8b58 --- /dev/null +++ b/packaging/Suite/Win32/gle32.dll diff --git a/packaging/Suite/Win32/glut32.dll b/packaging/Suite/Win32/glut32.dll Binary files differnew file mode 100644 index 000000000..106646ff7 --- /dev/null +++ b/packaging/Suite/Win32/glut32.dll diff --git a/packaging/Suite/Win32/install-header.bmp b/packaging/Suite/Win32/install-header.bmp Binary files differnew file mode 100644 index 000000000..4d9b2e951 --- /dev/null +++ b/packaging/Suite/Win32/install-header.bmp diff --git a/packaging/Suite/Win32/install.ico b/packaging/Suite/Win32/install.ico Binary files differnew file mode 100644 index 000000000..afc7863b5 --- /dev/null +++ b/packaging/Suite/Win32/install.ico diff --git a/packaging/Suite/Win32/suite_installer.nsi b/packaging/Suite/Win32/suite_installer.nsi new file mode 100644 index 000000000..ae83c054b --- /dev/null +++ b/packaging/Suite/Win32/suite_installer.nsi @@ -0,0 +1,482 @@ +;THIS IS NOT A FINISHED SCRIPT -- DO NOT RUN
+
+; Script generated by the HM NIS Edit Script Wizard.
+
+; HM NIS Edit Wizard helper defines
+; NE1 Defines
+!define PRODUCT_NAME "NanoEngineer-1 Suite"
+!define PRODUCT_VERSION "1.0.0b5"
+!define PRODUCT_NICKNAME "(Alpha 10)"
+!define PRODUCT_PUBLISHER "Nanorex, Inc."
+!define PRODUCT_WEB_SITE "http://www.nanoengineer-1.com"
+!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_NAME}\${PRODUCT_VERSION}"
+;!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\babel.exe"
+!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
+!define PRODUCT_UNINST_ROOT_KEY "HKLM"
+
+;QMX Defines
+!define PRODUCT_QMX_VERSION "0.5.0b1"
+!define PRODUCT_QMX_NAME "QuteMolX"
+!define PRODUCT_QMX_PUBLISHER "Nanorex, Inc"
+!define PRODUCT_QMX_WEB_SITE "http://www.nanoengineer-1.com/QuteMolX/"
+!define PRODUCT_QMX_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_NAME}\${PRODUCT_QMX_VERSION}"
+!define PRODUCT_QMX_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
+!define PRODUCT_QMX_UNINST_ROOT_KEY "HKLM"
+
+;GMX Defines
+!define PRODUCT_GMX_VERSION "3.3.2b1"
+!define PRODUCT_GMX_NAME "GROMACS_HDF5"
+!define PRODUCT_GMX_PUBLISHER "Nanorex, Inc"
+!define PRODUCT_GMX_WEB_SITE "http://www.nanorex.com"
+!define PRODUCT_GMX_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_NAME}\${PRODUCT_GMX_VERSION}"
+!define PRODUCT_GMX_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
+!define PRODUCT_GMX_UNINST_ROOT_KEY "HKLM"
+
+;NV1 Defines
+!define PRODUCT_NV1_VERSION "0.1.0a1"
+!define PRODUCT_NV1_NAME "NanoVision-1 ${PRODUCT_NV1_VERSION}"
+!define PRODUCT_NV1_PUBLISHER "Nanorex, Inc"
+!define PRODUCT_NV1_WEB_SITE "http://www.nanorex.com"
+!define PRODUCT_NV1_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\nv1.exe"
+!define PRODUCT_NV1_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
+!define PRODUCT_NV1_UNINST_ROOT_KEY "HKLM"
+
+!macro ReplaceInFile SOURCE_FILE SEARCH_TEXT REPLACEMENT
+ Push "${SOURCE_FILE}"
+ Push "${SEARCH_TEXT}"
+ Push "${REPLACEMENT}"
+ Call RIF
+!macroend
+
+; MUI 1.67 compatible ------
+!include "MUI.nsh"
+
+; MUI Settings
+!define MUI_ABORTWARNING
+!define MUI_ICON "install.ico"
+!define MUI_UNICON "uninstall.ico"
+!define MUI_HEADERIMAGE
+!define MUI_HEADERIMAGE_BITMAP "install-header.bmp"
+!define MUI_HEADERIMAGE_UNBITMAP "install-header.bmp"
+!define MUI_WELCOMEFINISHPAGE_BITMAP "wizard-sidebar.bmp"
+!define MUI_UNWELCOMEFINISHPAGE_BITMAP "wizard-sidebar.bmp"
+
+InstType "Basic"
+InstType "Full"
+
+; Welcome page
+!insertmacro MUI_PAGE_WELCOME
+; License page
+!insertmacro MUI_PAGE_LICENSE "..\..\cad\src\dist\Licenses\NanoEngineer-1_License.txt"
+;!insertmacro MUI_INSTALLOPTIONS_DISPLAY "iofile.ini"
+; Components page
+!insertmacro MUI_PAGE_COMPONENTS
+; Directory page
+!insertmacro MUI_PAGE_DIRECTORY
+; Instfiles page
+!insertmacro MUI_PAGE_INSTFILES
+; Finish page
+!define MUI_FINISHPAGE_RUN "$INSTDIR\program\main.exe"
+!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\ReadMe.html"
+!insertmacro MUI_PAGE_FINISH
+
+; Uninstaller pages
+!insertmacro MUI_UNPAGE_INSTFILES
+
+; Language files
+!insertmacro MUI_LANGUAGE "English"
+
+; MUI end ------
+
+Name "${PRODUCT_NAME} ${PRODUCT_VERSION} ${PRODUCT_NICKNAME}"
+OutFile "..\..\cad\src\build\NanoEngineer-1_${PRODUCT_VERSION}.exe"
+;InstallDir "$PROGRAMFILES\Nanorex\NanoEngineer-1_${PRODUCT_VERSION}"
+InstallDir "$PROGRAMFILES\Nanorex"
+InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
+;InstallDirRegKey HKLM "${PRODUCT_QMX_DIR_REGKEY}" ""
+;InstallDirRegKey HKLM "${PRODUCT_GMX_DIR_REGKEY}" ""
+;InstallDirRegKey HKLM "${PRODUCT_NV1_DIR_REGKEY}" ""
+ShowInstDetails show
+ShowUnInstDetails show
+
+SectionGroup /e "NanoEngineer-1 Suite Installer"
+Section "NanoEngineer-1" SECNE1
+ SectionIn 1 2
+ SetOutPath "$INSTDIR\NanoEngineer-1_${PRODUCT_VERSION}"
+ SetOverwrite try
+ File /r "..\..\cad\src\dist\*"
+
+ ; hack
+ SetOutPath "$INSTDIR\NanoEngineer-1_${PRODUCT_VERSION}\program"
+ File "C:\Qt\4.2.3\bin\QtSvg4.dll"
+
+ SetOutPath "$SYSDIR"
+ SetOverwrite off
+ File "glut32.dll"
+ File "gle32.dll"
+ SetOutPath "$INSTDIR\Pref_Mod"
+ File /r "\pref_mod\dist\*"
+ CreateDirectory "$SMPROGRAMS\Nanorex\NanoEngineer-1 ${PRODUCT_VERSION}"
+ CreateShortCut "$SMPROGRAMS\Nanorex\NanoEngineer-1 ${PRODUCT_VERSION}\NanoEngineer-1.lnk" "$INSTDIR\NanoEngineer-1_${PRODUCT_VERSION}\program\main.exe"
+ CreateShortCut "$DESKTOP\NanoEngineer-1.lnk" "$INSTDIR\NanoEngineer-1_${PRODUCT_VERSION}\program\main.exe"
+ CreateShortCut "$SMPROGRAMS\Nanorex\NanoEngineer-1 ${PRODUCT_VERSION}\ReadMe.html.lnk" "$INSTDIR\NanoEngineer-1_${PRODUCT_VERSION}\ReadMe.html"
+ SetOutPath "$INSTDIR"
+SectionEnd
+
+SectionGroup /e "QuteMolX"
+Section "QuteMolX (Required)" SEC_QMX_BASE
+ SectionIn 1 2
+ SetOutPath "$INSTDIR\QuteMolX"
+ SetOverwrite try
+ File "\QMX_Install\License.txt"
+ File "\QMX_Install\ReadMe.html"
+ File "\QMX_Install\build\*"
+ SetOutPath "$INSTDIR\QuteMolX\image"
+ File "\QMX_Install\build\image\*"
+ SetOutPath "$INSTDIR\QuteMolX\presets"
+ File "\QMX_Install\build\presets\*"
+ SetOutPath "$INSTDIR\QuteMolX"
+ CreateDirectory "$SMPROGRAMS\Nanorex\QuteMolX"
+ CreateShortCut "$SMPROGRAMS\Nanorex\QuteMolX\QuteMolX.lnk" "$INSTDIR\QuteMolX\QuteMolX.exe"
+ CreateShortCut "$DESKTOP\QuteMolX.lnk" "$INSTDIR\QuteMolX\QuteMolX.exe"
+ ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe" -k qutemol_enabled -v True'
+ ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe" -k qutemol_path -v "$INSTDIR\QuteMolX\QuteMolX.exe"'
+ SetOutPath "$INSTDIR"
+SectionEnd
+Section /o "Source" SEC_QMX_SRC
+ SectionIn 2
+ SetOutPath "$INSTDIR\QuteMolX\source"
+ SetOverwrite try
+ File /r "\QMX_Install\source\*"
+ SetOutPath "$INSTDIR"
+SectionEnd
+SectionGroupEnd
+
+SectionGroup /e "NanoVision-1"
+Section "NanoVision-1 Base" NV1_BASE
+ SectionIn 1 2
+ SetOutPath "$INSTDIR\NanoVision-1\bin"
+ SetOverwrite try
+ File "\NV1_Install\bin\*"
+ CreateDirectory "$SMPROGRAMS\Nanorex\NanoVision-1"
+ CreateShortCut "$SMPROGRAMS\Nanorex\NanoVision-1\NanoVision-1.lnk" "$INSTDIR\NanoVision-1\bin\nv1.exe"
+ CreateShortCut "$DESKTOP\NanoVision-1.lnk" "$INSTDIR\NanoVision-1\bin\nv1.exe"
+ SetOutPath "$INSTDIR\NanoVision-1\include"
+ File /r "\NV1_Install\include\*"
+ SetOutPath "$INSTDIR\NanoVision-1\lib"
+ File /r "\NV1_Install\lib\*"
+ SetOutPath "$INSTDIR\NanoVision-1"
+ SetOverwrite on
+ File "\NV1_Install\ReadMe.html"
+ File "\NV1_Install\License.txt"
+ SetOutPath "$APPDATA\Nanorex\NanoVision-1"
+ File "\NV1_Install\NanoVision-1.ini"
+ Push "$INSTDIR\NanoVision-1\lib"
+ Push "\"
+ Push "/"
+ Call StrRep
+ Pop "$R0" ;result
+ !insertmacro ReplaceInFile "$APPDATA\Nanorex\NanoVision-1.ini" "@PLUGSRCHPATH@" "$R0"
+; ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe -k qutemol_enabled -v True"'
+; ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe -k qutemol_path -v $INSTDIR\QuteMolX\QuteMolX.exe"
+ SetOutPath "$INSTDIR"
+SectionEnd
+
+Section /o "source" NV1_SRC
+ SectionIn 2
+ SetOutPath "$INSTDIR\NanoVision-1\source"
+ File /r "\NV1_Install\src\*"
+SectionEnd
+SectionGroupEnd
+
+SectionGroup /e "GROMACS"
+Section "GROMACS+HDF5 (Required)" SEC_GMX_BASE
+ SectionIn 1 2
+; SetOutPath "$INSTDIR"
+ SetOutPath "c:\GROMACS_HDF5"
+ SetOverwrite try
+ File "\GMX_Install\ReadMe.html"
+ File "\GMX_Install\.\License.txt"
+ SetOutPath "c:\GROMACS_HDF5\bin"
+ SetOverwrite try
+ File "\GMX_Install\dist\bin\*"
+ ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe" -k gromacs_enabled -v True"'
+ ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe" -k gromacs_path -v "c:\GROMACS_HDF5\bin\mdrun.exe"'
+SectionEnd
+Section /o "Headers & Libraries" SEC_GMX_LIBHDR
+ SectionIn 2
+ SetOutPath "c:\GROMACS_HDF5\include\gromacs"
+ File "\GMX_Install\dist\include\gromacs\*"
+ SetOutPath "c:\GROMACS_HDF5\include\gromacs\types"
+ File "\GMX_Install\dist\include\gromacs\types\*"
+ SetOutPath "c:\GROMACS_HDF5\include\gromacs"
+ File "\GMX_Install\dist\include\gromacs\*"
+ SetOutPath "c:\GROMACS_HDF5\lib"
+ File "\GMX_Install\dist\lib\*"
+SectionEnd
+Section "Documentation" SEC_GMX_DOC
+ SectionIn 1 2
+ SetOverwrite try
+ SetOutPath "c:\GROMACS_HDF5\share\gromacs\html"
+ File "\GMX_Install\dist\share\gromacs\html\*"
+ SetOutPath "c:\GROMACS_HDF5\share\gromacs\html\images"
+ File "\GMX_Install\dist\share\gromacs\html\images\*"
+ SetOutPath "c:\GROMACS_HDF5\share\gromacs\html\online"
+ File "\GMX_Install\dist\share\gromacs\html\online\*"
+ SetOutPath "c:\GROMACS_HDF5\share\gromacs\template"
+ File "\GMX_Install\dist\share\gromacs\template\*"
+ SetOutPath "c:\GROMACS_HDF5\share\gromacs\top"
+ File "\GMX_Install\dist\share\gromacs\top\*"
+SectionEnd
+Section "Tutorials" SEC_GMX_TUTOR
+ SectionIn 1 2
+ SetOverwrite try
+ SetOutPath "c:\GROMACS_HDF5\share\gromacs\tutor"
+ File "\GMX_Install\dist\share\gromacs\tutor\*"
+ SetOutPath "c:\GROMACS_HDF5\share\gromacs\tutor\gmxdemo"
+ File "\GMX_Install\dist\share\gromacs\tutor\gmxdemo\*"
+ SetOutPath "c:\GROMACS_HDF5\share\gromacs\tutor\methanol"
+ File "\GMX_Install\dist\share\gromacs\tutor\methanol\*"
+ SetOutPath "c:\GROMACS_HDF5\share\gromacs\tutor\mixed"
+ File "\GMX_Install\dist\share\gromacs\tutor\mixed\*"
+ SetOutPath "c:\GROMACS_HDF5\share\gromacs\tutor\nmr1"
+ File "\GMX_Install\dist\share\gromacs\tutor\nmr1\*"
+ SetOutPath "c:\GROMACS_HDF5\share\gromacs\tutor\nmr2"
+ File "\GMX_Install\dist\share\gromacs\tutor\nmr2\*"
+ SetOutPath "c:\GROMACS_HDF5\share\gromacs\tutor\speptide"
+ File "\GMX_Install\dist\share\gromacs\tutor\speptide\*"
+ SetOutPath "c:\GROMACS_HDF5\share\gromacs\tutor\water"
+ File "\GMX_Install\dist\share\gromacs\tutor\water\*"
+SectionEnd
+Section /o "Source" SEC_GMX_SRC
+ SectionIn 2
+ SetOverwrite try
+ SetOutPath "c:\GROMACS_HDF5\source"
+ file /r "\GMX_Install\dist\src\gromacs-3.3.2\*"
+SectionEnd
+SectionGroupEnd
+
+SectionGroup /e "MCPP"
+Section "MCPP (Required for GROMACS)" SEC_MCPP
+ SectionIn 1 2
+ SetOutPath "c:\GROMACS_HDF5\MCPP\bin"
+ File "\GMX_Install\mcpp\bin\mcpp.exe"
+ SetOutPath "c:\GROMACS_HDF5\MCPP"
+ File "\GMX_Install\mcpp\LICENSE"
+ File "\GMX_Install\mcpp\mcpp-manual-jp.html"
+ File "\GMX_Install\mcpp\mcpp-manual.html"
+ File "\GMX_Install\mcpp\NEWS"
+ File "\GMX_Install\mcpp\README"
+ ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe" -k cpp_enabled -v True'
+ ExecWait '"$INSTDIR\Pref_Mod\pref_modifier.exe" -k cpp_path -v "c:\GROMACS_HDF5\mcpp\bin\mcpp.exe"'
+SectionEnd
+Section /o "Source" SEC_MCPP_SRC
+ SectionIn 2
+ SetOutPath "c:\GROMACS_HDF5MCPP\source"
+ File /r "\GMX_Install\mcpp\source\*"
+SectionEnd
+SectionGroupEnd
+
+SectionGroupEnd
+
+Section -AdditionalIcons
+ SetOutPath $INSTDIR
+ CreateShortCut "$SMPROGRAMS\Nanorex\NanoEngineer-1 ${PRODUCT_VERSION}\partlib.lnk" "$INSTDIR\NanoEngineer-1_${PRODUCT_VERSION}\partlib"
+ CreateShortCut "$SMPROGRAMS\Nanorex\NanoEngineer-1 ${PRODUCT_VERSION}\Licenses.lnk" "$INSTDIR\NanoEngineer-1_${PRODUCT_VERSION}\Licenses"
+ CreateShortCut "$SMPROGRAMS\Nanorex\NanoEngineer-1 ${PRODUCT_VERSION}\Uninstall.lnk" "$INSTDIR\uninst.exe"
+ WriteIniStr "$INSTDIR\NanoVision-1\${PRODUCT_NV1_NAME}-${PRODUCT_NV1_VERSION}.url" "InternetShortcut" "URL" "${PRODUCT_NV1_WEB_SITE}"
+ CreateShortCut "$SMPROGRAMS\Nanorex\NanoVision-1\Website.lnk" "$INSTDIR\NanoVision-1\${PRODUCT_NV1_NAME}.url"
+ WriteIniStr "$INSTDIR\QuteMolX\${PRODUCT_QMX_NAME}-${PRODUCT_QMX_VERSION}.url" "InternetShortcut" "URL" "${PRODUCT_QMX_WEB_SITE}"
+ CreateShortCut "$SMPROGRAMS\Nanorex\QuteMolX\Website.lnk" "$INSTDIR\QuteMolX\${PRODUCT_QMX_NAME}.url"
+SectionEnd
+
+Section -Post
+ WriteUninstaller "$INSTDIR\uninst.exe"
+ WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\program\main.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\program\main.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
+SectionEnd
+
+
+Function un.onUninstSuccess
+ HideWindow
+ MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
+FunctionEnd
+
+Function un.onInit
+ MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
+ Abort
+FunctionEnd
+
+Section Uninstall
+ Delete "$INSTDIR\*"
+ RMDir /r "$INSTDIR\src"
+ RMDir /r "$INSTDIR\program"
+ RMDir /r "$INSTDIR\plugins"
+ RMDir /r "$INSTDIR\partlib"
+ RMDir /r "$INSTDIR\Licenses"
+ RMDir /r "$INSTDIR\doc"
+ RMDir /r "$INSTDIR\bin"
+ RMDir /r "$INSTDIR"
+ RMDir /r "C:\GROMACS_HDF5"
+
+ Delete "$DESKTOP\NanoEngineer-1.lnk"
+ Delete "$DESKTOP\NanoVision-1.lnk"
+ Delete "$DESKTOP\QuteMolX.lnk"
+
+ RMDir /r "$SMPROGRAMS\NanoEngineer-1 ${PRODUCT_VERSION}"
+ RMDir /r "$SMPROGRAMS\Nanorex"
+
+ DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
+ DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
+ SetAutoClose true
+
+SectionEnd
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+Function RIF
+ ClearErrors ; wanna be a newborn
+
+ Exch $0 ; REPLACEMENT
+ Exch
+ Exch $1 ; SEARCH_TEXT
+ Exch 2
+ Exch $2 ; SOURCE_FILE
+
+ Push $R0 ; SOURCE_FILE file handle
+ Push $R1 ; temporary file handle
+ Push $R2 ; unique temporary file name
+ Push $R3 ; a line to sar/save
+ Push $R4 ; shift puffer
+
+ IfFileExists $2 +1 RIF_error ; knock-knock
+ FileOpen $R0 $2 "r" ; open the door
+
+ GetTempFileName $R2 ; who's new?
+ FileOpen $R1 $R2 "w" ; the escape, please!
+
+ RIF_loop: ; round'n'round we go
+ FileRead $R0 $R3 ; read one line
+ IfErrors RIF_leaveloop ; enough is enough
+ RIF_sar: ; sar - search and replace
+ Push "$R3" ; (hair)stack
+ Push "$1" ; needle
+ Push "$0" ; blood
+ Call StrReplace ; do the bartwalk
+ StrCpy $R4 "$R3" ; remember previous state
+ Pop $R3 ; gimme s.th. back in return!
+ StrCmp "$R3" "$R4" +1 RIF_sar ; loop, might change again!
+ FileWrite $R1 "$R3" ; save the newbie
+ Goto RIF_loop ; gimme more
+
+ RIF_leaveloop: ; over'n'out, Sir!
+ FileClose $R1 ; S'rry, Ma'am - clos'n now
+ FileClose $R0 ; me 2
+
+ Delete "$2.old" ; go away, Sire
+ Rename "$2" "$2.old" ; step aside, Ma'am
+ Rename "$R2" "$2" ; hi, baby!
+ Delete "$2.old" ; Nano-Hive addition
+
+ ClearErrors ; now i AM a newborn
+ Goto RIF_out ; out'n'away
+
+ RIF_error: ; ups - s.th. went wrong...
+ SetErrors ; ...so cry, boy!
+
+ RIF_out: ; your wardrobe?
+ Pop $R4
+ Pop $R3
+ Pop $R2
+ Pop $R1
+ Pop $R0
+ Pop $2
+ Pop $0
+ Pop $1
+FunctionEnd
+
+Function StrReplace
+ Exch $0 ;this will replace wrong characters
+ Exch
+ Exch $1 ;needs to be replaced
+ Exch
+ Exch 2
+ Exch $2 ;the orginal string
+ Push $3 ;counter
+ Push $4 ;temp character
+ Push $5 ;temp string
+ Push $6 ;length of string that need to be replaced
+ Push $7 ;length of string that will replace
+ Push $R0 ;tempstring
+ Push $R1 ;tempstring
+ Push $R2 ;tempstring
+ StrCpy $3 "-1"
+ StrCpy $5 ""
+ StrLen $6 $1
+ StrLen $7 $0
+ Loop:
+ IntOp $3 $3 + 1
+ StrCpy $4 $2 $6 $3
+ StrCmp $4 "" ExitLoop
+ StrCmp $4 $1 Replace
+ Goto Loop
+ Replace:
+ StrCpy $R0 $2 $3
+ IntOp $R2 $3 + $6
+ StrCpy $R1 $2 "" $R2
+ StrCpy $2 $R0$0$R1
+ IntOp $3 $3 + $7
+ Goto Loop
+ ExitLoop:
+ StrCpy $0 $2
+ Pop $R2
+ Pop $R1
+ Pop $R0
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+FunctionEnd
+
+Function StrRep
+ Exch $R4 ; $R4 = Replacement String
+ Exch
+ Exch $R3 ; $R3 = String to replace (needle)
+ Exch 2
+ Exch $R1 ; $R1 = String to do replacement in (haystack)
+ Push $R2 ; Replaced haystack
+ Push $R5 ; Len (needle)
+ Push $R6 ; len (haystack)
+ Push $R7 ; Scratch reg
+ StrCpy $R2 ""
+ StrLen $R5 $R3
+ StrLen $R6 $R1
+loop:
+ StrCpy $R7 $R1 $R5
+ StrCmp $R7 $R3 found
+ StrCpy $R7 $R1 1 ; - optimization can be removed if U know len needle=1
+ StrCpy $R2 "$R2$R7"
+ StrCpy $R1 $R1 $R6 1
+ StrCmp $R1 "" done loop
+found:
+ StrCpy $R2 "$R2$R4"
+ StrCpy $R1 $R1 $R6 $R5
+ StrCmp $R1 "" done loop
+done:
+ StrCpy $R3 $R2
+ Pop $R7
+ Pop $R6
+ Pop $R5
+ Pop $R2
+ Pop $R1
+ Pop $R4
+ Exch $R3
+FunctionEnd
\ No newline at end of file diff --git a/packaging/Suite/Win32/uninstall.ico b/packaging/Suite/Win32/uninstall.ico Binary files differnew file mode 100644 index 000000000..0fb04d0a7 --- /dev/null +++ b/packaging/Suite/Win32/uninstall.ico diff --git a/packaging/Suite/Win32/wizard-sidebar.bmp b/packaging/Suite/Win32/wizard-sidebar.bmp Binary files differnew file mode 100644 index 000000000..3e05a170e --- /dev/null +++ b/packaging/Suite/Win32/wizard-sidebar.bmp |