GUI package

Graphical User Interface

GUI main class - Charter

Main class for Cadbiom gui

class cadbiom_gui.gt_gui.charter.Charter(cad)[source]

Mainwindow class, FULL initialization of the GUI in MVC pattern

add_accelerator(widget, accelerator, signal='activate')[source]

Adds a keyboard shortcut

add_edit_mvc(model_name, model=None, layout=False, w_destroy=True)[source]

Create, register and display a new edit_mvc with the given model

Parameters:

model_name (<str>) – Name of the model

Key model:

(optional) Chart model

Key layout:

(optional) Flag to activate the default layout (hierarchical_LR). Default False.

Key w_destroy:

(optional) If True, we will allow the closing of all windows associated with the EditMVC when it will be closed.

If False, we will not allow the closing of auxiliary windows; This is the case when it is called by cadbiom_gui.gt_gui.chart_simulator.chart_simul_controler.ChartSimulControler.on_extract() in order to extract the part of a model used in last simulation.

add_image(widget, image_file)[source]

Add image to a Button from http://www.pygtk.org/docs/pygtk/gtk-stock-items.html

cancel(but, dee)[source]

what?

check_curent_model()[source]

Decorator that checks if there is a current model.

It is used before the call of functions that do some processing on models.

If there is no model, the function juste returns None.

choose_BioPAX_file(widget)[source]

open a window to import BioPAX data from a triplestore

choose_cadlang_file(widget)[source]

open a window to search xml file

choose_pid_file(widget)[source]

open a window to search xml file coming from PID database

choose_pint_file(widget)[source]

Open a window to search pint ph file

choose_xml_file(widget)[source]

open a window to search xml file

compile_to_cadlang(file_name)[source]

Compile in view of exporting

create_drawing_buttons()[source]

Create the buttons to control drawing

The connection is made via drawing_buttons_connect(), called in an EditMVC object.

create_xml_file(xml_file)[source]

make a xml file with the current model

do_layout(*args, **kwargs)[source]

Returned modified function

drawing_button_disable()[source]

Disable graphic editor buttons Carefull: do not change value of handler for efficiency reason

drawing_button_disconnect()[source]

Disconnect graphic editor buttons Carefull: do not change value of handler for efficiency reason

drawing_button_enable()[source]

Enable graphic editor buttons Carefull: do not change value of handler for efficiency reason

drawing_buttons_connect()[source]

Connect the buttons to the controler of the graphic view Remember for each button the handler

export_picture(*args, **kwargs)[source]

Returned modified function

export_picture_to_file(*args, **kwargs)[source]

Returned modified function

export_to_cadlang(*args, **kwargs)[source]

Returned modified function

export_to_xml(*args, **kwargs)[source]

Returned modified function

get_em_with_model_name(name)[source]

Get EditMVC object in list of edit_MVC (not used)

Parameters:name (<str>) – Name of a model
Returns:EditMVC object
Return type:<EditMVC>
get_emvc_with_view(view)[source]

Retreive the edit_MVC from the view

hide()[source]

Useful ?

import_from_cadlang_file(ffile)[source]

As it says

import_from_pint_file(ffile)[source]

Import Pint model (testing)

import_from_xml(xml_data, string_data=False)[source]

Open and parse an xml file or a text

Parameters:
  • xml_data (<str>) – File of a model or a model in text form.
  • string_data (<boolean>) – Boolean to force xml text parsing instead of file parsing.
import_from_xml_file(xml_file)[source]

As it says

new_charts(widget)[source]

create a new charts when you click on new

ok_new_text(but, dialog)[source]

Prompt if new model - to give the name

on_basal_activated_genes(*args, **kwargs)[source]

Returned modified function

on_button_scroll_event(widget, event)[source]

Handle zoom based on mouse wheel scroll event on the overview

on_check(*args, **kwargs)[source]

Returned modified function

on_command_line_doc_menu(widget)[source]

Go to the doc of the command line

on_delete_tab_callback(*args, **kwargs)[source]

Returned modified function

on_dependency_graph(*args, **kwargs)[source]

Returned modified function

on_destroy(widget, _dummy_event)[source]

Called when the application is exiting

  • destroy if everything OK
  • Prevent accidental loose of the currently modified model
on_display_states(widget)[source]

Display influencing simple places on the selected transition

This is a callback attached to the current ChartInfo object

Note

Influencing places control transitions via their conditions.

on_edit_constraints(widget)[source]

BioSignal constraints editor

on_frontier_scc(*args, **kwargs)[source]

Returned modified function

on_gui_doc_menu(widget)[source]

Go to the doc of the GUI

on_key_pressed(*args, **kwargs)[source]

Returned modified function

on_show_doc(widget)[source]

Go to the main documentation site

on_show_legend(widget)[source]

Show graph editor legend

on_simulate(*args, **kwargs)[source]

Returned modified function

on_stats_info(*args, **kwargs)[source]

Returned modified function

on_workflow_doc_menu(widget)[source]

Go to the example workflow

open_macro(macro_node)[source]

Open a MacroNode state in an other tab

Parameters:macro_node (<CMacroNode>) – MacroNode to be edited
refresh()[source]

TODO

save_choice()[source]

Dialog window used to confirm a choice “of file for save” (not used)

save_constraints(edit)[source]

Export the edited constraints to the model

set_current_edit_mvc(edm, w_destroy=True)[source]

Register and display a new current edit item

Key w_destroy:(optional) If True (default), the window and its children are destroyed.
show()[source]

Called during the launch of the GUI

switch_graph_page_callback(widget, page, page_index)[source]

Standard notebook call back

update(mnode)[source]

Observer method used by ChartControler to inform Charter that a MacroNode will be edited

