summaryrefslogtreecommitdiff
blob: 39fcbc019bbeafd2ea5503241e1370a0cec48a91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
Index: pymol/setup.py
===================================================================
--- pymol/setup.py	(revision 4031)
+++ pymol/setup.py	(revision 4032)
@@ -123,10 +123,10 @@
                 out.write('"%s" "%s"' % (python_exe, pymol_file))
                 out.write(' %1 %2 %3 %4 %5 %6 %7 %8 %9' + os.linesep)
             else:
-                out.write('#!/bin/sh' + os.linesep)
+                out.write('#!/bin/bash' + os.linesep)
                 if sys.platform.startswith('darwin'):
-                    out.write('if [ "$DISPLAY" == "" ]; then DISPLAY=":0.0"; export DISPLAY; fi' + os.linesep)
-                out.write('PYMOL_PATH="%s"; export PYMOL_PATH' % pymol_path + os.linesep)
+                    out.write('[ "$DISPLAY" == "" ] && export DISPLAY=":0.0"' + os.linesep)
+                out.write('export PYMOL_PATH="%s"' % pymol_path + os.linesep)
                 out.write('"%s" "%s" "$@"' % (python_exe, pymol_file) + os.linesep)
 
         os.chmod(launch_script, 0755)
@@ -135,12 +135,16 @@
 
 #============================================================================
 
+# should be something like (build_base + "/generated"), but that's only
+# known to build and install instances
+generated_dir = os.path.join(os.environ.get("PYMOL_BLD", "build"), "generated")
+
 import create_shadertext
 create_shadertext.create_shadertext(
         "data/shaders",
         "shadertext.txt",
-        "generated/include/ShaderText.h",
-        "generated/src/ShaderText.c")
+        generated_dir + "/ShaderText.h",
+        generated_dir + "/ShaderText.c")
 
 pymol_src_dirs = [
     "ov/src",
@@ -152,12 +156,10 @@
     "layer5",
     "modules/cealign/src",
     "modules/cealign/src/tnt",
-    'generated/src',
-    'generated/include',
+    generated_dir,
 ]
 
 def_macros = [
-    ("_PYMOL_MODULE", None),
 ]
 
 libs = []
@@ -226,27 +228,32 @@
 
     for prefix in prefix_path:
         inc_dirs += filter(os.path.isdir, [prefix + s for s in ["/include", "/include/freetype2"]])
-        lib_dirs += filter(os.path.isdir, [prefix + s for s in ["/lib"]])
+        lib_dirs += filter(os.path.isdir, [prefix + s for s in ["/lib64", "/lib"]])
 
     glut = posix_find_lib(['glut', 'freeglut'], lib_dirs)
-    for _libs in (libs, pyogl_libs):
-        _libs += ["GL", "GLU", "GLEW", glut]
 
-    ext_comp_args = ["-ffast-math", "-funroll-loops", "-O3", "-fcommon"]
+    libs += ["GLEW"]
+    pyogl_libs += ["GL", "GLU", glut]
 
+    libs += pyogl_libs
+
+    ext_comp_args += ["-ffast-math", "-funroll-loops", "-O3", "-fcommon"]
+
 def get_pymol_version():
     return re.findall(r'_PyMOL_VERSION "(.*)"', open('layer0/Version.h').read())[0]
 
 def get_sources(subdirs, suffixes=('.c', '.cpp')):
     return [f for d in subdirs for s in suffixes for f in glob(d + '/*' + s)]
 
-def get_packages(base, parent='', r=[]):
+def get_packages(base, parent='', r=None):
     from os.path import join, exists
+    if r is None:
+        r = []
     if parent:
         r.append(parent)
     for name in os.listdir(join(base, parent)):
         if '.' not in name and exists(join(base, parent, name, '__init__.py')):
-            get_packages(base, join(parent, name))
+            get_packages(base, join(parent, name), r)
     return r
 
 def pyogl_extension(name, sources):
@@ -260,7 +267,10 @@
     author    = "Schrodinger",
     url       = "http://pymol.org",
     contact   = "pymol-users@lists.sourceforge.net",
-    description = "PyMOL is a Python-enhanced molecular graphics tool. It excels at 3D visualization of proteins, small molecules, density, surfaces, and trajectories. It also includes molecular editing, ray tracing, and movies. Open Source PyMOL is free to everyone!", 
+    description = ("PyMOL is a Python-enhanced molecular graphics tool. "
+        "It excels at 3D visualization of proteins, small molecules, density, "
+        "surfaces, and trajectories. It also includes molecular editing, "
+        "ray tracing, and movies. Open Source PyMOL is free to everyone!"),
 
     package_dir = {'' : 'modules'},
     packages = get_packages('modules'),
Index: pymol/ChangeLog
===================================================================
--- pymol/ChangeLog	(revision 4031)
+++ pymol/ChangeLog	(revision 4032)
@@ -2,6 +2,12 @@
 CHANGE LOG
 =========================================================================
 
+2013-06-18 Blaine Bell, Thomas Holder
+
+	* fixed loading in bg_rgb settings from old project pse files
+
+	* add URL support for run command
+
 2013-06-13 Blaine Bell <blaine.bell@schrodinger.com>
 
 	* fixed labels when use_shaders is 0 and show_frame_rate is on
