Ejemplo n.º 1
0
    def to_toolkit(self):
        """ Create a new toolkit color object from a Color object.

        Returns
        -------
        toolkit_color : toolkit object
            A toolkit color object, such as a Qt QColor or a Wx wx.Colour.
        """
        from pyface.toolkit import toolkit_object
        rgba_to_toolkit_color = toolkit_object('color:rgba_to_toolkit_color')
        return rgba_to_toolkit_color(self.rgba)
Ejemplo n.º 2
0
    def to_toolkit(self):
        """ Create a toolkit font object from the Font instance.

        Returns
        -------
        toolkit_font : any
            A toolkit font which matches the property of the font as
            closely as possible given the constraints of the toolkit.
        """
        from pyface.toolkit import toolkit_object
        font_to_toolkit_font = toolkit_object('font:font_to_toolkit_font')

        return font_to_toolkit_font(self)
Ejemplo n.º 3
0
    def from_toolkit(cls, toolkit_color, **traits):
        """ Create a new Color object from a toolkit color object.

        Parameters
        ----------
        toolkit_color : toolkit object
            A toolkit color object, such as a Qt QColor or a Wx wx.Colour.
        **traits
            Any additional trait values to be passed as keyword arguments.
        """
        from pyface.toolkit import toolkit_object
        toolkit_color_to_rgba = toolkit_object('color:toolkit_color_to_rgba')
        rgba = toolkit_color_to_rgba(toolkit_color)
        return cls(rgba=rgba, **traits)
Ejemplo n.º 4
0
    def from_toolkit(cls, toolkit_font):
        """ Create a Font from a toolkit font object.

        Parameters
        ----------
        toolkit_font : any
            A toolkit font to be converted to a corresponding class instance,
            within the limitations of the options supported by the class.
        """
        from pyface.toolkit import toolkit_object
        toolkit_font_to_properties = toolkit_object(
            'font:toolkit_font_to_properties')

        return cls(**toolkit_font_to_properties(toolkit_font))
Ejemplo n.º 5
0
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!
""" The implementation of a workbench window layout. """

# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

WorkbenchWindowLayout = toolkit_object(
    "workbench.workbench_window_layout:WorkbenchWindowLayout")
Ejemplo n.º 6
0
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!

""" A toolkit-specific menu manager that realizes itself in a menu control.

- :attr:`~.MenuManager`
"""


# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

MenuManager = toolkit_object("action.menu_manager:MenuManager")
Ejemplo n.º 7
0
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
#
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>
#------------------------------------------------------------------------------
""" A menu bar manager realizes itself in errr, a menu bar control. """


# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
MenuBarManager = toolkit_object('action.menu_bar_manager:MenuBarManager')

#### EOF ######################################################################
Ejemplo n.º 8
0
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!
""" A tool bar manager realizes itself in a tool bar control. """

# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

ToolBarManager = toolkit_object("action.tool_bar_manager:ToolBarManager")
Ejemplo n.º 9
0
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!
# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

# WIP: Currently only supports qt4 backend. API might change without
# prior notification
PyMimeData = toolkit_object("mimedata:PyMimeData")
Ejemplo n.º 10
0
# (C) Copyright 2005-2022 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!

""" The toggle field widgets. """

# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

ToggleField = toolkit_object("fields.toggle_field:ToggleField")
CheckBoxField = toolkit_object("fields.toggle_field:CheckBoxField")
RadioButtonField = toolkit_object("fields.toggle_field:RadioButtonField")
ToggleButtonField = toolkit_object("fields.toggle_field:ToggleButtonField")
Ejemplo n.º 11
0
# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
TaskWindowBackend = toolkit_object(
    'tasks.task_window_backend:TaskWindowBackend')
Ejemplo n.º 12
0
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
#
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>
#------------------------------------------------------------------------------
""" A menu manager realizes itself in a menu control. """


# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
MenuManager = toolkit_object('action.menu_manager:MenuManager')