=> Open the MacroNode in a new tab (but it is still linked to the current model)

win_register(window)[source]

Register a sub window This window will be destroyed when you connect its main widget event “destroy” to subwin_on_destroy()

used by: STATWindow, SCCWindow, BAGWindow, LegendWindow

win_remove(window)[source]

Destroy a sub window This window will be destroyed when you connect its main widget event “destroy” to subwin_on_destroy()

used by: STATWindow, SCCWindow, BAGWindow, LegendWindow

Graph views - ChartView

Main views for the Cadbiom gui

Classes available and inheritance hierarchy:

gtk.DrawingArea:
ChartView: Used by the graph editor window/page of charter
NavView: overview widget
gtk.Frame:
ChartPage: Graph editor window/page of charter
class cadbiom_gui.gt_gui.chart_view.ChartPage(width, height, drst, controler, model)[source]

A simple graph editor for pages: a graph area wrapped in a scroll window

attach(obs)[source]

standard in observer pattern

detach(obs)[source]

standard in observer pattern

notify(widget)[source]

used when the viewport is moved from inside (hbar and vbar)

update(dxx, dyy)[source]

Used when the viewport is moved from outside (navigator)

class cadbiom_gui.gt_gui.chart_view.ChartView(width, height, drawing_style, controler, model)[source]

Class for the main drawing window of charter

Note

Also instanciated by the overview widget.

Note

DrawingArea can capture key-press-events:

  • add gtk.gdk.KEY_PRESS_MASK mask to event
  • be sure that the DrawingArea has the focus by using grab_focus() on mouse events.

Todo

Optimize events handling:

  • on_motion_notify: Mouse over the widget, causing multiple calls to find_element() of the top node.
  • on_expose_event: When the window is covered/partially covered; all the pixmap is redrawn.
on_button_press(*args)[source]

On button_press event set the focus on the current widget, then redirect the event to the controller. We need this in order to test some keyboard shortcuts in the controller.

is_focus(): Determines if the widget is the focus widget within its toplevel. (This does not mean that the has-focus property is necessarily set; has-focus will only be set if the toplevel widget additionally has the global input focus.)

on_configure_event(widget, event)[source]

Initialisation and change in size

on_expose_event(widget, event)[source]

Redisplay drawing after cover and exposure of the window

update()[source]

Display a new drawing of the model

Notified by the model when changes have been made (move/delete/add item) Or by the ChartControler when a transition/node is selected.

zoom_minus()[source]

Zoom out function

zoom_plus()[source]

Zoom in function

class cadbiom_gui.gt_gui.chart_view.NavView(width, height, drst, controler, model)[source]

Specialized ChartView for navigator (used by the overview widget)

clear()[source]

As it says

on_configure_event(widget, event)[source]

Initialization and change in size

on_expose_event(widget, event)[source]

Redisplay drawing after cover and exposure of the window

scroll_update(xor, yor, width, height)[source]

Updating function used when the linked window is scrolled

update()[source]

Display a new drawing of the model

Notified by the model when changes have been made (move/delete/add item)

MVC management - EditMVC

Class for managing a triple (Model, View, Controler) associated with a model

class cadbiom_gui.gt_gui.edit_mvc.EditMVC(chart, model_name, model=None, layout=False)[source]

Editor object composed of a MVC pattern

Each instance of EditMVC is corresponding to an independant tab in the Cadbiom GUI.

We use the following classes:

ChartModel: Model ChartControler: Model controller NavControler: Overview controller

ChartPage: Graph editor container NavView: Graph editor overview

change_model(new_model)[source]

Change the model component

clean_subwin()[source]

As it says

connect(chart)[source]

Initialize the GUI when the user switches from an EditMVC to another

We connect the buttons and of the graphical interface to the components of the current EditMVC. Then the UI is sync with the current model

Parameters:chart (<Charter>) – Mainwindow class
disconnect(chart, w_destroy)[source]

Inverse connect operation

Parameters:w_destroy (<boolean>) – If true the window and its children are destroyed. If False, Subordinate windows are not destroyed.
display()[source]

Update and show

on_zoom_minus(widget)[source]

Zoom out

on_zoom_plus(widget)[source]

Zoom in

update(node, transition)[source]

Used in the observer pattern

win_register(win)[source]

Subordinate windows registration

win_remove(win)[source]

Subordinate windows are destroyed

GUI controllers

Main GUI controllers + auxiliary class (ChartClipboard)

class cadbiom_gui.gt_gui.chart_controler.ChartClipboard[source]

A clipboard used by ChartControler to handle the copy of nodes through models.

get_node()[source]

retrieve the current node in the clipboard

has_element()[source]

test if the clipboard has a registered node

has_macro()[source]

test if the clipboard has a registered macro node

put_node(node)[source]

register a chart model node in the clipboard

class cadbiom_gui.gt_gui.chart_controler.ChartControler(model, clipboard)[source]

Implement a controler for graphical views

Used by:

- the main graph editor widget as this
- NavControler for the overview widget through inheritance

Signals:

- current_change: Inform CharterInfo that the currently selected transition,
model or node has changed. Used to dispatch related information in the GUI.
- edit_node: Inform Charter that a MacroNode will be edited.

TODO: just show metadata on double click on another item => add a signal to inform CharterInfo objects

