123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957 |
- <class name="MainWindow">
- <relationships>
- <inheritance class="tk.Toplevel" priority="1"/>
- <inheritance class="SCCDWidget" priority="0"/>
- <association name="parent" class="A"/>
- <association name="generic_toolbars" class="Toolbar"/>
- <association name="model_toolbars" class="Toolbar"/>
- <association name="subwindow" class="Window"/>
- <association name="canvas" class="Canvas"/>
- <association name="progress_bar" class="ProgressBar"/>
- </relationships>
- <constructor>
- <super class="tk.TopLevel"/>
- <super class="SCCDWidget"/>
- <body>
- self.toolbar_frame = tk.Frame(self)
- self.canvas_frame = tk.Frame(self)
- self.progressbar_frame = tk.Frame(self)
- self.toolbar_frame.pack(fill=tk.X)
- self.canvas_frame.pack(fill=tk.BOTH, expand=tk.TRUE)
- self.progressbar_frame.pack(fill=tk.X)
- self.model_loaded = False
- global current_mapper
- current_mapper = None
- global current_rendered_model
- current_rendered_model = None
- global current_metamodel
- current_metamodel = None
- global current_model
- current_model = None
- </body>
- </constructor>
- <destructor>
- <body>
- self.destroy()
- </body>
- </destructor>
- <scxml initial="init">
- <state id="init" initial="generic_toolbar">
- <state id="generic_toolbar">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'generic_toolbars'"/>
- <parameter expr="'GenericToolbar'"/>
- <parameter expr="self.toolbar_frame"/>
- </raise>
- </onentry>
- <transition event="instance_created" target="../pack_generic">
- <parameter name="association_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="association_name"/>
- </raise>
- </transition>
- </state>
-
- <state id="pack_generic">
- <transition event="tk_widget" target="../progressbar">
- <parameter name="tk_elem"/>
- <script>
- tk_elem.pack(anchor=tk.NW)
- </script>
- </transition>
- </state>
- <state id="progressbar">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'progress_bar'"/>
- <parameter expr="'ProgressBar'"/>
- <parameter expr="{'parent': self.progressbar_frame}"/>
- </raise>
- </onentry>
- <transition event="instance_created" target="../pack_progressbar">
- <parameter name="association_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="association_name"/>
- </raise>
- </transition>
- </state>
- <state id="pack_progressbar">
- <transition event="tk_widget" target="../../running">
- <parameter name="tk_elem"/>
- <script>
- tk_elem.pack(side=tk.BOTTOM, fill=tk.X, expand=tk.TRUE)
- </script>
- </transition>
- </state>
- </state>
- <state id="running" initial="idle">
- <state id="idle">
- <onentry>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="0"/>
- <parameter expr="'Ready for action!'"/>
- </raise>
- </onentry>
- <transition event="create_new_model" target="../create_new_model"/>
- <transition event="open_model" target="../open_model"/>
- <transition event="rerender_model" target="../rerender_model"/>
- <transition event="new_rendered" cond="current_mapper is not None" target="../new_rendered"/>
- <transition event="verify" target="../verify_model"/>
- <transition event="conf_bottom" target="../conf_bottom"/>
- <transition event="custom_MM" target="../custom_MM"/>
- <transition event="upload_MVC" target="../upload_MVC"/>
- <transition event="add_object_diagrams" target="../add_object_diagrams"/>
- <transition event="change_metamodel" target="../change_metamodel">
- <parameter name="new_metamodel"/>
- <script>
- global current_metamodel
- current_metamodel = new_metamodel
- </script>
- </transition>
- <transition event="change_mapper" target="../change_mapper">
- <parameter name="new_mapper"/>
- <script>
- global current_mapper
- current_mapper = new_mapper
- print("Switch mapper to " + str(new_mapper))
- </script>
- </transition>
- <transition event="change_rendered" target="../change_rendered">
- <parameter name="new_rendered"/>
- <script>
- global current_rendered_model
- current_rendered_model = new_rendered
- </script>
- </transition>
- <transition event="select_for_creation" target=".">
- <parameter name="element_name"/>
- <raise event="select_for_creation" scope="narrow" target="'canvas'">
- <parameter expr="element_name"/>
- </raise>
- </transition>
- </state>
- <state id="add_object_diagrams" initial="init">
- <state id="init">
- <onentry>
- <raise event="mv_request" scope="broad">
- <parameter expr="'transformation_add_AL'"/>
- <parameter expr="[{'rendered': 'formalisms/MM_render', 'abstract': current_metamodel}, {'rendered': 'formalisms/MM_render'}, 'models/render_OD/' + current_metamodel, open('models/render_OD.alc', 'r').read()]"/>
- </raise>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="10"/>
- <parameter expr="'Adding transformation...'"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../modify_render_OD">
- <parameter name="context"/>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="25"/>
- <parameter expr="'Switching contexts...'"/>
- </raise>
- <script>
- self.context = context
- </script>
- </transition>
- <transition event="mv_exception" target="../../idle"/>
- </state>
- <state id="modify_render_OD" initial="exit">
- <onexit>
- <script>
- self.context = None
- </script>
- </onexit>
- <state id="exit">
- <onentry>
- <raise event="mv_request_context" scope="broad">
- <parameter expr="'exit'"/>
- <parameter expr="[]"/>
- <parameter expr="self.context"/>
- </raise>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="30"/>
- <parameter expr="'Modifying transformation merged metamodel...'"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../../../open_model/search_CS_mappers">
- <script>
- global current_mapper
- current_mapper = 'models/render_OD/' + current_metamodel
- </script>
- </transition>
- </state>
- </state>
- </state>
- <state id="upload_MVC" initial="load_code">
- <state id="load_code">
- <onentry>
- <script>
- from tkFileDialog import askopenfilename
- self.filename = askopenfilename()
- </script>
- </onentry>
- <transition cond="self.filename is not None" target="../overwriting_model">
- <raise event="mv_request" scope="broad">
- <parameter expr="'model_overwrite'"/>
- <parameter expr="[current_model, open(self.filename, 'r').read()]"/>
- </raise>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="10"/>
- <parameter expr="'Uploading model...'"/>
- </raise>
- </transition>
- <transition cond="self.filename is None" target="../../idle"/>
- </state>
- <state id="overwriting_model">
- <transition event="mv_response" target="../../rerender_model">
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="50"/>
- <parameter expr="'Rerendering model...'"/>
- </raise>
- </transition>
- </state>
- </state>
- <state id="change_metamodel">
- <onentry>
- <script>
- print("MM -> " + current_metamodel)
- </script>
- <raise event="mv_request" scope="broad">
- <parameter expr="'alter_context'"/>
- <parameter expr="[current_model, current_metamodel]"/>
- </raise>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="20"/>
- <parameter expr="'Storing model context...'"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../open_model/search_CS_mappers"/>
- </state>
- <state id="conf_bottom" initial="check_if_exists">
- <state id="check_if_exists">
- <transition cond="'formalisms/Bottom' in self.allowed_metamodels" target="../../idle"/>
- <transition cond="'formalisms/Bottom' not in self.allowed_metamodels" target="../add_bottom"/>
- </state>
- <state id="add_bottom">
- <onentry>
- <raise event="mv_request" scope="broad">
- <parameter expr="'conformance_add'"/>
- <parameter expr="[current_model, 'formalisms/Bottom']"/>
- </raise>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="10"/>
- <parameter expr="'Storing model context...'"/>
- </raise>
- <script>
- global current_metamodel
- current_metamodel = 'formalisms/Bottom'
- </script>
- </onentry>
- <transition event="mv_response" target="../../open_model/search_metamodels"/>
- </state>
- </state>
- <state id="custom_MM" initial="query">
- <state id="query">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'subwindow'"/>
- <parameter expr="'Browser'"/>
- <parameter expr="'Select metamodel to use.'"/>
- <parameter expr="['formalisms/SimpleClassDiagrams']"/>
- </raise>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="0"/>
- <parameter expr="'Browsing for metamodel...'"/>
- </raise>
- </onentry>
- <transition event="instance_created" target="../wait_for_metamodel">
- <parameter name="association_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="association_name"/>
- </raise>
- <script>
- self.subwindow = association_name
- </script>
- </transition>
- </state>
- <state id="wait_for_metamodel" initial="wait_for_result">
- <onentry>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="10"/>
- <parameter expr="'Browsing for model... OK'"/>
- </raise>
- </onentry>
- <state id="wait_for_result">
- <transition event="browse_result" cond="result not in self.allowed_metamodels" target="../got_result">
- <parameter name="result"/>
- <script>
- global current_metamodel
- current_metamodel = result
- </script>
- </transition>
- <transition event="close_window" target="../../../idle">
- <raise event="delete_instance" scope="cd">
- <parameter expr="self.subwindow"/>
- </raise>
- </transition>
- </state>
- <state id="got_result">
- <transition event="close_window" target="../mv_processing">
- <raise event="delete_instance" scope="cd">
- <parameter expr="self.subwindow"/>
- </raise>
- <raise event="mv_request" scope="broad">
- <parameter expr="'conformance_add'"/>
- <parameter expr="[current_model, current_metamodel]"/>
- </raise>
- </transition>
- </state>
- <state id="mv_processing">
- <transition event="mv_response" target="../../../open_model/search_metamodels"/>
- </state>
- </state>
- </state>
- <state id="change_mapper">
- <transition target="../open_model/search_CS_mappers"/>
- </state>
- <state id="change_rendered">
- <transition target="../rerender_model"/>
- </state>
- <state id="verify_model" initial="request">
- <state id="request">
- <onentry>
- <raise event="mv_request" scope="broad">
- <parameter expr="'verify'"/>
- <parameter expr="[current_model, current_metamodel]"/>
- </raise>
- </onentry>
- <transition event="mv_progress" target=".">
- <parameter name="result"/>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="result * 100"/>
- <parameter expr="'Verifying...'"/>
- </raise>
- </transition>
- <transition event="mv_response" target="../show_result">
- <parameter name="result"/>
- <raise event="create_instance" scope="cd">
- <parameter expr="'subwindow'"/>
- <parameter expr="'Popup'"/>
- <parameter expr="result"/>
- </raise>
- </transition>
- </state>
- <state id="show_result">
- <transition event="instance_created" target="../wait_for_close">
- <parameter name="assoc_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="assoc_name"/>
- </raise>
- </transition>
- </state>
- <state id="wait_for_close">
- <transition event="close_window" target="../../idle">
- <raise event="delete_instance" scope="cd">
- <parameter expr="'subwindow'"/>
- </raise>
- </transition>
- </state>
- </state>
- <state id="open_model" initial="query_model">
- <state id="query_model">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'subwindow'"/>
- <parameter expr="'Browser'"/>
- <parameter expr="'Select model to open'"/>
- <parameter expr="[]"/>
- </raise>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="0"/>
- <parameter expr="'Browsing for model...'"/>
- </raise>
- </onentry>
- <transition event="instance_created" target="../wait_for_model">
- <parameter name="association_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="association_name"/>
- </raise>
- <script>
- self.subwindow = association_name
- </script>
- </transition>
- </state>
- <state id="wait_for_model">
- <transition event="close_window" target="../../idle">
- <raise event="delete_instance" scope="cd">
- <parameter expr="self.subwindow"/>
- </raise>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="10"/>
- <parameter expr="'Browsing for model... OK'"/>
- </raise>
- </transition>
- <transition event="browse_result" target="../got_model">
- <parameter name="result"/>
- <script>
- global current_model
- current_model = result
- </script>
- </transition>
- </state>
- <state id="got_model">
- <transition event="close_window" target="../search_metamodels">
- <raise event="delete_instance" scope="cd">
- <parameter expr="self.subwindow"/>
- </raise>
- </transition>
- </state>
- <state id="search_metamodels">
- <onentry>
- <raise event="mv_request" scope="broad">
- <parameter expr="'model_types'"/>
- <parameter expr="[current_model]"/>
- </raise>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="10"/>
- <parameter expr="'Querying existing metamodels...'"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../search_CS_mappers">
- <parameter name="result"/>
- <script>
- global current_metamodel
- print("Allowed metamodels: " + str(result))
- if len(result) > 0:
- current_metamodel = next(iter(result))
- else:
- current_metamodel = 'formalisms/Bottom'
- self.allowed_metamodels = result
- </script>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="20"/>
- <parameter expr="'Querying existing metamodels... OK'"/>
- </raise>
- </transition>
- </state>
- <state id="search_CS_mappers">
- <onentry>
- <raise event="mv_request" scope="broad">
- <parameter expr="'transformation_between'"/>
- <parameter expr="[current_metamodel, 'formalisms/MM_render']"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../check_CS_mapper">
- <parameter name="result"/>
- <script>
- print("MM: " + str(current_metamodel))
- print("Allowed mappers: " + str(result))
- self.allowed_mappers = list(result)
- global current_mapper
- if len(result) > 0:
- if current_mapper not in result:
- current_mapper = next(iter(result))
- print("CHANGING MAPPER TO " + str(current_mapper))
- else:
- current_mapper = None
- print("REMOVING MAPPER")
- </script>
- </transition>
- </state>
- <state id="check_CS_mapper">
- <transition cond="current_mapper is None" target="../../rerender_model">
- <script>
- global current_rendered_model
- current_rendered_model = None
- self.allowed_rendered = []
- </script>
- <raise event="clear_canvas" scope="narrow" target="'canvas'"/>
- </transition>
- <transition cond="current_mapper is not None" target="../search_CS_rendered"/>
- </state>
- <state id="search_CS_rendered">
- <onentry>
- <raise event="mv_request" scope="broad">
- <parameter expr="'model_rendered'"/>
- <parameter expr="[current_model, current_mapper]"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../store_metamodel">
- <parameter name="result"/>
- <script>
- print("Allowed rendered: " + str(result))
- print("Current mapper: " + str(current_mapper))
- self.allowed_rendered = list(result)
- global current_rendered_model
- if (len(result) > 0):
- if current_rendered_model not in result:
- print("Reusing an existing rendered model")
- current_rendered_model = next(iter(result))
- else:
- print("Creating new rendered model!")
- current_rendered_model = "rendered/%s" % str(uuid.uuid4())
- self.allowed_rendered.append(current_rendered_model)
- </script>
- </transition>
- </state>
- <state id="store_metamodel">
- <onentry>
- <raise event="mv_request" scope="broad">
- <parameter expr="'alter_context'"/>
- <parameter expr="[current_model, current_metamodel]"/>
- </raise>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="45"/>
- <parameter expr="'Storing model context...'"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../../rerender_model"/>
- </state>
- </state>
- <state id="new_rendered">
- <onentry>
- <script>
- global current_rendered_model
- current_rendered_model = "rendered/%s" % str(uuid.uuid4())
- self.allowed_rendered.append(current_rendered_model)
- </script>
- </onentry>
- <transition target="../rerender_model"/>
- </state>
- <state id="create_new_model" initial="query_metamodel">
- <state id="query_metamodel">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'subwindow'"/>
- <parameter expr="'Browser'"/>
- <parameter expr="'Select metamodel to instantiate'"/>
- <parameter expr="['formalisms/SimpleClassDiagrams']"/>
- </raise>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="5"/>
- <parameter expr="'Browsing for metamodel...'"/>
- </raise>
- </onentry>
- <transition event="instance_created" target="../wait_for_metamodel">
- <parameter name="association_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="association_name"/>
- </raise>
- <script>
- self.subwindow = association_name
- </script>
- </transition>
- </state>
- <state id="wait_for_metamodel">
- <transition event="close_window" target="../../idle">
- <raise event="delete_instance" scope="cd">
- <parameter expr="self.subwindow"/>
- </raise>
- </transition>
- <transition event="browse_result" target="../got_mm">
- <parameter name="result"/>
- <script>
- global current_metamodel
- current_metamodel = result
- </script>
- </transition>
- </state>
- <state id="got_mm">
- <transition event="close_window" target="../prompt_model_name">
- <raise event="delete_instance" scope="cd">
- <parameter expr="self.subwindow"/>
- </raise>
- </transition>
- </state>
- <state id="prompt_model_name">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'subwindow'"/>
- <parameter expr="'PromptWindow'"/>
- <parameter expr="{'Model name': ''}"/>
- <parameter expr="{}"/>
- </raise>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="15"/>
- <parameter expr="'Prompt model name...'"/>
- </raise>
- </onentry>
- <transition event="instance_created" target="../waiting_for_model_name">
- <parameter name="association_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="association_name"/>
- </raise>
- <script>
- global current_model
- self.subwindow = association_name
- current_model = ""
- </script>
- </transition>
- </state>
- <state id="waiting_for_model_name">
- <transition event="prompt_results" target=".">
- <parameter name="results"/>
- <script>
- global current_model
- current_model = results["Model name"]
- </script>
- </transition>
- <transition event="close_window" cond="current_model != ''" target="../creating_model">
- <raise event="delete_instance" scope="cd">
- <parameter expr="self.subwindow"/>
- </raise>
- </transition>
- <transition event="close_window" cond="current_model == ''" target="../../idle">
- <raise event="delete_instance" scope="cd">
- <parameter expr="self.subwindow"/>
- </raise>
- </transition>
- </state>
- <state id="creating_model">
- <onentry>
- <raise event="mv_request" scope="broad">
- <parameter expr="'model_add'"/>
- <parameter expr="[current_model, current_metamodel, '']"/>
- </raise>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="25"/>
- <parameter expr="'Creating empty model...'"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../../open_model/search_metamodels">
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="50"/>
- <parameter expr="'Creating empty model... OK'"/>
- </raise>
- </transition>
- </state>
- </state>
- <state id="rerender_model" initial="initial_render">
- <state id="initial_render">
- <transition cond="self.model_loaded" target="../recreate_toolbars"/>
- <transition cond="not self.model_loaded" target="../canvas">
- <script>
- self.model_loaded = True
- </script>
- </transition>
- </state>
- <state id="recreate_toolbars" initial="waiting">
- <onentry>
- <raise event="close" scope="narrow" target="'model_toolbars'"/>
- <script>
- self.nr_toolbars = 3
- </script>
- </onentry>
- <state id="waiting">
- <transition event="close_window" target=".">
- <script>
- self.nr_toolbars -= 1
- </script>
- </transition>
- <transition cond="self.nr_toolbars == 0" target="../close_all"/>
- </state>
- <state id="close_all">
- <transition target="../../model_toolbars">
- <raise event="delete_instance" scope="cd">
- <parameter expr="'model_toolbars'"/>
- </raise>
- </transition>
- </state>
- </state>
- <state id="canvas">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'canvas'"/>
- <parameter expr="'Canvas'"/>
- <parameter expr="self.canvas_frame"/>
- </raise>
- </onentry>
-
- <transition event="instance_created" target="../pack_canvas">
- <parameter name="association_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="association_name"/>
- </raise>
- </transition>
- </state>
- <state id="pack_canvas">
- <transition event="tk_widget" target="../model_toolbars">
- <parameter name="tk_elem"/>
- <script>
- tk_elem.pack(fill=tk.BOTH, expand=tk.TRUE)
- </script>
- </transition>
- </state>
- <state id="model_toolbars" initial="mm_toolbar">
- <state id="mm_toolbar">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'model_toolbars'"/>
- <parameter expr="'MetamodellingToolbar'"/>
- <parameter expr="self.toolbar_frame"/>
- <parameter expr="current_metamodel"/>
- <parameter expr="self.allowed_metamodels"/>
- </raise>
- </onentry>
- <transition event="instance_created" target="../pack_mm_toolbar">
- <parameter name="association_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="association_name"/>
- </raise>
- </transition>
- </state>
- <state id="pack_mm_toolbar">
- <transition event="tk_widget" target="../cs_toolbar">
- <parameter name="tk_elem"/>
- <script>
- tk_elem.pack(anchor=tk.W)
- </script>
- </transition>
- </state>
- <state id="cs_toolbar">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'model_toolbars'"/>
- <parameter expr="'ConcreteSyntaxToolbar'"/>
- <parameter expr="self.toolbar_frame"/>
- <parameter expr="self.allowed_mappers"/>
- <parameter expr="self.allowed_rendered"/>
- </raise>
- </onentry>
- <transition event="instance_created" target="../pack_cs_toolbar">
- <parameter name="association_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="association_name"/>
- </raise>
- </transition>
- </state>
- <state id="pack_cs_toolbar">
- <transition event="tk_widget" target="../fetch_types">
- <parameter name="tk_elem"/>
- <script>
- tk_elem.pack(anchor=tk.W)
- </script>
- </transition>
- </state>
- <state id="fetch_types">
- <onentry>
- <raise event="mv_request" scope="broad">
- <parameter expr="'types'"/>
- <parameter expr="[current_model]"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../dsl_toolbar">
- <parameter name="result"/>
- <raise event="create_instance" scope="cd">
- <parameter expr="'model_toolbars'"/>
- <parameter expr="'DSLToolbar'"/>
- <parameter expr="self.toolbar_frame"/>
- <parameter expr="result"/>
- </raise>
- </transition>
- </state>
- <state id="dsl_toolbar">
- <transition event="instance_created" target="../pack_dsl_toolbar">
- <parameter name="association_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="association_name"/>
- </raise>
- </transition>
- </state>
- <state id="pack_dsl_toolbar">
- <transition event="tk_widget" cond="current_mapper is None" target="../../../idle">
- <parameter name="tk_elem"/>
- <script>
- tk_elem.pack(anchor=tk.W)
- </script>
- </transition>
- <transition event="tk_widget" cond="current_mapper is not None" target="../../request_render">
- <parameter name="tk_elem"/>
- <script>
- tk_elem.pack(anchor=tk.W)
- </script>
- </transition>
- </state>
- </state>
- <state id="request_render">
- <onentry>
- <raise event="mv_request" scope="broad">
- <parameter expr="'model_render'"/>
- <parameter expr="[current_model, current_mapper, current_rendered_model]"/>
- </raise>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="50"/>
- <parameter expr="'Perceptualizing model...'"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../render_model">
- <parameter name="result"/>
- <script>
- self.rendered = result
- </script>
- </transition>
- <transition event="mv_exception" target="../../../close"/>
- </state>
- <state id="render_model" initial="allocate_groups">
- <onentry>
- <raise event="update_status" scope="narrow" target="'progress_bar'">
- <parameter expr="80"/>
- <parameter expr="'Perceptualizing model... OK'"/>
- </raise>
- <raise event="clear_canvas" scope="narrow" target="'canvas'"/>
- <script>
- self.groups = [i for i in self.rendered if i["type"] == "Group"]
- self.contains = [i for i in self.rendered if i["type"] == "contains"]
- self.rendered = [i for i in self.rendered if i["type"] not in ["Group", "contains"]]
- self.rendered.reverse()
- </script>
- <raise event="mv_request" scope="broad">
- <parameter expr="'alter_context'"/>
- <parameter expr="[current_rendered_model, 'formalisms/MM_render']"/>
- </raise>
- </onentry>
- <state id="allocate_groups">
- <transition cond="len(self.groups) > 0" target="../allocating_group">
- <raise event="define_group" scope="narrow" target="'canvas'">
- <parameter expr="self.groups.pop()"/>
- </raise>
- </transition>
- <transition cond="len(self.groups) == 0" target="../allocate_contains"/>
- </state>
- <state id="allocating_group">
- <transition event="group_ready" target="../allocate_groups"/>
- </state>
- <state id="allocate_contains">
- <transition cond="len(self.contains) > 0" target=".">
- <raise event="define_contains" scope="narrow" target="'canvas'">
- <parameter expr="self.contains.pop()"/>
- </raise>
- </transition>
- <transition cond="len(self.contains) == 0" target="../render_elements"/>
- </state>
- <state id="render_elements">
- <transition cond="len(self.rendered) > 0" target=".">
- <raise event="draw_canvas" scope="narrow" target="'canvas'">
- <parameter expr="self.rendered.pop()"/>
- </raise>
- </transition>
- <transition cond="len(self.rendered) == 0" target="../../../idle"/>
- </state>
- </state>
- </state>
- <transition event="window-close" cond="ID == id(self)" target="../close">
- <parameter name="ID"/>
- </transition>
- </state>
- <state id="close">
- <onentry>
- <raise event="close_window" scope="narrow" target="'parent'"/>
- </onentry>
- </state>
- </scxml>
- </class>
|