Check-in [a4782b3770]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:update awthemes to version 7.3
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a4782b37703f45d8a034608c390f8801611e8d22
User & Date: chw 2019-12-03 21:38:37.062
Context
2019-12-04
06:46
add selected tk upstream changes check-in: 90b29fd7e9 user: chw tags: trunk
2019-12-03
21:49
merge with trunk check-in: cd42089549 user: chw tags: wtf-8-experiment
21:38
update awthemes to version 7.3 check-in: a4782b3770 user: chw tags: trunk
21:33
add tclws upstream changes check-in: 32cdbee92a user: chw tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to assets/awthemes7/README.txt.
8
9
10
11
12
13
14



15
16
17
18
19
20
21
  # application scaling
  tclsh demottk.tcl winxpblue -fontscale 1.2
  # tk scaling only
  tclsh demottk.tcl winxpblue -ttkscale 2.0
  # user with high dpi, smaller font
  tclsh demottk.tcl winxpblue -ttkscale 2.0 -fontscale 0.7




7.2 (2019-12-2)
   - setBackground will not do anything if the background color is unchanged.
   - fixed a bug with graphical buttons.
   - make setbackground more robust.

7.1 (2019-12-1)
   - fix border/padding scaling, needed for rounded buttons/tabs.







>
>
>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  # application scaling
  tclsh demottk.tcl winxpblue -fontscale 1.2
  # tk scaling only
  tclsh demottk.tcl winxpblue -ttkscale 2.0
  # user with high dpi, smaller font
  tclsh demottk.tcl winxpblue -ttkscale 2.0 -fontscale 0.7

7.3 (2019-12-2)
   - fix spinbox scaled styling

7.2 (2019-12-2)
   - setBackground will not do anything if the background color is unchanged.
   - fixed a bug with graphical buttons.
   - make setbackground more robust.

7.1 (2019-12-1)
   - fix border/padding scaling, needed for rounded buttons/tabs.
Changes to assets/awthemes7/awthemes.tcl.
62
63
64
65
66
67
68


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#   To style the scrollbars, use:
#        ttk::scrollbar .sb -style Vertical.TScrollbar
#     or ttk::scrollbar .sb -style Horizontal.TScrollbar
#   This will turn off the aqua styling and use the theme styling.
#   Also note that the styling for the scrollbar cannot be configured
#     afterwards, it must be configured when the scrollbar is created.
#


# 7.2
#   - setBackground will not do anything if the background color is unchanged.
#   - fixed a bug with graphical buttons.
#   - make setbackground more robust.
# 7.1
#   - fix border/padding scaling, needed for rounded buttons/tabs.
# 7.0
#   - clean up .svg files to use alpha channel for disabled colors.
#   - calculate some disabled colors.
#   - fix doc.
#   - split out theme specific code into separate files.
#   - Fix scaledStyle set of treeview indicator.
#   - make the tab topbar a generalized option.
#   - merge themeutils package
#   - clean up notebook tabs.
#   - winxpblue: notebook tab graphics.
#   - winxpblue: disabled images.
#   - black: disabled cb/rb images.
#   - black: add labelframe color.
# 6.0
#   - fix !focus colors
#   - slider border color
#   - various styling fixes and improvements
#   - separate scrollbar color
#   - optional scrollbar grip
#   - button images are now supported
#   - added winxpblue scalable theme







>
>
|



|

|












|







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#   To style the scrollbars, use:
#        ttk::scrollbar .sb -style Vertical.TScrollbar
#     or ttk::scrollbar .sb -style Horizontal.TScrollbar
#   This will turn off the aqua styling and use the theme styling.
#   Also note that the styling for the scrollbar cannot be configured
#     afterwards, it must be configured when the scrollbar is created.
#
# 7.3 (2019-12-2)
#   - fix spinbox scaled styling
# 7.2 (2019-12-2)
#   - setBackground will not do anything if the background color is unchanged.
#   - fixed a bug with graphical buttons.
#   - make setbackground more robust.
# 7.1 (2019-12-1)
#   - fix border/padding scaling, needed for rounded buttons/tabs.
# 7.0 (2019-11-30)
#   - clean up .svg files to use alpha channel for disabled colors.
#   - calculate some disabled colors.
#   - fix doc.
#   - split out theme specific code into separate files.
#   - Fix scaledStyle set of treeview indicator.
#   - make the tab topbar a generalized option.
#   - merge themeutils package
#   - clean up notebook tabs.
#   - winxpblue: notebook tab graphics.
#   - winxpblue: disabled images.
#   - black: disabled cb/rb images.
#   - black: add labelframe color.
# 6.0 (2019-11-23)
#   - fix !focus colors
#   - slider border color
#   - various styling fixes and improvements
#   - separate scrollbar color
#   - optional scrollbar grip
#   - button images are now supported
#   - added winxpblue scalable theme
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#   - added setMenuColors helper routine
#   - cleaned up the radiobutton image
#   - resized checkbutton and radiobutton images.
# 0.1
#   - initial coding
#

package provide awthemes 7.2