Parameters:
  • model (<ChartModel>) – Current chart model
  • mouse_role (<str>) – Mouse action “select”, “resizing”, “moving”
  • current_node (<CNode>) – Currently selected node
  • current_node_center (<tuple <float>,<float>>) – Tuple of coordinates (x, y) of the current node
  • current_handle (<int>) – Id of the node corner currently selected for resizing (only for MacroNodes)
  • current_transition (<CTransition>) – Currently selected transition
  • m_vscreen_coord (<tuple <float>,<float>>) – Mouse virtual screen coordinates (xloc, yloc)
  • lastx (<float>) – coordinates of last click in view
  • lasty (<float>) – coordinates of last click in view
  • clipboard (<ChartClipboard>) – Clipboard object used to copy nodes through models
  • drawing_style
  • signal_dict (<dict <str>:<list>>) – Structure to assign observers to each signal of ChartControler
  • gen_name (<generator>) – Generator of unique names for new nodes
  • node_copy_count (<generator>) – Generator of ints used in the naming of copied nodes
attach(signal, obs)[source]

Register an observer for the given signal

Parameters:
  • signal (<str>) – Name of the signal (“current_change” or “edit_node”)
  • obs (<CharterInfo> or <Charter>) – The observer
context_menu(event)[source]

Menu appearing on right click

detach(signal, obs)[source]

Remove an observer for the given signal

Parameters:
  • signal (<str>) – Name of the signal (“current_change” or “edit_node”)
  • obs (<CharterInfo> or <Charter>) – The observer
draft_transition(xmo, ymo)[source]

draw a transition arrow in dotted line @param xmo,ymo: mouse coordinates

menuitem_response(widget, action, item)[source]

Callback for the context menu described in context_menu()

Parameters:
  • action (<str>) – Option selected
  • item (<CTransition> or <CNode>) – Current selected node
  • widget – Widget that emitted the event
new_node(node_type)[source]

Creation of a new node

Called during the on_button_release() callback.

@param node_type: type of the node (string)

new_transition(xmo, ymo)[source]

Create a new transition

Called during the on_button_release() callback.

@param xmo, ymo: int mouse screen coordinates

nodes_names_generator()[source]

Return a generator of names for new nodes.

Names are generated in lexicographic order and we try to avoid names that are already in the model (this is important in order to avoid overwriting of nodes).

notify(signal)[source]

Emit a signal subsequently to a mouse action

  • current_change: Tell CharterInfo that the current selection has changed
  • edit_node: Tell Charter that the current MacroNode will be edited
Parameters:signal (<str>) – name of the signal
on_button_press(widget, event)[source]

Callback when a mouse button is pressed on the DrawingArea (contained in the ChartView object)

  • Detect the current element under the mouse (node or transition)

  • Select it, and notify observers

  • Interpret mouse actions according to the current mouse role:

    - Double click: Edit the node if it is a MacroNode
    - Left click: Resize (a MacroNode) or move
    - Right click: Open context menu
    

TODO: just show metadata on double click on another item

Parameters:
  • widget (<NavView> or <ChartView>) – gtk DrawingArea that emit the event
  • event (<gtk.gdk.Event>) – gdk mouse event with attributes (x, y)
on_button_release(widget, event)[source]

Callback when a mouse button is released on the DrawingArea (in the ChartView object)

Parameters:
  • widget (<NavView> or <ChartView>) – gtk DrawingArea that emit the event
  • event (<gtk.gdk.Event>) – gdk mouse event with attributes (x, y)
on_motion_notify(widget, event)[source]

Callback moving the cursor in the DrawingArea (in the ChartView object)

Parameters:
  • widget (<NavView> or <ChartView>) – gtk DrawingArea that emit the event
  • event (<gtk.gdk.Event>) – gdk mouse event with attributes (x, y)
remove_node_or_transition(item)[source]

Remove the given transition or the given node

Called by Charter object when Delete key is pressed, or when the Remove option is selected on the the context-menu hover an item on the DrawingArea.

Parameters:item (<CTransition> or <CNode> but not <CTopNode>) –
set_action_new_input_node(widget)[source]

As it says

set_action_new_macro_node(widget)[source]

As it says

set_action_new_perm_node(widget)[source]

As it says

set_action_new_simple_node(widget)[source]

As it says

set_action_new_start_node(widget)[source]

As it says

set_action_new_transition(widget)[source]

As it says

set_action_new_trap_node(widget)[source]

As it says

set_action_select(widget)[source]

As it says

set_mouse_role(role)[source]

As it says

set_view(view)[source]

As it says

class cadbiom_gui.gt_gui.chart_controler.NavControler[source]

Controler for navigation view (overview section in the GUI) Implement a controler for navigation views

attach(obs)[source]

observer management

detach(obs)[source]

observer management

notify(depx, depy)[source]

observer management

on_button_press(widget, event)[source]

action when a mouse button is pressed

on_button_release(widget, event)[source]

action when a mouse button is released

on_motion_notify(widget, event)[source]

callback

set_view(view)[source]

As it says

GUI auxiliary widgets - CharterInfo

Widget for displaying information on the elements of the model

CharterInfo: Contains 3 classes inheriting from Info:

ModelInfo NodeInfo TransInfo

class cadbiom_gui.gt_gui.charter_info.CharterInfo(frame)[source]

Windows for displaying information on the elements of the model

Contains 3 classes whose role is to update in real time the fields in the GUI about the currently selected transition, model or node.

This class is directly linked to the observers of the ChartControler thanks to the signal current_change.

display()[source]

Show all

enter_callback(widget, entry)[source]

return the entry

has_transition()[source]

As it says

set_controler(new_controler)[source]

Associate a controler in a MVC pattern

Note

attach current_change signal to the given controller.

Parameters:new_controler (<ChartControler>) – New ChartControler
switch_to(new_info)[source]

callback when info change

update(node, transition)[source]

Used if registered as an observer

class cadbiom_gui.gt_gui.charter_info.Info[source]

Abstract class

