Esempio n. 1
0
def apply_placement_tool_set(view, item_factory, modeling_language,
                             event_manager, handle_index):
    view.remove_all_controllers()
    view.add_controller(view_focus_tool(view))
    view.add_controller(*transactional_tool(
        placement_tool(view, item_factory, event_manager, handle_index),
        event_manager=event_manager,
    ))
    view.add_controller(drop_zone_tool(view, item_factory.item_class))
    view.add_controller(scroll_tool(view))
    view.add_controller(zoom_tool(view))
    view.add_controller(shortcut_tool(view, modeling_language, event_manager))
Esempio n. 2
0
def apply_default_tool_set(view, modeling_language, event_manager,
                           rubberband_state):
    """The default tool set."""
    view.remove_all_controllers()
    view.add_controller(hover_tool(view))
    view.add_controller(*transactional_tool(
        segment_tool(view), item_tool(view), event_manager=event_manager))
    view.add_controller(*text_edit_tools(view))
    view.add_controller(rubberband_tool(view, rubberband_state))
    view.add_controller(scroll_tool(view))
    view.add_controller(zoom_tool(view))
    view.add_controller(view_focus_tool(view))
    view.add_controller(shortcut_tool(view, modeling_language, event_manager))
Esempio n. 3
0
def test_start_tx_on_begin(view):
    event_manager = MockEventManager()
    tx_data = TxData(event_manager)
    (tool, ) = transactional_tool(
        Gtk.GestureDrag.new(view),
        event_manager=event_manager)  # type: ignore[arg-type]

    on_begin(tool, None, tx_data)
    assert tx_data.txs

    on_end(tool, None, tx_data)

    assert event_manager.events
    assert isinstance(event_manager.events[0], TransactionBegin)