www.delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2012/10/29/12:50:24

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=date:from:to:subject:message-id:mail-followup-to:references
:mime-version:content-type:content-disposition:in-reply-to
:user-agent;
bh=Vfg85mYE8eK3//90NIWg/KL3+r5h0wB9YJftjxlJcJE=;
b=fzk8BjfUkB1ycjx0c8B3dbJObTxqNecwKSkik/qFGCYh22pcidss/vn0/WKTBnb3+m
4QbM87EhQVC5vfsY92gPWjS4j+5B5aRSlweoSFI7f6t0mzkT0CVczYF/EsFK4VmdVYZ6
TyYf2Z40/SBhqOma4Q4DNgtuFopFNE/MitLAW7gxA35Et4VYKVjZ8ipxY6emi5h/5qZX
ggPuO/F6AWIaRGfhGT7eu9RjredemVo0jfve1qKSxW3V14sQDAiL3S+kH0LqCWs81BXD
8Gdn58dtPVcMabGdgy3cXcGlT3NOuq0dCVvKQ6s9dsqfRw2QqWng3YpdE/QogRLUTrW0
g2NQ==
Date: Mon, 29 Oct 2012 20:49:46 +0400
From: Vladimir Zhbanov <vzhbanov AT gmail DOT com>
To: geda-user AT delorie DOT com
Subject: Re: [geda-user] Can custom dialogs be created with guile?
Message-ID: <20121029164946.GA28209@localhost.localdomain>
Mail-Followup-To: geda-user AT delorie DOT com
References: <CAGde_xMM5jN9NY5De6y8wyRH7crQUKFEN1OZFHwVX1aTE3RgHA AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CAGde_xMM5jN9NY5De6y8wyRH7crQUKFEN1OZFHwVX1aTE3RgHA@mail.gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

--PNTmBPCT7hxwcZjr
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline

On Sun, Oct 28, 2012 at 12:36:51AM +0200, Svenn Are Bjerkem wrote:
> I guess no, but I have to ask.
I suspect you're right, there are only predefined dialogs. However...

> >From wiki and pcb.scm I find that there are a few types of predefined
> dialogs callable from guild already.
> I want to place a couple of entry boxes and an OK/Cancel button pair
> to send user input to a script which does the gory details.
> I could also be happy with one entry box repeatedly popping up called
> from inside a guile loop.

... However, there is a chance to use an external tool to make a
dialog, e.g. tcl or xdialog.

I have prepared a simple example files (see attachments). Put them into
any directory, cd into it and launch gschem. In gschem you need to hit
":" and enter the command
  (load "simple.scm")
You will see a new dialog. Try to enter any data into the entries and
see what's happening.  The scripts are apparently very rough, but they
could be a base to derive your work from. The log window will show you
feedback in the case of problems with the scripts.

-- 
http://vzhbanov.byethost33.com

--PNTmBPCT7hxwcZjr
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="simple.scm"

;; we need popen to work with pipes
(use-modules (ice-9 popen))
;; open pipe
(define port (open-input-pipe "./simple.tcl"))
;; read a string from port
(define str (read port))
;; close pipe
(close-pipe port)
;; test string
(gschem-msg str)

--PNTmBPCT7hxwcZjr
Content-Type: application/x-tcl
Content-Disposition: attachment; filename="simple.tcl"
Content-Transfer-Encoding: quoted-printable

#!/bin/sh=0A# I like Tcl!!!=0A#The next line executes wish - wherever it is=
\=0Aexec wish "$0" "$@"=0Aset ok ok=0Alabel .hello -text "Hello"=0Apack .he=
llo=0A=0Alabel .msg -font courierfont -wraplength 4i -justify left -text "A=
 simple form where you can type in the various entries and use tabs to move=
 circularly between the entries."=0Apack .msg -side top=0A=0Aframe .f1 -bd =
2=0Alabel .f1.label=0Aentry .f1.entry -relief sunken -width 40 -textvariabl=
e myname=0Apack .f1.entry -side right=0Apack .f1.label -side left=0A=0Afram=
e .f2 -bd 2=0Alabel .f2.label=0Aentry .f2.entry -relief sunken -width 40 -t=
extvariable myvalue=0Apack .f2.entry -side right=0Apack .f2.label -side lef=
t=0A=0A.f1.label config -text Name:=0A.f2.label config -text Value:=0Apack =
=2Emsg .f1 .f2 -side top -fill x=0Afocus .f1.entry=0A=0Aset quote {"}=0Afra=
me .buttons=0Apack .buttons -side bottom -fill x -pady 2m=0Abutton .buttons=
=2Eadd -text "Add" -command "puts \$quote\$myname=3D\$myvalue\$quote; exit"=
=0Abutton .buttons.dismiss -text Dismiss -command "exit"=0Apack .buttons.ad=
d .buttons.dismiss -side left -expand 1=0A
--PNTmBPCT7hxwcZjr--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019