Re: [racket-dev] separate plot library into gui-requiring and non-gui-requiring

2013-10-09 Thread Neil Toronto

I'm splitting up the plot package today.

Stephen: You'll be able to install plot-lib, then (require plot/pict) 
to get a `plot' function work-a-like that outputs picts instead of 
snips, or (require plot/bitmap) to get one that outputs bitmaps. You 
could easily make a plot-no-gui-lib package that contains only a 
plot/main.rkt that wraps one of those modules, if/when you make a 
web-only Racket distribution.


Anyone: Is it worth the extra complexity to make a plot-typed-lib and 
a plot-typed-gui-lib? Or should I put the typed interface in 
plot-lib and plot-gui-lib?


Also, what's a good name for the module that exports `plot-file', 
`plot-pict', `plot-bitmap', `plot/dc', and the 3d versions of those 
functions? Something like plot/no-gui?


Neil ⊥

On 10/08/2013 01:08 PM, Robby Findler wrote:

I think it is worth having a plot/pict or pict/plot library that doesn't
depend on racket/GUI/base (or maybe it would be better to disentangle
snips). In any case, we have many others such libraries that turn on
avoiding racket/gui/base for exactly this reason.

Robby

On Tuesday, October 8, 2013, Neil Toronto wrote:

On 10/08/2013 11:22 AM, Stephen Chang wrote:

Short question:
Is there a way to separate the gui-requiring parts of plot from the
non-gui-requiring parts?

Long question:
Many people have expressed pleasant surprise with the
plot-evaluating
ability of the racket pastebin Sam and I are working on.

Most of the effort is due to scribble's nice sandbox evaluation
capabilities but to get it fully working, I had to hack the plot
library in my racket install.

The problem is that plot uses racket/gui/base too eagerly but the
server has no display, resulting in a gtk initialization error. I
ultimately got around it by just commenting out all the gui parts of
plot, knowing that it would never get invoked, but obviously this is
an ugly solution.

I should say that I don't think plot is at fault. The plot library
does lazy-require racket/gui/base but that's not good enough because
the laziness has to propagate to other requires that also require
racket/gui/base (ie plot/snip) which isnt the case. But this cannot
work anyways because lazy-require only works with functions and some
of the things imported by plot/snip are classes.

I spent awhile trying to separate the gui-requiring parts of
plot but
was unsuccessful. Maybe the change has to be in racket/gui/base
itself
(related to PR 12465) I don't really know. I guess I'm just looking
for additional insight. Naively, slideshow/pict and 2htdp/draw
do not
have this problem so it seemed like it should be possible.


Right, racket/gui/base is necessary for snips. In all the
documentation that uses plots (plot, math, images) I've used the
following hack when setting up the evaluators:

   (eval '(require (rename-in (except-in plot plot plot3d)
  [plot-pict  plot]
  [plot3d-pict  plot3d])))

