#18289: Make graph display configurable
-------------------------------------+-------------------------------------
Reporter: vbraun | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.7
Component: graph theory | Resolution:
Keywords: | Merged in:
Authors: Volker Braun | Reviewers: Nathann Cohen
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/vbraun/graph_preference | 40e6f7c6dadf251d92e67ed980cae7b575c9d1b8
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by ncohen):
Hello,
> Sounds good, but will have to think about the proper implementation
first. Right now there are only rich output containers for a particular
type. So we either
> * render the text inside the image (meh)
> * add an optional caption to all image output types (maybe), or
> * add a rich output type that is a container of other rich output types
(probably want this for other purposes, too)
> I'd say that is material for another ticket.
I agree that the 1) is a bit 'meh' (as you say), but what about doing this
for the moment, knowing that it will be improved later? It is the cheapest
thing that we can do for the moment.
> By convention, the `_rich_repr_` method can just return `None` to
indicate that there is no rich output, e.g. because the desired output
types is not supported. The display framework then falls back to `_repr_`.
Okayyy, thanks !
> > - About other graph-like objects
>
> I've adjusted the docstring. I don't have any immediate plans to switch
other objects to graphical output, though we should think about that when
the dust has settled...
Oh. Well, I was sending this when you posted your message:
https://groups.google.com/d/topic/sage-devel/2dBo6Cm-sIc/discussion
Let's see what happens.
> > - Do you still plan to deprecate show in #18302?
>
> yes
Great!
> Sounds good, though I wanted to revisit the preferences system to make
it more general and make them more like google app engine ndb models. IMHO
we need an easy-to-use validating(!) option system for graphics options
and the like.
Couldn't agree more. I recently had to review some code which dealt with
an awful lot of options, and screens of code were only there to check
that.
> The display preferences are just a quick implementation that I needed.
It is better than dumb dictionaries, but not as good as it can be.
Great idea. We should have some "check_type" module with functions like
that:
{{{
sage: check_nonnegative_value(-2,"x") # exception if the value is
negative or not in RR
...
ValueError: 'x' (=-2) must be a nonnegative value
check_allowed_value('d',"x",["A","B","C"]) # exception if x is not
allowed
...
ValueError: 'x' (='d') must be equal to one of "A","B","C"
check_list_of_integers([1,2,3,"a",9]) # raise exception if not a list,
or contains non-integers
...
ValueError: "a" is not an integer
}}}
Then perhaps `DisplayPreferences` could just be a dictionary with a
modified `__setitem__`?
Nathann
--
Ticket URL: <http://trac.sagemath.org/ticket/18289#comment:89>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.