File: preferences.py

package info (click to toggle)
python-chaco 4.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 15,144 kB
  • sloc: python: 35,936; ansic: 1,211; cpp: 241; makefile: 124; sh: 5
file content (52 lines) | stat: -rw-r--r-- 1,278 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
""" Defines the Preferences class for the Chaco shell.
"""

from enable.api import white_color_trait
from traits.api import Enum, HasTraits, Int, Str


class Preferences(HasTraits):
    """ Contains all the preferences that configure the Chaco shell session.
    """

    # Width of the plot window, in pixels.
    window_width = Int(600)

    # Height of the plot window, in pixels.
    window_height = Int(600)

    # The type of plot to display.
    plot_type = Enum("line", "scatter")

    # Default name to use for the plot window.
    default_window_name = Str("Chaco Plot")

    # The default background color.
    bgcolor = white_color_trait

    # The default location of the origin for new image plots
    image_default_origin = Enum("top left", "bottom left",
                                "bottom right", "top right")

    @classmethod
    def from_file(cls, filename):
        """ Creates a new preferences object from a file on disk.
        """
        prefs = cls()
        prefs.load(filename)
        return prefs


    def load(self, filename):
        """ Loads a preferences file; existing settings are overwritten.
        """
        pass


    def save(self, filename):
        """ Saves the preferences to *filename*.
        """
        pass


# EOF