[racket] Extending DrRacket with non-text tabs

39 views
Skip to first unread message

Dmitry Pavlov

unread,
Sep 19, 2014, 12:12:08 PM9/19/14
to us...@racket-lang.org
Hello,

I recently wrote a spreadsheet editor in Racket [1].
Now I am considering a crazy idea to use it within
DrRacket natively, not as a separate app.

The most fantastic scenario would be me running
the spreadsheet editor(s) in DrRacket tab(s), started
by opening files with a certain extension via DrRacket's
"Open" dialog. Is that possible? If yes, is it [2] where
I should be looking? Do any manuals or examples exist for that?
Because I hardly understand where to start when it
comes to extending DrRacket.

If the most fantastic scenario is not possible
(I do not really know), maybe I can open my spreadsheet
editor(s) in separate windows by pressing a custom
button on the DrRacket's tool panel, or choosing
a custom menu item? What would you, experienced Racketeers,
do if you were in my place?

Thanks.

[1] https://github.com/kugelblitz/spreadsheet-editor
[2] http://docs.racket-lang.org/tools/drracket_get_extend.html


Regards,

Dmitry
____________________
Racket Users list:
http://lists.racket-lang.org/users

Robby Findler

unread,
Nov 11, 2014, 10:16:28 AM11/11/14
to Dmitry Pavlov, us...@racket-lang.org
Sorry for the long delay in replying.

DrRacket isn't really set up to give you much re-use in the situation
you're describing, if I understand correctly.

You can create another frame and DrRacket shouldn't interfere with
that frame (you would want to use the framework's group classes to
cooperate properly).

You should be able to use handler:insert-format-handler to open your
frame when a file with your extension is opened via the open dialog.

The extension docs that you pointed to below are really just the docs
for getting your code access to DrRacket. The actual libraries you
want to use are the framework library and the GUI library (and the
other parts of the library that you linked to).

Robby

Dmitry Pavlov

unread,
Nov 14, 2014, 6:47:06 AM11/14/14
to Robby Findler, us...@racket-lang.org
Robby,

> Sorry for the long delay in replying.

Never mind---I have been distracted by other things recently, and
now I am back to work on this, so your reply is in fact just in time,
thanks :)

> You should be able to use handler:insert-format-handler to open your
> frame when a file with your extension is opened via the open dialog.

Good, insert-format-handler will suffice my needs I think.
Dumb question follows: what is the best place to call
insert-format-handler from?

To be more specific about my goals:
I have a Racket installation, and I would like to have this
format handler registered by the moment a user starts DrRacket
and opens some file in it.

I tried and hijacked
/opt/racket/share/pkgs/drracket/drracket/private/main.rkt
to insert my (handler:insert-format-handler) to it, but
this surely does not seem to be a good solution.

My spreadsheet-editing module is currently in a collection
that is "raco link"-ed to the Racket installation. Is there
a way to call (handler:insert-format-handler) from a collection
module before the collection is (require)-d? Or can I form
a package from my collection and use some package mechanism
for that?

Also, a related question: what would you recommend for
adding a certain file type to the DrRacket's file->open
dialog, where currently are "Racket Sources" and "Any"?


Best regards,

Robby Findler

unread,
Nov 14, 2014, 8:46:31 AM11/14/14
to Dmitry Pavlov, Racket Users
Yes. See: http://docs.racket-lang.org/tools/implementing-tools.html

You probably want to call it just from the top-level of your unit (not
from phase1 or phase2).

> Also, a related question: what would you recommend for
> adding a certain file type to the DrRacket's file->open
> dialog, where currently are "Racket Sources" and "Any"?

I think you should call finder:default-filters (using the old value to
construct a new value).

Robby

Dmitry Pavlov

unread,
Nov 28, 2014, 10:19:13 AM11/28/14
to Robby Findler, Racket Users
Robby,

Thank you very much, I am happy now with editor running within DrRacket.

By the way, I have made a package, not with the full editor
itself (it is specific to my project), but with the base GUI class
(customizable).

I have registered the package on pkgs.racket-lang.org under the name
spreadsheet-editor. It fails to build, and here is what I am seeing:

http://pkg-build.racket-lang.org/server/built/fail/spreadsheet-editor.txt

require: PLaneT could not download the package "williams/table-panel:1":
tcp-connect: connection failed
detail: host not found
address: planet.racket-lang.org
port number: 80
step: 1
system error: Name or service not known; errno=-2
in: (planet williams/table-panel:1:2/table-panel)

At the same time, it all works fine on my system. Do you have an idea
how can it be fixed?


Best regards,

Dmitry

Matthew Flatt

unread,
Nov 28, 2014, 10:24:20 AM11/28/14
to Dmitry Pavlov, Racket Users, Robby Findler
The package-build service does not currently support access to PLaneT
packages.

You can find more information about the package-build service here:

http://pkg-build.racket-lang.org/about.html

(That page was intended to be linked from the main packages page, but
we haven't gotten there, yet.)

Robby Findler

unread,
Nov 28, 2014, 10:29:17 AM11/28/14
to Dmitry Pavlov, Racket Users
That's great! I'm glad to hear you got it working.

Robby

Dmitry Pavlov

unread,
Nov 28, 2014, 10:46:01 AM11/28/14
to Matthew Flatt, Racket Users
Matthew,

OK, got it.

What would you advise -- to ask the developer of table-panel to transfer
it to pkgs.racket-lang.org (so that spradsheet-editor could access it),
or to wait until pkgs.racket-lang.org supports PLaneT packages?

Best regards,

Dmitry

Matthew Flatt

unread,
Nov 28, 2014, 10:53:32 AM11/28/14
to Dmitry Pavlov, Racket Users
We'd really like to encourage moving packages from PLaneT to the new
package system. At the moment, we don't have plans for adding PLaneT
support to the package-build service.

Stephen De Gabrielle

unread,
Dec 1, 2014, 7:22:10 PM12/1/14
to Dmitry Pavlov, Matthew Flatt, Racket Users
you can just transfer it yourself - just retain his licence notice LGPL
that is what I've tried to do but I can't log into pkg.racket-lang.org to add it.

You should be able to clone and submit it to pkg.racket-lang.org yourself:
s.

Dmitry Pavlov

unread,
Dec 2, 2014, 5:10:39 AM12/2/14
to Stephen De Gabrielle, Matthew Flatt, Racket Users
Stephen,

> you can just transfer it yourself - just retain his licence notice LGPL
> that is what I've tried to do but I can't log into pkg.racket-lang.org
> <http://pkg.racket-lang.org> to add it.

OK, thank you for the advice.

I can not log in either. Probably they have something going
on right now on the server.


Regards,

Dmitry

Dmitry Pavlov

unread,
Dec 9, 2014, 7:49:53 AM12/9/14
to Stephen De Gabrielle, Racket Users
Stephen,

Thanks for your help on this. (I was out of work for a few days.)
I just made a couple of commits into the source tree that you
cloned https://github.com/spdegabrielle/table-panel

Hope pkgs.racket-lang.org will build the package successfully
in the next 24 hours.

Best regards,

Dmitry

Stephen De Gabrielle

unread,
Dec 9, 2014, 9:13:16 AM12/9/14
to Dmitry Pavlov, Racket Users
Thank you for doing the spreadsheet widget! I've been meaning to do this myself but I never seem to find the time. Salvaging a PLaneT package is the least I could do.

Kind regards,

Stephen
Reply all
Reply to author
Forward
0 new messages