maverig.presenter

maverig.presenter.abstractPresenter

class maverig.presenter.abstractPresenter.AbstractPresenter(presenter_manager, model, cfg=None)

Bases: object

on_settings()

Reacts on settings respectively config changes.

maverig.presenter.attributePanelPresenter

class maverig.presenter.attributePanelPresenter.AttributePanelPresenter(presenter_manager, model, cfg)

Bases: maverig.presenter.abstractPresenter.AbstractPresenter

Presenter class that acts as the event handler between the view and the model for the attribute panel.

on_change_visibility_triggered()

Toggles the visibility of the attribute panel. Saves the visibility state in the config.

on_change_graph_visibility_triggered(name)

Toggles the visibility of the different graphs in the attribute panel.

update_graph_visibility(name)

Saves the visible graphs in the config.

on_language()

Reacts on language changes. Triggers view reinitialization so that the view adopts the chosen language.

on_selection()

Reacts on selection changes. Creates attribute cells for the attribute panel.

on_attrs()

Reacts on value changes of attributes. Updates the displayed values in the attribute panel.

on_program_mode()

Reacts on program mode changes. In the composition program mode the attribute panel is hided while the panel is visible in the simulation program mode if the user didn’t hide it.

maverig.presenter.modePanelPresenter

class maverig.presenter.modePanelPresenter.ModePanelPresenter(presenter_manager, model, cfg)

Bases: maverig.presenter.abstractPresenter.AbstractPresenter

Presenter class that acts as the event handler between the view and the model for the mode panel.

on_btn_context_menu(event, comp_name)

Creates and opens a context menu when the user performs a right mouse click on a component button.

on_context_menu(event)

Creates and opens a context menu when the user performs a right mouse click in the component panel.

remove_selected_component()

Removes a component.

hide_selected_component()

Hides a component.

show_invisible_components()

Toggles the visibility of hided components in component panel.

restore_default_components()

Removes all components from and restores the default components. The list of hided components in the config gets cleared.

selection_mode_btn_clicked()

Switches the mode between ‘selection mode’ and ‘component mode’ when the selection mode button is clicked.

hand_mode_btn_clicked()

Switches the mode between ‘hand mode’ and ‘component mode’ when the hand mode button is clicked.

add_component_btn_clicked()

Opens the component wizard.

comp_btn_created(btn, comp_name)

Adds created button to buttons dict.

comp_btn_clicked(btn, comp_name)

Switches the mode between ‘component mode’ and ‘selection mode’ when a component button is clicked.

drag_started(btn, comp_name)

Switches the mode to component mode when a component is dragged.

on_change_visibility_triggered()

Toggles the visibility of the component panel. Saves the visibility state in the config.

on_language()

Reacts on language changes. Triggers view reinitialization so that the view adopts the chosen language.

on_mode()

Reacts on mode changes. Updates the component buttons accordingly.

on_program_mode()

Reacts on program mode changes. In the simulation program mode the component panel is hided while the panel is displayed in the composition program mode if the user didn’t hide it.

on_components()

Reacts on component changes. Triggers view reinitialization so that the panel adopts the changes.

get_published_components()

Returns a list with comp_name, category, icon and tooltip of every existing component for component grid creation.

maverig.presenter.componentWizardPresenter

class maverig.presenter.componentWizardPresenter.ComponentWizardPresenter(presenter_manager, model, cfg)

Bases: maverig.presenter.abstractPresenter.AbstractPresenter

Presenter class that acts as the event handler between the view and the model for the component wizard.

get_simulator_names()

Return the names of available simulators.

get_category_names()

Return a sorted list with the names of the categories.

on_new_simulator_triggered()

Triggers the visibility of the attribute panel.

init_view(v)
on_add_simulator_triggered()

Save new simulator description in json.

There are some TODOs in this method as advice future feature development.

on_add_component()

Save new component description in json.

There are some TODOs in this method as advice future feature development.

on_close_wizard()

Whenever the dialog gets closed (cancel, finish or close event), switch back to last known mode.

maverig.presenter.consolePanelPresenter

class maverig.presenter.consolePanelPresenter.ConsolePanelPresenter(presenter_manager, model, cfg)

Bases: maverig.presenter.abstractPresenter.AbstractPresenter

Presenter class that acts as the event handler between the view and the model for the console panel.