package require Tk
# set ::notksvg to true for testing purposes
if { ! [info exists ::notksvg] || ! $::notksvg } {
  catch { package require tksvg }
}








|







191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#   - added setMenuColors helper routine
#   - cleaned up the radiobutton image
#   - resized checkbutton and radiobutton images.
# 0.1
#   - initial coding
#

package provide awthemes 7.3

package require Tk
# set ::notksvg to true for testing purposes
if { ! [info exists ::notksvg] || ! $::notksvg } {
  catch { package require tksvg }
}

1685
1686
1687
1688
1689
1690
1691
1692

1693
1694
1695
1696
1697
1698
1699
          disabled  $images(spin-arrow-bg-up-d${sfx})]
      ttk::style element create ${pfx}Spinbox.downarrow image \
          [list $images(spin-arrow-bg-down-n${sfx}) \
          disabled  $images(spin-arrow-bg-down-d${sfx})]

      if { $pfx ne {} } {
        set layout [ttk::style layout TSpinbox]
        regsub {(Spinbox.[a-z]*arrow)} $layout "${pfx}\\1" layout

        ttk::style layout ${pfx}TSpinbox $layout
      }
    }

    ttk::style configure ${pfx}TSpinbox \
        -borderwidth 1 \
        -relief none \







|
>







1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
          disabled  $images(spin-arrow-bg-up-d${sfx})]
      ttk::style element create ${pfx}Spinbox.downarrow image \
          [list $images(spin-arrow-bg-down-n${sfx}) \
          disabled  $images(spin-arrow-bg-down-d${sfx})]

      if { $pfx ne {} } {
        set layout [ttk::style layout TSpinbox]
        regsub {(Spinbox.uparrow)} $layout "${pfx}\\1" layout
        regsub {(Spinbox.downarrow)} $layout "${pfx}\\1" layout
        ttk::style layout ${pfx}TSpinbox $layout
      }
    }

    ttk::style configure ${pfx}TSpinbox \
        -borderwidth 1 \
        -relief none \
Added assets/awthemes7/demoscaled.tcl.














































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/usr/bin/tclsh

package require Tk

if { 1 } {
  set ap [file normalize [file join [file dirname [info script]] .. code]]
  if { $ap ni $::auto_path } {
    lappend ::auto_path $ap
  }
  unset ap
}

if { [llength $::argv] < 1 } {
  puts "Usage: demottk.tcl <theme> \[-ttkscale <scale-factor>] \[-scale <scale-factor>] \[-fontscale <scale-factor>] \[-highlightcolor <color>] \[-notksvg]"
  exit 1
}

lappend ::auto_path [file dirname [info script]]

set theme [lindex $::argv 0]

set ::notksvg false
set fontscale 1.0 ; # default
set sf 1.0
set gc {}
for {set idx 1} {$idx < [llength $::argv]} {incr idx} {
  if { [lindex $::argv $idx] eq "-ttkscale" } {
    incr idx
    tk scaling [lindex $::argv $idx]
  }
  if { [lindex $::argv $idx] eq "-scale" } {
    incr idx
    set sf [lindex $::argv $idx]
  }
  if { [lindex $::argv $idx] eq "-highlightcolor" } {
    incr idx
    set gc [lindex $::argv $idx]
  }
  if { [lindex $::argv $idx] eq "-fontscale" } {
    incr idx
    set fontscale [lindex $::argv $idx]
  }
  if { [lindex $::argv $idx] eq "-notksvg" } {
    set ::notksvg true
  }
}

# now do the requires so that -notksvg has an effect.
package require colorutils
package require awthemes

if { $gc ne {} } {
  ::themeutils::setThemeColors $theme \
      graphics.color $gc
}
::themeutils::setThemeColors $theme \
    scale.factor $sf

if { ! $::notksvg } {
  catch { package require tksvg }
}

set fn data/bll-tecra/tkscale.txt
if { [file exists $fn] } {
  set fh [open $fn r]
  set scale [gets $fh]
  close $fh
  tk scaling -displayof . $scale
}

set calcdpi [expr {round([tk scaling]*72.0)}]
set scalefactor [expr {$calcdpi/100.0}]

# Tk defaults to pixels.  Sigh.
# Use points so that the fonts scale.
font configure TkDefaultFont -size 11
set origfontsz [font metrics TkDefaultFont -ascent]
font configure TkDefaultFont -size [expr {round(12.0*$fontscale)}]

set newfontsz [font metrics TkDefaultFont -ascent]
if { $origfontsz != $newfontsz } {
  set appscale [expr {double($newfontsz)/double($origfontsz)}]
  ::themeutils::setThemeColors $theme \
      scale.factor $appscale
}

set loaded false
if { 1 } {
  set fn [file join $::env(HOME) s ballroomdj code themes themeloader.tcl]
  if { [file exists $fn] } {
    source $fn
    themeloader::loadTheme $theme
    set loaded true
  }
}

set havetksvg false
if { ! [catch {package present tksvg}] } {
  set havetksvg true
}

