Skip to content

Commit

Permalink
Fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
femtocleaner[bot] committed Jun 28, 2018
1 parent b2e9baf commit 1bc1f81
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 27 deletions.
16 changes: 8 additions & 8 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using Compat; import Compat.String

tcl = library_dependency("tcl",aliases=["libtcl8.6","tcl86g","tcl86t","libtcl","libtcl8.6.so.0","libtcl8.5","libtcl8.5.so.0","tcl85"])
tk = library_dependency("tk",aliases=["libtk8.6","libtk","libtk8.6.so.0","libtk8.5","libtk8.5.so.0","tk85","tk86","tk86t"], depends=[tcl], validate = function(p,h)
is_apple() && (return @compat Libdl.dlsym_e(h,:TkMacOSXGetRootControl) != C_NULL)
is_apple() && (return Libdl.dlsym_e(h,:TkMacOSXGetRootControl) != C_NULL)
return true
end)

Expand All @@ -21,12 +21,12 @@ provides(AptGet,"tk8.5",tk)
provides(Sources,URI("http://prdownloads.sourceforge.net/tcl/tcl8.6.0-src.tar.gz"),tcl,unpacked_dir = "tcl8.6.0")
provides(Sources,URI("http://prdownloads.sourceforge.net/tcl/tk8.6.0-src.tar.gz"),tk,unpacked_dir = "tk8.6.0")

is64bit = @compat Sys.WORD_SIZE == 64
is64bit = Sys.WORD_SIZE == 64

provides(BuildProcess,Autotools(configure_subdir = "unix", configure_options = [is64bit?"--enable-64bit":"--disable-64bit"]),tcl, os = :Unix)
provides(BuildProcess,Autotools(configure_subdir = "unix", configure_options = [is64bit?"--enable-64bit":"--disable-64bit"]),tk, os = :Unix)
provides(BuildProcess,Autotools(configure_subdir = "unix", configure_options = [is64bit ? "--enable-64bit" : "--disable-64bit"]),tcl, os = :Unix)
provides(BuildProcess,Autotools(configure_subdir = "unix", configure_options = [is64bit ? "--enable-64bit" : "--disable-64bit"]),tk, os = :Unix)

if @compat Sys.WORD_SIZE == 64
if Sys.WORD_SIZE == 64
# Unfortunately the mingw-built tc segfaults since some function signatures
# are different between VC and mingw. This is fixed on tcl trunk. For now,
# just use VC to build tcl (Note requlres Visual Studio Express in the PATH)
Expand All @@ -48,8 +48,8 @@ if @compat Sys.WORD_SIZE == 64
end
end),tk)
else
provides(BuildProcess,Autotools(libtarget = "tcl86.dll", configure_subdir = "win", configure_options = [is64bit?"--enable-64bit":"--disable-64bit","--enable-threads"]),tcl, os = :Windows)
provides(BuildProcess,Autotools(libtarget = "tk86.dll", configure_subdir = "win", configure_options = [is64bit?"--enable-64bit":"--disable-64bit"]),tk, os = :Windows)
provides(BuildProcess,Autotools(libtarget = "tcl86.dll", configure_subdir = "win", configure_options = [is64bit ? "--enable-64bit" : "--disable-64bit","--enable-threads"]),tcl, os = :Windows)
provides(BuildProcess,Autotools(libtarget = "tk86.dll", configure_subdir = "win", configure_options = [is64bit ? "--enable-64bit" : "--disable-64bit"]),tk, os = :Windows)
end

@BinDeps.install @compat(Dict(:tk => :libtk, :tcl=>:libtcl))
@BinDeps.install Dict(:tk => :libtk, :tcl=>:libtcl)
4 changes: 2 additions & 2 deletions examples/manipulate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ entry(nm::AbstractString) = EntryWidget(nm, nm, "{}")


## Expression returns a plot object. Use names as values
function manipulate(ex::(@compat Union{Symbol,Expr}), controls...)
function manipulate(ex::(Union{Symbol,Expr}), controls...)
widgets = Array(Tk.Widget, 0)

w = Toplevel("Manipulate", 800, 500)
Expand All @@ -127,7 +127,7 @@ function manipulate(ex::(@compat Union{Symbol,Expr}), controls...)
d = Dict() # return Dict of values
vals = get_values(); keys = get_nms()
for i in 1:length(vals)
if !isa(keys[i], @compat Void)
if !isa(keys[i], Void)
d[keys[i]] = vals[i]
end
end
Expand Down
6 changes: 1 addition & 5 deletions examples/sketch.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using Tk
if VERSION < v"0.4.0-dev+3275"
using Base.Graphics
else
using Graphics
end
using Graphics

function sketch_window()
w = Window("drawing", 400, 300)
Expand Down
6 changes: 3 additions & 3 deletions examples/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Compat; import Compat.String
w = Toplevel("Test window", false)
## pack in tk frame for themed widgets
f = Frame(w)
configure(f, @compat Dict(:padding => [3,3,2,2], :relief=>"groove"))
configure(f, Dict(:padding => [3,3,2,2], :relief=>"groove"))
pack(f, expand=true, fill="both")

## widgets
Expand All @@ -26,11 +26,11 @@ pack_style = ["pack", "grid", "formlayout"][3]

if pack_style == "pack"
map(pack, widgets)
map(u -> pack_configure(u, @compat Dict(:anchor => "w")), widgets)
map(u -> pack_configure(u, Dict(:anchor => "w")), widgets)
elseif pack_style == "grid"
for i in 1:length(widgets)
grid(widgets[i], i, 1)
grid_configure(widgets[i], @compat Dict(:sticky => "we"))
grid_configure(widgets[i], Dict(:sticky => "we"))
end
else
map(u -> formlayout(u, "label"), widgets)
Expand Down
8 changes: 2 additions & 6 deletions src/Tk.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION >= v"0.4.0-dev+6521" && __precompile__(false)
__precompile__(false)

# julia tk interface
# TODO:
Expand Down Expand Up @@ -26,11 +26,7 @@ end

import Base: ==, bind, getindex, isequal, parent, setindex!, show, string, Text

if VERSION < v"0.4.0-dev+3275"
import Base.Graphics: width, height, getgc
else
import Graphics: width, height, getgc
end
import Graphics: width, height, getgc

import Cairo: destroy

Expand Down
4 changes: 2 additions & 2 deletions src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function configure(widget::Widget, args...; kwargs...)
tcl(widget, "configure", args...; kwargs...)
end

setindex!(widget::Widget, value, prop::Symbol) = configure(widget, @compat Dict(prop=>value))
setindex!(widget::Widget, value, prop::Symbol) = configure(widget, Dict(prop=>value))

## Get values
## cget
Expand Down Expand Up @@ -174,7 +174,7 @@ end

## add most typical callback
function callback_add(widget::Tk_Widget, callback::Function)
events = @compat Dict(
events = Dict(
:Tk_Window => "<Destroy>",
:Tk_Frame => nothing,
:Tk_Labelframe => nothing,
Expand Down
2 changes: 1 addition & 1 deletion src/widgets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ end


get_items(widget::Tk_Combobox) = widget.values
function set_items{T}(widget::Tk_Combobox, items::Vector{@compat Tuple{T,T}})
function set_items{T}(widget::Tk_Combobox, items::Vector{Tuple{T,T}})
vals = cb_pluck_labels(items)
configure(widget, values = vals)
widget.values = items
Expand Down

0 comments on commit 1bc1f81

Please sign in to comment.