on_change_visibility_triggered()

Toggles the visibility of the console panel. Saves the visibility state in the config.

on_console_clear_triggered()

Clears the console output.

on_language()

Reacts on language changes. Triggers view reinitialization so that the view adopts the chosen language.

on_program_mode()

Reacts on program mode changes. The console panel is visible in every program mode if the user didn’t hide it.

on_output(output, new_line=True)

Appends the given output to the console output.

maverig.presenter.menuBarPresenter

class maverig.presenter.menuBarPresenter.MenuBarPresenter(presenter_manager, model, cfg)

Bases: maverig.presenter.abstractPresenter.AbstractPresenter

Presenter class that acts as the event handler between the view and the model for the menu bar. Functionality that is concerning the scenario is realized in ‘maverig.presenter.scenarioPanelPresenter.ScenarioPanelPresenter’.

path = None
on_file_new_triggered()

Discards the current scenario.

new_file()

Clears the current scenario.

on_file_open_triggered()

Opens a file dialog.

open_file()

Loads a serialized scenario from a chosen file.

on_file_save_triggered()

Saves a serialized scenario. If the current scenario isn’t saved within a file already a file dialog will be opened.

on_file_save_as_triggered()

Opens a file dialog so that the serialized scenario can be saved within a named file.

static on_quit_triggered()

Shuts down the application.

on_undo_triggered()

Undo latest change.

on_redo_triggered()

Redo latest undone change.

on_cut_triggered()

Cuts selected elements.

on_copy_triggered()

Copies selected elements.

on_paste_triggered()

Pastes copied elements and selects them.

on_delete_triggered()

Removes selected elements.

on_select_all_triggered()

Selects all elements depending on current mode.

on_back_to_start_triggered()

Sets progress slider position to first index.

on_reduce_speed_triggered()

Reduces the speed of the progress slider.

on_run_triggered()

Starts the simulation and runs or pauses the progress slider. Switches the program mode.

on_stop_triggered()

Stops the simulation and progress slider. Switches to the composition program mode.

on_pause_triggered()

Pauses the progress slider and switches to the simulation paused program mode.

on_increase_speed_triggered()

Increases the speed of the progress slider.

on_forward_to_end_triggered()

Sets progress slider position to last possible index.

on_set_time_triggered()

Opens a dialog for changing time and speed parameters of the simulation. Sets the start time, the end time, the step size and the progress slider speed returned from the dialog.

on_go_to_triggered()

Opens a dialog where the user can set the progress slider position to a specific simulation time.

on_hand_mode_triggered()

Toggles the hand mode for shifting the scenario.

on_selection_mode_triggered()

Toggles the selection mode for element selection.

on_raster_mode_triggered()

Toggles raster mode for element snapping and scenario raster.

on_zoom_in_triggered()

Scales up the scenario.

on_zoom_out_triggered()

Scales down the scenario.

on_zoom_fit_triggered()

Fits all elements into the view.

on_trigger_component_panel()

Toggles the visibility of the component panel.

on_trigger_property_panel()

Toggles the visibility of the property panel.

on_trigger_console()

Toggles the visibility of the console panel.

on_trigger_status_bar()

Toggles the visibility of the status bar.

on_trigger_progress_bar()

Toggles the visibility of the progress bar.

on_trigger_attribute_panel()

Toggles the visibility of the attribute panel.

on_auto_layout_triggered()

Triggers scenario redrawing with ForceAtlas2.

on_settings_triggered()

Opens the settings dialog.

static on_help_triggered()

Opens the User Manual.

static on_about_triggered()

Opens the about dialog.

on_language()

Reacts on language changes. Triggers view reinitialization so that the view adopts the chosen language.

on_elements()

Reacts on changes of the elements count and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

on_mode()

Reacts on mode changes and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

on_drag()

Reacts if a component is dragged and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

on_vid_speed()

Reacts on changes of the progress slider speed and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

on_program_mode()

Reacts on program mode changes and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

on_selection()

Reacts on selection changes and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

on_clipboard()

Reacts on clipboard changes and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

static datetime_to_qdatetime(date_time)
static qdatetime_to_datetime(qdatetime)

maverig.presenter.presenterManager

class maverig.presenter.presenterManager.PresenterManager(model, cfg)

Bases: object

Container class for all presenters. Each presenter may call methods on other presenters through this container.