### EOF #######################################################################
Ejemplo n.º 13
0
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
#
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>
#------------------------------------------------------------------------------
""" The implementation of a wizard. """

# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
Wizard = toolkit_object('wizard.wizard:Wizard')

#### EOF ######################################################################
Ejemplo n.º 14
0
# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
TaskPane = toolkit_object('tasks.task_pane:TaskPane')
Ejemplo n.º 15
0
# Copyright (c) 2017, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
""" The implementation of a tree control with a model/ui architecture.
"""

# Import the toolkit specific version.
from __future__ import absolute_import

from pyface.toolkit import toolkit_object
Tree = toolkit_object('tree.tree:Tree')
Ejemplo n.º 16
0
# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
AdvancedEditorAreaPane = toolkit_object('tasks.advanced_editor_area_pane:'
                                        'AdvancedEditorAreaPane')
Ejemplo n.º 17
0
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
#
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>
#------------------------------------------------------------------------------
""" A status bar manager realizes itself in a status bar control. """


# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
StatusBarManager = toolkit_object('action.status_bar_manager:StatusBarManager')

### EOF #######################################################################
Ejemplo n.º 18
0
# (C) Copyright 2005-2022 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!

""" The implementation of EventLoopHelper. """


# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

EventLoopHelper = toolkit_object("util.event_loop_helper:EventLoopHelper")
Ejemplo n.º 19
0
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!
""" The implementation of a wizard. """

# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

Wizard = toolkit_object("wizard.wizard:Wizard")
Ejemplo n.º 20
0
 def _create_timer(self, event):
     klass = toolkit_object("timer.timer:Timer")
     self._timer = klass(self.hover_delay, self.on_timer)
Ejemplo n.º 21
0
# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
SplitEditorAreaPane = toolkit_object('tasks.split_editor_area_pane:'
                                     'SplitEditorAreaPane')

EditorAreaWidget = toolkit_object('tasks.split_editor_area_pane:'
                                  'EditorAreaWidget')
Ejemplo n.º 22
0
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
#
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>
#------------------------------------------------------------------------------
""" The implementation of a workbench view. """


# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
View = toolkit_object('workbench.view:View')

### EOF #######################################################################
Ejemplo n.º 23
0
# (C) Copyright 2005-2022 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!
"""
- :attr:`~.SplitEditorAreaPane`
- :attr:`~.EditorAreaWidget`
"""

from pyface.toolkit import toolkit_object

SplitEditorAreaPane = toolkit_object("tasks.split_editor_area_pane:"
                                     "SplitEditorAreaPane")

EditorAreaWidget = toolkit_object("tasks.split_editor_area_pane:"
                                  "EditorAreaWidget")
Ejemplo n.º 24
0
# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
Editor = toolkit_object('tasks.editor:Editor')
Ejemplo n.º 25
0
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!
""" The text field widget. """

# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

TextField = toolkit_object("fields.text_field:TextField")
Ejemplo n.º 26
0
# Copyright (c) 2017, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
""" A viewer based on a tree control. """


# Import the toolkit specific version.
from __future__ import absolute_import

from pyface.toolkit import toolkit_object
TreeViewer = toolkit_object('viewer.tree_viewer:TreeViewer')
Ejemplo n.º 27
0
# Copyright (c) 2017, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
""" A viewer based on a table control. """


# Import the toolkit specific version.
from __future__ import absolute_import

from pyface.toolkit import toolkit_object
TableViewer = toolkit_object('viewer.table_viewer:TableViewer')
Ejemplo n.º 28
0
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
#
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>
#------------------------------------------------------------------------------
""" The implementation of a page in a wizard. """


# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
WizardPage = toolkit_object('wizard.wizard_page:WizardPage')

#### EOF ######################################################################
Ejemplo n.º 29
0
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!
# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

