Changeset 700 for trunk/gui/vizservers
- Timestamp:
- May 4, 2007, 1:50:53 PM (17 years ago)
- Location:
- trunk/gui/vizservers/pymol
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/vizservers/pymol/layer0/MyPNG.c
r699 r700 14 14 Z* ------------------------------------------------------------------- 15 15 */ 16 #define _HAVE_LIBPNG /* _HAVE_LIBPNG not integrated into autotools build *NJK* */ 16 17 17 18 #ifdef _HAVE_LIBPNG … … 39 40 40 41 42 /* Persistent image capture buffer *NJK* */ 43 /* we make image buffer a pymol global to reduce time spent */ 44 /* allocating and reallocating memory for image captures */ 45 struct _CImage { 46 void *data; 47 int allocated; 48 int used; 49 }; 50 51 int ImageInit(PyMOLGlobals *G) 52 { 53 register CImage *I=NULL; 54 if( (I=(G->Image=Calloc(CImage,1)))) { 55 56 UtilZeroMem(I,sizeof(CImage)); 57 I->data = NULL; 58 I->used = 0; 59 I->allocated = 0; 60 return 1; 61 } else { 62 return 0; 63 } 64 } 65 66 /* PNG stdout support *NJK */ 67 /* add ability to write PNG files to standard output */ 68 /* we have to write to memory first so we can inform client */ 69 /* how much data is going to be sent */ 70 71 static void 72 user_write_data(png_structp png_ptr, png_bytep buf, png_size_t length) 73 { 74 voidp write_io_ptr = png_get_io_ptr(png_ptr); 75 struct _CImage *data = write_io_ptr; 76 int available; 77 int needed; 78 void *newdata; 79 80 available = data->allocated - data->used; 81 82 if (length > available) { 83 needed = length - available; 84 85 if (needed < 32768) 86 needed = 32768; 87 88 newdata = realloc(data->data, data->allocated + needed); 89 90 if (newdata != NULL) { 91 data->data = newdata; 92 data->allocated += needed; 93 } 94 else 95 return; 96 } 97 98 memcpy((unsigned char *)data->data + data->used, buf, length); 99 100 data->used += length; 101 return; 102 } 103 104 static void 105 user_flush_data(png_structp png_ptr) 106 { 107 return; 108 } 109 41 110 int MyPNGWrite(PyMOLGlobals *G,char *file_name,unsigned char *p, 42 111 unsigned int width,unsigned int height,float dpi) … … 44 113 #ifdef _HAVE_LIBPNG 45 114 46 FILE *fp ;115 FILE *fp = 0; /* PNG stdout support *NJK* */ 47 116 png_structp png_ptr; 48 117 png_infop info_ptr; … … 56 125 57 126 /* open the file */ 58 fp = fopen(file_name, "wb"); 59 if (fp == NULL) { 60 return 0; 61 } else if(feof(fp)) { 62 fclose(fp); 63 return 0; 127 if (strcmp(file_name,"-.png") != 0) { /* PNG stdout support *NJK* */ 128 fp = fopen(file_name, "wb"); 129 if (fp == NULL) { 130 return 0; 131 } else if(feof(fp)) { 132 fclose(fp); 133 return 0; 134 } 64 135 } 65 136 /* Create and initialize the png_struct with the desired error handler … … 73 144 if (png_ptr == NULL) 74 145 { 75 fclose(fp); 146 if (fp != NULL) /* PNG stdout support *NJK* */ 147 fclose(fp); 76 148 return 0; 77 149 } … … 81 153 if (info_ptr == NULL) 82 154 { 83 fclose(fp); 155 if (fp != NULL) /* PNG stdout support *NJK* */ 156 fclose(fp); 84 157 png_destroy_write_struct(&png_ptr, (png_infopp)NULL); 85 158 return 0; … … 92 165 { 93 166 /* If we get here, we had a problem reading the file */ 94 fclose(fp); 167 if (fp != NULL) /* PNG stdout support *NJK* */ 168 fclose(fp); 95 169 png_destroy_write_struct(&png_ptr, (png_infopp)NULL); 96 170 return 0; … … 98 172 99 173 /* set up the output control if you are using standard C streams */ 100 png_init_io(png_ptr, fp); 174 if (fp != NULL) /* PNG stdout support *NJK* */ 175 png_init_io(png_ptr, fp); 176 else { 177 G->Image->used = 0; 178 png_set_write_fn(png_ptr, G->Image, user_write_data, user_flush_data); 179 } 101 180 102 181 /* Set the image information here. Width and height are up to 2^31, … … 115 194 png_set_pHYs(png_ptr, info_ptr, dots_per_meter, dots_per_meter, PNG_RESOLUTION_METER); 116 195 } 196 png_set_compression_level(png_ptr,1); /* PNG stdout support *NJK* */ 117 197 118 198 png_set_gamma(png_ptr, SettingGet(G,cSetting_png_screen_gamma), … … 139 219 140 220 /* close the file */ 141 fclose(fp); 221 if (fp != NULL) /* PNG stdout support *NJK* */ 222 fclose(fp); 223 else { 224 /* Sample counting patch *NJK */ 225 fprintf(stdout, "image follows: %d %d\n", G->Image->used, PyMOLEndPerf(G->GLQueryId)); 226 PyMOLStartPerf(G->GLQueryId); 227 fwrite(G->Image->data,1,G->Image->used,stdout); 228 fflush(stdout); 229 G->Image->used = 0; 230 } 142 231 143 232 mfree(row_pointers); … … 321 410 } /* end of source */ 322 411 323 324 325 326 327 328 329 330 412 /* BMP save image support *NJK* */ 413 void 414 bmp_header_add_int(unsigned char* header, unsigned int pos, unsigned int data) 415 { 416 header[pos++] = data & 0xff; 417 header[pos++] = (data >> 8) & 0xff; 418 header[pos++] = (data >> 16) & 0xff; 419 header[pos++] = (data >> 24) & 0xff; 420 } 421 422 void 423 bmp_header_add_short(unsigned char* header, unsigned int pos, unsigned short data) 424 { 425 header[pos++] = data & 0xff; 426 header[pos++] = (data >> 8) & 0xff; 427 } 428 429 int MyBMPWrite(PyMOLGlobals *G,char *bmp,unsigned char *save_image,int width,int height,float dpi) 430 { 431 unsigned char header[54]; 432 int pos = 0; 433 int pad = 0; 434 int fsize = 0; 435 int row = 0; 436 int col = 0; 437 unsigned char *scr; 438 unsigned char *src = save_image; 439 unsigned char tmp; 440 struct _CImage *data = G->Image; 441 442 if ((3 * width) % 4 > 0) 443 pad = 4 - ((3 * width) % 4); 444 445 header[pos++] = 'B'; 446 header[pos++] = 'M'; 447 448 /* file size in bytes */ 449 fsize = (3 * width + pad) * height + sizeof(header); 450 bmp_header_add_int(header,pos,fsize); 451 pos+=4; 452 453 /* reserved value (must be 0) */ 454 bmp_header_add_int(header, pos, 0); 455 pos+=4; 456 457 /* offset in bytes to start of bitmap data */ 458 bmp_header_add_int(header, pos, sizeof(header)); 459 pos+=4; 460 461 /* size of the BITMAPINFOHEADER */ 462 bmp_header_add_int(header, pos, 40); 463 pos+=4; 464 465 /* width of the image in pixels */ 466 bmp_header_add_int(header, pos, width); 467 pos+=4; 468 469 /* height of the image in pixels */ 470 bmp_header_add_int(header, pos, height); 471 pos+=4; 472 473 /* 1 plane */ 474 bmp_header_add_short(header, pos, 1); 475 pos+=2; 476 477 /* 24 bits/pixel */ 478 bmp_header_add_short(header, pos, 24); 479 pos+=2; 480 481 /* no compression */ 482 /* size of image for compression */ 483 484 bmp_header_add_int(header, pos, 0); 485 pos+=4; 486 bmp_header_add_int(header, pos, 0); 487 pos+=4; 488 489 /* x pixels per meter */ 490 /* y pixels per meter */ 491 bmp_header_add_int(header, pos, 0); 492 pos+=4; 493 bmp_header_add_int(header, pos, 0); 494 pos+=4; 495 496 /* number of colors used (0 = compute from bits/pixel) */ 497 /* number of important colors (0 = all colors important) */ 498 bmp_header_add_int(header, pos, 0); 499 pos+=4; 500 bmp_header_add_int(header, pos, 0); 501 pos+=4; 502 503 if (data->allocated < fsize) { 504 char *newdata; 505 506 newdata = realloc(data->data, fsize); 507 508 if (newdata) { 509 data->data = newdata; 510 data->allocated = fsize; 511 } 512 } 513 514 if (data->allocated < fsize) 515 return(0); 516 517 scr = data->data; 518 519 for (row=0; row < height; row++) { 520 for (col=0; col < width; col++) { 521 tmp = src[0]; 522 scr[0] = src[2]; 523 scr[1] = src[1]; 524 scr[2] = tmp; 525 scr += 3; 526 src += 4; 527 } 528 scr += pad; /* skip over padding already in screen data */ 529 } 530 531 if (strcmp(bmp,"-.bmp") == 0) { 532 /* Sample counting patch *NJK* */ 533 fprintf(stdout,"image follows: %d %d\n",fsize, PyMOLEndPerf(G->GLQueryId)); 534 PyMOLStartPerf(G->GLQueryId); 535 fwrite(header,1,54,stdout); 536 fwrite(data->data,1,fsize-sizeof(header), stdout); 537 fflush(stdout); 538 } 539 else { 540 FILE *fp; 541 542 fp = fopen(bmp,"wb"); 543 fwrite(header,1,54, fp); 544 fwrite(data->data,1,fsize-sizeof(header), fp); 545 fflush(fp); 546 fclose(fp); 547 } 548 549 return(1); 550 } 551 -
trunk/gui/vizservers/pymol/layer0/PyMOLGlobals.h
r699 r700 55 55 typedef struct _CGO CGO; 56 56 typedef struct _CPlugIOManager CPlugIOManager; 57 typedef struct _CImage CImage; /* Persistent image capture buffer *NJK* */ 57 58 58 59 #ifndef _PYMOL_NOPY … … 150 151 151 152 int DragDirtyFlag; /* do we need an extra callback to handle a mouse drag? */ 153 int CmdPipe[2]; /* Sleep Interruption Patch *NJK* */ 154 CImage *Image; /* Persistent image capture buffer *NJK* */ 155 int GLQueryId; /* Sample counting patch *NJK* */ 152 156 153 157 -
trunk/gui/vizservers/pymol/layer0/os_gl.c
r699 r700 3 3 4 4 #include<stdio.h> 5 6 /* Sample counting patch *NJK* */ 7 void PyMOLInitPerf(GLsizei n, GLuint *id) 8 { 9 *id = 0; 10 11 glGenQueriesARB(1, id); 12 } 13 14 void PyMOLStartPerf(GLuint id) 15 { 16 glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id); 17 } 18 19 unsigned int PyMOLEndPerf(GLuint id) 20 { 21 GLuint count = 0; 22 23 glEndQueryARB(GL_SAMPLES_PASSED_ARB); 24 glGetQueryObjectuivARB(id, GL_QUERY_RESULT_ARB, &count); 25 26 return(count); 27 } 5 28 6 29 void PyMOLReadPixels(GLint x, -
trunk/gui/vizservers/pymol/layer1/Ortho.c
r699 r700 1917 1917 void OrthoCommandIn(PyMOLGlobals *G,char *buffer) 1918 1918 { 1919 char c = 1; /* Sleep Interruption Patch *NJK* */ 1919 1920 register COrtho *I=G->Ortho; 1920 1921 if(I->cmds) 1921 1922 QueueStrIn(I->cmds,buffer); 1923 write(G->CmdPipe[1],&c,1); /* Sleep Interruption Patch *NJK* */ 1922 1924 } 1923 1925 /*========================================================================*/ -
trunk/gui/vizservers/pymol/layer1/P.c
r699 r700 298 298 { /* can only be called by the glut process */ 299 299 #ifndef WIN32 300 fd_set fds; /* Sleep Interruption Patch *NJK* */ 300 301 struct timeval tv; 301 302 PRINTFD(G,FB_Threads) … … 304 305 tv.tv_sec=0; 305 306 tv.tv_usec=usec; 306 select(0,NULL,NULL,NULL,&tv); 307 /* Sleep Interruption Patch *NJK* */ 308 FD_ZERO(&fds); 309 FD_SET(TempPyMOLGlobals->CmdPipe[0],&fds); 310 select(TempPyMOLGlobals->CmdPipe[0]+1,&fds,NULL,NULL,&tv); 311 if (FD_ISSET(TempPyMOLGlobals->CmdPipe[0],&fds)) { 312 char c; 313 read(TempPyMOLGlobals->CmdPipe[0],&c,1); 314 } 307 315 PRINTFD(G,FB_Threads) 308 316 " PSleep-DEBUG: nap over.\n" -
trunk/gui/vizservers/pymol/layer1/Scene.c
r699 r700 1496 1496 } 1497 1497 SceneImageFinish(G,image); 1498 } 1499 1500 /* BMP save image support *NJK* */ 1501 void SceneBMP(PyMOLGlobals *G,char *bmp,float dpi,int quiet) 1502 { 1503 register CScene *I=G->Scene; 1504 1505 GLvoid *image = SceneImagePrepare(G); 1506 if(image && I->Image) { 1507 int width = I->Image->width; 1508 int height = I->Image->height; 1509 unsigned char *save_image = image; 1510 1511 if((image==I->Image->data) && I->Image->stereo) { 1512 width = I->Image->width; 1513 save_image = Alloc(unsigned char, I->Image->size*2); 1514 interlace((unsigned int*)save_image,(unsigned int*)I->Image->data,width,height); 1515 width *= 2; 1516 } 1517 if(dpi<0.0F) dpi = SettingGetGlobal_f(G,cSetting_image_dots_per_inch); 1518 if(MyBMPWrite(G,bmp,save_image,width,height,dpi)) { 1519 if(!quiet) { 1520 PRINTFB(G,FB_Scene,FB_Actions) 1521 " SceneBMP: wrote %dx%d pixel image to file \"%s\".\n", 1522 width,I->Image->height,bmp 1523 ENDFB(G); 1524 } 1525 } else { 1526 PRINTFB(G,FB_Scene,FB_Errors) 1527 " SceneBMP-Error: error writing \"%s\"! Please check directory...\n", 1528 bmp 1529 ENDFB(G); 1530 } 1531 1532 if(save_image && (save_image!=image)) 1533 FreeP(save_image); 1534 } 1535 SceneImageFinish(G,image); 1498 1536 } 1499 1537 /*========================================================================*/ … … 4799 4837 return 1; 4800 4838 } 4839 /* BMP save image support *NJK* */ 4840 static int SceneDeferredBMPImage(DeferredImage *di) 4841 { 4842 PyMOLGlobals *G=di->G; 4843 SceneMakeSizedImage(G,di->width, di->height,di->antialias); 4844 if(di->filename) { 4845 SceneBMP(G,di->filename, di->dpi, di->quiet); 4846 FreeP(di->filename); 4847 } 4848 return 1; 4849 } 4801 4850 static int SceneDeferredImage(DeferredImage *di) 4802 4851 { … … 4807 4856 FreeP(di->filename); 4808 4857 } 4858 return 1; 4859 } 4860 /* BMP save image support *NJK* */ 4861 int SceneDeferBMPImage(PyMOLGlobals *G,int width, int height, 4862 char *filename, int antialias, float dpi, int quiet) 4863 { 4864 DeferredImage *di = Calloc(DeferredImage,1); 4865 if(di) { 4866 DeferredInit(G,&di->deferred); 4867 di->G = G; 4868 di->width = width; 4869 di->height = height; 4870 di->antialias = antialias; 4871 di->deferred.fn = (DeferredFn*)SceneDeferredBMPImage; 4872 di->dpi = dpi; 4873 di->quiet = quiet; 4874 if(filename) { 4875 int stlen = strlen(filename); 4876 di->filename = Alloc(char,stlen+1); 4877 strcpy(di->filename, filename); 4878 } 4879 } 4880 OrthoDefer(G,&di->deferred); 4809 4881 return 1; 4810 4882 } -
trunk/gui/vizservers/pymol/layer4/Cmd.c
r699 r700 5463 5463 } 5464 5464 5465 /* BMP save image support *NJK* */ 5466 static PyObject *CmdBMP(PyObject *self, PyObject *args) 5467 { 5468 PyMOLGlobals *G = NULL; 5469 char *str1; 5470 int ok=false; 5471 int quiet; 5472 int width,height; 5473 float dpi; 5474 ok = PyArg_ParseTuple(args,"siifi",&str1,&width,&height,&dpi,&quiet); 5475 if (ok) { 5476 API_SETUP_PYMOL_GLOBALS; 5477 ok = (G!=NULL); 5478 } 5479 if (ok) { 5480 APIEntry(G); 5481 ExecutiveDrawNow(G); /* TODO STATUS */ 5482 if(width||height) { 5483 SceneDeferBMPImage(G,width,height,str1,-1,dpi,quiet); 5484 } else { 5485 SceneBMP(G,str1,dpi,quiet); 5486 } 5487 APIExit(G); 5488 } 5489 return APIResultOk(ok); 5490 } 5491 5492 /* Virtual Mouse command *NJK* */ 5493 static PyObject *CmdVMouse(PyObject *self, PyObject *args) 5494 { 5495 PyMOLGlobals *G = NULL; 5496 int ok = false; 5497 int button, modifier, state, x, y; 5498 5499 ok = PyArg_ParseTuple(args,"iiiii",&button,&modifier,&state,&x,&y); 5500 5501 if(ok) { 5502 API_SETUP_PYMOL_GLOBALS; 5503 ok = (G!=NULL); 5504 } 5505 if (ok) { 5506 APIEntry(G); 5507 if ((state == 0) || (state == 1)) 5508 ProcessMainButton(button,modifier,state,x,y); 5509 else if (state == 2) 5510 ProcessMainDrag(x,y); 5511 else if (state == 3) 5512 ProcessMainPassive(x,y); 5513 APIExit(G); 5514 } 5515 5516 return APIResultOk(ok); 5517 } 5518 5465 5519 static PyObject *CmdMPNG(PyObject *self, PyObject *args) 5466 5520 { … … 7611 7665 {"attach", CmdAttach, METH_VARARGS }, 7612 7666 {"bg_color", CmdBackgroundColor, METH_VARARGS }, 7667 {"bmp", CmdBMP, METH_VARARGS }, /* BMP save image support *NJK* */ 7613 7668 {"bond", CmdBond, METH_VARARGS }, 7614 7669 {"busy_draw", CmdBusyDraw, METH_VARARGS }, … … 7841 7896 {"unset_bond", CmdUnsetBond, METH_VARARGS }, 7842 7897 {"update", CmdUpdate, METH_VARARGS }, 7898 {"vmouse", CmdVMouse, METH_VARARGS }, /* Virtual Mouse command *NJK* */ 7843 7899 {"window", CmdWindow, METH_VARARGS }, 7844 7900 {"zoom", CmdZoom, METH_VARARGS }, -
trunk/gui/vizservers/pymol/layer5/PyMOL.c
r699 r700 2474 2474 result->G->PyMOL = result; /* store the instance pointer */ 2475 2475 2476 pipe(result->G->CmdPipe); /* Sleep Interruption Patch *NJK* */ 2476 2477 result->BusyFlag = false; 2477 2478 result->InterruptFlag = false; … … 2567 2568 TetsurfInit(G); 2568 2569 EditorInit(G); 2570 ImageInit(G); /* Persistent image capture buffer *NJK* */ 2571 PyMOLInitPerf(1,&G->GLQueryId); /* Sample counting patch *NJK* */ 2572 PyMOLStartPerf(G->GLQueryId); /* Sample counting patch *NJK* */ 2569 2573 2570 2574 #ifdef TRACKER_UNIT_TEST -
trunk/gui/vizservers/pymol/layer5/main.c
r699 r700 551 551 } 552 552 /*========================================================================*/ 553 /* Virtual mouse support *NJK* */ 554 void ProcessMainDrag(int x,int y) 555 { 556 PyMOLGlobals *G = TempPyMOLGlobals; 557 558 CMain *I = G->Main; 559 560 y=G->Option->winY-y; 561 562 PyMOL_Drag(PyMOLInstance,x,y,I->Modifiers); 563 564 if(PyMOL_GetRedisplay(PyMOLInstance, true)) { 565 if(G->HaveGUI) { 566 p_glutPostRedisplay(); 567 } 568 I->IdleMode = 0; 569 } 570 } 571 /*========================================================================*/ 553 572 static void MainButton(int button,int state,int x,int y) 554 573 { … … 590 609 } 591 610 /*========================================================================*/ 611 /* Virtual mouse support *NJK* */ 612 void ProcessMainButton(int button,int glMod,int state,int x,int y) 613 { 614 PyMOLGlobals *G = TempPyMOLGlobals; 615 616 CMain *I = G->Main; 617 618 I->IdleMode = 0; /* restore responsiveness */ 619 620 if(PyMOL_GetPassive(PyMOLInstance, true)) { 621 ProcessMainDrag(x,y); 622 } else { 623 /* stay blocked here because Clicks->SexFrame->PParse */ 624 625 y=G->Option->winY-y; 626 627 I->Modifiers = ((glMod&P_GLUT_ACTIVE_SHIFT) ? cOrthoSHIFT : 0) | 628 ((glMod&P_GLUT_ACTIVE_CTRL) ? cOrthoCTRL : 0) | 629 ((glMod&P_GLUT_ACTIVE_ALT) ? cOrthoALT : 0); 630 631 switch(button) { 632 case P_GLUT_BUTTON_SCROLL_FORWARD: 633 case P_GLUT_BUTTON_SCROLL_BACKWARD: 634 x=G->Option->winX/2; 635 y=G->Option->winY/2; /* force into scene */ 636 break; 637 } 638 PyMOL_Button(PyMOLInstance,button,state,x,y,I->Modifiers); 639 } 640 } 641 /*========================================================================*/ 592 642 static void MainPassive(int x,int y) 593 643 { … … 634 684 635 685 } 636 686 /*========================================================================*/ 687 /* Virtual mouse support *NJK* */ 688 void ProcessMainPassive(int x,int y) 689 { 690 PyMOLGlobals *G = TempPyMOLGlobals; 691 CMain *I = G->Main; 692 693 #define PASSIVE_EDGE 20 694 695 if(PyMOL_GetPassive(G->PyMOL,false)) { /* a harmless race condition -- we don't want 696 to slow Python down buy locking on passive 697 mouse motion */ 698 699 if((y<-PASSIVE_EDGE)||(x<-PASSIVE_EDGE)|| 700 (x>(G->Option->winX+PASSIVE_EDGE))|| 701 (y>(G->Option->winY+PASSIVE_EDGE))) { 702 /* release passive drag if mouse leaves window... */ 703 704 y=G->Option->winY-y; 705 706 PyMOL_Button(PyMOLInstance,P_GLUT_LEFT_BUTTON, P_GLUT_UP,x,y,I->Modifiers); 707 708 PyMOL_GetPassive(G->PyMOL,true); /* reset the flag */ 709 710 } else { 711 712 y=G->Option->winY-y; 713 714 PyMOL_Drag(PyMOLInstance,x,y,I->Modifiers); 715 716 } 717 718 if(PyMOL_GetRedisplay(PyMOLInstance, true)) { 719 if(G->HaveGUI) { 720 p_glutPostRedisplay(); 721 } 722 I->IdleMode = 0; 723 } 724 } 725 } 637 726 /*========================================================================*/ 638 727 static void MainDrawLocked(void) -
trunk/gui/vizservers/pymol/modules/pymol/api.py
r699 r700 59 59 60 60 #-------------------------------------------------------------------- 61 # vmouse adds Virutal mouse support *NJK* 61 62 import controlling 62 63 from controlling import \ … … 68 69 set_key, \ 69 70 unmask, \ 71 vmouse, \ 70 72 edit_mode 71 73 … … 124 126 125 127 #-------------------------------------------------------------------- 128 # bmp adds BMP save image support *NJK* 126 129 from exporting import \ 130 bmp, \ 127 131 png, \ 128 132 export_coords, \ -
trunk/gui/vizservers/pymol/modules/pymol/cmd.py
r699 r700 998 998 unlock(-1) 999 999 return r 1000 1001 # BMP save image support *NJK* 1002 # writing BMP files (thread-unsafe) 1003 1004 def _bmp(a,width=0,height=0,dpi=-1.0,quiet=1): # INTERNAL - can only be safely called by GLUT thread 1005 # INTERNAL - can only be safely called by GLUT thread 1006 # WARNING: internal routine, subject to change 1007 try: 1008 lock() 1009 fname = a 1010 if not re.search("\.bmp$",fname): 1011 fname = fname +".bmp" 1012 fname = exp_path(fname) 1013 r = _cmd.bmp(str(fname),int(width),int(height),float(dpi),int(quiet)) 1014 finally: 1015 unlock() 1016 return r 1000 1017 1001 1018 # quitting (thread-specific) -
trunk/gui/vizservers/pymol/modules/pymol/controlling.py
r699 r700 700 700 return r 701 701 702 # Virtual mouse support *NJK* 703 def vmouse(b,m,s,x,y): 704 r = DEFAULT_SUCCESS 705 try: 706 lock() 707 _cmd.vmouse(int(b),int(m),int(s),int(x),int(y)) 708 finally: 709 unlock(r) 710 if _raising(r): raise pymol.CmdException 711 return r -
trunk/gui/vizservers/pymol/modules/pymol/exporting.py
r699 r700 131 131 else: 132 132 r = cmd._do("cmd._png('%s',%d,%d,%1.6f,%d,%d)"%(filename,width,height,dpi,ray,quiet)) 133 if _raising(r): raise QuietException 134 return r 135 136 # BMP save image support *NJK* 137 def bmp(filename,width=0,height=0,dpi=-1.0,quiet=1): 138 ''' 139 DESCRIPTION 140 141 "bmp" writes a bmp format image file of the current image to disk. 142 143 USAGE 144 145 bmp filename 146 147 PYMOL API 148 149 cmd.bmp( string file ) 150 ''' 151 r = DEFAULT_ERROR 152 if thread.get_ident() ==pymol.glutThread: 153 r = cmd._bmp(str(filename),int(width),int(height),float(dpi),int(quiet)) 154 else: 155 r = cmd._do("cmd._bmp('%s',%d,%d,%1.6f,%d)"%(filename,width,height,dpi,quiet)) 133 156 if _raising(r): raise QuietException 134 157 return r -
trunk/gui/vizservers/pymol/modules/pymol/keywords.py
r699 r700 23 23 'backward' : [ self_cmd.backward , 0 , 0 , '' , parsing.STRICT ], 24 24 'bg_color' : [ self_cmd.bg_color , 0 , 0 , '' , parsing.STRICT ], 25 'bmp' : [ self_cmd.bmp , 0 , 0 , '' , parsing.SECURE ], # BMP save image support *NJK* 25 26 'bond' : [ self_cmd.bond , 0 , 0 , '' , parsing.STRICT ], 26 27 'break' : [ self_cmd.python_help , 0 , 0 , '' , parsing.PYTHON ], … … 252 253 'view' : [ self_cmd.view , 0 , 0 , '' , parsing.STRICT ], 253 254 'viewport' : [ self_cmd.viewport , 0 , 0 , '' , parsing.STRICT ], 255 'vmouse' : [ self_cmd.vmouse , 0 , 0 , '' , parsing.STRICT ], # Virtual mouse support *NJK* 254 256 'window' : [ self_cmd.window , 0 , 0 , '' , parsing.STRICT ], 255 257 'while' : [ self_cmd.python_help , 0 , 0 , '' , parsing.PYTHON ],
Note: See TracChangeset
for help on using the changeset viewer.