maverig.presenter.progressPresenter

class maverig.presenter.progressPresenter.ProgressPresenter(presenter_manager, model, cfg)

Bases: maverig.presenter.abstractPresenter.AbstractPresenter

Presenter class that acts as the event handler between the view and the model for the progress bar.

on_language()

Reacts on language changes. Triggers view reinitialization so that the view adopts the chosen language.

on_slider_moved(position)

Sets simulation data index to current slider position. Keeps slider position valid if the mosaik simulation progress isn’t as far as the position. The model performs lazy updates on the UI through the refresh_timer to prevent application from speed and graph animation issues.

on_change_visibility_triggered()

Toggles the visibility of the progress bar. Saves the visibility state in the config.

on_change_dateformat()

Toggles displaying of the date.

on_screen_dateformat()

Reacts on changes of the date display. Displays the date as calendar date or as countdown.

on_progress()

Applies the current mosaik simulation progress to the progress bar.

on_sim()

Reacts on simulation data index changes. Updates the slider position and the date.

on_vid_speed()

Reacts on changes of the progress slider speed. Stops und starts the progress slider to adopt new speed.

on_program_mode()

Reacts on program mode changes. In the composition program mode the progress bar is hided while the progress bar is visible in the simulation program mode if the user didn’t hide it. In addition the progress slider and the progress bar are set back if application switches to the composition program mode.

run_slider()

Starts the progress slider.

stop_slider()

Stops the progress slider.

run_iteration()

Updates the simulation data index which is responsible for moving the progress slider.

run_refresh()

Connected to timer which is responsible for model updates.

maverig.presenter.propertyPanelPresenter

class maverig.presenter.propertyPanelPresenter.PropertyPanelPresenter(presenter_manager, model, cfg)

Bases: maverig.presenter.abstractPresenter.AbstractPresenter

Presenter class that acts as the event handler between the view and the model for the property panel.

on_change_visibility_triggered()

Toggles the visibility of the property panel. Saves the visibility state in the config.

check_spinbox(widget, value)

Checks spinbox values.

value_changed(widget, value)

Handles value changes of the properties.

on_language()

Reacts on language changes. Triggers view reinitialization so that the view adopts the chosen language.

on_selection()

Reacts on selection changes. Triggers view reinitialization so that the view is updated depending on the selection.

on_param()

Reacts on value changes in model and updates the view.

on_program_mode()

Reacts on program mode changes. In the simulation program mode the property panel is hided while the panel is visible in the composition program mode if the user didn’t hide it.

maverig.presenter.scenarioPanelPresenter

class maverig.presenter.scenarioPanelPresenter.ScenarioPanelPresenter(presenter_manager, model, cfg)

Bases: maverig.presenter.abstractPresenter.AbstractPresenter

Presenter class that acts as the event handler between the view and the model for the scenario panel.

adjust_scene_rect()

Fits the size of the scene to the elements bounding rect.

on_selection_changed()

Adopts selection changes in model. Adapts visibility and z-mode of elements.

on_context_menu(event)

Creates and opens a context menu when the user performs a right mouse click in the scenario panel.

on_draw_background(painter)

Triggers raster drawing if raster mode is enabled.

element_at(mouse_pos)

Returns element at the current mouse position.

create_new_element(mouse_pos)

Creates a new element at the given mouse position.

mouse_clicked(mouse_pos, button)

Triggers creation of a new element at the given mouse position by clicking left mouse button. Switches between selection mode and component mode by clicking right mouse button.

damped_mouse_pos(mouse_pos)

Returns the damped mouse position if it is out of frame rect.

mouse_moved(mouse_pos, buttons)

Sets mouse position based on the damped mouse position.

mouse_released(mouse_pos)

Draws second endpoint of a line.

zoom(zoom_in, wheel_event=None)

Scales up or scales down the scenario depending on the mouse wheel alpha.

zoom_fit()

Fits all elements into the view.

delete_selected_elements()

Removes all selected elements.

copy_selected_elements()

Copies all selected elements.

cut_selected_elements()

Cuts all selected elements.

paste_elements()

Pastes all copied elements and selects them.

select_all_elements()

Selects all elements.

select_all_active_elements(mouse_pos)

Selects all elements depending on the current active mode.

on_attrs()

