polychron.presenters.ModelPresenter
Module
ModelPresenter
Bases: FramePresenter[ModelView, ProjectSelection]
Presenter for the main model tab
strat_check
instance-attribute
strat_check: bool = False
If a strat file has been loaded or not
date_check
instance-attribute
date_check: bool = False
If a data file has been loaded or not
phase_check
instance-attribute
phase_check: bool = False
If a phase file has been loaded or not
phase_rel_check
instance-attribute
phase_rel_check: bool = False
If a phase_rel file has been loaded or not
node
instance-attribute
node: str = 'no node'
The currently selected node for right click operations on the stratigraphic graph
edge_nodes
instance-attribute
edge_nodes: List[Any] = []
Used during testmenu (right click menu) options similar to self.node
comb_nodes
instance-attribute
comb_nodes: List[Any] = []
Used during testmenu (right click menu) options similar to self.node
Context equality only?
update_view
update_view() -> None
Update the view to reflect the current state of the model
popup_calibrate_model
popup_calibrate_model() -> None
Callback function for when Tools -> Calibrate model is selected
Formerly StartPage.load_mcmc
popup_calibrate_multiple
popup_calibrate_multiple() -> None
Callback function for when Tools -> Calibrate multiple models from project is selected
Opens a new popup box allowing the user to select which models from a list to calibrate as a batch.
Formerly popupWindow8
chronograph_render_wrap
chronograph_render_wrap() -> None
wraps chronograph render so we can assign a variable when running the func using a button
chronograph_render
chronograph_render() -> None
Initiates residual checking function and group ordering; then renders the chronological graph if the user chose to proceed (not close the window)
resid_check
resid_check() -> None
Loads a text box to check if the user thinks any samples are residual
When the popupwindows have been closed (correctly) the model will have been updated accordingly.
file_popup
file_popup(df: DataFrame) -> str
For a gien dataframe, preview the data to the user. Returns the users decision
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df
|
DataFrame
|
The dataframe to preview |
required |
Returns:
Type | Description |
---|---|
str
|
The string result value, which should be "cancel" or "load" |
open_strat_dot_file
open_strat_dot_file() -> None
Callback function when File > Load stratigraphic diagram file (.dot) (.csv) is selected, opening a .dot / graphviz file representing the stratigraphic relationships
Formerly StartPage.open_file1
open_strat_csv_file
open_strat_csv_file() -> None
Callback function when File > Load stratigraphic relationship file (.csv) is selected, opening a plain text strat file
Formerly StartPage.open_file2
open_scientific_dating_file
open_scientific_dating_file() -> None
Callback function when File > Load scientific dating file (.csv) is selected, opening a scientific dating file
Formerly StartPage.open_file3
open_context_grouping_file
open_context_grouping_file() -> None
Callback function when File > Load context grouping file (.csv) is selected, opening context grouping / phase file
Formerly StartPage.open_file4
open_group_relationship_file
open_group_relationship_file() -> None
Callback function when File > Load group relationship file (.csv) is selected, opening a group relationship / phase relationship file
Formerly StartPage.open_file5
open_context_equalities_file
open_context_equalities_file() -> None
Callback function when File > Load context equalities file (.csv) is selected, opening a file providing context equalities (in time)
Formerly StartPage.open_file6
close_application
close_application() -> None
Close polychron gracefully via File > Exit
toggle_grouped_rendering
toggle_grouped_rendering() -> None
Callback function for View > Display Stratigraphic diagram in phases (groups)
Toggles if graphs are rendered in grouped (phased) mode or not, and re-renders the graph accordingly.
Runs image render function with phases on separate levels
Formerly StartPage.phasing
on_data_button
on_data_button() -> None
Callback for when the "Data Loaded" button is pressed, which toggles the visibility of which required input files have been parsed or not
Formerly StartPage.display_data_func
on_testmenu
on_testmenu(event) -> None
Callback for when the testmenu is selected (the right option menu when right clicking on the littlecanvas)
Formerly StartPage.nodes
testmenu_delete_context
testmenu_delete_context() -> None
Callback function from the testmenu for deleting a single context
testmenu_add_new_contexts
testmenu_add_new_contexts() -> None
Callback function from the testmenu for adding contexts
testmenu_delete_strat_with
testmenu_delete_strat_with() -> None
Callback function from the testmenu for deleting stratigrahic relationship edges
testmenu_place_above
testmenu_place_above() -> None
Callback function from the testmenu for adding stratigrahic relationship
testmenu_delete_stratigraphic_prep
testmenu_delete_stratigraphic_prep() -> None
Callback function from the testmenu for deleting stratigraphic relationships, adding an option to the menu when a node was selected.
testmenu_equate_context_with
testmenu_equate_context_with() -> None
Callback function from the testmenu to equate two contexts (when one has already been selected)
testmenu_equate_context_prep
testmenu_equate_context_prep() -> None
Callback function from the testmenu which sets up menu to equate context for when user picks next node
testmenu_supplementary_menu
testmenu_supplementary_menu() -> None
Callback function from the testmenu for users to provide additional supplementary data
I.e. launches what was formerly popupWindow2
Note
This is not currently implemented. See https://github.com/bryonymoody/PolyChron/issues/69
testmenu_get_supplementary_for_context
testmenu_get_supplementary_for_context() -> None
Callback function from the testmenu to show supplementary data for the selected context/node
testmenu_place_above_prep
testmenu_place_above_prep() -> None
Callback function from the testmenu which sets up for placing one context above another
pre_click
pre_click(*args) -> None
makes test menu appear and removes any previous test menu
formerly StartMenu.preClick
on_left
on_left(*args) -> None
hides menu when left clicking
Formerly StartMenu.onLeft
on_right
on_right(*args) -> None
Makes the test menu appear after right click
Formerly StartPage.onRight
check_list_gen
check_list_gen() -> None
Update the contents of the datacanvas checklist based on provided model state
Formerly StartPage.check_list_gen
load_project
load_project() -> None
open a popup dialog to load a model from a different project
Formerly a call to load_Window(MAIN_FRAME)
load_existing_model
load_existing_model() -> None
Open a popup dialog to load an existing model from the current project (althoug possible to go back?)
Formerly a call to load_Window(MAIN_FRAME, proj_dir)
save_model
save_model() -> None
Save the current state of the model in-place
Formerly StartPage.save_state_1
save_as_new_model
save_as_new_model() -> None
Save the current state of the model, as a new model (with a new name) initially in the same project (although possible to put in a new project). Switches to the "new" model for any future changes.
Formerly StartPage.refresh_4_new_model
Todo
- Handle the edge case wehre a user selects the current model name by going back, and selecting the existing model. This currently does not save (as a save only occurs if the project/model name was changed). This needs to be separate to the path where the popup window is closed by closing the window, not pressing create.
on_resize
on_resize(event: Any) -> None
resizes image on canvas
Formerly StartPage.resize
on_resize_2
on_resize_2(event: Any) -> None
resizes image on canvas2
Formerly StartPage.resize2
move_from
move_from(event: Any) -> None
Remembers previous coordinates for scrolling with the mouse
Formerly StartPage.move_from
move_to
move_to(event: Any) -> None
Drag (move) canvas to the new position
Formerly StartPage.move_to
move_from2
move_from2(event: Any) -> None
Remembers previous coordinates for scrolling with the mouse
Formerly StartPage.move_from2
move_to2
move_to2(event: Any) -> None
Drag (move) canvas to the new position
Formerly StartPage.move_to2
on_wheel
on_wheel(event: Any) -> None
Zoom with mouse wheel for the stratigraphic image canvas
Formerly StartPage.wheel
on_wheel2
on_wheel2(event: Any) -> None
Zoom with mouse wheel for the chronological image canvas
Formerly StartPage.wheel2
addedge
addedge(edgevec: List[str]) -> None
adds an edge relationship (edgevec) to graph and rerenders the graph
Formerly StartPage.addedge
stratfunc
stratfunc(node: str) -> tuple[str] | None
obtains strat relationships for node
Formerly StartPage.stratfunc
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node
|
str
|
the context label to extract stratigraphic relationsips for |
required |
Returns:
Type | Description |
---|---|
tuple[str] | None
|
A 2-tuple of strings: the comma separated list of context above, and comma separated list of contexts below; Or None if the provided node/context label is not valid. |
nodecheck
nodecheck(x_current: int, y_current: int) -> str | None
Returns the node that corresponds to the mouse cooridinates
Formerly StartPage.nodecheck
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x_current
|
int
|
the x coord in image space accounting for translation |
required |
y_current
|
int
|
the y coord in image space accounting for translation |
required |
Returns:
Type | Description |
---|---|
str | None
|
The name of the node clicked on, or None |
node_del_popup
node_del_popup(context_name: str) -> str | None
Open a popup window for the user to provide input on deleting a node, returning the value
This blocks users interacting with the main window until the popup is closed
Formerly StartPage.node_del_popup
edge_del_popup
edge_del_popup(context_u: str, context_v: str) -> str | None
Open a popup window for the user to provide input on deleting an edge, returning the reason provided
This blocks users interacting with the main window until the popup is closed
Formerly StartPage.edge_del_popup
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context_u
|
str
|
the source of the relationship to be removed |
required |
context_v
|
str
|
the destination of the context to be removed |
required |
Returns:
Type | Description |
---|---|
str | None
|
An optional string of the reason the context was removed |