Opened 11 years ago
Last modified 11 years ago
#1807 new enhancement
Ampliar seleccion de tipos de imagenes al grabar capturas de graficos
| Reported by: | AngelPrior | Owned by: | Jorge |
|---|---|---|---|
| Priority: | normal | Milestone: | Mantainance |
| Component: | Interface | Version: | head |
| Severity: | normal | Keywords: | |
| Cc: | fmunoz@… |
Description (last modified by )
Se solicita ampliar con el tipo png los tipos de archivo disponibles al guardar un gráfico con TOLBase.
Para ello bastaría modificar el procedimiento proc ::bayesGraph::TakePhot en el archivo bysgraph.tcl.
Es trivial cambiar de gif a png cambiando las lineas 1166, 1170 y 1179.
Gracias
Change History (3)
comment:1 Changed 11 years ago by
| Description: | modified (diff) |
|---|---|
| Type: | defect → enhancement |
| Version: | 3.1 → head |
comment:2 Changed 11 years ago by
comment:3 Changed 11 years ago by
| Cc: | fmunoz@… added |
|---|
Note: See
TracTickets for help on using
tickets.

Se adjunta código de ejemplo:
#///////////////////////////////////////////////////////////////////////////// proc ::bayesGraph::TakePhoto {this {fileDest ""}} { # # PURPOSE: Takes a photo of the active graph and asks the user for a file to # save it. # # PARAMETERS: # this -> bayesgraph instance # fileDest -> File destiny of photo, default "" # #///////////////////////////////////////////////////////////////////////////// upvar \#0 ${this}::widgets widgets upvar \#0 ${this}::data data upvar \#0 ${this}::options opt set gr $data(gr,active) set grpath $widgets(gr,$gr) # move focus a other widget set wdFoc [focus] focus $widgets(tb,btg,scale) if {$fileDest eq ""} { set typelist {{"PNG Files" {".png"}} {"Gif Files" {".gif"}}} set fileDest [tk_getSaveFile -title [mc "Choose a file to save the image"]\ -initialdir $opt(PhotoLastDir)\ -parent $widgets(this) \ -defaultextension .png -filetypes $typelist] if {$fileDest eq ""} { tk_messageBox -type ok -message [mc "File hasn't been saved"]\ -icon warning -parent $widgets(this) -title [mc Warning] return } } set img [image create photo] $grpath snap $img set fileExt [string trimleft [file extension $fileDest] . ] $img write -format $fileExt $fileDest set opt(PhotoLastDir) [file dirname $fileDest] # restore focus if {[string length $wdFoc]} { focus $wdFoc } destroy $img }