You could also rename `plot-bitmap' and `plot3d-bitmap'. (The docs
use picts because they look better rendered in a PDF.) It wouldn't
be hard to make a module that does that and provides everything.
(Except possibly `plot-snip', `plot-frame', etc.)

I'm reluctant to single out one way of rendering when the GUI isn't
available. Picts look nicer when scaled, but bitmaps look nicer when
unscaled (plots are subpixel-rendered in this case). Picts take much
more time to redraw, but for bitmaps it's just a blit.

Neil ⊥

_
  Racket Developers list:
http://lists.racket-lang.org/__dev http://lists.racket-lang.org/dev



_
 Racket Developers list:
 http://lists.racket-lang.org/dev


Re: [racket-dev] separate plot library into gui-requiring and non-gui-requiring

2013-10-09 Thread Stephen Chang
Thanks Neil!

plot/no-gui sounds fine to me. I'll give it a try after you push.

On Wed, Oct 9, 2013 at 12:08 PM, Neil Toronto neil.toro...@gmail.com wrote:
 I'm splitting up the plot package today.

 Stephen: You'll be able to install plot-lib, then (require plot/pict) to
 get a `plot' function work-a-like that outputs picts instead of snips, or
 (require plot/bitmap) to get one that outputs bitmaps. You could easily make
 a plot-no-gui-lib package that contains only a plot/main.rkt that wraps
 one of those modules, if/when you make a web-only Racket distribution.

 Anyone: Is it worth the extra complexity to make a plot-typed-lib and a
 plot-typed-gui-lib? Or should I put the typed interface in plot-lib and
 plot-gui-lib?

 Also, what's a good name for the module that exports `plot-file',
 `plot-pict', `plot-bitmap', `plot/dc', and the 3d versions of those
 functions? Something like plot/no-gui?

 Neil ⊥


 On 10/08/2013 01:08 PM, Robby Findler wrote:

 I think it is worth having a plot/pict or pict/plot library that doesn't
 depend on racket/GUI/base (or maybe it would be better to disentangle
 snips). In any case, we have many others such libraries that turn on
 avoiding racket/gui/base for exactly this reason.

 Robby

 On Tuesday, October 8, 2013, Neil Toronto wrote:

 On 10/08/2013 11:22 AM, Stephen Chang wrote:

 Short question:
 Is there a way to separate the gui-requiring parts of plot from
 the
 non-gui-requiring parts?

 Long question:
 Many people have expressed pleasant surprise with the
 plot-evaluating
 ability of the racket pastebin Sam and I are working on.

 Most of the effort is due to scribble's nice sandbox evaluation
 capabilities but to get it fully working, I had to hack the plot
 library in my racket install.

 The problem is that plot uses racket/gui/base too eagerly but the
 server has no display, resulting in a gtk initialization error. I
 ultimately got around it by just commenting out all the gui parts
 of
 plot, knowing that it would never get invoked, but obviously this
 is
 an ugly solution.

 I should say that I don't think plot is at fault. The plot library
 does lazy-require racket/gui/base but that's not good enough
 because
 the laziness has to propagate to other requires that also require
 racket/gui/base (ie plot/snip) which isnt the case. But this
 cannot
 work anyways because lazy-require only works with functions and
 some
 of the things imported by plot/snip are classes.

 I spent awhile trying to separate the gui-requiring parts of
 plot but
 was unsuccessful. Maybe the change has to be in racket/gui/base
 itself
 (related to PR 12465) I don't really know. I guess I'm just
 looking
 for additional insight. Naively, slideshow/pict and 2htdp/draw
 do not
 have this problem so it seemed like it should be possible.


 Right, racket/gui/base is necessary for snips. In all the
 documentation that uses plots (plot, math, images) I've used the
 following hack when setting up the evaluators:

(eval '(require (rename-in (except-in plot plot plot3d)
   [plot-pict  plot]
   [plot3d-pict  plot3d])))

 You could also rename `plot-bitmap' and `plot3d-bitmap'. (The docs
 use picts because they look better rendered in a PDF.) It wouldn't
 be hard to make a module that does that and provides everything.
 (Except possibly `plot-snip', `plot-frame', etc.)

 I'm reluctant to single out one way of rendering when the GUI isn't
 available. Picts look nicer when scaled, but bitmaps look nicer when
 unscaled (plots are subpixel-rendered in this case). Picts take much
 more time to redraw, but for bitmaps it's just a blit.

 Neil ⊥

 _
   Racket Developers list:
 http://lists.racket-lang.org/__dev http://lists.racket-lang.org/dev


 _
  Racket Developers list:
  http://lists.racket-lang.org/dev

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] get-x method on key event always returns zero?

2013-10-09 Thread John Clements
It appears to me that the 'get-x' method on a key event always returns zero, 
counter to what the docs say. Is this a doc bug, a software bug, or just me 
being dumb?

FWIW, here's a simple program that illustrates this; press a key while the 
window has focus, and you will always see 0 in the x value field:

#lang racket/base


(require racket/gui
 racket/class)


(define sound-canvas%
  (class canvas%
(init-field frame-num-text)
(init-field y-value-text)

(define/override (on-char evt)
  (send y-value-text begin-edit-sequence #f)
  (send y-value-text erase)
  (send y-value-text insert 
(format x value: ~v
(send evt get-x)))
  (send y-value-text end-edit-sequence)
  (send frame-num-text begin-edit-sequence #f)
  (send frame-num-text erase)
  (send frame-num-text insert (format key : ~a (send evt get-key-code)))
  (send frame-num-text end-edit-sequence))

(super-new)))


(let* ([f (new frame% [label abc] [width 400] [height 100])]
   [tx (new text%)]
   [ty (new text%)]
   [c (new sound-canvas%
   [parent f]
   #;[paint-callback 
  (make-sound-drawing-callback left-getter right-getter
   len data-left data-right)]
   [frame-num-text tx]
   [y-value-text   ty])]
   [ecx (new editor-canvas%
 [parent f]
 [editor tx]
 [style '(no-border no-hscroll no-vscroll)]
 [stretchable-width #t]
 [stretchable-height #f]
 [horizontal-inset 1]
 [vertical-inset 1]
 [min-width 50]
 [min-height 20])]
   [ecy (new editor-canvas%
 [parent f]
 [editor ty]
 [style '(no-border no-hscroll no-vscroll)]
 [stretchable-width #t]
 [stretchable-height #f]
 [horizontal-inset 1]
 [vertical-inset 1]
 [min-width 50]
 [min-height 20])])
  (send f show #t))


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] separate plot library into gui-requiring and non-gui-requiring

2013-10-09 Thread Neil Toronto
Pushed. Included are the plot/pict and plot/bitmap modules, which export 
`plot' and `plot3d' work-a-likes. The documentation has the details.


The only thing left now is to break the package up. *rolls up sleeves*

Neil ⊥

On 10/09/2013 12:10 PM, Stephen Chang wrote:

Thanks Neil!

plot/no-gui sounds fine to me. I'll give it a try after you push.

On Wed, Oct 9, 2013 at 12:08 PM, Neil Toronto neil.toro...@gmail.com wrote:

I'm splitting up the plot package today.

Stephen: You'll be able to install plot-lib, then (require plot/pict) to
get a `plot' function work-a-like that outputs picts instead of snips, or
(require plot/bitmap) to get one that outputs bitmaps. You could easily make
a plot-no-gui-lib package that contains only a plot/main.rkt that wraps
one of those modules, if/when you make a web-only Racket distribution.

Anyone: Is it worth the extra complexity to make a plot-typed-lib and a
plot-typed-gui-lib? Or should I put the typed interface in plot-lib and
plot-gui-lib?

Also, what's a good name for the module that exports `plot-file',
`plot-pict', `plot-bitmap', `plot/dc', and the 3d versions of those
functions? Something like plot/no-gui?

Neil ⊥


On 10/08/2013 01:08 PM, Robby Findler wrote:


I think it is worth having a plot/pict or pict/plot library that doesn't
depend on racket/GUI/base (or maybe it would be better to disentangle
snips). In any case, we have many others such libraries that turn on
avoiding racket/gui/base for exactly this reason.

Robby

On Tuesday, October 8, 2013, Neil Toronto wrote:

 On 10/08/2013 11:22 AM, Stephen Chang wrote:

 Short question:
 Is there a way to separate the gui-requiring parts of plot from
the
 non-gui-requiring parts?

 Long question:
 Many people have expressed pleasant surprise with the
 plot-evaluating
 ability of the racket pastebin Sam and I are working on.

 Most of the effort is due to scribble's nice sandbox evaluation
 capabilities but to get it fully working, I had to hack the plot
 library in my racket install.

 The problem is that plot uses racket/gui/base too eagerly but the
 server has no display, resulting in a gtk initialization error. I
 ultimately got around it by just commenting out all the gui parts
of
 plot, knowing that it would never get invoked, but obviously this
is
 an ugly solution.

 I should say that I don't think plot is at fault. The plot library
 does lazy-require racket/gui/base but that's not good enough
because
 the laziness has to propagate to other requires that also require
 racket/gui/base (ie plot/snip) which isnt the case. But this
cannot
 work anyways because lazy-require only works with functions and
some
 of the things imported by plot/snip are classes.

 I spent awhile trying to separate the gui-requiring parts of
 plot but
 was unsuccessful. Maybe the change has to be in racket/gui/base
 itself
 (related to PR 12465) I don't really know. I guess I'm just
looking
 for additional insight. Naively, slideshow/pict and 2htdp/draw
 do not
 have this problem so it seemed like it should be possible.


 Right, racket/gui/base is necessary for snips. In all the
 documentation that uses plots (plot, math, images) I've used the
 following hack when setting up the evaluators:

(eval '(require (rename-in (except-in plot plot plot3d)
   [plot-pict  plot]
   [plot3d-pict  plot3d])))

 You could also rename `plot-bitmap' and `plot3d-bitmap'. (The docs
 use picts because they look better rendered in a PDF.) It wouldn't
 be hard to make a module that does that and provides everything.
 (Except possibly `plot-snip', `plot-frame', etc.)

 I'm reluctant to single out one way of rendering when the GUI isn't
 available. Picts look nicer when scaled, but bitmaps look nicer when
 unscaled (plots are subpixel-rendered in this case). Picts take much
 more time to redraw, but for bitmaps it's just a blit.

 Neil ⊥

 _
   Racket Developers list:
 http://lists.racket-lang.org/__dev http://lists.racket-lang.org/dev



_
  Racket Developers list:
  http://lists.racket-lang.org/dev


_
 Racket Developers list:
 http://lists.racket-lang.org/dev


Re: [racket-dev] separate plot library into gui-requiring and non-gui-requiring

2013-10-09 Thread Laurent
Le 10 oct. 2013 00:09, Neil Toronto neil.toro...@gmail.com a écrit :
 Also, what's a good name for the module that exports `plot-file',
`plot-pict', `plot-bitmap', `plot/dc', and the 3d versions of those
functions? Something like plot/no-gui?

plot/draw maybe?

Laurent
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] [plt] Push #27569: master branch updated

2013-10-09 Thread Sam Tobin-Hochstadt
On Wed, Oct 9, 2013 at 7:41 PM,  ntoro...@racket-lang.org wrote:

 0edd7e0 Neil Toronto neil.toro...@gmail.com 2013-10-09 17:40
 :
 | Split plot package into five packages
 :

Following some of the other packages, you might want to add a `plot`
package that depends on everything except `plot-compat.

Sam
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] [plt] Push #27569: master branch updated

2013-10-09 Thread Neil Toronto

On 10/09/2013 05:44 PM, Sam Tobin-Hochstadt wrote:

On Wed, Oct 9, 2013 at 7:41 PM,  ntoro...@racket-lang.org wrote:


0edd7e0 Neil Toronto neil.toro...@gmail.com 2013-10-09 17:40
:
| Split plot package into five packages
:


Following some of the other packages, you might want to add a `plot`
package that depends on everything except `plot-compat.


I did, except it depends on plot-compat as well. I'll take that 
dependency out.


Neil ⊥

_
 Racket Developers list:
 http://lists.racket-lang.org/dev


Re: [racket-dev] package system, minimal builds and more

2013-10-09 Thread Neil Toronto

On 10/01/2013 07:30 AM, Neil Toronto wrote:

On 10/01/2013 09:20 AM, Tobias Hammer wrote:

* monolithic math
currently math is one big package and installing it pulls in nearly
everything through the docs. Is it planned to split it into -lib and
-doc?


We were waiting for a reason. This is one. I'll try it on my flight home
tonight. (Never done any package management before.)


Okay, that took longer than I thought. It was much easier than splitting 
the plot package, though...


Neil ⊥

_
 Racket Developers list:
 http://lists.racket-lang.org/dev


Re: [racket-dev] get-x method on key event always returns zero?

2013-10-09 Thread Matthias Felleisen


world uses get-x like this: 

  (define/public (deal-with-mouse %)
(if (not on-mouse) 
;; No mouse handler = discard mouse events (so snip are not 
selected
;;  in the pasteboard, for example
(class %
  (super-new)
  (define/override (on-event e)
(void)))
;; Mouse handler = handle mouse events
(class %
  (super-new)
  (define/override (on-event e)
(define-values (x y me) (mouse-event-parts e))
(when live
  (cond
[(and (= 0 x width) (= 0 y height)) (pmouse x y me)]
[(member me '(leave enter)) (pmouse x y me)]
[else (void)]))

[[ Yes, this is a method-based mixin ]]

but note that I override on-event not on-key. The mouse-event-parts method 
uses get-x on e. -- Matthias



On Oct 9, 2013, at 5:17 PM, John Clements wrote:

 It appears to me that the 'get-x' method on a key event always returns zero, 
 counter to what the docs say. Is this a doc bug, a software bug, or just me 
 being dumb?
 
 FWIW, here's a simple program that illustrates this; press a key while the 
 window has focus, and you will always see 0 in the x value field:
 
 #lang racket/base
 
 
 (require racket/gui
 racket/class)
 
 
 (define sound-canvas%
  (class canvas%
(init-field frame-num-text)
(init-field y-value-text)
 
(define/override (on-char evt)
  (send y-value-text begin-edit-sequence #f)
  (send y-value-text erase)
  (send y-value-text insert 
(format x value: ~v
(send evt get-x)))
  (send y-value-text end-edit-sequence)
  (send frame-num-text begin-edit-sequence #f)
  (send frame-num-text erase)
  (send frame-num-text insert (format key : ~a (send evt get-key-code)))
  (send frame-num-text end-edit-sequence))
 
(super-new)))
 
 
 (let* ([f (new frame% [label abc] [width 400] [height 100])]
   [tx (new text%)]
   [ty (new text%)]
   [c (new sound-canvas%
   [parent f]
   #;[paint-callback 
  (make-sound-drawing-callback left-getter right-getter
   len data-left data-right)]
   [frame-num-text tx]
   [y-value-text   ty])]
   [ecx (new editor-canvas%
 [parent f]
 [editor tx]
 [style '(no-border no-hscroll no-vscroll)]
 [stretchable-width #t]
 [stretchable-height #f]
 [horizontal-inset 1]
 [vertical-inset 1]
 [min-width 50]
 [min-height 20])]
   [ecy (new editor-canvas%
 [parent f]
 [editor ty]
 [style '(no-border no-hscroll no-vscroll)]
 [stretchable-width #t]
 [stretchable-height #f]
 [horizontal-inset 1]
 [vertical-inset 1]
 [min-width 50]
 [min-height 20])])
  (send f show #t))
 
 
 _
  Racket Developers list:
  http://lists.racket-lang.org/dev


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] raco setup errors

2013-10-09 Thread Stephen Chang
Pulled today's commits and got the following errors during raco setup. I'm
guessing it's because some dependencies changed. Is there a step I forgot
to do?

raco setup: --- building documentation ---
raco setup: docs failure: query-rows: the database disk image is malformed
raco setup: --- installing collections ---
raco setup: --- post-installing collections ---
raco setup: post-installing: pkgs/gui-lib/mred
raco setup: post-installing: pkgs/gui-lib/racket/gui
raco setup: post-installing: pkgs/mzcom
raco setup: post-installing: pkgs/mzscheme/mzscheme
raco setup: post-installing: pkgs/racket-doc/help
raco setup: --- checking package dependencies ---
query-rows: the database disk image is malformed
  context...:

/home/stchang/plt/racket/collects/db/private/sqlite3/connection.rkt:369:0:
handle-status*
   /home/stchang/plt/racket/collects/db/private/sqlite3/connection.rkt:330:8

/home/stchang/plt/racket/collects/db/private/sqlite3/connection.rkt:161:4:
step method in connection%

/home/stchang/plt/racket/collects/db/private/sqlite3/connection.rkt:149:8:
loop

/home/stchang/plt/racket/collects/db/private/sqlite3/connection.rkt:52:4:
query1 method in connection%

/home/stchang/plt/racket/collects/db/private/generic/functions.rkt:165:0:
query-rows8
   /home/stchang/plt/racket/collects/setup/doc-db.rkt:338:3: temp107
   /home/stchang/plt/racket/collects/setup/doc-db.rkt:496:2: loop
   /home/stchang/plt/racket/collects/setup/doc-db.rkt:330:0:
doc-db-get-dependencies41
   /home/stchang/plt/racket/collects/setup/private/pkg-deps.rkt:317:8:
for-loop
   /home/stchang/plt/racket/collects/setup/private/pkg-deps.rkt:344:2:
for-loop
   /home/stchang/plt/racket/collects/setup/private/pkg-deps.rkt:22:0:
check-package-dependencies
   /home/stchang/plt/racket/collects/setup/setup-core.rkt:59:0: setup-core
   /home/stchang/plt/racket/collects/setup/setup-go.rkt: [running body]
   /home/stchang/plt/racket/collects/setup/main.rkt: [running body]
   /home/stchang/plt/racket/collects/raco/main.rkt: [running body]
_
  Racket Developers list:
  http://lists.racket-lang.org/dev