예제 #1
0
    def test_package_global_default_preferences(self):
        """ package global default preferences """

        from enthought.preferences.api import get_default_preferences
        from enthought.preferences.api import set_default_preferences

        set_default_preferences(self.preferences)
        self.assertEqual(self.preferences, get_default_preferences())

        return
예제 #2
0
    def _create_decorated_scene(self, parent):
        """ Create a new decorated scene. """

        pref = get_default_preferences()
        stereo = eval(pref.get('enthought.tvtk.scene.stereo'))

        scene = DecoratedScene(parent, stereo=stereo)

        # Set the scene's traits to preference values.
        scene.magnification = \
                eval(pref.get('enthought.tvtk.scene.magnification'))

        fg = eval(pref.get('enthought.tvtk.scene.foreground_color'))
        bg = eval(pref.get('enthought.tvtk.scene.background_color'))
        scene.foreground = fg
        scene.background = bg
        # FIXME: This seems necessary for some strange reason, if not
        # the actual background of the renderer never gets set even
        # though the renderer and the scene's background are synced.
        scene.renderer.background = scene.background

        return scene
예제 #3
0
    def _create_decorated_scene(self, parent):
        """ Create a new decorated scene. """

        pref = get_default_preferences()
        stereo = eval(pref.get('enthought.tvtk.scene.stereo'))

        scene = DecoratedScene(parent, stereo=stereo)

        # Set the scene's traits to preference values.
        scene.magnification = \
                eval(pref.get('enthought.tvtk.scene.magnification'))

        fg = eval(pref.get('enthought.tvtk.scene.foreground_color'))
        bg = eval(pref.get('enthought.tvtk.scene.background_color'))
        scene.foreground = fg
        scene.background = bg
        # FIXME: This seems necessary for some strange reason, if not
        # the actual background of the renderer never gets set even
        # though the renderer and the scene's background are synced. 
        scene.renderer.background = scene.background

        return scene
예제 #4
0
    # The path to the preferences node that contains our preferences.
    preferences_path = 'acme'

    #### Preferences ##########################################################

    bgcolor = Color
    fgcolor = Color

    #### Traits UI views ######################################################

    view = View('bgcolor', 'fgcolor')


# Entry point.
if __name__ == '__main__':

    # Create a manager with some pages.
    preferences_manager = PreferencesManager(
        pages = [
            AcmePreferencesPage(), AcmeWorkbenchPreferencesPage()
        ]
    )

    # Show the UI...
    preferences_manager.configure_traits()

    # Save the preferences...
    get_default_preferences().flush()

#### EOF ######################################################################