set ttheme $theme
if { ($havetksvg && $theme eq "black") ||
    ($havetksvg && $theme eq "winxpblue") } {
  set ttheme aw${theme}
}
if { [file exists $ttheme.tcl] && ! $loaded } {
  source $ttheme.tcl
}

ttk::style theme use $theme

set val 55
set valb $theme
set off 0
set on 1

. configure -background [ttk::style lookup TFrame -background]

if { [info commands ::ttk::theme::${theme}::scaledStyle] ne {} } {
  font create SmallFont
  font configure SmallFont -size [expr {round(8.0*$fontscale)}]
  ttk::theme::${theme}::scaledStyle Small TkDefaultFont SmallFont
}

ttk::style configure TFrame -borderwidth 0

foreach {k} {{} Small} {
  set tfont TkDefaultFont
  set s {}
  if { $k ne {} } {
    set tfont SmallFont
    set s Small.
  }

  ttk::labelframe .lf${k} \
      -text " Normal " \
      -style ${s}TLabelframe
  ttk::style configure ${s}TLabelframe.Label -font $tfont

  ttk::frame .bf$k
  ttk::label .lb$k -text $theme -style ${s}TLabel
  ttk::style configure ${s}TLabel -font $tfont
  ttk::button .b$k -text $theme -style ${s}TButton
  ttk::style configure ${s}TButton -font $tfont
  pack .lb$k .b$k -in .bf$k -side left -padx 3p

  ttk::combobox .combo$k -values \
      [list aaa bbb ccc ddd eee fff ggg hhh iii jjj kkk lll mmm nnn ooo ppp] \
      -textvariable valb \
      -width 15 \
      -height 5 \
      -font $tfont \
      -style ${s}TCombobox
  option add *TCombobox*Listbox.font $tfont

  ttk::frame .cbf$k
  ttk::checkbutton .cboff$k -text off -variable off -style ${s}TCheckbutton
  ttk::checkbutton .cbon$k -text on -variable on -style ${s}TCheckbutton
  pack .cboff$k .cbon$k -in .cbf$k -side left -padx 3p

  ttk::separator .sep$k -style ${s}TSeparator

  ttk::frame .rbf$k
  ttk::radiobutton .rboff$k -text off -variable on -value 0 -style ${s}TRadiobutton
  ttk::radiobutton .rbon$k -text on -variable on -value 1 -style ${s}TRadiobutton
  pack .rboff$k .rbon$k -in .rbf$k -side left -padx 3p

  pack .bf$k .combo$k .cbf$k .sep$k .rbf$k \
      -in .lf$k -side top -anchor w -padx 3p -pady 3p
  pack configure .sep$k -fill x -expand true

  ttk::frame .hf$k
  ttk::scale .sc$k \
      -from 0 \
      -to 100 \
      -variable val \
      -length [expr {round(100*$scalefactor)}] \
      -style ${s}Horizontal.TScale
  ttk::progressbar .pb$k \
      -mode determinate \
      -variable val \
      -length [expr {round(100*$scalefactor)}] \
      -style ${s}Horizontal.TProgressbar
  ttk::entry .ent$k -textvariable valb \
      -width 15 \
      -font $tfont \
      -style ${s}TEntry
  ttk::spinbox .sbox$k -textvariable val \
      -width 5 \
      -from 1 -to 100 -increment 0.1 \
      -font $tfont \
      -style ${s}TSpinbox
  pack .sc$k .pb$k .ent$k .sbox$k \
      -in .hf$k -side top -anchor w -padx 3p -pady 3p

  ttk::frame .vf$k
  ttk::scale .scv$k \
      -orient vertical \
      -from 0 -to 100 \
      -variable val \
      -length [expr {round(100*$scalefactor)}] \
      -style ${s}Vertical.TScale
  ttk::progressbar .pbv$k -orient vertical \
      -mode determinate \
      -variable val \
      -length [expr {round(100*$scalefactor)}] \
      -style ${s}Vertical.TProgressbar
  pack .scv$k .pbv$k -in .vf$k -side right -padx 3p -pady 3p

  pack .hf$k .vf$k -in .lf$k -side left -anchor e
}
.lfSmall configure -text " Scaled "
pack .lf .lfSmall -in . -side left -padx 3p -pady 3p -expand 1 -fill both

Changes to assets/awthemes7/pkgIndex.tcl.
1
2
3
4
5
6
7
8
package ifneeded awthemes 7.2 \
    [list source [file join $dir awthemes.tcl]] 
package ifneeded colorutils 4.4 \
    [list source [file join $dir colorutils.tcl]] 

package ifneeded awdark 7.0 \
    [list source [file join $dir awdark.tcl]]
package ifneeded awlight 7.0 \
|







1
2
3
4
5
6
7
8
package ifneeded awthemes 7.3 \
    [list source [file join $dir awthemes.tcl]] 
package ifneeded colorutils 4.4 \
    [list source [file join $dir colorutils.tcl]] 

package ifneeded awdark 7.0 \
    [list source [file join $dir awdark.tcl]]
package ifneeded awlight 7.0 \