Reacts on value changes of attributes. Updates the background visualization of the date time if day and night visualization is enabled.

on_mode()

Reacts on mode changes. Updates the views drag mode, interactive mode and mouse cursor depending on the active mode.

on_drag()

Reacts if an element is dragged into the scene from the component panel.

on_elements()

Reacts on changes on elements count and updates the view.

on_error(title, text, info_text, elem_ids)

Reacts on model scenario errors and displays an error dialog

run_force_layout()

Triggers running of the force atlas algorithm.

group_presenters

Returns a set of all group presenters.

groups

Returns a set of all groups.

maverig.presenter.settingsPresenter

class maverig.presenter.settingsPresenter.SettingsPresenter(presenter_manager, model, cfg)

Bases: maverig.presenter.abstractPresenter.AbstractPresenter

Presenter class that acts as the event handler between the view and the model for the settings dialog.

on_change_visibility_triggered()

Shows the settings dialog.

on_language_changed()

Sets flag ‘do_change_language’ to true if the language has been changed. The flag is used when the presenter applies the settings.

install_language(do_update=True)

Sets chosen language if it is changed by user. This is handled separately to prevent handling of unnecessary events in whole application if the language hasn’t been changed.

apply_settings()

Triggers applying of settings.

apply_setting(tab, setting, do_update=True)

Applies the given setting.

maverig.presenter.statusBarPresenter

class maverig.presenter.statusBarPresenter.StatusBarPresenter(presenter_manager, model, cfg)

Bases: maverig.presenter.abstractPresenter.AbstractPresenter

Presenter class that acts as the event handler between the view and the model for the status bar.

on_change_visibility_triggered()

Toggles the visibility of the status bar. Saves the visibility state in the config.

on_language()

Reacts on language changes. Triggers view reinitialization so that the view adopts the chosen language.

on_drag()

Reacts if an element is dragged. Displays information that dragging is active currently.

on_mode()

Reacts on mode changes. Displays the chosen mode in the status bar.

on_vid_speed_event()

Reacts on changes of the progress slider speed. Displays the current speed in the status bar.

on_program_mode()

Reacts on program mode changes. The status bar is visible in every program mode if the user didn’t hide it.

error(message)

Sets the given message in the status bar and applies a red background to the status bar.

info(message)

Sets the given message in the status bar and applies a blue background to the status bar..

success(message)

Sets the given message in the status bar and applies a green background to the status bar..

reset()

Resets the status bar.

maverig.presenter.toolbarPresenter

class maverig.presenter.toolbarPresenter.ToolbarPresenter(presenter_manager, model, cfg)

Bases: maverig.presenter.abstractPresenter.AbstractPresenter

Presenter class that acts as the event handler between the view and the model for toolbar. Events that are fired by the toolbar view are mapped to the menu bar presenter because all functionality of the toolbar is covered by the menu bar. Code changes can be realized at one place in this way.

on_file_open_triggered()

Opens a file dialog.

on_file_save_triggered()

Saves a serialized scenario. If the current scenario isn’t saved within a file already a file dialog will be opened.

on_back_to_start_triggered()

Sets progress slider position to first index.

on_reduce_speed_triggered()

Reduces the speed of the progress slider.

on_run_triggered()

Starts the simulation and runs or pauses the progress slider. Switches the program mode.

on_stop_triggered()

Stops the simulation and progress slider. Switches to the composition program mode.

on_increase_speed_triggered()

Increases the speed of the progress slider.

on_forward_to_end_triggered()

Sets progress slider position to last possible index.

on_zoom_in_triggered()

Scales up the scenario.

on_zoom_out_triggered()

Scales down the scenario.

on_zoom_fit_triggered()

Fits all elements into the view.

on_delete_triggered()

Removes selected elements.

on_settings_triggered()

Opens the settings dialog.

on_auto_layout_triggered()

Triggers scenario redrawing with ForceAtlas2.

on_language()

Reacts on language changes. Triggers view reinitialization so that the view adopts the chosen language.

on_elements()

Reacts on changes of the elements count and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

on_selection()

Reacts on selection changes and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

on_drag()

Reacts if a component is dragged and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

on_sim()

Reacts on changes of the simulation time and speed parameters and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

on_vid_speed()

Reacts on changes of the progress slider speed and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

on_program_mode()

Reacts on program mode changes and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.