To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 10228
10227  |  10229
Subject: 
Re: txt2dat - Create LDraw files from text
Newsgroups: 
lugnet.cad.dev
Date: 
Fri, 29 Apr 2005 15:48:01 GMT
Viewed: 
4464 times
  
In lugnet.cad.dev, Kevin L. Clague wrote:
In lugnet.cad.dev, Don Heyse wrote:
But for a really cheesy GUI you could probably write a 10 line tcl
script that opens a file browser and lets you select a font file
then run something like the command line above, except skip the
-MFhello.png and let ldglite open a small window with the txt2dat
output in it.

  txt2dat -s AbCdEfG -c4 -p72 ariel.ttf | ldglite -v0 -- >NULL

Now where did I put that little tcl script for lpub...

ahhh..... ummm.... LSynth?

LPub has its own built in cheezy little GUI!

Err... yeah, lsynth.  That's why I couldn't find it.  So now
that I found it it looks a bit more than 10 lines.  Oops.

Anyhow, substitute txt2dat for lsynth, make a few little
additions and ya get a cheesy GUI for txt2dat that sorta works.

Enjoy,

Don


#!/bin/sh
#-*-tcl-*-
# the next line restarts using wish \
exec wish "$0" -- ${1+"$@"}

#
# Tk GUI for txt2dat
#

# wm withdraw .
wm title . "txt2dat - Create LDraw files from text"

set rootdir $env(SystemRoot)
set fontdir $rootdir/fonts
set stickertext " "
set fontfile ""
set outfile ""
set color "\-c 4"
set pointsize "\-p 72"

set types {
    {{Font Files}       {.ttf}        }
    {{All Files}        *             }
}


proc BrowseIF {} {
    global fontfile fontdir types
    set fontfile [tk_getOpenFile -initialdir $fontdir -filetypes $types
-defaultextension ttf -initialfile arial.ttf]
    if {$fontfile != ""} {
set fontdir $fontfile
    }
}

proc BrowseOF {} {
    global outfile fontdir
    set outfile [tk_getSaveFile -initialdir $outfile]
}

proc Synthesize {} {
    global stickertext fontfile fontdir outfile color pointsize log
    if {$outfile != ""} {
      if [catch {set n [exec txt2dat "\-s" $stickertext $fontfile > $outfile]}
input] {
        $log insert end $input\n
      } else {
        $log insert end OK $n\n
      }
    } else {
      if [catch {set n [exec txt2dat "\-s" $stickertext $fontfile]} input] {
        $log insert end $input\n
      } else {
        $log insert end OK $n\n
      }
    }
}

frame .f -borderwidth 10
pack .f -side top

frame .f.row6
pack .f.row6 -side top -anchor w
label .f.row6.li -text "Sticker Text"
pack .f.row6.li -side left

frame .f.row7
pack .f.row7 -side top -fill y
entry .f.row7.inf -width 60 -relief sunken -textvariable stickertext
pack .f.row7.inf -side left

frame .f.row0
pack .f.row0 -side top -anchor w
label .f.row0.li -text "Font File"
pack .f.row0.li -side left

frame .f.row1
pack .f.row1 -side top -fill y
entry .f.row1.inf -width 60 -relief sunken -textvariable fontfile
button .f.row1.browseFontFile -text "Browse" -command {BrowseIF}
pack .f.row1.inf .f.row1.browseFontFile -side left

frame .f.row2
pack .f.row2 -side top -anchor w
label .f.row2.lo -text "Output File"
pack .f.row2.lo -side left

frame .f.row3
pack .f.row3 -side top -fill y
entry .f.row3.of -width 60 -relief sunken -textvariable outfile
button .f.row3.browseOutFile -text "Browse" -command {BrowseOF}
pack .f.row3.of .f.row3.browseOutFile -side left

frame .f.row4 -borderwidth 10
pack .f.row4 -side top -fill y
button .f.row4.synthesize -text "Process" -command {Synthesize}
pack .f.row4.synthesize -side top

frame .f.row5
pack .f.row5 -side top -fill y
set log [text .f.row5.log -width 80 -height 20 \
    -borderwidth 2 -relief raised -setgrid true \
    -yscrollcommand {.f.row5.scroll set}]
scrollbar .f.row5.scroll -command {.f.row5.log yview}
pack .f.row5.scroll -side right -fill both -expand true
pack .f.row5.log -side top -fill both -expand true

$log insert end "Welcome to txt2dat, a text sticker generator for LDRAW."
$log insert end \n
$log insert end \n



Message is in Reply To:
  Re: txt2dat - Create LDraw files from text
 
(...) <snip> (...) ahhh..... ummm.... LSynth? LPub has its own built in cheezy little GUI! (...) K (19 years ago, 29-Apr-05, to lugnet.cad.dev)

29 Messages in This Thread:











Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR