12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115 |
- <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"/>
- <parameter name="open_model"/>
- <parameter name="limited_mode"/>
- <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
- self.preload_model = open_model
- self.limited_mode = limited_mode
- 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">
- <parallel id="init">
- <state id="init" initial="init">
- <state id="init" initial="determine_initial">
- <state id="determine_initial">
- <transition cond="self.limited_mode" target="../progressbar"/>
- <transition cond="not self.limited_mode" target="../generic_toolbar"/>
- </state>
- <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="activity" target="../execute_activity"/>
- <transition event="create_activity" target="../create_activity"/>
- <transition event="modify_defined_attrs" target="../modify_defined_attrs">
- <parameter name="as_element"/>
- <parameter name="cs_element"/>
- <script>
- self.as_element = as_element
- self.cs_element = cs_element
- </script>
- </transition>
- <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>
- <transition cond="self.preload_model is not None" target="../open_model/search_metamodels">
- <script>
- global current_model
- current_model = self.preload_model
- self.preload_model = None
- </script>
- </transition>
- </state>
- <state id="modify_defined_attrs" initial="create_window">
- <state id="create_window">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'subwindow'"/>
- <parameter expr="'AttributeEditor'"/>
- <parameter expr="self.as_element"/>
- </raise>
- </onentry>
- <transition event="instance_created" target="../wait_for_finished">
- <parameter name="assoc_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="assoc_name"/>
- </raise>
- <script>
- self.current_window = assoc_name
- </script>
- </transition>
- </state>
- <state id="wait_for_finished">
- <transition event="close_window" target="../mark_dirty">
- <raise event="delete_instance" scope="cd">
- <parameter expr="self.current_window"/>
- </raise>
- </transition>
- </state>
- <state id="mark_dirty">
- <onentry>
- <raise event="mv_request" scope="broad">
- <parameter expr="'attr_assign'"/>
- <parameter expr="[current_rendered_model, self.cs_element, 'dirty', True]"/>
- </raise>
- </onentry>
- <transition event="mv_response" target="../../rerender_model"/>
- </state>
- </state>
- <state id="execute_activity" initial="open_window">
- <state id="open_window">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'subwindow'"/>
- <parameter expr="'ActivityExecutor'"/>
- </raise>
- </onentry>
- <transition event="instance_created" target="../waiting">
- <parameter name="assoc_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="assoc_name"/>
- </raise>
- <script>
- self.activity_executor = assoc_name
- </script>
- </transition>
- </state>
- <state id="waiting">
- <transition event="window_close" target="../../idle">
- <raise event="delete_instance" scope="cd">
- <parameter expr="self.activity_executor"/>
- </raise>
- </transition>
- </state>
- </state>
- <state id="create_activity" initial="open_window">
- <state id="open_window">
- <onentry>
- <raise event="create_instance" scope="cd">
- <parameter expr="'subwindow'"/>
- <parameter expr="'ActivityCreator'"/>
- </raise>
- </onentry>
- <transition event="instance_created" target="../waiting">
- <parameter name="assoc_name"/>
- <raise event="start_instance" scope="cd">
- <parameter expr="assoc_name"/>
- </raise>
- <script>
- self.activity_creator = assoc_name
- </script>
- </transition>
- </state>
- <state id="waiting">
- <transition event="window_close" target="../../idle">
- <raise event="delete_instance" scope="cd">
- <parameter expr="self.activity_creator"/>
- </raise>
- </transition>
- </state>
- </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="[{'abstract': current_metamodel, 'rendered': 'formalisms/MM_render'}, {'rendered': 'formalisms/MM_render'}]"/>
- </raise>
- <script>
- print("Finding transformation with current MM: " + current_metamodel)
- </script>
- </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>
- </state>
- <state id="key_status">
- <onentry>
- <script>
- global control_pressed
- control_pressed = False
- </script>
- </onentry>
- <state id="listening">
- <transition event="control" target=".">
- <script>
- global control_pressed
- control_pressed = True
- </script>
- </transition>
- <transition event="control-release" target=".">
- <script>
- global control_pressed
- control_pressed = False
- </script>
- </transition>
- </state>
- </state>
- </parallel>
- </scxml>
- </class>
|