Only show OC button in DrR when the tool is actually loaded.
Closes PR13344.
This commit is contained in:
parent
519dfb6fdc
commit
f9e3418d8a
typed-racket-compatibility
typed-racket-lib
typed-racket-more/typed/racket
|
@ -6,14 +6,11 @@ typed-scheme
|
|||
#:read-syntax r:read-syntax
|
||||
#:info make-info
|
||||
|
||||
(require (prefix-in r: typed-racket/typed-reader))
|
||||
(require (prefix-in r: typed-racket/typed-reader)
|
||||
typed-racket/private/oc-button)
|
||||
|
||||
(define (make-info key default use-default)
|
||||
(case key
|
||||
[(drscheme:toolbar-buttons)
|
||||
;; If Optimization Coach is installed, load it.
|
||||
(with-handlers ([exn:fail:filesystem? (lambda _ '())]) ; not found
|
||||
(collection-path "optimization-coach")
|
||||
(list (dynamic-require 'optimization-coach/tool
|
||||
'optimization-coach-drracket-button)))]
|
||||
(maybe-show-OC)]
|
||||
[else (use-default key default)]))
|
||||
|
|
|
@ -7,14 +7,12 @@ typed/scheme/base
|
|||
#:info make-info
|
||||
#:language-info make-language-info
|
||||
|
||||
(require typed-racket/private/oc-button)
|
||||
|
||||
(define (make-info key default use-default)
|
||||
(case key
|
||||
[(drscheme:toolbar-buttons)
|
||||
;; If Optimization Coach is installed, load it.
|
||||
(with-handlers ([exn:fail:filesystem? (lambda _ '())]) ; not found
|
||||
(collection-path "optimization-coach")
|
||||
(list (dynamic-require 'optimization-coach/tool
|
||||
'optimization-coach-drracket-button)))]
|
||||
(maybe-show-OC)]
|
||||
[else (use-default key default)]))
|
||||
|
||||
(define make-language-info
|
||||
|
|
|
@ -7,14 +7,12 @@ typed/scheme
|
|||
#:info make-info
|
||||
#:language-info make-language-info
|
||||
|
||||
(requie typed-racket/private/oc-button)
|
||||
|
||||
(define (make-info key default use-default)
|
||||
(case key
|
||||
[(drscheme:toolbar-buttons)
|
||||
;; If Optimization Coach is installed, load it.
|
||||
(with-handlers ([exn:fail:filesystem? (lambda _ '())]) ; not found
|
||||
(collection-path "optimization-coach")
|
||||
(list (dynamic-require 'optimization-coach/tool
|
||||
'optimization-coach-drracket-button)))]
|
||||
(maybe-show-OC)]
|
||||
[else (use-default key default)]))
|
||||
|
||||
(define make-language-info
|
||||
|
|
16
typed-racket-lib/typed-racket/private/oc-button.rkt
Normal file
16
typed-racket-lib/typed-racket/private/oc-button.rkt
Normal file
|
@ -0,0 +1,16 @@
|
|||
#lang racket/base
|
||||
|
||||
;; Control whether the OC button show up for TR files in DrR.
|
||||
|
||||
(provide maybe-show-OC)
|
||||
|
||||
(define (maybe-show-OC)
|
||||
;; If Optimization Coach is installed, load it.
|
||||
(with-handlers ([exn:fail:filesystem? (lambda _ '())]) ; not found
|
||||
(collection-path "optimization-coach")
|
||||
(if (dynamic-require 'optimization-coach/tool
|
||||
'optimization-coach-loaded?)
|
||||
;; OC is loaded, show button
|
||||
(list (dynamic-require 'optimization-coach/tool
|
||||
'optimization-coach-drracket-button))
|
||||
'())))
|
|
@ -7,14 +7,12 @@ typed/racket/base
|
|||
#:info make-info
|
||||
#:language-info make-language-info
|
||||
|
||||
(require typed-racket/private/oc-button)
|
||||
|
||||
(define (make-info key default use-default)
|
||||
(case key
|
||||
[(drscheme:toolbar-buttons)
|
||||
;; If Optimization Coach is installed, load it.
|
||||
(with-handlers ([exn:fail:filesystem? (lambda _ '())]) ; not found
|
||||
(collection-path "optimization-coach")
|
||||
(list (dynamic-require 'optimization-coach/tool
|
||||
'optimization-coach-drracket-button)))]
|
||||
(maybe-show-OC)]
|
||||
[else (use-default key default)]))
|
||||
|
||||
(define make-language-info
|
||||
|
|
|
@ -7,14 +7,12 @@ typed/racket
|
|||
#:info make-info
|
||||
#:language-info make-language-info
|
||||
|
||||
(require typed-racket/private/oc-button)
|
||||
|
||||
(define (make-info key default use-default)
|
||||
(case key
|
||||
[(drscheme:toolbar-buttons)
|
||||
;; If Optimization Coach is installed, load it.
|
||||
(with-handlers ([exn:fail:filesystem? (lambda _ '())]) ; not found
|
||||
(collection-path "optimization-coach")
|
||||
(list (dynamic-require 'optimization-coach/tool
|
||||
'optimization-coach-drracket-button)))]
|
||||
(maybe-show-OC)]
|
||||
[else (use-default key default)]))
|
||||
|
||||
(define make-language-info
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
;; Defines a language analogous to #lang racket/gui but typed
|
||||
|
||||
(require "gui/base.rkt"
|
||||
typed/racket)
|
||||
typed/racket
|
||||
typed-racket/private/oc-button)
|
||||
|
||||
(provide (all-from-out "gui/base.rkt")
|
||||
(all-from-out typed/racket))
|
||||
|
@ -20,10 +21,7 @@
|
|||
(define (make-info key default use-default)
|
||||
(case key
|
||||
[(drscheme:toolbar-buttons)
|
||||
(with-handlers ([exn:fail:filesystem? (lambda _ '())])
|
||||
(collection-path "optimization-coach")
|
||||
(list (dynamic-require 'optimization-coach/tool
|
||||
'optimization-coach-drracket-button)))]
|
||||
(maybe-show-OC)]
|
||||
[else (use-default key default)]))
|
||||
|
||||
(require typed-racket/typed-reader))
|
||||
|
|
Loading…
Reference in New Issue
Block a user