mirror of
https://github.com/ruby/ruby.git
synced 2025-09-18 18:13:58 +02:00
* ext/tk/lib/tkextlib/tile.rb, ext/tk/lib/tkextlib/tile/style.rb,
ext/tk/sample/ttk_wrapper.rb: improve treating and control themes. add Tk::Tile.themes and Tk::Tile.set_theme(theme). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7542aa5b39
commit
8f5ddf723f
4 changed files with 73 additions and 27 deletions
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
||||
#
|
||||
version = '0.1.1'
|
||||
version = '0.1.2'
|
||||
#
|
||||
##########################################################################
|
||||
# parse commandline arguments
|
||||
|
@ -107,38 +107,16 @@ TkConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__! true
|
|||
TkItemConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__! true
|
||||
|
||||
|
||||
##########################################################################
|
||||
# define utility method
|
||||
##########################################################################
|
||||
def setTheme(theme)
|
||||
unless Tk::Tile::Style.theme_names.find{|n| n == theme}
|
||||
if (pkg = TkPackage.names.find{|n| n =~ /(tile|ttk)::theme::#{theme}/})
|
||||
TkPackage.require(pkg)
|
||||
end
|
||||
end
|
||||
Tk::Tile::Style.theme_use(theme)
|
||||
end
|
||||
|
||||
|
||||
##########################################################################
|
||||
# make theme name list
|
||||
##########################################################################
|
||||
ThemesList = Tk::Tile::Style.theme_names
|
||||
TkPackage.names.find_all{|n| n =~ /^(tile|ttk)::theme::/}.each{|pkg|
|
||||
ThemesList << pkg.split('::')[-1]
|
||||
}
|
||||
ThemesList.uniq!
|
||||
|
||||
|
||||
##########################################################################
|
||||
# set theme of widget style
|
||||
##########################################################################
|
||||
if OPTS[:list] || OPTS[:verbose]
|
||||
print "supported theme names: #{ThemesList.inspect}\n"
|
||||
print "supported theme names: #{Tk::Tile.themes.inspect}\n"
|
||||
exit if OPTS[:list] && ARGV.empty?
|
||||
end
|
||||
print "use theme: \"#{OPTS[:theme]}\"\n" if OPTS[:theme] && OPTS[:verbose]
|
||||
setTheme(OPTS[:theme]) if OPTS[:theme]
|
||||
#setTheme(OPTS[:theme]) if OPTS[:theme]
|
||||
Tk::Tile.set_theme(OPTS[:theme]) if OPTS[:theme]
|
||||
|
||||
|
||||
##########################################################################
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue