Accept both spaces and tab characters as word separators. It used to
only accept spaces.
Thanks to Roguish for the bug report and Jeff Epler for the fix.
Signed-off-by: Sebastian Kuzminsky <seb@highlab.com>
By deferring the treeclose/treeopen until idle, the work isn't done
each time a single tree node is opened/closed. Doing this work
repeatedly (with included "update" command) caused the automatic closing
to take an appreciable amount of time, particularly on slower machines.
A new file type (.demo) in the configs tree is supported by the linuxcnc
script and the configuration selector (pickconfig.tcl). A .demo file
must be executable and is typically implemented as a shell script that
invokes an application with appropriate parameters.
This facility makes it possible to demonstrate apps related to linuxcnc
using pickconfig without starting linuxcnc or requiring a complete ini
file.
Thanks to Chris Morley for suggestion
Details:
Modify pickconfig to support .demo files
Use noforcecopy for .demo files which should not be copied to
a user dir
Provide .demo apps for halrun,info,parport,xhc-hb04
Provide .demo apps for gladevcp,pyvcp
New script: linuxcnc_var and removal of several scripts/*.in.
Rename latency scripts for consistency (and reduce merge overwrites).
Remove latencyplot from menu.
Moved gladevcp demo apps from root/gladevcp to configs/apps/gladevcp
The root/gladevcp/ examples were orphans and didn't work with
the configuration selector
Change .py files so persistent files are named .save instead of
.ini to avoid conflict with .ini files which the configuration
selector presumes are working configs.
Rebranding in some py files
Some clarifications within copied README files
Consolidate by-widgets dir
Update docs
New doc for configuration selector (needs formatting)
Update for configs tree rearrangement
Rename 2 non working sim .ini files to .ini.notworking
show message and exit if ini file not compatible with emccalib
comment out old debug prints
don't require space in ini file equal line:
e.g,. accept P=value instead of requiring P =[ ]value
limit msg length for popups when errant input to gcmc compiler
typo on strip()
for detecting options comment, split on // not /
minor: ngcgui.txt update
new: involute-gear.gcmc adapted for ngcgui from B. Stultien's example
new: ensure_mode.gcmd include file to resolve potential conflict
with preamble and gcmc code (gcmc wins)
with updates:
1) popup msg error if entry box for gcmc not a number
2) allow comment after tag when tagging a gcmc option
3) handle gcmc_include_path for new custom tab additions
4) incorporate ensure_mode in .gcmc examples
5) update ngcgui.txt for ensure_mode
Replace puts stderr with stdout to avoid problems when
file descriptor 2 is reassigned by embedding axis app.
Original puts stderr can be restored when the inadvertent
loss of stderr is solved
This was never a good idea, was undocumented, and noted as
deprecated in docs/src/gui/ngcgui.txt.
The plentiful availability of global-named-readonly-parameters
in the master branch makes support even more problematic
1) decline gcmc file if not in linuxcnc path
2) if not embedded and gcmc file, use file dir as outdir with message
3) remove leftover id of gcmc file when not found
(squashed commits from test branch: dgarr/ngcgui-gcmc)
Add support for [py]ngcgui to read .gcmc input files for the gcmc
compiler and make tab pages with entry boxes for tagged variables.
A tabpage 'info' message and compiler options can be specified
by tags too.
Ref: gcmc (G-Code Meta Compiler) http://www.vagrearg.org/content/gcmc
Note: gcmc version 1.4.3 or later must be installed separately and
available in the user PATH
--------------------------------------------------------------------
Tag formats (simplified):
Variable:
//ngcgui: vname [= value , [comment text]]
Info message:
//ngcgui: info: text message
Option:
//ngcgui: -optioname [optionvalue]
--------------------------------------------------------------------
When a feature for a gcmc tab page is created, the variables
and options are passed to the compiler and a gcode subroutine
file is produced and placed at the head of the linuxcnc subroutine
search path. These files are purged at each ngcgui restart
that uses .gcmc files.
--------------------------------------------------------------------
Example ini files for axis, touchy, and gscreen:
configs/sim/axis/ngcgui/ngcgui_gcmc.ini
configs/sim/axis/ngcgui/pyngcgui_gcmc.ini
configs/sim/touchy/ngcgui/pyngcgui_touchy_gcmc.ini
configs/sim/gscreen/ngcgui/pyngcgui_gscreen_gcmc.ini
Example gcmc files:
nc_files/gcmc_lib/drill.gcmc
nc_files/gcmc_lib/square.gcmc
nc_files/gcmc_lib/star.gcmc (Bertho Stultiens)
nc_files/gcmc_lib/wheels.gcmc (Alan Battersby)
that can accept a watchlist
Usage:
halshow [Options] [watchfile]
Options:
--help (this help)
Notes:
Create watchfile in halshow using: 'File/Save Watch List'
linuxcnc must be running for standalone usage
If a directory named *_lib is added to configs/nc_files,
then create proper symlink for it when installing
a new user configuration.
minor: rename somes vars for clarity
Inconsistent README and .txt formatting worked poorly after
wm resize allowed by prior commit. This change removes
regsub reformat and relies on paragraphs (without breaks)
in files for display.
a subdir will not be copied to user configs if it or
any children contain ini files since such a directory
will be considered a potential config and included
in picker tree
Makefile.inc.in includes:
/usr/local/etc/emc2/configs
in:
EMC2_SYSTEM_CONFIG_DIR
but the directory doesnt exist and is not created
so: don't show nonexisting dirs
pickconfig.tcl now makes a flat directory structure when
copying files to ~linuxcnc/configs.
This makes for a simpler user configs directory and
facilitates rearranging directories in the distro config
tree.
This change makes ini files refer to ../../nc_files throughout
so that they can work in both rip builds and installed debs.
see also configs/maintainer.txt
also: pickconfig.tcl: remove ::copy_special_subdirs
all directories below root/configs are candidates for
config presentation provided:
1) they contain an ini file (or a child contains an ini file)
2) they are not on the ::exclude_list
currently only item is 'common'
This provision guards against an ini file being added to
configs/common
set by ::make_flat_user_dirs
Current usage has been hierarchical.
This change supports future use of a flat user dir for configs.
also:
1) when copying to user dir, never copy an nc_files dir
since it is handled elsewhere
2) change some var names for readibility
1) reorder display of directories to show preferred items first
2) change openmode to simplify first view
but go to last_ini if available
3) display text when selecting top nodes too
4) add some notes
use make to create simple standalone executable files for
ngcgui,pyngcgui,gremlin_view,tooledit
instead of copying files from source tree
to add this patch, you may need to rm existing files:
lib/python/gremlin_view.py
lib/python/pyngcgui.py
share/linuxcnc/gremlin_view.ui
By default, [py]ngcgui terminates created ngc files with M2.
M2 (Program End) has a number of defined side effects that
may not be wanted. This patch provides an option (nom2) such
that the created ngc file is started and ended with a single
percent (%) character and no terminating M2.
Option format:
command_line: -N | --nom2
Inifile:
NGCGUI_OPTS = ... nom2 ...
(Note: [py]ngcgui has always ignored M2 lines that follow an
endsub in the subroutines it processes)
thanks to Rick (rng3) for the suggestion
in proc source_the_files:
1) catch error and report without traceback
2) identify original file if it was converted
3) allow detection of error in more than one file
in proc hal_to_tcl:
catch and report file open errors without traceback
When [HAL]TWOPASS=verbose is specified, prints are made comparing
lines that are altered when converting from hal to tcl. This patch
reduces the output by avoiding printing differences that occur
because of leading or trailing whitespace differences only.
The auto-generated file named readme.ngc is put in the user nc_files directory.
It can run as a simple gcode file and displays debug messages that show
the linuxcnc version and identifies important directories for the user.
With this change, the file can also run as an ngcgui compatible subfile.
Inifile values were not handled correctly for multiple HALFILEs
because the call to the halcmdSubstitute proc when reading halfile
substituted for instances of [SECTION]VAR which were needed later
to make entries for multiple tabs.
two small bugs within halcmdSubstitue masked bad behavior for single
HALFILE examples
And note that support of global variables as input parameters
(a deprecated feature) is marked as a declining feature
to be removed for the 2.6 release
detect inclusion of numbered subroutine
if a numbered subroutine is included in a _named_ subroutine file,
execution seems to stop when the endsub is encountered
Example (2.5)
$ cat prog1.ngc
o<suba> call
M2
$ cat suba.ngc
o<suba> sub
(print, before o100)
o100 sub
(print, this is suba)
o100 endsub
o100 call
(print, after o100)
o<suba> endsub
When prog1.ngc is executed, the prints are:
before o100
this is suba
nothing is executed after the o100 endsub
Context:
new deb install (from buildbot) with an existing ~/emc2 dir
Behavior
copies config files to $linuxcnc::USER_CONFIG_DIR = ~/linuxcnc/configs
^^^^^^^^
however, if ncfiles == ~/emc2/nc_files exists,
then symbolic links are not created.
Change: rebrand to linuxcnc
and if ~/emc2/nc_files exists, issue a popup message to user
Expected ini parameters for specifying files are:
[RS274NGC]SUBROUTINE_PATH
and
[DISPLAY]NGCGUI_SUBFILE -- as a filename only
Unexpected usage: user specifies [DISPLAY]NGCGUI_SUBFILE as
an absolute filename
This fails, as expected, if absolute filename is not in search path.
Change is to warn if user specifies an absolute filename that doses not resolve
to the search path and simultaneously has a file by that name in the search
path.
commit 0d938107 changed everything to a fixed font, but the
change message indicates that the goal was to affect only
the "detail_box" text widget. Tweak the resource settings so
that a fixed font is only selected for Text widgets.
this includes the main script, some of the GUIs, the Python module,
the Tcl package, some image fies.
On a sim system, axis, tkemc, xemc all start. runtests pass.
a system with realtime wasn't yet tested.
packaging probably requires additional changes and was not yet tested.
global feature name changed from #<_feature> to #<_feature:> to be more
consistent with ngcgui recommended practice
minor: use any,color,override for transient indication of
use of entrykeybinding
minor: fix name on hole_circle.ngc
symptom: when specifying a single "Custom" tab, an error
occurred because ::ngc(any,custom,color) was not set yet
fix: invoke initgui earlier for embedded page
symptom: with option new, new tab could not find file
in search path because fullpath was passed
fix: use file tail to support search
sim/gladevcp/inifiles use [RS274NGC]SUBROUTINE_PATH to find subroutines
This patch creates a gladevcp_lib directory so that ini file items
that specify [RS274NGC]SUBROUTINE_PATH with relative path items
can be resolved in both run-in-place (RIP) configurations and
with configurations copied by pickconfig.tcl for packaged builds.
The naming conventions used are the same as for ngcgui_lib
When ngcgui is embedded in axis, a user can use the gui filechooser to browse
and select a file that is not in the search path ([RS274NGC]SUBROUTINE_PATH)
When the processed file is sent to emc (via axis) it won't run because the
subroutine is not found in the search path. (If the subfile contains no calls
to other routines, it can be made to run by activating the checkbox for
"Expand subroutine"))
Detect that file is not in search path and inform user.
Related change: ngcgui_ttt places its generated subfiles in /tmp so that they
will be purged (ubuntu: /etc/default/rcS:TMPTIME) and uses the
expandsubroutines option so that the subfile does not need to be in the search
path ([RS274NGC]SUBROUTINE_PATH). A new option, nopathcheck, is used by
ngcgui_ttt to avoid warnings on the search path restriction.
Allowing subdirectories was working for RIP but not a packaged build
1) pickconfig: when copying files, if inifile configdir
has linked files, copy the linked files
2) pickconfig: when creating user configurations, create directories
at the same nesting level as originally specified for the ini file
relative to the directory from the $emc::CONFIG_DIR list
so that ini file items which specify relative links will
work in both run-in-place and packaged builds
3) configs/sim/*.ini: change ini file items for .hal and .tbl
files to point to files within the inifile directory itself
and create links for these files to an ancestor directory.
This supports sharing of files for all the config/sim
configurations and operation with run-in-place or packaged builds
4) pickconfig: (minor fix) avoid infinite loop when trying to mkdir
5) config/sim/*/*.ini: (minor fix) remove commented reference to
nonexistent file gamepad.hal
6) ngcgui_lathe.ini: (minor fix) remove bogus item in SUBROUTINE_PATH
former behavior: no details were shown when a directory node clicked
new behavior: show README in directory (if it exists) when a directory
node is clicked.
Note: the script also supports use of .txt files corresponding to .ini
files but this feature doesn't seem to be used
Support option handling as specified by keywords in the [HAL]TWOPASS
ini file item. Example:
[HAL]
TWOPASS = on,verbose,nodelete
Options:
verbose: extra reporting including comparison of lines
with ini file items that converted from hal files
to tcl global variable format
nodelete: do not delete the temporary tcl files converted from hal files
Parse more occurrences of: "[SECTION]item "
Lines with more than one ini file item like:
net name.[STANZA1]item1 <= [STANZA2]item2 => [STANZA2]item3
are now supported.
Note that the trailing space (or end-of-line) is used in finding
ini file item occurrences and this precludes support of lines with an
item embedded _within_ text like:
net name.[STANZA1]item1.morestuff [STANZA2]item2
This will be reported as an error since
[STANZA]item1.morestuff does not likely exist
The pid component supports an option debug=dbg.
In the pid code, if the dbg >0, extra pins are exported
for all instances.
Here, twopass.tcl is modified so that occurrences of debug=dbg on
multiple loadrt lines are handled by ORing the values for
each line. This maintains compatibility with the pid component
usage.
example:
loadrt pid names=aa1 debug=0
loadrt pid names=aa2 debug=1
loadrt pid names=aa3 debug=0
will result in dbg = 0|1|0 = 1 and cause export of extra pins for all
pid instances.
For ngcgui tab pages embedded in axis gui, use a search path for the
filename items:
[DISPLAY]NGCGUI_PREAMBLE, NGCGUI_SUBFILE, NGCGUI_POSTAMBLE, TTT_PREAMBLE
If a filename is specified with an initial "/" character, only the absolute
filename is considered.
When the file is specified as a relative filename (first character is not a "/"),
the search order is:
[DISPLAY]PROGRAM_PREFIX
[RS274NGC]SUBROUTINE_PATH
First file found in the search wins.
Thanks to Seb Kuzminsky for the suggestion.
The demo files for ngcgui (ngcgui_simple.ini, ngcgui.ini, ngcgui_lathe.ini)
point to configuration files like:
NGCGUI_SUBFILE = ../../nc_files/ngcgui_lib/simp.ngc
This works as is with RIP builds.
For packages, pickconfig.tcl creates a link for examples like:
~/emc2/nc_files/examples -> /usr/share/emc/ncfiles
This patch alters pickconfig.tcl so it creates another similar link:
~/emc2/nc_files/ngcgui_lib -> /usr/share/emc/ncfiles/ngcgui_lib
maintaining the relative locations used in the ngcgui*.ini files
misplaced bracket prevented exclusion of these numbered params
in handling of special association lines for positional parameters.
error report: _tkinter.TclError: can't read ""num02" : no such variable
thanks to Bob Palmer for bug report
ngcgui is a subroutine utility for writing and using emc subroutines
ngcgui can run as a standalone application or be embedded in
multiple tab pages in the axis gui
Support two new tcl packages that create axis gui tab pages
Ngcgui (ngcgui subroutine utility)
Ngcguittt (ngcgui interface for truetype-tracer)
new: tcl/ngcgui_app.tcl -- tcl package for [DISPLAY]TKPKG = Ngcgui
new: tcl/ngcgui_ttt.tcl -- tcl package for [DISPLAY]TKPKG = Ngcguittt
new: tcl/ngcgui.tcl -- ngcgui namespace, procs, and standalone
updated: tcl/pkgIndex.tcl -- tcl index for new tcl packages
new: configs/sim/ngcgui*.ini -- example ini files
new: nc_files/ngcgui_lib -- ngcgui compatible library
requires libtk-img (tcl Img package)
requires truetype-tracer v4 to use Ngcguittt
In the built-in conversion of a halfile to a (transient) tcl file,
trailing comments in halfile lines like:
sets thesig 1 #comment
are separated with a ";" for tcl compatibiltiy, like:
sets thesig 1 ;#comment
Allows multiple loadrt calls for same module
An earlier commit, aefefc1d9e, allows tcl scripts be used to configure
hal (jepler 8/19/2009 -- bravo!). A new directory is created, configs/simtcl,
for simulator examples that use .tcl files for hal configuration.
This patch uses the presence of an inifile entry [HAL]TWOPASS=anything to
direct a two-pass hal configuration using the files specified by
[HAL]HALFILE. These HALFILE files can be existing .hal files or preferably
.tcl files which are very similar but allow use of programming constructions
like conditionals and loops.
example: HALFILE=twopass_demo.tcl
or: HALFILE=../sim/core_sim.hal
The principal script, twopass.tcl reads the HALFILE files in two passes.
In the first pass (pass0), no hal commands are executed but loadrt and loadusr
calls are consolidated. This allows entry of loadrt calls for a given module
in multiple places using either the "count=" or "names=" specifiers (but not
simultaneously on a given module as they are mutually exclusive).
For compatibilty with existing .hal files, when .hal HALFILE files are
specified, they are first read and the [SECTION]ITEM specifiers are rewritten
as $::SECTION(ITEM) for tcl compatibility. This step is not manifest to the
user. The .hal files are also checked for hal commands which conflict in name
with tcl commands and warnings are issued to denote potential problems.
Since no hal commands are executed in pass0, the hal state cannot be
interrogated in any useful way. At the conclusion of pass0, all the combined
loadrt and loadusr commands are executed.
In the second pass (pass1), the HAL[HALFILE] files are read again and all
commands except the loadrt and loadusr commands are executed (unless they are
for modules that were not detected in pass0). A function (named
"::tp::passnumber") is available for use in tcl HALFILE files for debugging.
In the second pass, the addf functions are executed in the order of occurrence.
Since the order of the addf functions may be very important, the user must
manage this sequence. A convenient method is to put all addf calls in one
place in the desired order. An alternative method is to use the "position"
argument in the addf call.
Two demo/test cases based on sim/axis.ini and its three hal files
(core_sim.hal,axis_manualtoolchange.hal,simulated_home.hal)
are included:
twopass_compat.ini uses unmodified hal files that are transcribed
transparently for tcl compatibility
twopass_demo.ini uses a tcl configuration file with both loadrt "count="
and "names=" methods on different modules
Notes:
1) Using the form "loadrt modname count=n" requires the user to manage
the order and identity of the n modname items created. Modules
are created numbered 0 to n-1 and the user must keep track of the
ordering.
It is advantageous to use the form "loadrt modname names=namea,nameb ..."
With this method, the user has explicit control of the component
names and can use multiple loadrt lines even in different files.
For example:
filea
loadrt flipflop names=ff1,ff2
...
fileb
loadrt flipflop names=ff9
...
filec
addf ff9 servo-thread
addf ff2 servo-thread
addf ff1 servo-thread
With this method, configuration files can become more modular and
readable while supporting an overall strategy for ordering the execution
of the components.
2) In executing [HAL]HALFILE tcl scripts, the tcl "puts" command will
print during each pass. The user can alter this behavior using procs:
::tp::passnumber returns 0 | 1 for the current pass number
::tp::no_puts disable the tcl "puts" command
::tp::alter_puts alters the tcl "puts" command so that it
reports <pass0> or <pass1>
::tp::restore_puts restores the tcl "puts" command
explicitly make all copied files user-writable.
[file copy] copies the file mode, so if the original was not writable
then the copy will not be writable for [put_file_contents] or for
later user modification.
ongoing work on hostmot2 8i20 support has led to names like
hm2_5i23.0.sserial.0.port.0.8i20.angle
which made halshow grumpy because it had a hardcoded limit of 5
tree levels. Generalize halshow so that an unlimited number of levels
will work.
* get rid of undesirable ridge border on jog speed controls
* align jog controls to the top of their area, not center
(better appearance when there are no angular axes)
A difference between tk8.4 and tk8.5 radiobuttons meant that
on Ubuntu 10.04 it was not possible to see whether a radiobutton
was selected or not selected.
After this change, the background of the checkbutton's indicator is
blue and its indicator dot is white. This seems most in keeping with
the tkemc white-on-blue style.
since 4b9ca027 worldlabellist always held all the axis letters A...W and
the axiscoordmap was always 0...8. The padding to at least 9 items
also became unneeded.
In this case, the initialization code can be greatly simplified.
Running a configuration from a read-only location won't work
(axis crashes outright, and with tkemc offsets are totally broken
since the var file can't be written). So, don't offer the user the
"run without copying" option.
while we agree it's utterly insane to require .desktop files to be
executable (because they won't do the right thing when executed
from the shell), it's apparently some kind of security measure. Without
this, double clicking a desktop emc icon doesn't work.
lsearch must be used only for arguments which are guaranteed to have
proper tcl "list" structure. The halfile construct
loadrt hal_parport cfg="0x378 out "
does not. Treat the hal file lines like free-form text instead,
and use glob-style [string match] which does not place any restrictions
on the form of the string argument.
Locate emc.so, hal.so, emc.tcl and a new pkgIndex.tcl file in a directory that
is a subdir of a directory included in the tcl auto_path list as configured for
the tcl/tk packages in the ubuntu distribution.
For a conventional build with --prefix=/usr, the chosen parent dir is:
/usr/lib/tcltk
and the shared library files will be located in the subdir:
/usr/lib/tcltk/emc2
With these changes, aan external tcl program should be able to say:
package require Emc 1.0
and/or
package require Hal 1.0
For this normal case, no extra configuration is required.
For an installed emc built with --prefix=/otherlocation, the using
application must modify the tcl auto_path list:
e.g., lappend auto_path /otherlocation/lib/tcltk
or set the TCLLIBPATH appropriately
e.g., export TCLLIBPATH=/otherlocation/lib/tcltk
For a run-in-place build of emc, '. scripts/emc-environment' to set
TCLLIBPATH appropriately.