コード例 #1
0
    def start(self):
        """ Start the workspace instance.

        This method will create the container content and register the
        provided plugin with the workbench.

        """
        self.content = Container(padding=0)
        self.load_area()
        manifest = PersistentManifest()
        self._manifest_id = manifest.id
        self.workbench.register(manifest)
コード例 #2
0
ファイル: workspace.py プロジェクト: saluzi/declaracad
    def start(self):
        """ Start the workspace instance.

        This method will create the container content and register the
        provided plugin with the workbench.

        """
        self.content = Container(padding=0)
        manifest = UIManifest()
        self._manifest_id = manifest.id
        try:
            self.workbench.register(manifest)
        except ValueError:
            #: Already registered
            pass
        self.workbench.get_plugin('declaracad.ui')
        self.load_area()
コード例 #3
0
 def show_debug_console(self):
     """ Show an IPython console for debugging.
     """
     from enaml.layout.api import FloatItem, RemoveItem
     from enaml.widgets.api import Window, Container, DockItem, IPythonConsole
     dock_area = self.dock_area
     name = 'ipython_console'
     item = DockItem(dock_area, name=name, title='Console')
     console_container = Container(item, padding=0)
     console = IPythonConsole(console_container,
                              initial_ns={
                                  'main_controller': self,
                                  'windows': Window.windows,
                              })
     console.observe('exit_requested', lambda change: \
         dock_area.update_layout(RemoveItem(item=name)))
     dock_area.update_layout(FloatItem(item=name))
コード例 #4
0
ファイル: test_base_views.py プロジェクト: prismv/exopy
def test_swapping(exopy_qtbot, task_workbench, dialog_sleep):
    """Test moving a view between containers.

    """
    task = RootTask()
    view = RootTaskView(task=task,
                        core=task_workbench.get_plugin('enaml.workbench.core'))

    subtask = ComplexTask(name='Test')
    subview = view.view_for(subtask)

    task.add_child_task(0, subtask)

    cont = Container()

    show_widget(exopy_qtbot, cont)
    view.set_parent(cont)
    view.refresh()

    def assert_children():
        assert cont.children == [view]

    exopy_qtbot.wait_until(assert_children)
    exopy_qtbot.wait(dialog_sleep)

    view.set_parent(None)
    subview.set_parent(cont)
    subview.refresh()

    def assert_children():
        assert cont.children == [subview]

    exopy_qtbot.wait_until(assert_children)
    exopy_qtbot.wait(dialog_sleep)

    subview.set_parent(None)
    view.set_parent(cont)
    view.refresh()

    def assert_children():
        assert cont.children == [view]

    exopy_qtbot.wait_until(assert_children)
    assert subview.visible
    exopy_qtbot.wait(dialog_sleep)
コード例 #5
0
def test_swapping(windows, task_workbench, dialog_sleep):
    """Test moving a view between containers.

    """
    task = RootTask()
    view = RootTaskView(task=task,
                        core=task_workbench.get_plugin('enaml.workbench.core'))

    subtask = ComplexTask(name='Test')
    subview = view.view_for(subtask)

    task.add_child_task(0, subtask)

    cont = Container()

    show_widget(cont)
    view.set_parent(cont)
    view.refresh()
    process_app_events()
    assert cont.children == [view]
    sleep(dialog_sleep)

    view.set_parent(None)
    subview.set_parent(cont)
    subview.refresh()
    process_app_events()
    assert cont.children == [subview]
    sleep(dialog_sleep)

    subview.set_parent(None)
    view.set_parent(cont)
    view.refresh()
    process_app_events()
    assert cont.children == [view]
    assert subview.visible
    sleep(dialog_sleep)
コード例 #6
0
 def start(self):
     self.content = Container()
     self.dock_area = DockArea(name='dock_area')
     self.dock_area.set_parent(self.content)
     deferred_call(self.plugins_started)