I've just committed a new script (rules.tcl) for the TclTk GUI that permits
interactive rule setting without needing an xterm for r.colors, r.reclass,
r.recode, and v.reclass. The interface lets you select the input map and an
output map (except for r.colors where it is not needed), and offers a simple
text widget where rules can be entered. There are several improvements I'd
like to add and hope that someone can help with.
1. I've managed to bind Control-c for copying in the text widget (Control-x
already cuts), but can't get Control-v to paste.
2. For r.reclass and r.recode, I am currently using a redirect (i.e.,
command < rulesfile) to get rules into the process, but I don't think that
this works with Windows (However, I'm not Windows savvy). I'd like to use
pure TclTk for this, but don't know how to do it--probably with "open", but
I'm not sure.
A better solution would be for r.reclass and r.recode to have a rules=[file]
argument, so that they could be treated like r.colors and v.reclass.
You'll need to update the menu (gmmenu.tcl) as well as get the rules.tcl
file to test.
Let me know how it works on other systems.
Michael
__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
Michael Barton wrote:
I've just committed a new script (rules.tcl) for the TclTk GUI
Where is it?
find . -type f -name 'rules.tcl'
produces no output.
A better solution would be for r.reclass and r.recode to have a rules=[file]
argument, so that they could be treated like r.colors and v.reclass.
I'm working on this.
--
Glynn Clements <glynn@gclements.plus.com>
Curses,
It looks like it didn't commit. Don't know why. I'll try again.
Michael
On 6/25/07 3:49 PM, "Glynn Clements" <glynn@gclements.plus.com> wrote:
Michael Barton wrote:
I've just committed a new script (rules.tcl) for the TclTk GUI
Where is it?
find . -type f -name 'rules.tcl'
produces no output.
A better solution would be for r.reclass and r.recode to have a rules=[file]
argument, so that they could be treated like r.colors and v.reclass.
I'm working on this.
__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
OK. It went this time.
Michael
On 6/25/07 3:49 PM, "Glynn Clements" <glynn@gclements.plus.com> wrote:
Michael Barton wrote:
I've just committed a new script (rules.tcl) for the TclTk GUI
Where is it?
find . -type f -name 'rules.tcl'
produces no output.
A better solution would be for r.reclass and r.recode to have a rules=[file]
argument, so that they could be treated like r.colors and v.reclass.
I'm working on this.
__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
Michael Barton wrote:
I've just committed a new script (rules.tcl) for the TclTk GUI that permits
interactive rule setting without needing an xterm for r.colors, r.reclass,
r.recode, and v.reclass. The interface lets you select the input map and an
output map (except for r.colors where it is not needed), and offers a simple
text widget where rules can be entered. There are several improvements I'd
like to add and hope that someone can help with.
1. I've managed to bind Control-c for copying in the text widget (Control-x
already cuts), but can't get Control-v to paste.
Try changing:
$rules_text tag bind <Control-v> {%W insert [selection get]}
to:
$rules_text tag bind <Control-v> {tk_textPaste %W}
AFAICT, tk_textPaste pastes the clipboard, while "selection get" returns
the primary selection (use "selection get -selection CLIPBOARD" if you
want the contents of the clipboard).
Actually, it should probably just use the "bind" command rather than the
text widget's "tag bind" command (the latter is intended for applying
bindings to specific regions of text, e.g. for implementing hyperlinks).
Also, those bindings should probably be applied to all text widgets, not
just that one, e.g.:
bind Text <Control-c> {tk_textCopy %W}
bind Text <Control-v> {tk_textPaste %W}
FWIW, my version of Tk (8.4.9) already has Ctrl-C and Ctrl-V bound to
Copy/Paste.
--
Glynn Clements <glynn@gclements.plus.com>
On 6/25/07 8:02 PM, "Glynn Clements" <glynn@gclements.plus.com> wrote:
Michael Barton wrote:
I've just committed a new script (rules.tcl) for the TclTk GUI that permits
interactive rule setting without needing an xterm for r.colors, r.reclass,
r.recode, and v.reclass. The interface lets you select the input map and an
output map (except for r.colors where it is not needed), and offers a simple
text widget where rules can be entered. There are several improvements I'd
like to add and hope that someone can help with.
1. I've managed to bind Control-c for copying in the text widget (Control-x
already cuts), but can't get Control-v to paste.
Try changing:
$rules_text tag bind <Control-v> {%W insert [selection get]}
to:
$rules_text tag bind <Control-v> {tk_textPaste %W}
Thanks for the idea, but I already tried this. At least on my Mac it won't
paste into the text widget (though it WILL paste elsewhere, indicating that
copy works)
AFAICT, tk_textPaste pastes the clipboard, while "selection get" returns
the primary selection (use "selection get -selection CLIPBOARD" if you
want the contents of the clipboard).
Actually, it should probably just use the "bind" command rather than the
text widget's "tag bind" command (the latter is intended for applying
bindings to specific regions of text, e.g. for implementing hyperlinks).
Also, those bindings should probably be applied to all text widgets, not
just that one, e.g.:
bind Text <Control-c> {tk_textCopy %W}
bind Text <Control-v> {tk_textPaste %W}
I think I tried both of these too, but now I can't remember--so I'll try
them and see.
FWIW, my version of Tk (8.4.9) already has Ctrl-C and Ctrl-V bound to
Copy/Paste.
This is real weird. I'd say it's a Mac problem, but I'm using x11 TclTk (I
think 8.4.12).
Michael
__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
On 6/25/07 8:02 PM, "Glynn Clements" <glynn@gclements.plus.com> wrote:
Also, those bindings should probably be applied to all text widgets, not
just that one, e.g.:
bind Text <Control-c> {tk_textCopy %W}
bind Text <Control-v> {tk_textPaste %W}
These work. Thanks Glynn.
Michael
__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton