Menu

#171 scidthemes-0.9.3

v.5.0
open
nobody
None
5
2022-06-29
2022-06-19
Bogdan
No

File scidthemes.0.9.3.zip contains a separate library.

I use '~/.tclshrc', which have a line:
lappend ::auto_path ~/tcl/lib/scidthemes-0.9.3
File '~/tcl/lib/scidthemes-0.9.3/pkgIndex.tcl' automatically load and execute code from file 'scidthemes.tcl'.
So, I have an error, when start tclsh:
error reading package index file /usr/lib64/scidthemes-0.9.3/pkgIndex.tcl: invalid command name "image"

This error can be resolved with next changes in 'pkgIndex.tcl' file:

--- a/pkgIndex.tcl  2018-08-22 16:06:34.000000000 +0300
+++ b/pkgIndex.tcl  2022-06-19 20:22:01.761586474 +0300
@@ -1,3 +1,3 @@
 set themesdir [file join [pwd] [file dirname [info script]]]
-source [file join $themesdir scidthemes.tcl]
+package ifneeded scidthemes 0.9.3 [list source [file join $dir scidthemes.tcl]]
 #option add *Menu.BorderWidth 0

Patch attached.

1 Attachments

Discussion

  • Bogdan

    Bogdan - 2022-06-19

    I prepare system and test patches.
    Final versions of patches attached.

    Patch 1:

    --- a/pkgIndex.tcl  2022-06-19 20:48:15.581926339 +0300
    +++ b/pkgIndex.tcl  2022-06-19 20:49:23.326755651 +0300
    @@ -1,3 +1,3 @@
     set themesdir [file join [pwd] [file dirname [info script]]]
    -source [file join $themesdir scidthemes.tcl]
    +package ifneeded ttk::theme::scidthemes 0.9.3 [list source [file join $dir scidthemes.tcl]]
     #option add *Menu.BorderWidth 0
    

    Patch 2

    --- a/scidthemes.tcl    2022-06-19 20:08:54.825417759 +0300
    +++ b/scidthemes.tcl    2022-06-19 20:26:43.785386803 +0300
    @@ -4,6 +4,7 @@
     ###
     ### scidthemes.tcl: modern ttk themes for tcl and scid in 7 colors
     ###
    +package require Tk
     package provide ttk::theme::scidthemes 0.9.3
     foreach t { blue mint green purple sand pink grey} \
             c { "#5464c4" "#7cac50" "#50ac69" "#8050ac" "#ac9750" "#ac5093" "#606060" } {
    
     
  • Bogdan

    Bogdan - 2022-06-20

    With this patch, first line of pkgIndex.tcl - is not needs.
    So, final version of pkgIndex.tcl file may be just in one line:

    package ifneeded ttk::theme::scidthemes 0.9.3 [list source [file join $dir scidthemes.tcl]]
    
     
  • Uwe

    Uwe - 2022-06-24

    Thank you Bogdan. I'll check this

     
  • Uwe

    Uwe - 2022-06-28

    I checked the patch. It work for the tclsh, but it fails on new installations of SCID:
    SCID does preload the themes, so they are not "needed". If no theme of
    the packages is used then no themes are loaded and no theme is
    available in the theme menu. The patch only works when the
    theme is stored in option.dat and used on start of SCID.

     
  • Bogdan

    Bogdan - 2022-06-29

    Line:

    package ifneeded ttk::theme::scidthemes 0.9.3 [list source [file join $dir scidthemes.tcl]]
    

    register a command, which must be executed, when user call:

    package require ttk::theme::scidthemes
    

    So, if user doesn't call "package require ", then themes from ttk::theme::scidthemes package does not to be loaded.

    Original "pkgIndex.tcl" file have line:

    source [file join $themesdir scidthemes.tcl]
    

    which directly loads the scidthemes.tcl file when interpreter detect pkgIndex.tcl in the directories from ::auto_path variable. And this command does not provide an option for user - does he really needs this package.

    Normal behaviour in general usage - is to load package by request.
    So, if scidthemes with original pkgIndex.tcl file will be stored into the common libraries path (::auto_path), then each application, which starts from this environment - will load scidthemes library automatically, without request.

    Of course, applications, which necessary need this package - may load it without request. But this is not a common behaviour, not universal mode.

    May be problem with SCID is because SCID does not call "package require ttk::theme::scidthemes" at start?

     

Log in to post a comment.