DockPane = toolkit_object("tasks.dock_pane:DockPane")
Ejemplo n.º 30
0
# Author: Prabhu Ramachandran
# Copyright (c) 2006-2018,  Enthought, Inc.
# License: BSD Style.
"""
Event-loop based timers that perform actions periodically.

Note that if a timer goes out of scope without a reference to being saved,
there is nothing keeping the underlying toolkit timer alive and it will be
garbage collected, meaning that the timer will stop firing (or indeed, may
never fire).
"""

from pyface.toolkit import toolkit_object
from pyface.timer.i_timer import MCallbackTimer, MEventTimer

PyfaceTimer = toolkit_object('timer.timer:PyfaceTimer')


class EventTimer(MEventTimer, PyfaceTimer):
    pass


class CallbackTimer(MCallbackTimer, PyfaceTimer):
    pass


class Timer(CallbackTimer):
    """ Subclass of CallbackTimer that matches the old API """

    def __init__(self, millisecs, callable, *args, **kwargs):
        """ Initialize and start the timer.
Ejemplo n.º 31
0
#
#  Written by: David C. Morrill
#
#  Date: 05/18/2005
#
#  (c) Copyright 2005 by Enthought, Inc.
#
#-------------------------------------------------------------------------------

#-------------------------------------------------------------------------------
#  Imports:
#-------------------------------------------------------------------------------

# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
DoLaterTimer = toolkit_object('timer.do_later:DoLaterTimer')

#-------------------------------------------------------------------------------
#  Does something 50 milliseconds from now:
#-------------------------------------------------------------------------------

def do_later ( callable, *args, **kw_args ):
    """ Does something 50 milliseconds from now.
    """
    DoLaterTimer( 50, callable, args, kw_args )

#-------------------------------------------------------------------------------
#  Does something after some specified time interval:
#-------------------------------------------------------------------------------

def do_after ( interval, callable, *args, **kw_args ):
Ejemplo n.º 32
0
# Copyright (c) 2017, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
""" The preference dialog. """


# Import the toolkit specific version.
from __future__ import absolute_import

from pyface.toolkit import toolkit_object
TreeViewer = toolkit_object('preference.preference_dialog:PreferenceDialog')
Ejemplo n.º 33
0
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!
# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

TaskPane = toolkit_object("tasks.task_pane:TaskPane")
Ejemplo n.º 34
0
# (C) Copyright 2005-2022 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!
"""
- :attr:`~.TaskWindowBackend`
"""

from pyface.toolkit import toolkit_object

TaskWindowBackend = toolkit_object(
    "tasks.task_window_backend:TaskWindowBackend")
Ejemplo n.º 35
0
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!

""" The implementation of a page in a wizard. """


# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

WizardPage = toolkit_object("wizard.wizard_page:WizardPage")
Ejemplo n.º 36
0
# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
SplitEditorAreaPane = toolkit_object('tasks.split_editor_area_pane:'
                                     'SplitEditorAreaPane')

EditorAreaWidget = toolkit_object('tasks.split_editor_area_pane:'
                                    'EditorAreaWidget')
Ejemplo n.º 37
0
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!
"""
Event-loop based timers that perform actions periodically.

Note that if a timer goes out of scope without a reference to being saved,
there is nothing keeping the underlying toolkit timer alive and it will be
garbage collected, meaning that the timer will stop firing (or indeed, may
never fire).
"""

from pyface.toolkit import toolkit_object
from pyface.timer.i_timer import MCallbackTimer, MEventTimer

PyfaceTimer = toolkit_object("timer.timer:PyfaceTimer")


class EventTimer(MEventTimer, PyfaceTimer):
    pass


class CallbackTimer(MCallbackTimer, PyfaceTimer):
    pass


class Timer(CallbackTimer):
    """ Subclass of CallbackTimer that matches the old API """
    def __init__(self, millisecs, callable, *args, **kwargs):
        """ Initialize and start the timer.
Ejemplo n.º 38
0
"""A timer that invokes a specified callback periodically.
"""
# Author: Prabhu Ramachandran <*****@*****.**>
# Copyright (c) 2006-2007,  Enthought, Inc.
# License: BSD Style.

# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

Timer = toolkit_object("timer.timer:Timer")
Ejemplo n.º 39
0
# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

# WIP: Currently only supports qt4 backend. API might change without
# prior notification
PyMimeData = toolkit_object('mimedata:PyMimeData')
Ejemplo n.º 40
0
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
#
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>
#------------------------------------------------------------------------------
""" The implementation of a workbench editor. """


# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
Editor = toolkit_object('workbench.editor:Editor')

### EOF #######################################################################
Ejemplo n.º 41
0
# (C) Copyright 2005-2022 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!
""" A toolkit-specific menu bar manager that realizes itself in a menu bar
control.

- :attr:`~.MenuBarManager`
"""

# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

MenuBarManager = toolkit_object("action.menu_bar_manager:MenuBarManager")
Ejemplo n.º 42
0
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
#
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>
#------------------------------------------------------------------------------
""" A tool bar manager realizes itself in a tool palette control. """


# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
ToolPaletteManager = toolkit_object('action.tool_palette_manager:ToolPaletteManager')

### EOF #######################################################################
Ejemplo n.º 43
0
# (C) Copyright 2005-2022 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!

""" A toolkit-specific tool bar manager that realizes itself in a tool palette
control.

- :attr:`~.ToolPaletteManager`
"""


# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

ToolPaletteManager = toolkit_object(
    "action.tool_palette_manager:ToolPaletteManager"
)
Ejemplo n.º 44
0
# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
DockPane = toolkit_object('tasks.dock_pane:DockPane')
Ejemplo n.º 45
0
# Author: Prabhu Ramachandran
# Copyright (c) 2006-2018,  Enthought, Inc.
# License: BSD Style.
"""
Event-loop based timers that perform actions periodically.

Note that if a timer goes out of scope without a reference to being saved,
there is nothing keeping the underlying toolkit timer alive and it will be
garbage collected, meaning that the timer will stop firing (or indeed, may
never fire).
"""

from pyface.toolkit import toolkit_object
from pyface.timer.i_timer import MCallbackTimer, MEventTimer

PyfaceTimer = toolkit_object('timer.timer:PyfaceTimer')


class EventTimer(MEventTimer, PyfaceTimer):
    pass


class CallbackTimer(MCallbackTimer, PyfaceTimer):
    pass