Implementing a “notes window” for metadata of transitions and nodes

Used by:

:class:`ModelInfo`
:class:`NodeInfo`
:class:`TransInfo`
display_note_window(title, note_text)[source]

Display a window with the given text content

Used to display notes from the selected transitions or nodes.

Parameters:
  • title (<str>) – Title of the window
  • note_text (<str>) – Text content to display
has_transition()[source]

Return the current transition

on_escape(widget, event)[source]

On ESC key_press_event, destroy this window.

save_note(widget)[source]

Save the current text modified in display_note_window

update(controler)[source]

Used when registered as an observer

warn_change()[source]

Called when ChartInfo is updated (Ex: save notes)

class cadbiom_gui.gt_gui.charter_info.ModelInfo(cin)[source]

Object used as a model - store information for CharterInfo

set_model(widget)[source]

Called when the name of the model has been modified by a user - set the name of the model, - then notify the model.

update(controler)[source]

when used as an observer

class cadbiom_gui.gt_gui.charter_info.NodeInfo(cin)[source]

A component of CharterInfo used for nodes

Todo

Display node notes; move notes code from TransInfo to Info

set_node(widget)[source]

Called when the node has been modified by a user - set the node settings, - then notify the model.

set_note(widget)[source]

Associate a text note to a node

Use the method of the parent class Info to display the note.

update(node)[source]

Used when registered as an observer

class cadbiom_gui.gt_gui.charter_info.TransInfo(cin)[source]

A component of CharterInfo used for transitions

has_transition()[source]

As it says

save_note(widget)[source]

register the note (deactivated for now)

set_note(widget)[source]

Associate a text note to a transition

Use the method of the parent class Info to display the note.

set_trans(widget)[source]

Called when the transition has been modified by a user (and after TransInfo update)

  • set the transition settings,
  • then notify the model.
update(trans)[source]

When registered as an observer

warn_change()[source]

As it says

GUI auxiliary widgets - Miscellaneous

Small widgets for Cadbiom gui:

- SearchManager: List of simple nodes for searching
- SearchFrontier: Same as SearchManager but specialized on frontier nodes
- LegendWindow: Widget to display the legend
- ImportPIDParam: Widget for model importing
- ImportBioPAXParams: Widget for BioPAX model importing
class cadbiom_gui.gt_gui.chart_misc_widgets.ImportBioPAXParams(chart, parent=None)[source]

Widget for BioPAX model importing

Note

requires biopax2cadbiom module

destroy()[source]

for parents

import_BioPAX_data(widget)[source]

Import from BioPAX data on triplestore

on_destroy(widget)[source]

standard destroy callback

on_escape(widget, event)[source]

On ESC key_press_event, destroy this window.

on_import_blacklist_file(widget)[source]

Choose blacklist file of entities

on_set_output_file(widget)[source]

Choose output model file

class cadbiom_gui.gt_gui.chart_misc_widgets.ImportPIDParam(chart, parent=None)[source]

Widget for model importing

ai_inter_rb_callback(widget, ai_name)[source]

set activator/inhibitor interpretation (and or or)

clock_rb_callback(widget, has_clock)[source]

set clock generation

destroy()[source]

for parents

import_from_pid_file(file)[source]

compile a pid file

on_destroy(widget)[source]

standard destroy callback

on_escape(widget, event)[source]

On ESC key_press_event, destroy this window.

on_import(widget)[source]

lauch import

class cadbiom_gui.gt_gui.chart_misc_widgets.LegendWindow(parent=None)[source]

Widget to display the legend

destroy()[source]

if registered as a child

on_destroy(widget)[source]

standard destroy callback

on_escape(widget, event)[source]

On ESC key_press_event, destroy this window.

class cadbiom_gui.gt_gui.chart_misc_widgets.SearchFrontier(chart, notebook, label)[source]

Same as SearchManager but specialized on frontier nodes

display_nodes()[source]

Display node names on the widget

get_frontier_node_names()[source]

As it says

class cadbiom_gui.gt_gui.chart_misc_widgets.SearchManager(chart, notebook, label)[source]

List of simple nodes for searching

Parameters:model_changed (<boolean>) – Flag updated to True by the model. Its value is True until the user clicks on the “update” button. This operation is manual since it can be costly.
clear()[source]

Remove all items

display_nodes()[source]

Display node names on the widget

  • On set_model() at the initialization of the model
  • On on_update() by a click on the button “update” by the user
get_selected_items()[source]

As it says

get_selected_or_matching_node_names()[source]

Get nodes names of interest

Methods used to find nodes:
  • nodes selected in the list of the GUI
  • parse regex inserted in the search entry

Note

selected items work in conjunction with regular expressions in the search entry.

Returns:List of names or None
Return type:<list <str>> or None
on_clear(widget)[source]

Clear button callback: Reset selected nodes, and search entry field

on_extract(widget)[source]

Extract nodes environment

  • Get selected nodes
  • Get all transitions of interest: - ori and ext nodes are concerned - ori or ext are concerned and the second node is a Start/Trap node
on_show(widget)[source]

Show button callback: Show nodes of interest in the graph editor

Transitions with conditions where the selected nodes are involved are also marked

on_update(widget)[source]

Update button callback: Sync the view of simple nodes with the model

set_model(model)[source]

Refresh the GUI with the given model

Called by set_current_edit_mvc() during the switch to a new/another tab/model.

update()[source]

The model informs observers that the model has changed

We keep this value to True until the user clicks on the “update” button.

Property checking - controllers & widgets

Collection of widgets for properties checking

Classes:

class cadbiom_gui.gt_gui.chart_checker.chart_checker_controler.ChartChecker(emvc, reporter, parent=None)[source]

Provides a GUI interface for query checking

destroy()[source]

call back adaptor

on_escape(widget, event)[source]

On ESC key_press_event, destroy this window.

class cadbiom_gui.gt_gui.chart_checker.chart_checker_controler.InhibWindow(l_solutions, emvc, reporter, parent)[source]

Show inhibitors of the current solution

Not used anymore (code disabled)

class cadbiom_gui.gt_gui.chart_checker.chart_checker_controler.PropertyVisitor[source]

Translate a SigExpression (condition of a transition) into a set of nodes that satisfy the condition.

Used to force the simulator to use nodes mentioned in a start property by the user.

Non mandatory nodes (inhibitors) are not retained. Activators can be accessed in the attribute ‘nodes’

visit_sig_ident(tnode)[source]

ident -> keep the node

visit_sig_not(node)[source]

translate a not

Do not retain the subnode if it is an “ident” node. Retain only subnodes if they are in a binary expression linked by a logical “and”.

Because:

  • not (a or b) is valid only if a and b are False; thus we don’t care of a and b
  • not (a and b) is valid only if a or b are True, or if a and b are False; thus a and b can be True alternately and it is sufficient for us.
visit_sig_sync(binnode)[source]

translate a binary (or/and) expression

class cadbiom_gui.gt_gui.chart_checker.chart_checker_controler.QueryCheckingForm(emvc, er_rep)[source]

General simple query checking; used by ChartChecker

Todo

Exemple example_model.bcx: Final property: “C” Start property: A and G

Pourquoi G se retrouve dans les places frontières des solutions et pas A ? Car c’est déjà une frontière et pas A… => bug ?

clean_subwin()[source]

destroy all registered subwindows

destroy()[source]

destroy all

get_frame()[source]

as name says

on_cond(widget)[source]

Launch solution computations If solutions are found, MAC search is unlocked.

on_entry_changed(widget)[source]

react in cas of change in entries

on_mac(widget)[source]

launch mac computations

on_solutions(widget)[source]

display solutions

on_yn(widget)[source]

lauch a satisfiability test

rb_callback(widget, idw)[source]

happen and never happen call back

win_register(win)[source]

register sub window for destroy

win_remove(win)[source]

used when the sub window destroys itself

class cadbiom_gui.gt_gui.chart_checker.chart_checker_controler.SolutionWindow(l_fsol, emvc, reporter, parent, title='')[source]

Show solutions (non-optimal or Minimal Activation Conditions)

build_button_frame(state_list, group=None)[source]

???

clean_subwin()[source]

sub windows management

create_solution_file(sol_file, all_bool)[source]

make a xml file with the current model

destroy()[source]

when leaving the window

on_chrono(widget)[source]

Show a chronogram of a trajectory initialized with solution

on_destroy(widget)[source]

when leaving the window

on_escape(widget, event)[source]

On ESC key_press_event, destroy this window.

on_inhib(widget)[source]

Compute inhibitors

on_save(widget, all_sol=True)[source]

open a window to save as xml file @param all_sol : boolean - True if we take all solutions

on_simul(widget)[source]

Launch simulation of a solution

Note

We also parse the start property since it can activate some places (other than frontiers), whose are required for the simulator to operate properly. Indeed, the simulator accepts to fire transitions only if places are activated for a given step.

Note

Mentionner une place frontière en start property va l’activer directement et graphiquement; init_places va donc la contenir et les solutions également. Cela n’est pas le cas pour une place autre, non frontière. Ici nous rétablissons simplement la liste de places init_places pour que le simulateur fonctionne correctement en activant dans le graph editor les bonnes places/transitions à chaque étape.

Todo

Mettre à jour les solutions en y ajoutant les places dans start property?

rb_callback(widget, id_frame)[source]

radio button call_back

win_register(win)[source]

sub windows management

win_remove(win)[source]

sub windows management

cadbiom_gui.gt_gui.chart_checker.chart_checker_controler.logical_and(list)[source]

@return: logical_formula: str - AND of the input list

Simulation - controllers & widgets

Controller and auxiliary widgets for simulations with gui.

class cadbiom_gui.gt_gui.chart_simulator.chart_simul_controler.ChartSimulControler(emvc, sim_option, reporter, init_places=None, icseq=None, parent=None)[source]

Control different parameters of a simulation and display panel

destroy()[source]

Used if chart_simul_controller is itself a secondary window

loop()[source]

temporized loop for automatic simulation

on_chrono(widget)[source]

setup chronogram

on_delay(widget)[source]

adjust the simulation timer

on_destroy(widget)[source]

destroy the windows after all secondary windows

on_escape(widget, event)[source]

On ESC key_press_event, destroy this window.

on_extract(widget, ex_type)[source]

extract the part of a model used in last simulation

on_init(widget)[source]

initialisation of the simulator

on_input_file_selected(widget)[source]

Choose an input file

on_reload(widget)[source]

reset the simulator

on_select_front(widget)[source]

selection of frontier activated places at initialization

on_select_whole(widget)[source]

selection of activated places at initialization

on_start(widget)[source]

start a simulation

on_step_simul(widget)[source]

callback for step by step simulation

set_input_file(filename)[source]

Open an input file

Test first line of the input file => must begin with one of these words: “$inputs” or “%”, or any word (full scenario, where the first line is a set of place names)

class cadbiom_gui.gt_gui.chart_simulator.chart_simul_controler.DisplayError(report, model_name, text=None)[source]

auxiliary widget for simulator

class cadbiom_gui.gt_gui.chart_simulator.chart_simul_controler.SelectPlaceWindow(simulator, frontier_bool)[source]

Select the activated place for initialization

create_init_file(file_name)[source]

make a txt file with the current selected places

destroy()[source]

as usual for aux widget

load_init_file(file_name)[source]

load a file to initialize the simulator

on_deselect(widget)[source]

???

on_load(widget)[source]

open a window to search xml file coming from PID database

on_save(widget)[source]

open a window to save initialization

on_select(widget)[source]

???

on_validate(widget)[source]

validate the choice of activated places

set_places()[source]

set the chosen activated places

class cadbiom_gui.gt_gui.chart_simulator.chart_simul_controler.ToggleFrontier(model, notebook, label)[source]

List of frontier nodes for searching

get_frontier_node_names()[source]

retrieve frontier nodes from the model

class cadbiom_gui.gt_gui.chart_simulator.chart_simul_controler.ToggleWholeModel(model, notebook, label)[source]

List of simple nodes for searching

get_selected_items()[source]

retrieve the selected items

Statical analysis - controllers & widgets

Collection of widgets and controlers for static analysis

class cadbiom_gui.gt_gui.chart_static.chart_stat_controler.BAGWindow(l_fsol, emvc, reporter, parent=None)[source]
build_button_frame(pair, group=None)[source]

???

create_solution_file(sol_file, all_bool)[source]

Print solutions in a file

display_info()[source]

???

class cadbiom_gui.gt_gui.chart_static.chart_stat_controler.ChartStatControler(emvc, reporter)[source]

Control of static analysis

/!This class is fully deprecated and is no longer used /!

clean_subwin()[source]

sub windows management

destroy()[source]

Standard call back

on_b_gene(widget)[source]

Compute basal activated genes

on_depgraph(widget)[source]

Computation and export of the dependance graph

on_destroy(widget)[source]

Standard call back

on_frontier(widget)[source]

Compute connected components which are on the frontier

on_stat(widget)[source]

Fill window with model information.

win_register(win)[source]

register a sub wundow

win_remove(win)[source]

unregister a sub window

class cadbiom_gui.gt_gui.chart_static.chart_stat_controler.DependencyGraphWindow(emvc, reporter, parent)[source]

Dialog for dependency graph analysis and export /!This class is fully deprecated and is no longer used /!

destroy()[source]

For linked windows

on_destroy(widget)[source]

Standard call back

on_save_dot(widget)[source]

compute a dependency graph and open a window to save as dot file

on_save_graphml(widget)[source]

compute a dependency graph and open a window to save as graphml file

rb_callback(widget, name)[source]

???

class cadbiom_gui.gt_gui.chart_static.chart_stat_controler.SCCWindow(l_fsol, emvc, reporter, parent=None)[source]

Class used for displaying frontier isolated components. This class is the matherclass for Basal Activated Genes, and Information windows linked to the current model (via Static Analysis menu).

build_button_frame(state_list, group=None)[source]

Display info on each isolated SCC

clean_subwin()[source]

sub windows management => useless, no subwin

create_solution_file(sol_file, all_bool)[source]

Print solutions in a file

destroy()[source]

when leaving the parent window

display_info()[source]

Display info on isolated SCC

on_destroy(widget)[source]

when leaving the window useless ? no sub window is created from this mother class and from subclasses…

on_escape(widget, event)[source]

On ESC key_press_event, destroy this window.

on_save(widget, all_sol=True)[source]

open a window to save as xml file @param all_sol : boolean - True if we take all solutions

rb_callback(widget, id_frame)[source]

radio button call_back

win_register(win)[source]

sub windows management => useless, no subwin

win_remove(win)[source]

sub windows management => useless, no subwin

class cadbiom_gui.gt_gui.chart_static.chart_stat_controler.STATWindow(stat, emvc, reporter, parent=None)[source]

Class for displaying statistics

build_button_frame(stat_str, group=None)[source]

???

create_solution_file(sol_file, all_bool)[source]

Print solutions in a file

display_info()[source]

???

Tools

Search areas management

Widgets for lists of nodes used in Cadbiom Gui

class cadbiom_gui.gt_gui.utils.listDisplay.ChoiceList(l_names, callback, title)[source]

Display a list with marks (this class is not used)

choice_selection_callback(widget, path, view_column)[source]

callback called when a choice is done

class cadbiom_gui.gt_gui.utils.listDisplay.ToggleList[source]

List view with toggle button (Simple/frontier nodes list)

clear()[source]

Remove all items

deselect_all()[source]

Deselect all items

get_pair_values()[source]

Retrieve the cas and word associated (pairs)

get_selected_items()[source]

Retrieve the names of the selected items

refresh(newlist)[source]

Rebuild the list

select_all()[source]

Select all items

set_list_pairs(l_pairs)[source]

initialize from a list of pairs - all unselected @param l_pairs: list< pair<string,bool> >

set_list_select(l_keywords)[source]

initialize from a list of name - all unselected @param l_keywords: list<string>

set_selected_items(selected_list)[source]

Set the check status of the given items in the GUI

Note

Given items are checked, others are unchecked.

toggled_col1_callback(cellrenderer, path)[source]

Callback for column1, called when toggled event is fired

Parameters:path – position of the cell in the list_item

Tabs decoration

Utilities for notebooks

cadbiom_gui.gt_gui.utils.notebookUtils.add_icon_to_button(button)[source]

Add a close button to tab Called by :meth:create_custom_tab

cadbiom_gui.gt_gui.utils.notebookUtils.create_custom_tab(text)[source]

Customized tab with label and close button

Returns:eventBox and tab button. eventBox is useful since it allows you to catch events for widgets which do not have their own window.
Return type:<tuple <gtk.EventBox>, <gtk.Button>>

Error reporters

To adapt message handling to different environment we use reporters

