- Timestamp:
- Jul 14, 2010, 3:54:10 PM (14 years ago)
- Location:
- branches/blt4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/molvisviewer.tcl
r1795 r1807 53 53 private variable _obj2models; # array containing list of models 54 54 # for each data object. 55 55 private variable _waitForImage 0 56 56 private variable _view 57 57 private variable _click … … 678 678 set count 0 679 679 itcl::body Rappture::MolvisViewer::ReceiveImage { size cacheid frame rock } { 680 set _waitForImage 0; # Turn off wait loop. 680 681 set tag "$frame,$rock" 681 682 global count … … 769 770 } 770 771 if {"" != $data1} { 772 # Save the PDB data in case the user wants to later save it. 771 773 set _pdbdata $data1 772 SendCmd "loadpdb -defer \"$data1\" $model $state" 774 set nBytes [string length $data1] 775 776 # We know we're buffered here, so append the "loadpdb" command 777 # with the data payload immediately afterwards. 778 append _outbuf "loadpdb -defer $nBytes $model $state\n" 779 append _outbuf $data1 773 780 set _dataobjs($model-$state) 1 774 781 } … … 776 783 set data2 [$dataobj get components.molecule.pdb] 777 784 if {"" != $data2} { 785 # Save the PDB data in case the user wants to later save it. 778 786 set _pdbdata $data2 779 SendCmd "loadpdb -defer \"$data2\" $model $state" 787 set nBytes [string length $data2] 788 789 # We know we're buffered here, so append the "loadpdb" command 790 # with the data payload immediately afterwards. 791 append _outbuf "loadpdb -defer $nBytes $model $state\n" 792 append _outbuf $data2 780 793 set _dataobjs($model-$state) 1 781 794 } … … 820 833 } 821 834 if {"" != $data3} { 835 # Save the PDB data in case the user wants to later save it. 822 836 set _pdbdata $data3 823 SendCmd "loadpdb -defer \"$data3\" $model $state" 824 set _dataobjs($model-$state) 1 837 set nBytes [string length $data3] 838 839 # We know we're buffered here, so append the "loadpdb" 840 # command with the data payload immediately afterwards. 841 append _outbuf "loadpdb -defer $nBytes $model $state\n" 842 append _outbuf $data3 825 843 } 844 set _dataobjs($model-$state) 1 826 845 } 827 846 } … … 934 953 if { $flush } { 935 954 SendCmd "bmp"; # Flush the results. 955 set _waitForImage 1 936 956 } 937 957 set _buffering 0; # Turn off buffering. … … 945 965 blt::busy release $itk_component(hull) 946 966 967 if { $_waitForImage } { 968 tkwait variable [itcl::scope _waitForImage] 969 } 947 970 debug "exiting rebuild" 948 971 } … … 1441 1464 } 1442 1465 } 1466 update idletasks 1467 update 1443 1468 } 1444 1469 -
branches/blt4/packages/vizservers/pymolproxy/pymolproxy.c
r1719 r1807 1038 1038 } 1039 1039 1040 /* 1041 * LoadPDBCmd -- 1042 * 1043 * Load a PDB file into pymol. There is no good way to load PDB data 1044 * into pymol without using a file. This causes problems in that we 1045 * don't know when pymol is done with the file. So there's always 1046 * a bit of mess left around. We use the same file for every file 1047 * so there's a chance that pymol is still using a file while we're 1048 * overwriting it. 1049 * 1050 * The command expects the number of bytes in the pdb data, the 1051 * name, and the state. 1052 */ 1040 1053 static int 1041 1054 LoadPDBCmd(ClientData clientData, Tcl_Interp *interp, int argc, … … 1046 1059 int state = 1; 1047 1060 int i, defer = 0, push = 0, varg = 1; 1048 1061 int nBytes; 1062 1049 1063 if (proxyPtr == NULL) 1050 1064 return TCL_ERROR; 1051 1065 clear_error(proxyPtr); 1052 pdbdata = name = NULL; /* Suppress compiler warning. */ 1066 pdbdata = name = NULL; /* Suppress compiler warning. */ 1067 nBytes = 0; /* Suppress compiler warning. */ 1053 1068 for(i = 1; i < argc; i++) { 1054 1069 if ( strcmp(argv[i],"-defer") == 0 ) … … 1057 1072 push = 1; 1058 1073 else if (varg == 1) { 1059 pdbdata = argv[i];1074 nBytes = atoi(argv[i]); 1060 1075 varg++; 1061 1076 } else if (varg == 2) { … … 1067 1082 } 1068 1083 } 1069 1070 1084 if (!defer || push) { 1071 1085 proxyPtr->flags |= UPDATE_PENDING; … … 1080 1094 char fileName[200]; 1081 1095 FILE *f; 1082 size_t nBytes;1083 1096 ssize_t nWritten; 1084 1097 char *data; 1098 1099 data = malloc(sizeof(char) * nBytes); 1100 if (data == NULL) { 1101 trace("can't allocate %d bytes for \"pdbdata\" buffer", nBytes); 1102 return TCL_ERROR; 1103 } 1104 if (GetBytes(&proxyPtr->client, data, nBytes) != BUFFER_OK) { 1105 trace("can't read %d bytes for \"pdbdata\" buffer", nBytes); 1106 return TCL_ERROR; 1107 } 1085 1108 sprintf(fileName, "/tmp/pymol%d.pdb", getpid()); 1086 1109 f = fopen(fileName, "w"); … … 1089 1112 perror("pymolproxy"); 1090 1113 } 1091 nBytes = strlen(pdbdata); 1092 nWritten = fwrite(pdbdata, sizeof(char), nBytes, f); 1114 nWritten = fwrite(data, sizeof(char), nBytes, f); 1093 1115 if (nBytes != nWritten) { 1094 1116 trace("short write %d wanted %d bytes", nWritten, nBytes); … … 1844 1866 1845 1867 child = fork(); 1846 1847 1868 if (child < 0) { 1848 1869 fprintf(stderr, "can't fork process: %s\n", strerror(errno)); … … 1943 1964 } else if (status == 0) { 1944 1965 trace("attempting to signal (SIGTERM) pymol server."); 1945 kill(-child, SIGTERM); // kill process group1966 kill(-child, SIGTERM); // Kill process group 1946 1967 alarm(5); 1947 1968 status = waitpid(child, &result, 0); … … 1950 1971 while ((status == -1) && (errno == EINTR)) { 1951 1972 trace("Attempting to signal (SIGKILL) pymol server."); 1952 kill(-child, SIGKILL); // kill process group1973 kill(-child, SIGKILL); // Kill process group 1953 1974 alarm(10); 1954 1975 status = waitpid(child, &result, 0);
Note: See TracChangeset
for help on using the changeset viewer.