class Timer(CallbackTimer):
    """ Subclass of CallbackTimer that matches the old API """

    def __init__(self, millisecs, callable, *args, **kwargs):
        """ Initialize and start the timer.
Ejemplo n.º 46
0
from __future__ import absolute_import

from traits.testing.unittest_tools import unittest

from pyface.gui import GUI
from pyface.toolkit import toolkit_object

from ..progress_dialog import ProgressDialog

ModalDialogTester = toolkit_object('util.modal_dialog_tester:ModalDialogTester')
no_modal_dialog_tester = (ModalDialogTester.__name__ == 'Unimplemented')


class TestDialog(unittest.TestCase):

    def setUp(self):
        self.gui = GUI()
        self.dialog = ProgressDialog()

    def test_create(self):
        # test that creation and destruction works as expected
        self.dialog._create()
        self.gui.process_events()
        self.assertIsNotNone(self.dialog.control)
        self.assertIsNotNone(self.dialog.progress_bar)
        self.assertIsNotNone(self.dialog._message_control)
        self.assertIsNone(self.dialog._elapsed_control)
        self.assertIsNone(self.dialog._estimated_control)
        self.assertIsNone(self.dialog._remaining_control)
        self.dialog.destroy()
Ejemplo n.º 47
0
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>
#------------------------------------------------------------------------------
""" An action manager item that represents an actual action. """


# Enthought library imports.
from traits.api import Any, Instance, List, Property, Str

# Local imports.
from action import Action
from action_manager_item import ActionManagerItem

# Import the toolkit specific versions of the internal classes.
from pyface.toolkit import toolkit_object
_MenuItem = toolkit_object('action.action_item:_MenuItem')
_Tool = toolkit_object('action.action_item:_Tool')
_PaletteTool = toolkit_object('action.action_item:_PaletteTool')


class ActionItem(ActionManagerItem):
    """ An action manager item that represents an actual action. """

    #### 'ActionManagerItem' interface ########################################

    # The item's unique identifier ('unique' in this case means unique within
    # its group).
    id = Property(Str)

    #### 'ActionItem' interface ###############################################
Ejemplo n.º 48
0
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
#
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>
#------------------------------------------------------------------------------
""" A tool bar manager realizes itself in a tool bar control. """


# Import the toolkit specific version.
from pyface.toolkit import toolkit_object
ToolBarManager = toolkit_object('action.tool_bar_manager:ToolBarManager')

### EOF #######################################################################
import unittest

from pyface.toolkit import toolkit_object
from traits.api import HasTraits, Instance, Str
from traitsui.api import InstanceEditor, Item, View
from traitsui.tests._tools import (
    BaseTestMixin,
    requires_toolkit,
    ToolkitName,
)

from traitsui.testing.api import (DisplayedText, KeySequence, MouseClick,
                                  UITester)

ModalDialogTester = toolkit_object(
    "util.modal_dialog_tester:ModalDialogTester")
no_modal_dialog_tester = ModalDialogTester.__name__ == "Unimplemented"


class EditedInstance(HasTraits):
    value = Str()
    traits_view = View(Item("value"), buttons=["OK"])


class ObjectWithInstance(HasTraits):
    inst = Instance(EditedInstance, ())


def get_view(style):
    return View(Item("inst", style=style), buttons=["OK"])
# ------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
#
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>
# ------------------------------------------------------------------------------
""" The implementation of a workbench window layout. """


# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

WorkbenchWindowLayout = toolkit_object("workbench.workbench_window_layout:WorkbenchWindowLayout")

### EOF #######################################################################
Ejemplo n.º 51
0
# (C) Copyright 2005-2022 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!

""" A toolkit-specific status bar manager that realizes itself in a status bar
control.

- :attr:`~.StatusBarManager`
"""


# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

StatusBarManager = toolkit_object("action.status_bar_manager:StatusBarManager")
Ejemplo n.º 52
0
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
#
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>
#------------------------------------------------------------------------------
""" The implementation of a wizard. """

# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

Wizard = toolkit_object('wizard.wizard:Wizard')

#### EOF ######################################################################
Ejemplo n.º 53
0
#------------------------------------------------------------------------------
# Copyright (c) 2017, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
#
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>
#------------------------------------------------------------------------------
""" The text field widget. """

# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

TextField = toolkit_object('fields.text_field:TextField')
Ejemplo n.º 54
0
# Copyright (c) 2019, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
#
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>

""" The combo field widget. """

# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

ComboField = toolkit_object('fields.combo_field:ComboField')
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!
import unittest

from pyface.tasks.api import SplitEditorAreaPane
from pyface.toolkit import toolkit_object

GuiTestAssistant = toolkit_object("util.gui_test_assistant:GuiTestAssistant")
no_gui_test_assistant = GuiTestAssistant.__name__ == "Unimplemented"


@unittest.skipIf(no_gui_test_assistant, "No GuiTestAssistant")
class TestSplitEditorAreaPane(unittest.TestCase, GuiTestAssistant):
    def setUp(self):
        GuiTestAssistant.setUp(self)
        self.area_pane = SplitEditorAreaPane()

    def tearDown(self):
        if self.area_pane.control is not None:
            with self.delete_widget(self.area_pane.control):
                self.area_pane.destroy()
        GuiTestAssistant.tearDown(self)

    def test_create_destroy(self):
Ejemplo n.º 56
0
#------------------------------------------------------------------------------
# Copyright (c) 2019, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
#
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>
#------------------------------------------------------------------------------
""" The spin field widget. """

# Import the toolkit specific version.
from pyface.toolkit import toolkit_object

SpinField = toolkit_object('fields.spin_field:SpinField')