class cadbiom_gui.gt_gui.utils.reporter.CompilReporter[source]

register errors and info - must be checked after compilation memory contains all the messages

Used in the GUI to show Errors from the model checking functions.

display(mess, supl='')[source]

Combine the message with context information

display_info(mess, supl='')[source]

For information

reset()[source]

RAZ

set_context(mess)[source]

Context message: describe the context (transition for exp.)

class cadbiom_gui.gt_gui.utils.reporter.ErrorReporter(tview, model)[source]

Usefull for some tests where a header message is informative display messages in a textviewer

display(hdr, mes='')[source]

Build the message from mess and header

class cadbiom_gui.gt_gui.utils.reporter.SimpleErrorReporter[source]

Minimum reporter

display(mess)[source]

Set the error attribute and print the message

Text editors

Collection of widgets for text handling

class cadbiom_gui.gt_gui.utils.text_page.BioSignalEditor(name, master, on_leave)[source]

Biosignal simple editor - can load and save files

Used by the Charter to view/edit the constraints of a model.

@param on_leave: method to be used when quitting the editor

choose_file()[source]

As it says

get_text()[source]

As it says

on_destroy(widget, xxx=None)[source]

destroy callback

on_new(widget)[source]

Clear callback

on_open(widget)[source]

open a window to search .bsi file

on_save(widget)[source]

Save callback

on_save_as(widget)[source]

Save as callback

set_text(text)[source]

As it says

class cadbiom_gui.gt_gui.utils.text_page.TextArea(language=None)[source]

GtkSourceView with supplementary attributes

refresh_config(edit_config)[source]

As it says

class cadbiom_gui.gt_gui.utils.text_page.TextEditConfig[source]

Text editors configuration

class cadbiom_gui.gt_gui.utils.text_page.TextPage(language, edit_config=None)[source]

A simple text editor for pages

clear()[source]

RAZ of the buffer

get_text()[source]

Retrieve text from the buffer

insert_at_end(text)[source]

Insert text at the end of the buffer

is_modified(widget)[source]

Mark as modified

refresh_config(edit_config)[source]

Self explained

set_text(text)[source]

Put text in the buffer

Dialog boxes

A collection of warning widgets

class cadbiom_gui.gt_gui.utils.warn.DialogEntry(mess)[source]

Custom dialog entry

cadbiom_gui.gt_gui.utils.warn.cancel_warn(message)[source]

Error - imply cancellation of the action

cadbiom_gui.gt_gui.utils.warn.confirm(parent, message)[source]

Ask for action :return: Choice of the user (True/False) :rtype: <boolean>

cadbiom_gui.gt_gui.utils.warn.ok_warn(message, color=None)[source]

Simple warning before action

cadbiom_gui.gt_gui.utils.warn.start_warn(message)[source]

Warn for a start

cadbiom_gui.gt_gui.utils.warn.system_warn(message)[source]

Fatal error - bug or bd problems

Graph Editor Design

Drawing routines

A drawing style contains all the information to display a chart model and its items. We use essentially two styles Navigator and Plain corresponding to the two views displayed on the gui.

Classes available:

:class:`DrawingStyle`
    :class:`PlainDrawing`: For graph editor
    :class:`NavDrawing`: For overview widget
:class:`Arrow`: For Transitions
class cadbiom_gui.gt_gui.graphics.drawing_style.Arrow[source]

Generic arrow (Transition item)

draw(view, direct, pos)[source]

draw the arrow

class cadbiom_gui.gt_gui.graphics.drawing_style.DrawingStyle[source]

Abstract class for chart model drawing

draw_input(node, xfv, yfv, wfv, hfv)[source]

@param xfv: x coordinate of father in virtual view @param yfv: y coordinate of father in virtual view @param wfv: width of father in virtual view @param hfv: height of father in virtual view

draw_macro(node, xfv, yfv, wfv, hfv)[source]

@param xfv: x coordinate of father in virtual view @param yfv: y coordinate of father in virtual view @param wfv: width of father in virtual view @param hfv: height of father in virtual view

draw_perm(node, xfv, yfv, wfv, hfv)[source]

@param xfv: x coordinate of father in virtual view @param yfv: y coordinate of father in virtual view @param wfv: width of father in virtual view @param hfv: height of father in virtual view

draw_simple(node, xfv, yfv, wfv, hfv)[source]

@param xfv: x coordinate of father in virtual view @param yfv: y coordinate of father in virtual view @param wfv: width of father in virtual view @param hfv: height of father in virtual view

draw_start(node, xfv, yfv, wfv, hfv)[source]

@param xfv: x coordinate of father in virtual view @param yfv: y coordinate of father in virtual view @param wfv: width of father in virtual view @param hfv: height of father in virtual view

draw_top_node(node, xfv, yfv, wfv, hfv)[source]

@param xfv: x coordinate of father in virtual view @param yfv: y coordinate of father in virtual view @param wfv: width of father in virtual view @param hfv: height of father in virtual view

draw_transition(node, xfv, yfv, wfv, hfv)[source]

@param xfv: x coordinate of father in virtual view @param yfv: y coordinate of father in virtual view @param wfv: width of father in virtual view @param hfv: height of father in virtual view

draw_transition_group(tgr, xfv, yfv, wfv, hfv)[source]

Draw transitions with common extremities @param tgr: is a list of transitions with same extremities @param xfv,yfv: view coordinates of the macro node @param wfv,hfv: affinity ratios father node -> virtual screen

draw_trap(node, xfv, yfv, wfv, hfv)[source]

@param xfv: x coordinate of father in virtual view @param yfv: y coordinate of father in virtual view @param wfv: width of father in virtual view @param hfv: height of father in virtual view

visit_cinput_node(node)[source]

@return: (v_width, v_height, 0.0)

visit_cmacro_node(node)[source]

@return: (v_width, v_height, v_h_top_limit, handle_w_limit, handle_h_limit)

visit_cperm_node(node)[source]

@return: (v_width, v_height, v_h_top_limit)

visit_csimple_node(node)[source]

@return: (v_width, v_height, v_h_top_limit)

visit_cstart_node(node)[source]

@return: (v_width, v_height, 0.0)

visit_ctop_node(node)[source]

@return:(0.0, 0.0, 0.0)

visit_ctransition(node)[source]

@return: (v_w_detect_limit, v_h_detect_limit

visit_ctrap_node(node)[source]

@return: (v_width, v_height, 0.0)

class cadbiom_gui.gt_gui.graphics.drawing_style.NavDrawing[source]

Drawing style for the overview widget

draw_circle(node, xfv, yfv, wfv, hfv, fill, color)[source]

As it says

draw_macro(node, xfv, yfv, wfv, hfv)[source]

@param xfv: x coordinate of father in virtual view @param yfv: y coordinate of father in virtual view @param wfv: width of father in virtual view @param hfv: height of father in virtual view

draw_rectangle(node, xfv, yfv, wfv, hfv, fill, color)[source]

As it says

draw_transition_group(tgr, xfv, yfv, wfv, hfv)[source]

Draw transitions with common extremities @param tgr: is a list of transitions with same extremities @param xfv,yfv: view coordinates of the macro node @param wfv,hfv: affinity ratios father node -> virtual screen

visit_cinput_node(node)[source]

@return: (v_width, v_height, 0.0)

visit_cmacro_node(node)[source]

@return: (v_width, v_height, v_h_top_limit, handle_w_limit, handle_h_limit)

visit_cperm_node(node)[source]

@return: (v_width, v_height, v_h_top_limit)

visit_csimple_node(node)[source]

@return: (v_width, v_height, v_h_top_limit)

visit_cstart_node(node)[source]

@return: (v_width, v_height, 0.0)

visit_ctop_node(node)[source]

@return:(0.0, 0.0, 0.0)

visit_ctransition(node)[source]

@return: (v_w_detect_limit, v_h_detect_limit

visit_ctrap_node(node)[source]

@return: (v_width, v_height, 0.0)

class cadbiom_gui.gt_gui.graphics.drawing_style.PlainDrawing[source]

Main drawing style used in main window of charter

draw_edge_gen(view, xr1, yr1, xr2, yr2, hor, nnn, label, color)[source]

draw an edge

draw_macro(node, xfv, yfv, wfv, hfv)[source]

@param xfv: x coordinate of father in virtual view @param yfv: y coordinate of father in virtual view @param wfv: width of father in virtual view @param hfv: height of father in virtual view

draw_macro_node_gen(view, xxr, yyr, wir, her, hlabel, name, color, line_color)[source]

Rectangle with round corners

draw_node_gen(view, xxr, yyr, wir, her, name, color, line_color)[source]

@param xxr,yyr: coordinates in view @param wir, her: size in view

draw_perm(node, xfv, yfv, wfv, hfv)[source]

@param xfv: x coordinate of father in virtual view @param yfv: y coordinate of father in virtual view @param wfv: width of father in virtual view @param hfv: height of father in virtual view

draw_simple(node, xfv, yfv, wfv, hfv)[source]

@param xfv: x coordinate of father in virtual view @param yfv: y coordinate of father in virtual view @param wfv: width of father in virtual view @param hfv: height of father in virtual view

draw_transition(trans, x1v, y1v, x2v, y2v, nnn, hor, xfv, yfv)[source]

@param trans: the transition @param x1v, y1v: origin coordinates in virtual screen @param x2v, y2v: extremity coordinates in virtual screen @param xfv, yfv: father coordinate in virtual screen

draw_transition_group(tgr, xfv, yfv, wfv, hfv)[source]

Draw transitions with common extremities @param tgr: is a list of transitions with same extremities @param xfv, yfv: view coordinates of the macro node @param wfv, hfv: affinity ratios father node -> virtual screen

Layout routines

Layouts are performed by a visitor of the chart model

class cadbiom_gui.gt_gui.layout.LayoutVisitor(view, layout_style)[source]

Visitor used to do a gt graph layout

Available layouts:

- dot - "hierarchical" or layered drawings of directed graphs.
This is the default tool to use if edges have directionality.

- neato - "spring model" layouts.
This is the default tool to use if the graph is not too large
(about 100 nodes) and you don't know anything else about it.
Neato attempts to minimize a global energy function, which is equivalent
to statistical multi-dimensional scaling.

- fdp - "spring model" layouts similar to those of neato, but does
this by reducing forces rather than working with energy.

- sfdp - multiscale version of fdp for the layout of large graphs.

- twopi - radial layouts, after Graham Wills 97.
Nodes are placed on concentric circles depending their distance from a
given root node.

- circo - circular layout, after Six and Tollis 99, Kauffman and Wiese 02.
This is suitable for certain diagrams of multiple cyclic structures,
such as certain telecommunications networks.
visit_chart_model(model)[source]

Not used

visit_cinput_node(node)[source]

Not used

visit_cmacro_node(node)[source]

Layouts are done on each macro place Change the local coordinates of subnodes according to layout style

visit_cperm_node(node)[source]

Not used

visit_csimple_node(node)[source]

Not used

visit_cstart_node(node)[source]

Not used

visit_ctop_node(node)[source]

Same as macro node

visit_ctransition(trans)[source]

Not used

visit_ctrap_node(node)[source]

Not used