Index: pymol/layer1/Setting.c
===================================================================
--- pymol/layer1/Setting.c	(revision 4031)
+++ pymol/layer1/Setting.c	(revision 4032)
@@ -41,6 +41,7 @@
 #include"ShaderMgr.h"
 #include"Sphere.h"
 #include"Selector.h"
+#include"Parse.h"
 
 static void *SettingPtr(CSetting * I, int index, ov_size size);
 
@@ -920,43 +921,67 @@
         set_type = false;
         break;
       default:
-        if(ok)
-          switch (setting_type) {
-          case cSetting_boolean:
-          case cSetting_int:
-            ok = PConvPyIntToInt(PyList_GetItem(list, 2),
-                                 (int *) SettingPtr(I, index, sizeof(int)));
-            break;
-          case cSetting_color:
-            {
-              int color = 0;
-              ok = PConvPyIntToInt(PyList_GetItem(list, 2), &color);
-              if(ok)
-                color = ColorConvertOldSessionIndex(I->G, color);
-              *((int *) SettingPtr(I, index, sizeof(int))) = color;
-            }
-            break;
-          case cSetting_float:
-            ok = PConvPyFloatToFloat(PyList_GetItem(list, 2),
-                                     (float *) SettingPtr(I, index, sizeof(float)));
-            break;
-          case cSetting_float3:
-            ok = PConvPyListToFloatArrayInPlaceAutoZero(PyList_GetItem(list, 2),
-                                                        (float *) SettingPtr(I, index,
-                                                                             3 *
-                                                                             sizeof
-                                                                             (float)), 3);
-            break;
-          case cSetting_string:
-            ok = PConvPyStrToStrPtr(PyList_GetItem(list, 2), &str);
-            if(ok) {
-              strcpy(((char *) SettingPtr(I, index, strlen(str) + 1)), str);
-            }
-            break;
-          }
+        if(ok){
+	  int skip = false;
+	  switch (index){
+	  case cSetting_bg_rgb:
+	  case cSetting_bg_rgb_top:
+	  case cSetting_bg_rgb_bottom:
+	    if (setting_type == cSetting_float3){
+	      float vals[3];
+	      ok = PConvPyListToFloatArrayInPlaceAutoZero(PyList_GetItem(list, 2), (float*)&vals, 3);
+	      if (ok){
+		SettingSet_color_from_3f(I, index, vals);
+		setting_type = cSetting_color;
+		skip = true;
+	      }
+	    } else if (setting_type == cSetting_color){
+	      int color = 0;
+	      ok = PConvPyIntToInt(PyList_GetItem(list, 2), &color);
+	      if(ok)
+		color = ColorConvertOldSessionIndex(I->G, color);
+	      *((int *) SettingPtr(I, index, sizeof(int))) = color;
+	    }
+	  }
+	  if (!skip){
+	    switch (setting_type) {
+	    case cSetting_boolean:
+	    case cSetting_int:
+	      ok = PConvPyIntToInt(PyList_GetItem(list, 2),
+				   (int *) SettingPtr(I, index, sizeof(int)));
+	      break;
+	    case cSetting_color:
+	      {
+		int color = 0;
+		ok = PConvPyIntToInt(PyList_GetItem(list, 2), &color);
+		if(ok)
+		  color = ColorConvertOldSessionIndex(I->G, color);
+		*((int *) SettingPtr(I, index, sizeof(int))) = color;
+	      }
+	      break;
+	    case cSetting_float:
+	      ok = PConvPyFloatToFloat(PyList_GetItem(list, 2),
+				       (float *) SettingPtr(I, index, sizeof(float)));
+	      break;
+	    case cSetting_float3:
+	      ok = PConvPyListToFloatArrayInPlaceAutoZero(PyList_GetItem(list, 2),
+							  (float *) SettingPtr(I, index,
+									       3 *
+									       sizeof
+									       (float)), 3);
+	      break;
+	    case cSetting_string:
+	      ok = PConvPyStrToStrPtr(PyList_GetItem(list, 2), &str);
+	      if(ok) {
+		strcpy(((char *) SettingPtr(I, index, strlen(str) + 1)), str);
+	      }
+	      break;
+	    }
+	  }
+	}
       }
       if(ok && set_type)
-        I->info[index].type = setting_type;
+	I->info[index].type = setting_type;
     }
   }
   return (ok);
Index: pymol/modules/pymol/parsing.py
===================================================================
--- pymol/modules/pymol/parsing.py	(revision 4031)
+++ pymol/modules/pymol/parsing.py	(revision 4032)
@@ -437,6 +437,15 @@
 
     # launching routines
 
+    def execfile(filename, global_ns, local_ns):
+        if '://' in filename:
+            import pymol.internal as pi
+            co = compile(pi.file_read(filename), filename, 'exec')
+            exec(co, global_ns, local_ns)
+        else:
+            import __builtin__ as b
+            b.execfile(filename, global_ns, local_ns)
+
     def run_file(file,global_ns,local_ns):
         pymol.__script__ = file
         try: