You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(57) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(151) |
Mar
(131) |
Apr
(171) |
May
(125) |
Jun
(43) |
Jul
(26) |
Aug
(19) |
Sep
(10) |
Oct
|
Nov
(4) |
Dec
(28) |
| 2004 |
Jan
(134) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <de...@us...> - 2004-01-07 01:48:22
|
Update of /cvsroot/pymerase/smw/smw/profiles In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/profiles Added Files: __init__.py Log Message: Imported version of SMW downloaded on 2003 Apr 14 --- NEW FILE: __init__.py --- |
Update of /cvsroot/pymerase/smw/smw/modeler/UML/unittest
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/modeler/UML/unittest
Added Files:
__init__.py testRelink.py testUMLActivityEditor.py
testUMLCollaborationEditor.py testUMLCollaborationPE.py
testUMLCore2.py testUMLCoreEditor.py testUMLCorePE.py
testUMLSCEditor.py testUMLSCPE.py testUMLSDEditor.py
testUMLUseCaseEditor.py testUMLUseCasePE.py
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: __init__.py ---
--- NEW FILE: testRelink.py ---
import unittest
import sys
from smw.modeler import modelerApp
from smw.modeler.DiagramEditor import *
from smw.modeler.UML.UMLCoreEditor import *
class RelinkTest(unittest.TestCase):
def testQt(self):
import qt
def testRelink(self):
smw=modelerApp.modelerApp()
smw.main(loop=0,args=["--profile","UML14"])
dem=None
for e in smw.project.editorSet.editors():
if isinstance(e,DiagramEditorManager):
dem=e
assert(dem)
print smw.project.getRoot()
editor=dem.subEditors[0]
assert(editor)
clas=[]
for x in range(2):
c=editor.addClass(point=[10+x*200,100],name="Class"+str(x))
dem.notifyFocusOn(c,None)
clas.append(c)
c=editor.addClass(point=[150,200],name="Class3")
clas.append(c)
dem.notifyFocusOn(c,None)
assoc=editor.addAssociation(clas[0].presentation[0],clas[1].presentation[0],[[110,100],[210,100]])
dem.notifyFocusOn(assoc,None)
smw.processEvents()
if assoc.presentation[1].canConnectTo(clas[2],1):
assoc.presentation[1].connectTo(clas[2],clas[2].presentation[0],1)
smw.processEvents()
dep=editor.addDependency(clas[0].presentation[0],clas[1].presentation[0],[[110,100],[210,100]])
dem.notifyFocusOn(dep,None)
smw.processEvents()
if dep.presentation[1].canConnectTo(clas[2],1):
dep.presentation[1].connectTo(clas[2],clas[2].presentation[0],1)
dem.notifyFocusOn(dep,None)
smw.processEvents()
gen=editor.addGeneralization(clas[0].presentation[0],clas[1].presentation[0],[[110,100],[210,100]])
dem.notifyFocusOn(gen,None)
if gen.presentation[0].canConnectTo(clas[2],1):
gen.presentation[0].connectTo(clas[2],clas[2].presentation[0],1)
dem.notifyFocusOn(gen,None)
if dep.presentation[1].canConnectTo(clas[1],0):
dep.presentation[1].connectTo(clas[1],clas[1].presentation[0],0)
dem.notifyFocusOn(dep,None)
smw.processEvents()
if gen.presentation[0].canConnectTo(clas[2],0):
gen.presentation[0].connectTo(clas[2],clas[2].presentation[0],0)
dem.notifyFocusOn(gen,None)
smw.processEvents()
if assoc.presentation[1].canConnectTo(clas[2],0):
assoc.presentation[1].connectTo(clas[2],clas[2].presentation[0],0)
dem.notifyFocusOn(assoc,None)
smw.processEvents()
#test link with "another link"
#DO NOT test this. The editor does not support this
#dep2=editor.addDependency(clas[2].presentation[0],dep.presentation[1],[[110,100],[210,100]])
#gen2=editor.addGeneralization(clas[2].presentation[0],gen.presentation[0],[[110,100],[210,100]])
#assoc2=editor.addAssociation(clas[2].presentation[0],assoc.presentation[1],[[110,100],[210,100]])
smw.processEvents()
editor.selectAll()
editor.deleteSelection()
smw.processEvents()
smw.undo()
smw.processEvents()
smw.processEvents()
for i in range(5):
editor.zoomOutTool()
smw.processEvents()
for i in range(5):
editor.zoomInTool()
smw.processEvents()
smw.closeProject()
if __name__ == '__main__':
unittest.main()
--- NEW FILE: testUMLActivityEditor.py ---
from smw.testdriver.DiagramEditorTester import *
from smw.modeler.UML.UMLADEditor import *
t=DiagramEditorTester()
e=t.getMainEditor()
c=e.addClass([100,100])
ad=e.addActivityDiagram(c)
editor=t.getCurrentEditor()
print editor
assert(isinstance(editor,UMLActivityDiagramE))
t.testEditor(
editor,
["addADDecisionTool","addADActionStateTool","addADSwimlaneTool"],[
["addADTransitionTool",["addADStateTool","addADDecisionTool","addADActionStateTool"],
["addADDecisionTool","addADFinalStateTool","addADActionStateTool"]
]
])
--- NEW FILE: testUMLCollaborationEditor.py ---
from smw.testdriver.DiagramEditorTester import *
from smw.modeler.UML.UMLCollaborationEditor import *
t=DiagramEditorTester()
e=t.getMainEditor()
c1=e.addClass([100,100])
#c2=e.addClass([200,100])
assoc=e.addAssociation(c1.presentation[0],
c1.presentation[0],
[ [100,100],[100,100]])
ad=e.addCollaborationDiagram(c1)
editor=t.getCurrentEditor()
assert(isinstance(editor,UMLCollaborationDiagramE))
t.testEditor(
editor,
["addCollInstanceTool","addCollCommentTool"],[
["addCollLinkTool",["addCollInstanceTool"],
["addCollInstanceTool"]
]
## ["addCollGeneralizationTool",["addClassifierRoleTool"],
## ["addClassifierRoleTool"]
## ]
]
)
--- NEW FILE: testUMLCollaborationPE.py ---
from smw.testdriver.PropertyEditorTester import *
from smw.metamodel import UML14
from smw.modeler.UML.UMLInstanceEditor import *
tester=PEtester(UML14)
tester.test(UMLInstancePE,)
--- NEW FILE: testUMLCore2.py ---
from smw.testdriver.DiagramEditorTester import *
t=DiagramEditorTester(profile="UML14")
t.testEditor(t.getMainEditor(),
["addCommentTool","addClassTool","addPackageTool","addActorTool","addInterfaceTool","addSubsystemTool"],
[ ["addAssociationTool",
["addClassTool","addInterfaceTool","addActorTool"],
["addClassTool"]
],
["addDependencyTool",
["addClassTool"],["addClassTool"]
],
])
##t.testActionCombo(t.getMainEditor(),"addClassTool","addClassTool","addGeneralizationTool",selfLink=0)
##t.testCreateInside(t.getMainEditor(),
## "addPackageTool",
## ["addCommentTool","addClassTool","addPackageTool","addActorTool","addInterfaceTool","addSubsystemTool"]
## )
##t.testCreateInside(t.getMainEditor(),
## "addSubsystemTool",
## ["addCommentTool","addClassTool","addPackageTool","addActorTool","addInterfaceTool","addSubsystemTool"]
## )
t.testCreateDiagram(t.getMainEditor(),
"addClassTool",t.getMainEditor().addStateMachine)
--- NEW FILE: testUMLCoreEditor.py ---
import unittest
import sys
from smw.modeler import modelerApp
from smw.modeler.DiagramEditor import *
from smw.modeler.UML.UMLCoreEditor import *
class smwAppTest(unittest.TestCase):
def testQt(self):
import qt
def testCore(self):
smw=modelerApp.modelerApp()
smw.main(loop=0,args=["--profile","UML14"])
dem=None
for e in smw.project.editorSet.editors():
if isinstance(e,DiagramEditorManager):
dem=e
assert(dem)
print smw.project.getRoot()
editor=dem.subEditors[0]
assert(editor)
c1=[]
for x in range(5):
c1.append(editor.addClass(point=[10+x*100,40],name="A"+str(x)))
dem.notifyFocusOn(c1[x],None)
c2=[]
for x in range(5):
c2.append(editor.addClass(point=[10+x*100,130],name="B"+str(x)))
for x in range(5):
z=editor.addComment(point=[400,10+50*x],name="C"+str(x))
z.body="""
Institutionen för informationsbehandling vid Åbo Akademi
ansvarar för två utbildningsprogram. Det ena med
informationsbehandling som huvudämne omfattar 160 studieveckor
och leder till fil.mag-examen medan det andra med datateknik som
huvudämne omfattar 180 studieveckor och leder till
dipl.ing-examen. Inom ramen för Turku Centre for Computer Science
(TUCS) ges kurser på engelska både på fördjupad nivå och för
forskarstuderande."""
dem.notifyFocusOn(z,None)
smw.processEvents()
assoc=[]
for x in range(5):
e=editor.addGeneralization(c1[x].presentation[0],
c2[x].presentation[0], [ [30+x*100,50],[30+x*100,100]])
dem.notifyFocusOn(e,None)
smw.processEvents()
e=editor.addDependency(c1[x].presentation[0],
c2[x].presentation[0],
[ [50+x*100,50],[50+x*100,100]])
dem.notifyFocusOn(e,None)
smw.processEvents()
e=editor.addAssociation(c1[x].presentation[0],
c2[x].presentation[0],
[ [70+x*100,50],[70+x*100,100]])
assoc.append(e.presentation[0])
dem.notifyFocusOn(e,None)
e=editor.addAssociation(c1[x].presentation[0],
c1[x].presentation[0],
[ [70+x*100,50],[70+x*100,100]])
assoc.append(e.presentation[0])
dem.notifyFocusOn(e,None)
smw.processEvents()
for x in range(5):
editor.selectPresentation(assoc[5+x])
editor.hideSelection()
for x in range(5):
editor.selectPresentation(assoc[x])
editor.deleteSelection()
for x in range(5):
e=editor.addActor(point=[10+x*100,250],name="Actor"+str(x))
dem.notifyFocusOn(e,None)
smw.processEvents()
for x in range(5):
e=editor.addPackage(point=[10+x*100,350],name="P"+str(x))
dem.notifyFocusOn(e,None)
for x in range(10):
editor.zoomOutTool()
smw.processEvents()
for x in range(5):
editor.zoomInTool()
smw.processEvents()
oldW = editor.xSize
e=editor.addClass(point=[editor.xSize-20,50],name="just a test")
dem.notifyFocusOn(e,None)
assert(editor.xSize>oldW)
oldH = editor.ySize
e=editor.addClass(point=[100,editor.ySize-20],name="height test")
dem.notifyFocusOn(e,None)
assert(editor.ySize>oldH)
print "Saving"
smw.saveProjectAs("test.iml")
editor.selectAll()
smw.processEvents()
editor.deleteSelection()
smw.saveProjectAs("test2.iml")
smw.processEvents()
smw.undo()
smw.saveProjectAs("test3.iml")
smw.redo()
smw.saveProjectAs("test4.iml")
smw.processEvents()
smw.undo()
#smw.exec_loop()
for c in c1:
editor.addStateMachine(c)
smw.processEvents()
smw.processEvents()
if __name__ == '__main__':
unittest.main()
--- NEW FILE: testUMLCorePE.py ---
from smw.testdriver.PropertyEditorTester import *
from smw.modeler.UML.UMLCorePE import *
from smw.metamodel import UML14
from smw.modeler import DialogEditor
from smw.modeler.Shell import SMWShell
tester=PEtester(UML14)
tester.test(UMLModelElementPE)
tester.test(UMLAssociationPE)
A=UML14.Class(name="A")
B=UML14.Class(name="B")
as=UML14.Association(name="test",
connection=[UML14.AssociationEnd(name="ae1",
participant=A),
UML14.AssociationEnd(name="ae2",
participant=B)
])
td=TagDefinition(name="testTaggDef",
tagType="UML::Datatypes::String",
namespace=B,
multiplicity=Multiplicity())
td.multiplicity.range.add(
MultiplicityRange(multiplicity=td.multiplicity,lower=1,upper=1))
tv=TaggedValue(name="testTaggedVal",dataValue="",
modelElement=B,
type=td)
B.taggedValue.append(tv)
tester.test(UMLAssociationPE,[as])
A.feature.insert(Attribute(name="X",type=B))
tester.test(UMLAttributePE)
tester.test(UMLDocumentationPE)
tester.test(UMLAttributeListPE,[A])
p=UML14.Parameter(name="test",type=Class(name="int"))
o=Operation(name="op")
o.parameter.insert(p)
B.feature.insert(o)
tester.test(UMLOperationPE,[o])
tester.test(UMLOperationListPE,[B])
hifi=UML14.Stereotype(name="stereo",extendedElement=[B],owner=B,namespace=B)
B.stereotype.append(hifi)
m=UML14.Method(name="aMethod",body=UML14.ProcedureExpression(body="hejhopp",language="Java"))
m.parameter.insert(p)
B.feature.insert(m)
tester.test(UMLMethodPE,[m])
tester.test(UMLMethodListPE,[B])
tester.test(UMLParameterPE,[p])
tester.test(UMLParameterListPE,[o,m])
tester.test(UMLTaggedValuePE,[tv])
tester.test(UMLTagDefinitionPE,[tv])
tester.test(UMLTaggedValueListPE,[B])
tester.test(UMLStereotypeListPE,[B])
tester.test(UMLStereotypePE,[hifi])
tester.test(UMLClassPE,[A,B])
tester.test(UMLActionStatePE)
Q=Class(name="åäö")
tester.test(ElementDE,[Q])
sub=Subsystem(name="mySystem")
op=Operation(name="operation")
sub.feature.insert(o)
sub.feature.insert(op)
tester.test(UMLSubsystemPE,[sub])
tester.test(UMLExtensionPointPE)
tester.test(UMLExtensionPointListPE)
tester.test(SMWShell)
tester.test(UMLConstraintPE)
tester.test(UMLConstraintListPE)
--- NEW FILE: testUMLSCEditor.py ---
from smw.testdriver.DiagramEditorTester import *
from smw.modeler.UML.UMLSCEditor import *
t=DiagramEditorTester()
e=t.getMainEditor()
c=e.addClass([100,100])
sm=e.addStateMachine(c)
editor=t.getCurrentEditor()
assert(isinstance(editor,UMLStateMachineDiagramE))
t.testEditor(
editor,
["addStateTool","addInitialVertexTool","addFinalStateTool",
"addForkJoinVertexTool","addHistoryStateTool","addSynchStateTool",
"addChoiceTool"],
[
["addTransitionTool",
["addStateTool","addInitialVertexTool"],["addStateTool"]]
])
--- NEW FILE: testUMLSCPE.py ---
from smw.testdriver.PropertyEditorTester import *
from smw.modeler.UML.UMLSCEditor import *
from smw.metamodel import UML14
tester=PEtester(UML14)
for e in [
UMLInternalTransitionsDE,
UMLChoiceDE,
UMLStateDE,
UMLTransitionDE,
UMLSynchStateDE,
UMLStateMachineDE,
]:
tester.test(e)
--- NEW FILE: testUMLSDEditor.py ---
from smw.testdriver.DiagramEditorTester import *
from smw.modeler.UML.UMLSDEditor import *
t=DiagramEditorTester()
e=t.getMainEditor()
p=e.addPackage([100,100])
c=e.addClass([100,100])
c.namespace=p
act=e.addActor([150,150])
act.namespace=p
op=Operation(name="op")
c.feature.append(op)
op2=Operation(name="op2")
act.feature.append(op2)
assoc=e.addAssociation(c.presentation[0],
c.presentation[0],
[ [100,100],[100,100]])
assoc2=e.addAssociation(c.presentation[0],
act.presentation[0],
[ [100,100],[150,150]])
seq=e.addSequenceDiagram(p)
editor=t.getCurrentEditor()
assert(isinstance(editor,UMLSequenceDiagramE))
t.testEditor(
editor,
["addSDActorTool","addSDObjectTool","addSDCommentTool"],[
["addSDProcedureCallTool",["addSDObjectTool","addSDActorTool"],
["addSDObjectTool"]
],
["addSDReturnTool",["addSDObjectTool"],
["addSDObjectTool","addSDActorTool"]
],
["addSDCreateActionTool",["addSDObjectTool"],
["addSDObjectTool","addSDActorTool"]
],
["addSDTerminateActionTool",["addSDObjectTool"],
["addSDObjectTool","addSDActorTool"]
]
])
--- NEW FILE: testUMLUseCaseEditor.py ---
from smw.testdriver.DiagramEditorTester import *
from smw.modeler.UML.UMLUCEditor import *
t=DiagramEditorTester()
e=t.getMainEditor()
c=e.addClass([100,100])
use=e.addUseCaseDiagram(c)
editor=t.getCurrentEditor()
print editor
assert(isinstance(editor,UMLUseCaseE))
t.testEditor(
editor,
["addUCInterfaceTool","addUCActorTool","addUCUseCaseTool","addUCSystemBoundaryTool"],[
["addUCDependencyTool",["addUCInterfaceTool"],
["addUCActorTool","addUCUseCaseTool"]
],
["addUCGeneralizationTool",["addUCActorTool"],
["addUCActorTool"]
],
["addUCIncludeTool",["addUCUseCaseTool"],
["addUCUseCaseTool"]
],
["addUCAssociationTool",["addUCUseCaseTool",],
["addUCActorTool"]
],
["addUCExtendTool",["addUCUseCaseTool",],
["addUCUseCaseTool"]
]
])
--- NEW FILE: testUMLUseCasePE.py ---
from smw.testdriver.PropertyEditorTester import *
from smw.metamodel import UML14
from smw.modeler.UML.UMLExtensionPointPE import *
from smw.modeler.UML.UMLCorePE import *
tester=PEtester(UML14)
Use=UML14.UseCase(name="Use")
point=UML14.ExtensionPoint(name="point",useCase=Use)
tester.test(UMLExtensionPointPE,[point])
tester.test(UMLExtensionPointListPE,[Use])
|
|
From: <de...@us...> - 2004-01-07 01:48:22
|
Update of /cvsroot/pymerase/smw/smw/modeler/profiles
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/modeler/profiles
Added Files:
__init__.py chiProfile.py sartProfile.py scwProfile.py
tacoProfile.py
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: __init__.py ---
--- NEW FILE: chiProfile.py ---
from smw.metamodel.Profiles import *
class CHIProfile(Profile):
def createModel(self,name):
from smw.chi.metamodel.chi1 import *
return CHIModel(name=name)
chiblurb="""CHI Profile.
Use this profile to model chi specifications.
This profile has been developed by Victor Bos and Ivan Porres.
"""
def register(modelerApp):
p= CHIProfile('CHI',
'smw.chi.metamodel.chi1',
['smw.chi.chiEditor'],
chiblurb)
modelerApp.registerProfile(p)
--- NEW FILE: sartProfile.py ---
from smw.metamodel.Profiles import *
from smw.sart.SARTDiagrams import *
class SARTProfile(Profile):
def createModel(self,name):
from smw.sart.metamodel.SART import Model
root=Model(name=name)
root.presentation.add(DataFlowDiagram())
return root
def beforeExport(self,model):
pass
def afterImport(self,model):
ok=0
for p in model.presentation:
if isinstance(p,DataFlowDiagram):
ok=1
if not ok:
model.presentation.add(DataFlowDiagram())
blurb="""SART Profile.
Use this profile to create SA/RT models.
This profile has been developed by Joakim Isaksson and Johan Lilius. It is distributed freely under the terms of the GNU General Plublic License (GPL).
"""
def register(modelerApp):
p= SARTProfile('SART','smw.sart.metamodel.SART',
['smw.sart.SARTDataFlowEditor',
'smw.sart.SARTStateMachineEditor'],blurb)
modelerApp.registerProfile(p)
--- NEW FILE: scwProfile.py ---
from smw.metamodel.Profiles import *
from smw.scw.CodeGen import *
from smw.metamodel import TransactionManager
from smw import io
import smw.Configuration
from smw.metamodel import UML14 as metamodel
from smw.scw.Element.LayerManager import mkTestCaseName,mkTestDependencyName,mkTestMethodName
from smw.scw.Element.SfiManager import mkUnittestDependencyName
from qt import *
class SCWProfile(UMLProfile):
theSFIManager=None
resultDialog=None
elementColors={"undefined":QColor(255,255,205),
"testPassed":QColor(230,230,255),
"testFailed":QColor(255,180,200)
##"allTestsPassed":QColor(230,230,255),
## "someTestsFailed":QColor(255,180,200)
}
optionsDialog=None
def createModel(self,name):
#from smw.scw.CodeGen import *
# clearing the history because
# TransactionManager.theTM=None
if not self.theSFIManager:
if TransactionManager.theTM:
self.theSFIManager=SfiManager(TransactionManager.theTM)
else:
self.theSFIManager=SfiManager()
self.optionsDialog=None
proj=self.theSFIManager.newProject()
if proj==None:
self.theSFIManager.deleteProject(self.theSFIManager.currentProject().name)
proj=self.theSFIManager.newProject()
root=proj
root.presentation.add(ClassDiagram())
return root
def afterImport(self,model):
UMLProfile.afterImport(self,model)
if model.ownedElement.select(lambda x : self.isPythonPackage(x)):
pythonpackage=model.ownedElement.select( \
lambda x : self.isPythonPackage(x))[0]
elif model.ownedElement.select(lambda x : isinstance(x,metamodel.Package) \
and (x.name=="python2_2" or x.name=="python2.2")):
raise "Invalid python package in model"
else:
config=smw.Configuration.Configuration()
ppObj=config.getParameter("install_path")
pp=ppObj.currentValue
pythonUMLModel=io.loadModel(pp+"/scw/python.iml")
if not pythonUMLModel:
raise " Could not open datafile "+pp+"/scw/python.iml."
if not pythonUMLModel.ownedElement.select(lambda x : self.isPythonPackage(x)):
raise " Invalid datafile "+pp+"/scw/python.iml."
pythonpackage=pythonUMLModel.ownedElement.select(lambda x : self.isPythonPackage(x))[0]
model.ownedElement.append(pythonpackage)
pythonpackage.name="python2_2"
assert(pythonpackage)
unittestpackage=pythonpackage.ownedElement.select( \
lambda x: isinstance(x,metamodel.Package) and x.name=="unittest")[0]
testcaseclass=unittestpackage.ownedElement.select( \
lambda x: isinstance(x,metamodel.Class) and x.name=="TestCase")[0]
assert(unittestpackage)
assert(testcaseclass)
# Check the model and possibly turn it into a SCW uml model:
malformed=0
packs=[]
classes=[]
allelements=self.theSFIManager._layerManager.returnElements(model)
for e in allelements:
inppackage=0
if e.oclIsKindOf(metamodel.Package) or e.oclIsKindOf(metamodel.Class): #model?
ns=e
while (ns!=model):
if self.isPythonPackage(ns):
inppackage=1
ns=ns.namespace
if not inppackage:
if e.oclIsKindOf(metamodel.Class):
classes.append(e)
if e.oclIsKindOf(metamodel.Package):
packs.append(e)
# add correctness tags and update all element below:
if (e.oclIsKindOf(metamodel.Model) or e.oclIsKindOf(metamodel.Package) \
or (e.oclIsKindOf(metamodel.Class) \
and not (self.theSFIManager._layerManager.isTestClass(e)))) \
and not e.taggedValue.select(lambda x: x.name=="correctness") \
and not inppackage:
self.theSFIManager.layerManager().attachTag(e,"correctness","undefined")
ns=e # update elements below..
while ns.namespace:
ns=ns.namespace
for x in ns.taggedValue.select(lambda x: x.name=="correctness"):
x.dataValue="undefined"
for c in classes:
# mark the class abstract if all it's operations do not have methods
for f in c.feature:
if f.oclIsKindOf(metamodel.Operation) and not f.method:
c.isAbstract=1
# create test case for the class if does not exist.
if not self.theSFIManager._layerManager.isTestClass(c) \
and not self.theSFIManager._layerManager.getTestClient(c):
tc=metamodel.Class()
tcname=mkTestCaseName(c.name)
tc.name=tcname
# if cannot create the test case:
if c.namespace.ownedElement.select(lambda x : x.name==tcname):
malformed=1
break
tc.namespace=c.namespace
self.theSFIManager._layerManager.attachTag(tc,'testcase')
d=self.theSFIManager._layerManager.newDependency(c,tc,mkTestDependencyName(c.name))
assert(d)
gname=self.theSFIManager._layerManager.createUniqueElementName(model,"generalization")
g=self.theSFIManager._layerManager.newGeneralization(testcaseclass,tc,gname)
assert(g)
# add operations and methods to testClass
# test class is made concrete, even if the real class is not
ops=c.feature.select(lambda x: x.oclIsKindOf(metamodel.Operation))
for o in ops:
to=self.theSFIManager._layerManager.newOperation(tc,mkTestMethodName(o.name))
if o.method:
for m in o.method:
self.theSFIManager._layerManager.newMethod(tc,mkTestMethodName(o.name),to)
# else:
# self._layerManager.newMethod(tc,mkTestMethodName(o.name),to)
else:
tc.isAbstract=1
for p in packs:
if not p.clientDependency.select(lambda x: x.supplier.select( \
lambda y: y==unittestpackage)):
name=mkUnittestDependencyName(p.name)
name=self.theSFIManager.layerManager().createUniqueElementName( \
model,name)
d=self.theSFIManager._layerManager.newDependency( \
unittestpackage,p,name)
assert(d)
if not malformed: # no unsolveable error found:
root=model
self.theSFIManager.setUp()
self.theSFIManager._pythonUMLPackage=pythonpackage
self.theSFIManager._unittestPackage[model]=unittestpackage
self.theSFIManager._testCaseClass[model]=testcaseclass
self.theSFIManager._projects[model.name] = model
self.theSFIManager._currentProject = model
self.theSFIManager._currentLayers[model.name] = None
self.theSFIManager._currentElements[model.name] = model # is necessary?
self.theSFIManager.focusOnElement(model)
# codegenTimestamp
self.theSFIManager.codeGenTimestamp[model.name]=0
else:
raise "Could not open the file"
def isPythonPackage(self,p):
""" return 1 if the given package can be accepted as an python package, else 0. """
return isinstance(p,metamodel.Package) and not isinstance(p,metamodel.Model) \
and isinstance(p.namespace,metamodel.Model) \
and p.name=="python2.2" or p.name=="python2_2" \
and p.ownedElement.select(lambda x : isinstance(x,metamodel.Package) and x.name=="unittest" \
and x.ownedElement.select(lambda y : isinstance(y,metamodel.Class) \
and y.name=="TestCase"))
scwblurb="""SFI Profile.
Use this profile to model and develop Python
programs using the Stepwise Feature Introduction
Method. It is based on UML 1.4
It contains an editor for SFI diagrams and the basic
UML 1.4 editors.
This profile has been developed by Luka Milovanov,
Tomas Czarnecki, Juha Javanainen, Jarkko Lahti,
Marko Mattila and Mari Melander. It is distributed
freely under the terms of the GNU General Plublic
License (GPL).
"""
def register(modelerApp):
p= SCWProfile('UML14SFI','smw.metamodel.UML14',
['smw.scw.modeler.UMLSCWCore',
'smw.modeler.UML.UMLADEditor',
'smw.modeler.UML.UMLSCEditor',
'smw.modeler.UML.UMLCollaborationEditor',
'smw.modeler.UML.UMLUCEditor',
'smw.modeler.UML.UMLSDEditor'
],scwblurb
)
modelerApp.registerProfile(p)
--- NEW FILE: tacoProfile.py ---
from smw.metamodel.Profiles import *
class TacoProfile(UMLProfile):
pass
tacoblurb="""TACO Profile.
Use this profile to create TACO models.
This profile has been developed by Johan Lilius, Dragos Truscan and Ivan Porres. It is distributed freely under the terms of the GNU General Plublic License (GPL).
"""
def register(modelerApp):
p= TacoProfile('TACO','smw.metamodel.UML14',
['smw.modeler.UML.UMLCore',
'smw.modeler.UML.UMLADEditor',
'smw.modeler.UML.UMLSCEditor',
'smw.modeler.UML.UMLCollaborationEditor',
'smw.modeler.UML.UMLUCEditor',
'smw.modeler.UML.UMLSDEditor'],blurb=tacoblurb)
modelerApp.registerProfile(p)
|
|
From: <de...@us...> - 2004-01-07 01:48:21
|
Update of /cvsroot/pymerase/smw/smw/modeler/UML/icons In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/modeler/UML/icons Added Files: dummyfile.txt Log Message: Imported version of SMW downloaded on 2003 Apr 14 --- NEW FILE: dummyfile.txt --- |
|
From: <de...@us...> - 2004-01-07 01:48:19
|
Update of /cvsroot/pymerase/smw/smw/mmgen/dlg
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mmgen/dlg
Added Files:
GeneratorDlg.py GeneratorDlg.ui __init__.py makefile
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: GeneratorDlg.py ---
# Form implementation generated from reading ui file 'GeneratorDlg.ui'
#
# Created: on 8. jan 10:43:21 2003
# by: The PyQt User Interface Compiler (pyuic)
#
# WARNING! All changes made in this file will be lost!
from qt import *
class GeneratorDlg(QDialog):
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
QDialog.__init__(self,parent,name,modal,fl)
if not name:
self.setName("GeneratorDlg")
GeneratorDlgLayout = QGridLayout(self,1,1,0,0,"GeneratorDlgLayout")
self.Frame7 = QFrame(self,"Frame7")
self.Frame7.setSizePolicy(QSizePolicy(5,0,0,0,self.Frame7.sizePolicy().hasHeightForWidth()))
self.Frame7.setFrameShape(QFrame.StyledPanel)
self.Frame7.setFrameShadow(QFrame.Raised)
Frame7Layout = QGridLayout(self.Frame7,1,1,11,6,"Frame7Layout")
self.Convert = QPushButton(self.Frame7,"Convert")
self.Convert.setAutoDefault(1)
Frame7Layout.addWidget(self.Convert,0,1)
self.Quit = QPushButton(self.Frame7,"Quit")
Frame7Layout.addWidget(self.Quit,0,2)
spacer = QSpacerItem(0,0,QSizePolicy.Expanding,QSizePolicy.Minimum)
Frame7Layout.addItem(spacer,0,0)
GeneratorDlgLayout.addWidget(self.Frame7,1,0)
self.Frame3 = QFrame(self,"Frame3")
self.Frame3.setSizePolicy(QSizePolicy(5,7,0,0,self.Frame3.sizePolicy().hasHeightForWidth()))
self.Frame3.setFrameShape(QFrame.StyledPanel)
self.Frame3.setFrameShadow(QFrame.Raised)
Frame3Layout = QGridLayout(self.Frame3,1,1,11,6,"Frame3Layout")
self.TextLabel1_4 = QLabel(self.Frame3,"TextLabel1_4")
Frame3Layout.addWidget(self.TextLabel1_4,1,0)
self.Name = QLineEdit(self.Frame3,"Name")
Frame3Layout.addWidget(self.Name,4,2)
self.TextLabel5_4 = QLabel(self.Frame3,"TextLabel5_4")
TextLabel5_4_font = QFont(self.TextLabel5_4.font())
TextLabel5_4_font.setFamily("Arial")
TextLabel5_4_font.setPointSize(12)
TextLabel5_4_font.setBold(1)
self.TextLabel5_4.setFont(TextLabel5_4_font)
Frame3Layout.addMultiCellWidget(self.TextLabel5_4,3,3,0,1)
self.SourceFile = QLineEdit(self.Frame3,"SourceFile")
Frame3Layout.addMultiCellWidget(self.SourceFile,1,1,1,3)
self.TextLabel5_2_3 = QLabel(self.Frame3,"TextLabel5_2_3")
TextLabel5_2_3_font = QFont(self.TextLabel5_2_3.font())
TextLabel5_2_3_font.setFamily("Arial")
TextLabel5_2_3_font.setPointSize(12)
TextLabel5_2_3_font.setBold(1)
self.TextLabel5_2_3.setFont(TextLabel5_2_3_font)
Frame3Layout.addMultiCellWidget(self.TextLabel5_2_3,0,0,0,1)
self.Version = QLineEdit(self.Frame3,"Version")
Frame3Layout.addWidget(self.Version,4,3)
self.SelectSource_3 = QPushButton(self.Frame3,"SelectSource_3")
self.SelectSource_3.setAutoDefault(0)
Frame3Layout.addWidget(self.SelectSource_3,1,4)
self.FileFormat_3 = QButtonGroup(self.Frame3,"FileFormat_3")
self.FileFormat_3.setColumnLayout(0,Qt.Vertical)
self.FileFormat_3.layout().setSpacing(6)
self.FileFormat_3.layout().setMargin(11)
FileFormat_3Layout = QGridLayout(self.FileFormat_3.layout())
FileFormat_3Layout.setAlignment(Qt.AlignTop)
self.UMLIncludeDatatypes = QCheckBox(self.FileFormat_3,"UMLIncludeDatatypes")
self.UMLIncludeDatatypes.setEnabled(0)
self.UMLIncludeDatatypes.setChecked(1)
FileFormat_3Layout.addMultiCellWidget(self.UMLIncludeDatatypes,4,4,0,1)
self.SimpleFormat = QRadioButton(self.FileFormat_3,"SimpleFormat")
FileFormat_3Layout.addMultiCellWidget(self.SimpleFormat,1,1,0,1)
self.MOFFormat = QRadioButton(self.FileFormat_3,"MOFFormat")
self.MOFFormat.setChecked(1)
FileFormat_3Layout.addMultiCellWidget(self.MOFFormat,0,0,0,1)
self.UMLVersionLabel_5 = QLabel(self.FileFormat_3,"UMLVersionLabel_5")
self.UMLVersionLabel_5.setEnabled(0)
FileFormat_3Layout.addWidget(self.UMLVersionLabel_5,3,0)
self.UMLFormat = QRadioButton(self.FileFormat_3,"UMLFormat")
FileFormat_3Layout.addMultiCellWidget(self.UMLFormat,2,2,0,1)
self.UMLVersion = QComboBox(0,self.FileFormat_3,"UMLVersion")
self.UMLVersion.setEnabled(0)
self.UMLVersion.setEditable(0)
FileFormat_3Layout.addWidget(self.UMLVersion,3,1)
Frame3Layout.addMultiCellWidget(self.FileFormat_3,2,2,0,4)
self.TextLabel1_2_3 = QLabel(self.Frame3,"TextLabel1_2_3")
Frame3Layout.addMultiCellWidget(self.TextLabel1_2_3,4,4,0,1)
self.TemplateFile = QLineEdit(self.Frame3,"TemplateFile")
Frame3Layout.addMultiCellWidget(self.TemplateFile,5,5,2,3)
self.TextLabel4_3 = QLabel(self.Frame3,"TextLabel4_3")
Frame3Layout.addMultiCellWidget(self.TextLabel4_3,5,5,0,1)
self.SelectExtra_3 = QPushButton(self.Frame3,"SelectExtra_3")
self.SelectExtra_3.setAutoDefault(0)
Frame3Layout.addWidget(self.SelectExtra_3,5,4)
self.Output = QButtonGroup(self.Frame3,"Output")
self.Output.setColumnLayout(0,Qt.Vertical)
self.Output.layout().setSpacing(6)
self.Output.layout().setMargin(11)
OutputLayout = QGridLayout(self.Output.layout())
OutputLayout.setAlignment(Qt.AlignTop)
self.HOME = QRadioButton(self.Output,"HOME")
self.HOME.setChecked(1)
self.Output.insert( self.HOME,1)
OutputLayout.addMultiCellWidget(self.HOME,0,0,0,1)
spacer_2 = QSpacerItem(40,20,QSizePolicy.Fixed,QSizePolicy.Minimum)
OutputLayout.addItem(spacer_2,1,0)
self.GenerateProfile = QCheckBox(self.Output,"GenerateProfile")
self.GenerateProfile.setChecked(1)
OutputLayout.addWidget(self.GenerateProfile,1,1)
self.SpecificTarget = QRadioButton(self.Output,"SpecificTarget")
self.SpecificTarget.setChecked(0)
OutputLayout.addMultiCellWidget(self.SpecificTarget,2,2,0,1)
spacer_3 = QSpacerItem(40,20,QSizePolicy.Fixed,QSizePolicy.Minimum)
OutputLayout.addItem(spacer_3,3,0)
self.TargetDir = QLineEdit(self.Output,"TargetDir")
self.TargetDir.setEnabled(0)
OutputLayout.addWidget(self.TargetDir,3,1)
self.SelectTargetDir = QPushButton(self.Output,"SelectTargetDir")
self.SelectTargetDir.setEnabled(0)
self.SelectTargetDir.setAutoDefault(0)
OutputLayout.addWidget(self.SelectTargetDir,3,2)
Frame3Layout.addMultiCellWidget(self.Output,6,6,0,4)
GeneratorDlgLayout.addWidget(self.Frame3,0,0)
self.languageChange()
self.resize(QSize(520,503).expandedTo(self.minimumSizeHint()))
self.connect(self.SelectSource_3,SIGNAL("clicked()"),self.chooseInputFile)
self.connect(self.SelectExtra_3,SIGNAL("clicked()"),self.chooseAditionalPythonModule)
self.connect(self.Quit,SIGNAL("clicked()"),self,SLOT("close()"))
self.connect(self.Convert,SIGNAL("clicked()"),self.convert)
self.connect(self.HOME,SIGNAL("toggled(bool)"),self.GenerateProfile,SLOT("setChecked(bool)"))
self.connect(self.HOME,SIGNAL("toggled(bool)"),self.GenerateProfile,SLOT("setEnabled(bool)"))
self.connect(self.SpecificTarget,SIGNAL("toggled(bool)"),self.SelectTargetDir,SLOT("setEnabled(bool)"))
self.connect(self.SpecificTarget,SIGNAL("toggled(bool)"),self.TargetDir,SLOT("setEnabled(bool)"))
self.connect(self.SelectTargetDir,SIGNAL("clicked()"),self.chooseTargetDir)
self.setTabOrder(self.SourceFile,self.SelectSource_3)
self.setTabOrder(self.SelectSource_3,self.MOFFormat)
self.setTabOrder(self.MOFFormat,self.UMLFormat)
self.setTabOrder(self.UMLFormat,self.UMLVersion)
self.setTabOrder(self.UMLVersion,self.UMLIncludeDatatypes)
self.setTabOrder(self.UMLIncludeDatatypes,self.Name)
self.setTabOrder(self.Name,self.Version)
self.setTabOrder(self.Version,self.TemplateFile)
self.setTabOrder(self.TemplateFile,self.SelectExtra_3)
self.setTabOrder(self.SelectExtra_3,self.Convert)
self.setTabOrder(self.Convert,self.Quit)
def languageChange(self):
self.setCaption(self.tr("Python Metamodel Generator"))
self.Convert.setText(self.tr("Convert"))
self.Quit.setText(self.tr("Quit"))
self.TextLabel1_4.setText(self.tr("Source file"))
self.TextLabel5_4.setText(self.tr("Target Python Module"))
self.TextLabel5_2_3.setText(self.tr("Source Metamodel"))
self.SelectSource_3.setText(self.tr("Browse..."))
self.FileFormat_3.setTitle(self.tr("Source File Format"))
self.UMLIncludeDatatypes.setText(self.tr("Include standard UML datatypes in target module"))
self.SimpleFormat.setText(self.tr("Simple Metamodel Description Script"))
self.MOFFormat.setText(self.tr("OMG MOF Model saved in XMI"))
self.UMLVersionLabel_5.setText(self.tr("UML Version"))
self.UMLFormat.setText(self.tr("UML Class Model saved in XMI"))
self.UMLVersion.clear()
self.UMLVersion.insertItem(self.tr("UML 0"))
self.UMLVersion.insertItem(self.tr("UML 1.1"))
self.UMLVersion.insertItem(self.tr("UML 1.3"))
self.UMLVersion.insertItem(self.tr("UML 1.4"))
self.UMLVersion.setCurrentItem(2)
self.TextLabel1_2_3.setText(self.tr("Name and Version"))
self.TextLabel4_3.setText(self.tr("Aditional Python code"))
self.SelectExtra_3.setText(self.tr("Browse..."))
self.Output.setTitle(self.tr("Target Forlder"))
self.HOME.setText(self.tr("Generate files in .smw folder"))
self.GenerateProfile.setText(self.tr("Generate modeler profile"))
self.SpecificTarget.setText(self.tr("Generate files in a specific folder"))
self.SelectTargetDir.setText(self.tr("Browse..."))
def chooseAditionalPythonModule(self):
print "GeneratorDlg.chooseAditionalPythonModule(): Not implemented yet"
def chooseInputFile(self):
print "GeneratorDlg.chooseInputFile(): Not implemented yet"
def convert(self):
print "GeneratorDlg.convert(): Not implemented yet"
def chooseTargetDir(self):
print "GeneratorDlg.chooseTargetDir(): Not implemented yet"
--- NEW FILE: GeneratorDlg.ui ---
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>GeneratorDlg</class>
<widget class="QDialog">
<property name="name">
<cstring>GeneratorDlg</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>520</width>
<height>503</height>
</rect>
</property>
<property name="caption">
<string>Python Metamodel Generator</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<widget class="QFrame" row="1" column="0">
<property name="name">
<cstring>Frame7</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>Raised</enum>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QPushButton" row="0" column="1">
<property name="name">
<cstring>Convert</cstring>
</property>
<property name="text">
<string>Convert</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" row="0" column="2">
<property name="name">
<cstring>Quit</cstring>
</property>
<property name="text">
<string>Quit</string>
</property>
</widget>
<spacer row="0" column="0">
<property name="name">
<cstring>Spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
</spacer>
</grid>
</widget>
<widget class="QFrame" row="0" column="0">
<property name="name">
<cstring>Frame3</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>Raised</enum>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>TextLabel1_4</cstring>
</property>
<property name="text">
<string>Source file</string>
</property>
</widget>
<widget class="QLineEdit" row="4" column="2">
<property name="name">
<cstring>Name</cstring>
</property>
</widget>
<widget class="QLabel" row="3" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>TextLabel5_4</cstring>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
<bold>1</bold>
</font>
</property>
<property name="text">
<string>Target Python Module</string>
</property>
</widget>
<widget class="QLineEdit" row="1" column="1" rowspan="1" colspan="3">
<property name="name">
<cstring>SourceFile</cstring>
</property>
</widget>
<widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>TextLabel5_2_3</cstring>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
<bold>1</bold>
</font>
</property>
<property name="text">
<string>Source Metamodel</string>
</property>
</widget>
<widget class="QLineEdit" row="4" column="3">
<property name="name">
<cstring>Version</cstring>
</property>
</widget>
<widget class="QPushButton" row="1" column="4">
<property name="name">
<cstring>SelectSource_3</cstring>
</property>
<property name="text">
<string>Browse...</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
<widget class="QButtonGroup" row="2" column="0" rowspan="1" colspan="5">
<property name="name">
<cstring>FileFormat_3</cstring>
</property>
<property name="title">
<string>Source File Format</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>UMLIncludeDatatypes</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Include standard UML datatypes in target module</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QRadioButton" row="1" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>SimpleFormat</cstring>
</property>
<property name="text">
<string>Simple Metamodel Description Script</string>
</property>
</widget>
<widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>MOFFormat</cstring>
</property>
<property name="text">
<string>OMG MOF Model saved in XMI</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" row="3" column="0">
<property name="name">
<cstring>UMLVersionLabel_5</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>UML Version</string>
</property>
</widget>
<widget class="QRadioButton" row="2" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>UMLFormat</cstring>
</property>
<property name="text">
<string>UML Class Model saved in XMI</string>
</property>
</widget>
<widget class="QComboBox" row="3" column="1">
<item>
<property name="text">
<string>UML 0</string>
</property>
</item>
<item>
<property name="text">
<string>UML 1.1</string>
</property>
</item>
<item>
<property name="text">
<string>UML 1.3</string>
</property>
</item>
<item>
<property name="text">
<string>UML 1.4</string>
</property>
</item>
<property name="name">
<cstring>UMLVersion</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="editable">
<bool>false</bool>
</property>
<property name="currentItem">
<number>2</number>
</property>
</widget>
</grid>
</widget>
<widget class="QLabel" row="4" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>TextLabel1_2_3</cstring>
</property>
<property name="text">
<string>Name and Version</string>
</property>
</widget>
<widget class="QLineEdit" row="5" column="2" rowspan="1" colspan="2">
<property name="name">
<cstring>TemplateFile</cstring>
</property>
</widget>
<widget class="QLabel" row="5" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>TextLabel4_3</cstring>
</property>
<property name="text">
<string>Aditional Python code</string>
</property>
</widget>
<widget class="QPushButton" row="5" column="4">
<property name="name">
<cstring>SelectExtra_3</cstring>
</property>
<property name="text">
<string>Browse...</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
<widget class="QButtonGroup" row="6" column="0" rowspan="1" colspan="5">
<property name="name">
<cstring>Output</cstring>
</property>
<property name="title">
<string>Target Forlder</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>HOME</cstring>
</property>
<property name="text">
<string>Generate files in .smw folder</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="buttonGroupId">
<number>1</number>
</property>
</widget>
<spacer row="1" column="0">
<property name="name">
<cstring>Spacer2_2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QCheckBox" row="1" column="1">
<property name="name">
<cstring>GenerateProfile</cstring>
</property>
<property name="text">
<string>Generate modeler profile</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QRadioButton" row="2" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>SpecificTarget</cstring>
</property>
<property name="text">
<string>Generate files in a specific folder</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
<spacer row="3" column="0">
<property name="name">
<cstring>Spacer3</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QLineEdit" row="3" column="1">
<property name="name">
<cstring>TargetDir</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton" row="3" column="2">
<property name="name">
<cstring>SelectTargetDir</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Browse...</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
</grid>
</widget>
<connections>
<connection>
<sender>SelectSource_3</sender>
<signal>clicked()</signal>
<receiver>GeneratorDlg</receiver>
<slot>chooseInputFile()</slot>
</connection>
<connection>
<sender>SelectExtra_3</sender>
<signal>clicked()</signal>
<receiver>GeneratorDlg</receiver>
<slot>chooseAditionalPythonModule()</slot>
</connection>
<connection>
<sender>Quit</sender>
<signal>clicked()</signal>
<receiver>GeneratorDlg</receiver>
<slot>close()</slot>
</connection>
<connection>
<sender>Convert</sender>
<signal>clicked()</signal>
<receiver>GeneratorDlg</receiver>
<slot>convert()</slot>
</connection>
<connection>
<sender>HOME</sender>
<signal>toggled(bool)</signal>
<receiver>GenerateProfile</receiver>
<slot>setChecked(bool)</slot>
</connection>
<connection>
<sender>HOME</sender>
<signal>toggled(bool)</signal>
<receiver>GenerateProfile</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>SpecificTarget</sender>
<signal>toggled(bool)</signal>
<receiver>SelectTargetDir</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>SpecificTarget</sender>
<signal>toggled(bool)</signal>
<receiver>TargetDir</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>SelectTargetDir</sender>
<signal>clicked()</signal>
<receiver>GeneratorDlg</receiver>
<slot>chooseTargetDir()</slot>
</connection>
</connections>
<tabstops>
<tabstop>SourceFile</tabstop>
<tabstop>SelectSource_3</tabstop>
<tabstop>MOFFormat</tabstop>
<tabstop>UMLFormat</tabstop>
<tabstop>UMLVersion</tabstop>
<tabstop>UMLIncludeDatatypes</tabstop>
<tabstop>Name</tabstop>
<tabstop>Version</tabstop>
<tabstop>TemplateFile</tabstop>
<tabstop>SelectExtra_3</tabstop>
<tabstop>Convert</tabstop>
<tabstop>Quit</tabstop>
</tabstops>
<slots>
<slot>chooseAditionalPythonModule()</slot>
<slot>chooseInputFile()</slot>
<slot>convert()</slot>
<slot>chooseTargetDir()</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>
--- NEW FILE: __init__.py ---
--- NEW FILE: makefile ---
UI_FILES = $(wildcard *.ui)
.PHONY: clean first_rule
first_rule: $(patsubst %.ui, %.py, $(UI_FILES))
%.py: %.ui
pyuic -o $@.tmp $^
# fix bad output by qt designer
# cygwin perl (or is it windows) does not support -i
perl -p -e 'if (/self.tr/) { s/\\\\"/\\"/g; }' $@.tmp > $@
rm $@.tmp
clean:
-rm -f $(patsubst %.ui, %.py, $(UI_FILES))
|
|
From: <de...@us...> - 2004-01-07 01:48:19
|
Update of /cvsroot/pymerase/smw/smw/mmgen/UML14/unittest
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mmgen/UML14/unittest
Added Files:
__init__.py testAttribute.py testBehavioralFeature.py
testBuiltInWFR.py testCircularGeneralization.py
testFQPToElement.py testMultipleGeneralizations.py
testMultiplicity.py testOrdering.py testParameter.py
testVisibility.py
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: __init__.py ---
--- NEW FILE: testAttribute.py ---
from smw.metamodel.UML14 import *
attr=Attribute()
attr.name="theAttr"
myExp=Expression()
myExp.body="5*3+1"
myExp.language="the_name"
attr.initialValue=myExp
clfier=Classifier(name="int")
attr.type=clfier
attr.visibility=VisibilityKind.vk_public
assert(fromAttributeToString(attr)=="+theAttr:int=5*3+1")
attr=Attribute()
attr.name="theAttr"
myExp=Expression()
myExp.body="5*3+1"
myExp.language=""
attr.initialValue=myExp
clfier=Classifier(name="Real")
attr.type=clfier
attr.visibility=VisibilityKind.vk_private
assert(fromAttributeToString(attr)=="-theAttr:Real=5*3+1")
attr=Attribute()
attr.name="theAttr"
myExp=Expression()
myExp.body="Hello World!"
myExp.language=""
attr.initialValue=myExp
clfier=Classifier(name="String")
attr.type=clfier
attr.visibility=VisibilityKind.vk_protected
assert(fromAttributeToString(attr)=="#theAttr:String=Hello World!")
attr=Attribute()
attr.name="theAttr"
myExp=Expression()
myExp.body="Hello World!"
myExp.language=""
attr.initialValue=myExp
clfier=Classifier(name="String")
attr.type=clfier
attr.visibility=VisibilityKind.vk_package
assert(fromAttributeToString(attr)=="~theAttr:String=Hello World!")
#OBS the default visibilitykind for the attribute is Public(+), if the attribute is empty None is returned
attr=Attribute()
assert(fromAttributeToString(attr)==None)
--- NEW FILE: testBehavioralFeature.py ---
from smw.metamodel.UML14 import *
#tests for fromBehavioralToString method
t=Class(name="int")
op=Operation(name="add")
op.parameter.insert(Parameter(name="x",type=t))
op.parameter.insert(Parameter(name="y",type=t))
op.visibility=VisibilityKind.vk_private
assert(fromBehavioralFeatureToString(op)=="-add(x:int,y:int)")
op=Operation(name="add")
op.parameter.insert(Parameter(kind=ParameterDirectionKind.pdk_return, type=t))
op.parameter.insert(Parameter(name="x",type=t))
op.parameter.insert(Parameter(name="y",type=t))
assert(fromBehavioralFeatureToString(op)=="+add(x:int,y:int):int")
op=Operation(name="add")
op.parameter.insert(Parameter(name="x",type=t))
op.parameter.insert(Parameter(name="y",type=t))
assert(fromBehavioralFeatureToString(op)=="+add(x:int,y:int)")
op=Operation(name="add")
op.parameter.insert(Parameter(name="x",type=t))
op.parameter.insert(Parameter(name="y",type=t))
op.parameter.insert(Parameter(name="z",type=t))
op.parameter.insert(Parameter(kind=ParameterDirectionKind.pdk_return, type=t))
assert(fromBehavioralFeatureToString(op)=="+add(x:int,y:int,z:int):int")
op=Operation(name="add")
op.parameter.insert(Parameter(name="x",type=t))
op.parameter.insert(Parameter(kind=ParameterDirectionKind.pdk_return, type=t))
op.parameter.insert(Parameter(name="y",type=t))
assert(fromBehavioralFeatureToString(op)=="+add(x:int,y:int):int")
op=Operation(name="add")
op.parameter.insert(Parameter(name="x",type=t))
op.parameter.insert(Parameter(kind=ParameterDirectionKind.pdk_return, type=t))
op.parameter.insert(Parameter(name="y"))
assert(fromBehavioralFeatureToString(op)=="+add(x:int,y):int")
op=Operation(name="add")
op.parameter.insert(Parameter(name="x",type=t))
op.parameter.insert(Parameter(kind=ParameterDirectionKind.pdk_return, type=t))
assert(fromBehavioralFeatureToString(op)=="+add(x:int):int")
op=Operation(name="add")
op.parameter.insert(Parameter(name="x"))
op.parameter.insert(Parameter(kind=ParameterDirectionKind.pdk_return, type=t))
assert(fromBehavioralFeatureToString(op)=="+add(x):int")
op=Operation(name="add")
op.parameter.insert(Parameter(kind=ParameterDirectionKind.pdk_return, type=t))
assert(fromBehavioralFeatureToString(op)=="+add():int")
op=Operation(name="add")
assert(fromBehavioralFeatureToString(op)=="+add()")
op=Operation(name="add")
op.parameter.insert(Parameter(name="x"))
op.parameter.insert(Parameter(name="y"))
op.parameter.insert(Parameter(kind=ParameterDirectionKind.pdk_return, type=t))
assert(fromBehavioralFeatureToString(op)!="+add(x,y,z):int")
op=Operation(name="add")
op.visibility=VisibilityKind.vk_package
assert(fromBehavioralFeatureToString(op)=="~add()")
op=Operation(name="add")
op.visibility=VisibilityKind.vk_protected
assert(fromBehavioralFeatureToString(op)=="#add()")
op=Operation(name="remove")
assert(fromBehavioralFeatureToString(op)=="+remove()")
op=Operation(name="remove")
op.parameter.insert(Parameter(kind=ParameterDirectionKind.pdk_return,type=Class(name="void")))
assert(fromBehavioralFeatureToString(op)=="+remove()")
op=Operation(name="add")
op.parameter.insert(Parameter(name="x",type=t))
op.parameter.insert(Parameter(name="y",type=t))
op.parameter.insert(Parameter(name="z",type=t))
op.parameter.insert(Parameter(name="bull",kind=ParameterDirectionKind.pdk_return, type=t))
assert(fromBehavioralFeatureToString(op)=="+add(x:int,y:int,z:int):int")
op=Operation(name="add")
op.parameter.insert(Parameter(name="x",type=Class(name="")))
#print fromBehavioralFeatureToString(op)
assert(fromBehavioralFeatureToString(op)=="+add(x)")
--- NEW FILE: testBuiltInWFR.py ---
from smw.metamodel.UML14 import *
d=Dependency()
ok=0
try:
d.isWellFormed()
except WFRException,e:
ok=1
assert(ok)
--- NEW FILE: testCircularGeneralization.py ---
from smw.metamodel.UML14 import *
m1 = Model()
c1 = Class()
c2 = Class()
g1 = Generalization()
c1.namespace = m1
c2.namespace = m1
g1.namespace = m1
g1.child = c1
g1.parent = c2
m1.isWellFormedRecursive()
g1.parent = c1
c2.namespace = None
try:
m1.isWellFormedRecursive()
except WFRException:
print "Caught exception (this is correct)"
pass
else:
print "We should not be wellformed here!"
assert(0)
g2 = Generalization()
c2.namespace = m1
g2.namespace = m1
g1.parent = c2
g2.parent = c1
g2.child = c2
try:
m1.isWellFormedRecursive()
except WFRException:
print "Caught exception (this is correct)"
pass
else:
print "We should not be wellformed here!"
assert(0)
--- NEW FILE: testFQPToElement.py ---
from smw.metamodel.UML14 import *
model = Model()
a = Package(name="packageA")
b = Package(name="packageB")
c = Package(name="packageC")
aa = Class(name="classA")
model.ownedElement.insert(a)
model.ownedElement.insert(b)
model.ownedElement.insert(c)
a.ownedElement.insert(aa)
assert(fromFQPToElement("packageA::classA",model)==aa)
assert(fromFQPToElement("packageB::classNotPresent",model)==None)
assert(fromFQPToElement("totallyBullshit::something",model)==None)
assert(fromFQPToElement("classA",model)==None)
assert(fromFQPToElement("packageC",model)==c)
model=Model()
model.ownedElement.insert(a)
a.ownedElement.insert(b)
b.ownedElement.insert(c)
c.ownedElement.insert(aa)
assert(fromFQPToElement("packageA::packageB::packageC::classA",model)==aa)
assert(fromFQPToElement("packageA::packageB::packageC::",model)==None)
model=Model()
model.ownedElement.insert(aa)
assert(fromFQPToElement("classA",model)==aa)
--- NEW FILE: testMultipleGeneralizations.py ---
from smw.metamodel.UML14 import *
m = Model()
c1 = Class()
c2 = Class()
c1.namespace = m
c2.namespace = m
g1 = Generalization()
g2 = Generalization()
g1.namespace = m
g1.child = c1
g1.parent = c2
assert(m.isWellFormedRecursive())
g2.namespace = m
g2.child = c1
g2.parent = c2
try:
m.isWellFormedRecursive()
except WFRException:
pass
else:
assert(0)
--- NEW FILE: testMultiplicity.py ---
from smw.metamodel.UML14 import *
###Testing fromStringToMultiplicity
assert(fromStringToMultiplicity("2..5")!=None)
m=fromStringToMultiplicity("2..5")
assert(len(m.range)==1)
assert(m.range[0].lower==2 and m.range[0].upper==5)
assert(fromStringToMultiplicity("kjhadfsohwe")==None)
m=fromStringToMultiplicity("0")
assert(m.range[0].lower==0 and m.range[0].upper==0)
m=fromStringToMultiplicity("10")
assert(m.range[0].lower==10 and m.range[0].upper==10)
m=fromStringToMultiplicity("*")
assert(m.range[0].lower==0 and m.range[0].upper==-1)
m=fromStringToMultiplicity(" 2.. *" )
assert(m.range[0].lower==2 and m.range[0].upper==-1)
m=fromStringToMultiplicity("* .. * ")
assert(m.range[0].lower==0 and m.range[0].upper==-1)
testlist=""
m=fromStringToMultiplicity(testlist)
assert(m==None)
testlist="stupidtest,0..4"
m=fromStringToMultiplicity(testlist)
assert(m==None)
testlist=""
m=fromStringToMultiplicity(testlist)
assert(m==None)
testlist="5.. 2 "
m=fromStringToMultiplicity(testlist)
assert(m.range[0].lower==2 and m.range[0].upper==5)
testlist="*.. 5 "
m=fromStringToMultiplicity(testlist)
assert(m.range[0].lower==5 and m.range[0].upper==-1)
testlist="5..*"
m=fromStringToMultiplicity(testlist)
assert(m.range[0].lower==5 and m.range[0].upper==-1)
testlist="2. 7, 10.. 29"
m=fromStringToMultiplicity(testlist)
assert(m==None)
testlist="2.. 7, 10.. 29, 23..2"
m=fromStringToMultiplicity(testlist)
assert(m.range[0].lower==2 and m.range[0].upper==7)
assert(m.range[1].lower==10 and m.range[1].upper==29)
assert(m.range[2].lower==2 and m.range[2].upper==23)
testlist="5..7, "
m=fromStringToMultiplicity(testlist)
assert(m==None)
testlist="2..7,10..29"
m=fromStringToMultiplicity(testlist)
assert(m.range[0].lower==2 and m.range[0].upper==7)
assert(m.range[1].lower==10 and m.range[1].upper==29)
testlist="5..7. "
m=fromStringToMultiplicity(testlist)
assert(m==None)
###starting tests fromMultiplicityToString
testlist="2"
a=fromStringToMultiplicity(testlist)
b=fromMultiplicityToString(a)
print b
assert("2"==b)
testlist="2..7,8..15"
a=fromStringToMultiplicity(testlist)
b=fromMultiplicityToString(a)
assert("2..7,8..15"==b)
testlist="2..7,15..8"
a=fromStringToMultiplicity(testlist)
b=fromMultiplicityToString(a)
assert("2..7,8..15"==b)
testlist="2..7,*"
a=fromStringToMultiplicity(testlist)
b=fromMultiplicityToString(a)
assert("2..7,*"==b)
testlist="*"
a=fromStringToMultiplicity(testlist)
b=fromMultiplicityToString(a)
assert("*"==b)
testlist="2..7,8..15"
a=fromStringToMultiplicity(testlist)
b=fromMultiplicityToString(a)
assert("2..7,8..15"==b)
testlist="2 ..7, 8..15"
a=fromStringToMultiplicity(testlist)
b=fromMultiplicityToString(a)
assert("2..7,8..15"==b)
--- NEW FILE: testOrdering.py ---
from smw.metamodel.UML14 import *
ae=AssociationEnd()
ae.ordering=OrderingKind.ok_unordered
assert(fromOrderingToString(ae)=="")
ae=AssociationEnd()
ae.ordering=OrderingKind.ok_ordered
assert(fromOrderingToString(ae)=="{ordered}")
--- NEW FILE: testParameter.py ---
from smw.metamodel.UML14 import *
#test for fromParameterToString method
t=Class(name="int")
exp=Expression()
p=Parameter(name="x",type=t)
p.kind=ParameterDirectionKind.pdk_in
#print fromParameterToString(p)
assert(fromParameterToString(p)=="in x:int")
p=Parameter(name="y",type=t)
p.kind=ParameterDirectionKind.pdk_return
exp.body="42"
p.defaultValue=exp
#print fromParameterToString(p)
assert(fromParameterToString(p)=="return y:int=42")
t2=Class(name="String")
p=Parameter(name="name",type=t2)
exp.body="Hello World"
p.kind=ParameterDirectionKind.pdk_inout
p.defaultValue=exp
#print fromParameterToString(p)
assert(fromParameterToString(p)=="in-out name:String=Hello World")
--- NEW FILE: testVisibility.py ---
from smw.metamodel.UML14 import *
ae=AssociationEnd()
ae.visibility=VisibilityKind.vk_public
assert(fromVisibilityToString(ae)=="+")
ae.visibility=VisibilityKind.vk_private
assert(fromVisibilityToString(ae)=="-")
ae.visibility=VisibilityKind.vk_protected
assert(fromVisibilityToString(ae)=="#")
#ae.visibility="teststring"
#assert(fromVisibilityToString(ae)=="")
|
|
From: <de...@us...> - 2004-01-07 01:48:19
|
Update of /cvsroot/pymerase/smw/smw/mmgen/UML14 In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mmgen/UML14 Added Files: 01-02-15.xml 01-02-16.dtd 01-02-23.mdl UML14actions.py UML14template.py Log Message: Imported version of SMW downloaded on 2003 Apr 14 --- NEW FILE: 01-02-15.xml --- <?xml version="1.0" encoding="UTF-8" ?> <!-- <!DOCTYPE XMI SYSTEM 'Model.dtd'> --> <XMI xmi.version='1.1' xmlns:Model='omg.org/mof.Model/1.3'> <XMI.header> <XMI.model xmi.name='UML' xmi.version='1.4'/> <XMI.metamodel xmi.name='Model' xmi.version='1.3'/> </XMI.header> <XMI.content> <Model:Package xmi.id='a0' name='UML' annotation='' isRoot='false' isLeaf='false' isAbstract='false' visibility='public_vis'> <Model:Namespace.contents> <Model:Tag xmi.id='a1' name='org.omg.mof.idl_prefix=org.omg' annotation='' tagId='org.omg.mof.idl_prefix' elements='a0'> <Model:Tag.values> <XMI.any xmi.type='string'>org.omg</XMI.any> </Model:Tag.values> </Model:Tag> <Model:Tag xmi.id='a2' name='org.omg.xmi.namespace=UML' annotation='' tagId='org.omg.xmi.namespace' elements='a0'> <Model:Tag.values> <XMI.any xmi.type='string'>UML</XMI.any> </Model:Tag.values> [...5186 lines suppressed...] <XMI.field>1</XMI.field> <!-- lower --> <XMI.field>1</XMI.field> <!-- upper --> <XMI.field>false</XMI.field> <!-- is_ordered --> <XMI.field>false</XMI.field> <!-- is_unique --> </Model:AssociationEnd.multiplicity> </Model:AssociationEnd> <Model:AssociationEnd xmi.id='a798' name='elementImport' annotation='' isNavigable='true' aggregation='none' isChangeable='true' type='a797'> <Model:AssociationEnd.multiplicity> <XMI.field>0</XMI.field> <!-- lower --> <XMI.field>-1</XMI.field> <!-- upper --> <XMI.field>false</XMI.field> <!-- is_ordered --> <XMI.field>true</XMI.field> <!-- is_unique --> </Model:AssociationEnd.multiplicity> </Model:AssociationEnd> </Model:Namespace.contents> </Model:Association> </Model:Namespace.contents> </Model:Package> </XMI.content> </XMI> --- NEW FILE: 01-02-16.dtd --- <!-- _______________________________________________________________ --> <!-- --> <!-- XMI is the top-level XML element for XMI transfer text --> <!-- _______________________________________________________________ --> <!ELEMENT XMI (XMI.header?, XMI.content?, XMI.difference*, XMI.extensions*)> <!ATTLIST XMI xmi.version CDATA #FIXED "1.1" timestamp CDATA #IMPLIED verified (true|false) #IMPLIED> <!-- _______________________________________________________________ --> <!-- --> <!-- XMI.header contains documentation and identifies the model, --> <!-- metamodel, and metametamodel --> <!-- _______________________________________________________________ --> <!ELEMENT XMI.header (XMI.documentation?, XMI.model*, XMI.metamodel*, [...1684 lines suppressed...] <!ELEMENT UML:ElementImport.isSpecification EMPTY> <!ATTLIST UML:ElementImport.isSpecification xmi.value (true|false) #REQUIRED> <!ELEMENT UML:ElementImport.package (UML:Package)*> <!ELEMENT UML:ElementImport.importedElement (UML:ModelElement)*> <!ENTITY % UML:ElementImportFeatures 'XMI.extension | UML:ElementImport.visibility | UML:ElementImport.alias | UML:ElementImport.isSpecification | UML:ElementImport.package | UML:ElementImport.importedElement'> <!ENTITY % UML:ElementImportAtts '%XMI.element.att; %XMI.link.att; visibility %UML:VisibilityKind; #IMPLIED alias CDATA #IMPLIED isSpecification (true|false) #IMPLIED package IDREFS #IMPLIED importedElement IDREFS #IMPLIED'> <!ELEMENT UML:ElementImport (%UML:ElementImportFeatures;)*> <!ATTLIST UML:ElementImport %UML:ElementImportAtts;> <!-- ========= UML:UML ========= --> --- NEW FILE: 01-02-23.mdl --- (object Petal version 44 _written "Rose 7.0.9420.17" charSet 0) (object Design "Logical View" is_unit TRUE is_loaded TRUE quid "3A71E26E0182" defaults (object defaults rightMargin 0.250000 leftMargin 0.250000 topMargin 0.250000 bottomMargin 0.500000 pageOverlap 0.250000 clipIconLabels TRUE autoResize TRUE snapToGrid TRUE [...36057 lines suppressed...] tool "XML_DTD" name "DefaultDeclType" value ""))) (object Attribute tool "XML_DTD" name "default__Module-Spec" value (list Attribute_Set (object Attribute tool "XML_DTD" name "Assign All" value FALSE) (object Attribute tool "XML_DTD" name "ComponentPath" value ""))) (object Attribute tool "XML_DTD" name "HiddenTool" value FALSE)) quid "38431EDC01D9")) --- NEW FILE: UML14actions.py --- import string from qt import * def newMultiplicity(lower=1,upper=1): m=Multiplicity() m.range.insert(MultiplicityRange(lower=lower,upper=upper)) return m def newAssociation(classifier1,classifier2,name=None): if not name: name='' as=Association(name=name,namespace=classifier1.namespace) ae1=AssociationEnd(participant=classifier1, association=as, multiplicity=newMultiplicity(1,1), isNavigable=1) ae2=AssociationEnd(participant=classifier2, association=as, multiplicity=newMultiplicity(1,1), isNavigable=1) return as def newAssociationRole(classifierrole1,classifierrole2,name=None): if not name: name='unnamed' baseAss=classifierrole1.base[0].association[0].association #FIXME asr=AssociationRole(base=baseAss,name=name,namespace=classifierrole1.namespace) aer1=AssociationEndRole(association=asr, participant=classifierrole1, base=baseAss.connection[0], multiplicity=newMultiplicity(1,1), isNavigable=1) aer2=AssociationEndRole(association=asr, participant=classifierrole2, base=baseAss.connection[1], multiplicity=newMultiplicity(1,1), isNavigable=1) return asr def collectAssociations(clf,assoc=None): """Method for collecting all AssociationEnds from a classifier and all its superclasses. """ if not assoc: assoc=[] assoc+=clf.association for g in clf.generalization: assoc+=g.parent.association if g.parent.generalization: return collectAssociations(g.parent,assoc) else: return assoc def newLink(instance1,instance2,name=None): """Creates a new link between two instances, there must exist an association between the base classifiers (or superclasses of these) for the link to map onto, otherwise it will return None and no Link is created. returns the new Link """ if not name: name='unnamed' baseAss=None assocs1=MMSet() assocs2=MMSet() assocs1=collectAssociations(instance1.classifier[0]) assocs2=collectAssociations(instance2.classifier[0]) for a in assocs1: for b in assocs2: if not a == b and a.association == b.association: baseAss=a.association break if not baseAss: return None link=Link(name=name,association=baseAss,namespace=instance1.namespace) if baseAss.connection[0].participant == instance1.classifier[0]: le1=LinkEnd(instance=instance1,link=link, associationEnd=baseAss.connection[0]) le2=LinkEnd(instance=instance2,link=link, associationEnd=baseAss.connection[1]) else: le1=LinkEnd(instance=instance1,link=link, associationEnd=baseAss.connection[1]) le2=LinkEnd(instance=instance2,link=link, associationEnd=baseAss.connection[0]) return link def fromMultiplicityToString(multiplicity): """ fromMultiplicityToString creates a string from a multiplicity instance that will be displayed in the editor, i.e. 2..7 . Example: testlist='2..7' a=fromStringToMultiplicity(testlist) b=fromMultiplicityToString(a) assert('2..7'==b) """ outString="" for i in multiplicity.range: lower=i.lower upper=i.upper if upper==-1: upper="*" if outString: outString = outString +"," if lower==0 and upper=="*": outString=outString+"*" else: if lower!=upper: outString=outString+str(lower)+".."+str(upper) else: outString=outString+str(lower) return outString def fromStringToMultiplicity(s): """ fromStringToMultiplicity creates an Multiplicity instance from a given string containing a multiplicity range such as '1..5', '*' or '2..5,7..10' Example: testlist='2.. 7, 10.. 29, 23..2' m=fromStringToMultiplicity(testlist) assert(m.range[0].lower==2 and m.range[0].upper==7) assert(m.range[1].lower==10 and m.range[1].upper==29) assert(m.range[2].lower==2 and m.range[2].upper==23) It returns None if the string is empty or contains an invalid multiplicty range. """ s=string.replace(s," ","") list=string.split(s,",") if len(list)==0: return None m=Multiplicity() for temp in list: r=string.split(temp,"..") #If only element x in list, lower=x and upper=x if len(r)==1: r.append(r[0]) # r[0]=string.strip(r[0]) if r[0]=='*': r[0]=0 r.append(-1) else: try: r[0]=int(r[0]) except ValueError: return None if r[1]=='*': r[1]=-1 else: try: r[1]=int(r[1]) except ValueError: return None if r[1] != -1 and r[0] > r[1] or r[0]==-1: r[0],r[1]=r[1],r[0] #Swap if len(r)==3 and r[1]!=-1: #if input is i.e(*..5) swap to (5..*) r[0]=r[1] r[1]=r[2] m.range.insert(MultiplicityRange(lower=r[0],upper=r[1])) #for loop ends #creates a new multiplicity instance with the given multiplicities sorted! return m def fromAttributeToString(attr): """ fromAttributeToString takes the attributes from the Attribute instance and converts them into a string. This string is then used for proper output in the class diagram, i.e. ([visibility][name]:[type]=[body]), +x:int=5... Example: attr=Attribute() attr.name=\"theAttr\" myExp=Expression() myExp.body=\"Hello World!\" myExp.language=\"\" attr.initialValue=myExp clfier=Classifier(name=\"String\") attr.type=clfier attr.visibility=VisibilityKind.vk_protected assert(fromAttributeToString(attr)==\"#theAttr:String=Hello World!\") """ s="" if attr.visibility == VisibilityKind.vk_public: s=s+"+" elif attr.visibility == VisibilityKind.vk_private: s=s+"-" elif attr.visibility == VisibilityKind.vk_protected: s=s+"#" elif attr.visibility == VisibilityKind.vk_package: s=s+"~" if attr.name: s=s+attr.name if attr.type: s=s+":"+attr.type.name if attr.initialValue and attr.initialValue.body: s=s+"="+attr.initialValue.body if s=='+': return None else: return s def fromBehavioralFeatureToString(bf): ''' fromBehaviorToString takes the name, parameters, type (and kind), etc. from the BehavioralFeature instance for output to be printed in the diagram... Example: op=Operation(name="add") op.parameter.insert(Parameter(name="x",type=t)) op.parameter.insert(Parameter(kind=ParameterDirectionKind.pdk_return, type=t)) op.parameter.insert(Parameter(name="y",type=t)) op.visibility=VisibilityKind.vk_private assert(fromBehavioralFeatureToString(op)=="-add(x:int,y:int):int") According to specifications if a BehavioralFeature returns nothing (i.e. void) the return type should be omitted. ''' s="" if bf.visibility == VisibilityKind.vk_public: s=s+"+" elif bf.visibility == VisibilityKind.vk_private: s=s+"-" elif bf.visibility == VisibilityKind.vk_protected: s=s+"#" elif bf.visibility == VisibilityKind.vk_package: s=s+"~" first=1 end="" #according to "the bible" it should be nothing s=s+bf.name+"(" for p in bf.parameter: if p.kind==ParameterDirectionKind.pdk_return and p.type and not p.type.name == "void": end+=":"+p.type.name if not first and p.name and p.kind!=ParameterDirectionKind.pdk_return: s=s+',' if p.name and p.kind!=ParameterDirectionKind.pdk_return: s=s+p.name first=0 if p.type and p.type.name!="" and p.name and p.kind!=ParameterDirectionKind.pdk_return: s=s+":"+p.type.name s=s+")"+end return s def fromParameterToString(p): '''fromParameterToString returns the textual representation of a parameter according to the specification. Example: t2=Class(name="String") p=Parameter(name="name",type=t2) exp=Expression() exp.body="Hello World" p.kind=ParameterDirectionKind.pdk_inout p.defaultValue=exp assert(fromParameterToString(p)=="in-out name:String=Hello World") ''' s="" if p.kind==ParameterDirectionKind.pdk_in: s+="in " elif p.kind==ParameterDirectionKind.pdk_inout: s+="in-out " elif p.kind==ParameterDirectionKind.pdk_out: s+="out " elif p.kind==ParameterDirectionKind.pdk_return: s+="return " if p.name!="": s+=p.name if p.type: if p.type.name!="": s+=":" s+=p.type.name if p.defaultValue and p.defaultValue.body !="": s+="="+p.defaultValue.body return s def fromOrderingToString(ae): """fromOrderingToString gets the orderingkind from an associationEnd so that it will be easier to print relevant output to the screen...""" s="" if ae.ordering==OrderingKind.ok_ordered: return "{ordered}" else: return s def fromVisibilityToString(ae): """fromVisibilityToString takes an AssociationEnd Rolename as the argument and returns the given visibility of the name e.g +specification=public...""" s="" if ae.visibility == VisibilityKind.vk_public: s=s+"+" elif ae.visibility == VisibilityKind.vk_private: s=s+"-" elif ae.visibility == VisibilityKind.vk_protected: s=s+"#" return s def fromFQPToElement(s,model): """fromFQPToElement takes a FullyQualifiedPath in the form of a string and a model and returns a reference to that particular element (if it exists). If the element does not exist, it returns None. """ if not model: return None names=string.split(s,"::") for e in model.ownedElement: if e.name==names[0] and len(names)==1: return e elif len(names)>1: if e.name==names[0]: names=names[1:] return fromFQPToElement(string.join(names,"::"),e) #out of elements.. return None def convertSimpleToCompositeState(state): assert(isinstance(state,SimpleState)) # this is a really dirty hack # and it is not undoable state.__setclass__(CompositeState) state.subvertex=[] state.isConcurrent=0 state.isRegion=0 return state --- NEW FILE: UML14template.py --- class Association: def wfrAssociation1(self): return self.allConnections().forAll( lambda r1,r2: implies(r1.name==r2.name,r1==r2)) def wfrAssociation2(self): return self.allConnections().select(lambda c: c.aggregation != AggregationKind.ak_none).size()<=1 def wfrAssociation3(self): return implies(self.allConnections().size()>=3, self.allConnections().forAll( lambda c: c.aggregation == AggregationKind.ak_none)) def allConnections(self): return self.connection class Classifier: def allFeatures(self): return self.feature def allOperations(self): return self.allFeatures().select(lambda f: f.oclIsKindOf(Operation)) def allMethods(self): return self.allFeatures().select(lambda f: f.oclIsKindOf(Method)) class Method: def wfrHasSameSignature(self): op = self.specification if not op: return None if len(self.parameter) != len(op.parameter): return None x = 1 for i in range(len(self.parameter)): pm, po = self.parameter[i], op.parameter[i] x = x and (pm.name == po.name) x = x and (pm.type.name == po.type.name) x = x and (pm.kind == po.kind) return x class GeneralizableElement: def wfrCanNotGeneralizeItself(self): checked = [] parents = [] for i in self.generalization: parents.append(i) while len(parents) > 0: p = parents.pop() checked.append(p) p = p.parent if p == self: return 0 addthese = p.generalization for i in addthese: if not i in checked and not i in parents: parents.append(i) return 1 def wfrCanNotGeneralizeSameElementTwice(self): above = [] for i in self.generalization: if i.parent in above: return 0 above.append(i.parent) return 1 class Class: def wfrClass1(self): "If a Class is concrete, all the Operations of the Class should have a realizing Method in the full descriptor [1.4,01.02.01,2-60]" return self.isAbstract or self.allOperations().forAll(lambda op: self.allMethods().exist(lambda m: m.specification.asSet().includes(op))) class Transition: def getDescription(self): text='' if self.trigger: text=self.trigger.getDescription() if self.guard: text=text+'['+self.guard.expression.body+']' if self.effect: text=text+'/'+self.effect.script.body return text class SignalEvent: def getDescription(self): return self.signal.name class CallEvent: def getDescription(self): return self.operation.name class TimeEvent: def getDescription(self): return self.when class ChangeEvent: def getDescription(self): return self.changeExpression class CompositeState: def wfrCompositeState1(self): "A composite state can have at most one initial vertex" return self.subvertex.select( lambda v: v.oclIsKindOf(Pseudostate) and v.kind== PseudostateKind.pk_initial).size() <=1 def wfrCompositeState2(self): "A composite state can have at most one deep history vertex" return self.subvertex.select( lambda v: v.oclIsKindOf(Pseudostate) and v.kind== PseudostateKind.pk_deepHistory).size() <=1 def wfrCompositeState3(self): "A composite state can have at most one shallow history vertex" return self.subvertex.select( lambda v: v.oclIsKindOf(Pseudostate) and v.kind== PseudostateKind.pk_shallowHistory).size() <=1 def wfrCompositeState4(self): "There have to be at least two composite substates in a concurrent composite state" return implies(self.isConcurrent, self.subvertex.select(lambda v: v.oclIsKindOf(CompositeState)).size()>=2) def wfrCompositeState5(self): "A concurrent state can only have composite states as substates" return implies(self.isConcurrent, self.subvertex.forAll(lambda s: s.oclIsKindOf(CompositeState))) def wfrCompositeState6(self): "The substates of a composite state are part of only that composite state" return self.subvertex.forAll(lambda s: s.container.asSet().size()==1 and s.container == self) class FinalState: def wfrFinalState1(self): "A final state cannot have any outgoing transitions" return self.outgoing.size()==0 class Pseudostate: def wfrPseudostate1(self): "An initial vertex can have at most one outgoing transition and no incoming transitions" return implies(self.kind == PseudostateKind.pk_initial, self.outgoing.size()<=1 and self.incoming.isEmpty()) def wftPseudostate2(self): "History vertices can have at most one outgoing transition" return implies(self.kind == PseudostateKind.pk_deepHistory or self.kind== PseudostateKind.pk_shallowHistory, self.outgoing.size()<=1) |
|
From: <de...@us...> - 2004-01-07 01:48:19
|
Update of /cvsroot/pymerase/smw/smw/mmgen/unittest
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mmgen/unittest
Added Files:
__init__.py testmmdiff.py
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: __init__.py ---
--- NEW FILE: testmmdiff.py ---
from smw.mmgen.mmdiff import Diff
d=Diff()
d.compare("UML13","UML14")
d.compare("UML11","UML14")
d.compare("UML13","UML13")
d.compare("NOTANAME","NOTANANANAME")
|
|
From: <de...@us...> - 2004-01-07 01:48:19
|
Update of /cvsroot/pymerase/smw/smw/mmgen/UML13
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mmgen/UML13
Added Files:
UML13-XMI11-UML13.xml UML13.mdl UML13Clean-XMI11-UML13.xml
UML13Clean.mdl UML13Physical-XMI11-UML13.xml UML13Physical.mdl
UML13mm.py UML13template.py
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: UML13-XMI11-UML13.xml ---
<?xml version = '1.0' encoding = 'ISO-8859-1' ?>
<!-- <!DOCTYPE XMI SYSTEM 'UML13.dtd' > -->
<XMI xmi.version = '1.1' xmlns:UML='//org.omg/UML/1.3' timestamp = 'Tue Dec 04 17:01:46 2001' >
<XMI.header>
<XMI.documentation>
<XMI.exporter>Unisys.JCR.1</XMI.exporter>
<XMI.exporterVersion>1.3.2</XMI.exporterVersion>
</XMI.documentation>
<XMI.metamodel xmi.name = 'UML' xmi.version = '1.3'/>
</XMI.header>
<XMI.content>
<!-- ==================== UML13 [Model] ==================== -->
<UML:Model xmi.id = 'G.0'
name = 'UML13' visibility = 'public' isSpecification = 'false'
isRoot = 'false' isLeaf = 'false' isAbstract = 'false' >
<UML:Namespace.ownedElement>
<UML:Dependency xmi.id = 'G.350'
name = '{Core?Data Types}{33F1E286026C}' visibility = 'public' isSpecification = 'false' >
<UML:Dependency.client>
[...10792 lines suppressed...]
<UML:TaggedValue xmi.id = 'XX.220'
tag = 'persistence' value = 'transient' >
<UML:TaggedValue.modelElement>
<Foundation.Core.ModelElement xmi.idref = 'S.212'/> <!-- UML13::Model Management::Package -->
</UML:TaggedValue.modelElement>
</UML:TaggedValue>
<UML:TaggedValue xmi.id = 'XX.221'
tag = 'persistence' value = 'transient' >
<UML:TaggedValue.modelElement>
<Foundation.Core.ModelElement xmi.idref = 'S.213'/> <!-- UML13::Model Management::Subsystem -->
</UML:TaggedValue.modelElement>
</UML:TaggedValue>
<UML:TaggedValue xmi.id = 'XX.222'
tag = 'persistence' value = 'transient' >
<UML:TaggedValue.modelElement>
<Foundation.Core.ModelElement xmi.idref = 'S.215'/> <!-- UML13::Model Management::ElementImport -->
</UML:TaggedValue.modelElement>
</UML:TaggedValue>
</XMI.content>
</XMI>
--- NEW FILE: UML13.mdl ---
(object Petal
version 42
_written "Rose 4.5.8054a"
charSet 0)
(object Design "Logical View"
is_unit TRUE
is_loaded TRUE
defaults (object defaults
rightMargin 0.250000
leftMargin 0.250000
topMargin 0.250000
bottomMargin 0.500000
pageOverlap 0.250000
clipIconLabels TRUE
autoResize FALSE
snapToGrid FALSE
gridX 30
[...20507 lines suppressed...]
tool "Visual Basic"
name "ImplementsDelegation"
value TRUE)))
(object Attribute
tool "Visual Basic"
name "default__Module-Spec"
value (list Attribute_Set
(object Attribute
tool "Visual Basic"
name "ProjectFile"
value "")))
(object Attribute
tool "Visual Basic"
name "HiddenTool"
value FALSE)
(object Attribute
tool "VisualStudio"
name "HiddenTool"
value FALSE))
quid "327A583203B1"))
--- NEW FILE: UML13Clean-XMI11-UML13.xml ---
<?xml version = '1.0' encoding = 'ISO-8859-1' ?>
<!-- <!DOCTYPE XMI SYSTEM 'UML13.dtd' > -->
<XMI xmi.version = '1.1' xmlns:UML='//org.omg/UML/1.3' timestamp = 'Wed Dec 05 14:37:07 2001' >
<XMI.header>
<XMI.documentation>
<XMI.exporter>Unisys.JCR.1</XMI.exporter>
<XMI.exporterVersion>1.3.2</XMI.exporterVersion>
</XMI.documentation>
<XMI.metamodel xmi.name = 'UML' xmi.version = '1.3'/>
</XMI.header>
<XMI.content>
<!-- ==================== UML13Clean [Model] ==================== -->
<UML:Model xmi.id = 'G.0'
name = 'UML13Clean' visibility = 'public' isSpecification = 'false'
isRoot = 'false' isLeaf = 'false' isAbstract = 'false' >
<UML:Namespace.ownedElement>
<UML:Dependency xmi.id = 'G.337'
name = '{Core?Data Types}{33F1E286026C}' visibility = 'public' isSpecification = 'false' >
<UML:Dependency.client>
[...10600 lines suppressed...]
<UML:TaggedValue xmi.id = 'XX.220'
tag = 'persistence' value = 'transient' >
<UML:TaggedValue.modelElement>
<Foundation.Core.ModelElement xmi.idref = 'S.212'/> <!-- UML13Clean::Model Management::Package -->
</UML:TaggedValue.modelElement>
</UML:TaggedValue>
<UML:TaggedValue xmi.id = 'XX.221'
tag = 'persistence' value = 'transient' >
<UML:TaggedValue.modelElement>
<Foundation.Core.ModelElement xmi.idref = 'S.213'/> <!-- UML13Clean::Model Management::Subsystem -->
</UML:TaggedValue.modelElement>
</UML:TaggedValue>
<UML:TaggedValue xmi.id = 'XX.222'
tag = 'persistence' value = 'transient' >
<UML:TaggedValue.modelElement>
<Foundation.Core.ModelElement xmi.idref = 'S.215'/> <!-- UML13Clean::Model Management::ElementImport -->
</UML:TaggedValue.modelElement>
</UML:TaggedValue>
</XMI.content>
</XMI>
--- NEW FILE: UML13Clean.mdl ---
(object Petal
version 45
_written "Rose 7.5.0103.1920"
charSet 0)
(object Design "Logical View"
is_unit TRUE
is_loaded TRUE
attributes (list Attribute_Set
(object Attribute
tool "Java"
name "IDE"
value "Internal Editor"))
quid "3C0E07D10337"
defaults (object defaults
rightMargin 0.250000
leftMargin 0.250000
topMargin 0.250000
[...31825 lines suppressed...]
tool "XML_DTD"
name "DefaultDeclType"
value "")))
(object Attribute
tool "XML_DTD"
name "default__Module-Spec"
value (list Attribute_Set
(object Attribute
tool "XML_DTD"
name "Assign All"
value FALSE)
(object Attribute
tool "XML_DTD"
name "ComponentPath"
value "")))
(object Attribute
tool "XML_DTD"
name "HiddenTool"
value FALSE))
quid "327A583203B1"))
--- NEW FILE: UML13Physical-XMI11-UML13.xml ---
<?xml version = '1.0' encoding = 'ISO-8859-1' ?>
<!-- <!DOCTYPE XMI SYSTEM 'UML13.dtd' > -->
<XMI xmi.version = '1.1' xmlns:UML='//org.omg/UML/1.3' timestamp = 'Mon Mar 04 10:08:48 2002' >
<XMI.header>
<XMI.documentation>
<XMI.exporter>Unisys.JCR.1</XMI.exporter>
<XMI.exporterVersion>1.3.2</XMI.exporterVersion>
</XMI.documentation>
<XMI.metamodel xmi.name = 'UML' xmi.version = '1.3'/>
</XMI.header>
<XMI.content>
<!-- ==================== UML13Physical [Model] ==================== -->
<UML:Model xmi.id = 'G.0' xmi.uuid = '3C0E07D10337'
name = 'UML13Physical' visibility = 'public' isSpecification = 'false'
isRoot = 'false' isLeaf = 'false' isAbstract = 'false' >
<UML:Namespace.ownedElement>
<UML:Dependency xmi.id = 'G.349'
name = '{Core?Data Types}{33F1E286026C}' visibility = 'public' isSpecification = 'false' >
<UML:Dependency.client>
[...10775 lines suppressed...]
<UML:TaggedValue xmi.id = 'XX.220'
tag = 'persistence' value = 'transient' >
<UML:TaggedValue.modelElement>
<Foundation.Core.ModelElement xmi.idref = 'S.212'/> <!-- UML13Physical::Model Management::Package -->
</UML:TaggedValue.modelElement>
</UML:TaggedValue>
<UML:TaggedValue xmi.id = 'XX.221'
tag = 'persistence' value = 'transient' >
<UML:TaggedValue.modelElement>
<Foundation.Core.ModelElement xmi.idref = 'S.213'/> <!-- UML13Physical::Model Management::Subsystem -->
</UML:TaggedValue.modelElement>
</UML:TaggedValue>
<UML:TaggedValue xmi.id = 'XX.222'
tag = 'persistence' value = 'transient' >
<UML:TaggedValue.modelElement>
<Foundation.Core.ModelElement xmi.idref = 'S.215'/> <!-- UML13Physical::Model Management::ElementImport -->
</UML:TaggedValue.modelElement>
</UML:TaggedValue>
</XMI.content>
</XMI>
--- NEW FILE: UML13Physical.mdl ---
(object Petal
version 45
_written "Rose 7.5.0103.1920"
charSet 0)
(object Design "Logical View"
is_unit TRUE
is_loaded TRUE
attributes (list Attribute_Set
(object Attribute
tool "Java"
name "IDE"
value "Internal Editor"))
quid "3C0E07D10337"
defaults (object defaults
rightMargin 0.250000
leftMargin 0.250000
topMargin 0.250000
[...32650 lines suppressed...]
tool "XML_DTD"
name "DefaultDeclType"
value "")))
(object Attribute
tool "XML_DTD"
name "default__Module-Spec"
value (list Attribute_Set
(object Attribute
tool "XML_DTD"
name "Assign All"
value FALSE)
(object Attribute
tool "XML_DTD"
name "ComponentPath"
value "")))
(object Attribute
tool "XML_DTD"
name "HiddenTool"
value FALSE))
quid "327A583203B1"))
--- NEW FILE: UML13mm.py ---
# UML 1.3
# 6-4
Element("Foundation.Core","Element",[],[])
Element("Foundation.Core","ModelElement",["Element"],
[Attr("name","Name"),
Attr("visibility","VisibilityKind"),
Attr("isSpecification","Boolean")])
Element("Foundation.Core","Constraint",["ModelElement"],
[Attr("body","BooleanExpression")])
Association("ModelElement","constraint","*",
"Constraint","constrainedElement","*")
Element("Foundation.Core","Feature",["ModelElement"],
[Attr("ownerScope","ScopeKind")])
Element("Foundation.Core","Namespace",["ModelElement"],[])
Aggregation("Namespace","ownedElement","*",
"ModelElement","namespace","0..1")
Element("Foundation.Core","GeneralizableElement",["ModelElement"],
[Attr("isRoot","Boolean"),
Attr("isLeaf","Boolean"),
Attr("isAbstract","Boolean")])
Element("Foundation.Core","Parameter",["ModelElement"],
[Attr("defaultValue","Expression"),
Attr("kind","ParameterDirectionKind")])
Association("Classifier","parameter","*",
"Parameter","type","1")
Element("Foundation.Core","Classifier",["Namespace","GeneralizableElement"],[])
Aggregation("Classifier","feature","*",
"Feature","ownwer","0..1")
Element("Foundation.Core","StructuralFeature",["Feature"],
[Attr("multiplicity","Multiplicity"),
Attr("changeability","ChangeableKind"),
Attr("targetScope","ScopeKind")])
Element("Foundation.Core","Attribute",["StructuralFeature"],
[Attr("initialValue","Expression")])
Element("Foundation.Core","BehavioralFeature",["Feature"],
[Attr("isQuery","Boolean")])
Aggregation("BehavioralFeature","parameter","*",
"Parameter","behavioralFature","0..1")
Element("Foundation.Core","Operation",["BehavioralFeature"],
[Attr("concurrency","CallConcurrencyKind"),
Attr("isRoot","Boolean"),
Attr("isLeaf","Boolean"),
Attr("isAbstract","Boolean"),
Attr("specification","String")])
Element("Foundation.Core","Method",["BehavioralFeature"],
[Attr("body","ProcedureExpression")])
Association("Operation","method","*",
"Method","specifiaction","1")
# 6-5
Element("Foundation.Core","Relationship",["ModelElement"],[])
Element("Foundation.Core","Dependency",["Relationship"],[])
Association("ModelElement","supplierDependency","*",
"Dependency","supplier","*")
Association("ModelElement","clientDependency","*",
"Dependency","client","*")
Element("Foundation.Core","Binding",["Dependency"],[])
Element("Foundation.Core","Ussagee",["Dependency"],[])
Element("Foundation.Core","Permission",["Dependency"],[])
Element("Foundation.Core","Abstraction",["Dependency"],[
Attr("mapping","MappingExpression")])
Element("Foundation.Core","Flow",["Relationship"],[])
Association("ModelElement","sourceFlow","*",
"Flow","source","*")
Association("ModelElement","targetFlow","*",
"Flow","target","*")
Element("Foundation.Core","Generalization",["Relationship"],
[Attr("discriminator","Name")])
Association("Generalization","child","1",
"GeneralizableElement","generalizartion","*")
Association("Generalization","parent","1",
"GeneralizableElement","specialization","*")
Association("Classifier","powertypeRange","*",
"Generalization","powertype","0..1")
Element("Foundation.Core","Class",["Classifier"],[Attr("isActive","Boolean")])
Element("Foundation.Core","AssociationEnd",["ModelElement"],
[Attr("isNavigable","Boolean"),
Attr("ordering","OrderingKind"),
Attr("aggregation","AggregationKind"),
Attr("targetScope","ScopeKind"),
Attr("multiplicity","Multiplicity"),
Attr("changeability","ChangeableKind")])
Association("Classifier","associationEnd","*",
"AssociationEnd","type","1")
Association("Classifier","participant","*",
"AssociationEnd","specification","*")
Aggregation("AssociationEnd","qualifier","*",
"Attribute","associationEnd","0..1")
Element("Foundation.Core","Association",["Relationship"],[])
Aggregation("Association","connection","*",
"AssociationEnd","association","1")
Element("Foundation.Core","AssociationClass",["Association","Class"],[])
# 6-6
Element("Foundation.Core","Interface",["Classifier"],[])
Element("Foundation.Core","DataType",["Classifier"],[])
Element("Foundation.Core","Node",["Classifier"],[])
Element("Foundation.Core","Component",["Classifier"],[])
Aggregation("Node","resident","*",
"Component","deploymentLocation","*")
Element("Foundation.Core","PresentationElement",[],[])
Aggregation("ModelElement","presentation","*",
"PresentationElement","subject","*")
# 6-9
Element("Foundation.Data_Types","Multiplicity",[],[])
Element("Foundation.Data_Types","MultiplicityRange",[],
[Attr("lower","Integer"),
Attr("upper","UnlimitedInteger")])
Aggregation("Multiplicity","range","*",
"MultiplicityRange","multiplicity","0..1")
# 6-10
Element("Foundation.Data_Types","Expression",[],
[Attr("language","Name"),
Attr("body","String")])
Element("Foundation.Data_Types","ProcedureExpression",["Expression"],[])
Element("Foundation.Data_Types","BooleanExpression",["Expression"],[])
Element("Foundation.Data_Types","ActionExpression",["Expression"],[])
Element("Foundation.Data_Types","IterationExpression",["Expression"],[])
Element("Foundation.Data_Types","ObjectSetExpression",["Expression"],[])
Element("Foundation.Data_Types","TimeExpression",["Expression"],[])
Element("Foundation.Data_Types","TypeExpression",["Expression"],[])
Element("Foundation.Data_Types","ArgListsExpression",["Expression"],[])
Element("Foundation.Data_Types","MappingExpression",["Expression"],[])
# 6-11
Element("Foundation.Extension_Mechanisms","TaggedValue",["ModelElement"],
[ Attr("tag","Name"),
Attr("value","String")])
Aggregation("ModelElement","taggedValue","*",
"TaggedValue","modelElement","1")
Element("Foundation.Extension_Mechanisms","Stereotype",["GeneralizableElement"],
[ Attr("icon","Geometry"),
Attr("baseClass","Name")])
Association("ModelElement","stereotype","*",
"Stereotype","extendedElement","*")
Aggregation("Stereotype","stereotypeConstraint","*",
"Constraint","constrainedElement2","0..1")
Association("ModelElement","constraint","*",
"Constraint","constrainedElement","*")
Aggregation("Stereotype","requiredTag","*",
"TaggedValue","stereotype","0..1")
# 6-13
Element("Behavior_Elements.Common_Behavior","Action",["ModelElement"],
[Attr("recurrence","IterationExpression"),
Attr("target","ObjectSetExpression"),
Attr("isAsynchronous","Boolean"),
Attr("script","ActionExpression")])
Element("Behavioral_Elements.Common_Behavior","Argument",[],[Attr("value","Expression")])
Aggregation("Action","actual","*",
"Argument","action","0..1")
Element("Behavioral_Elements.Common_Behavior","ActionSequence",["Action"],[])
Aggregation("ActionSequence","action","*",
"Action","actionSequence","0..1")
Element("Behavioral_Elements.Common_Behavior","SendAction",["Action"],[])
Association("SendAction","signal","1",
"Signal","sendAction","*")
Element("Behavioral_Elements.Common_Behavior","CreateAction",["Action"],[])
Association("CreateAction","instantiation","1",
"Classifier","createActionAction","*")
Element("Behavioral_Elements.Common_Behavior","CallAction",["Action"],[])
Association("CallAction","operation","1",
"Operation","callAction","*")
Element("Behavioral_Elements.Common_Behavior","AssigmentAction",["Action"],[])
Element("Behavioral_Elements.Common_Behavior","ReturnAction",["Action"],[])
Element("Behavioral_Elements.Common_Behavior","TerminateAction",["Action"],[])
Element("Behavioral_Elements.Common_Behavior","DestroyAction",["Action"],[])
Element("Behavioral_Elements.Common_Behavior","UninterpretedAction",["Action"],[])
# 6-14
Element("Behavioral_Elements.Common_Behavior","Signal",["Classifier"],[])
Association("Signal","context","*",
"BehavioralFeature","raisedSignal","*")
Element("Behavioral_Elements.Common_Behavior","Exception",["Signal"],[])
Element("Behavioral_Elements.Common_Behavior","Reception",["BehavioralFeature"],[
Attr("spectification","String"),
Attr("isRoot","Boolean"),
Attr("isLeaf","Boolean"),
Attr("isAbstract","Boolean")])
Association("Signal","reception","*",
"Reception","signal","1")
# SM
Element("State_Machines","StateMachine",["ModelElement"],[])
Aggregation("ModelElement","behavior","*",
"StateMachine","context","0..1")
Association("StateMachine","transitions","*",
"Transition","stateMachine","0..1")
Aggregation("StateMachine","top","1",
"State","stateMachine","0..1")
Association("StateMachine","submachineState","*",
"SubmachineState","submachine","1")
Element("Behavioral_Elements.State_Machines'","StateVertex",["ModelElement"],[])
Element("Behavioral_Elements.State_Machines'","Transition",["ModelElement"],[])
Aggregation("StateVertex","outgoing","*",
"Transition","source","1")
Aggregation("StateVertex","incoming","*",
"Transition","target","1")
Aggregation("CompositeState","subvertex","*",
"StateVertex","container","0..1")
Element("Behavioral_Elements.State_Machines'","Guard",["ModelElement"],
[Attr("expression","BooleanExpression")])
Aggregation("Transition","guard","0..1",
"Guard","transition","1")
Aggregation("Transition","trigger","0..1",
"Event","transition","*")
Aggregation("Transition","effect","0..1",
"Action","transition","0..1")
Element("Behavioral_Elements.State_Machines'","State",["StateVertex"],[])
Association("State","deferrableEvent","*",
"Event","state","*")
Aggregation("State","internalTransition","*",
"Transition","state","0..1")
Aggregation("State","entry","0..1",
"Action","stateEntry","0..1")
Aggregation("State","exit","0..1",
"Action","stateExit","0..1")
Aggregation("State","doActivity","0..1",
"Action","stateDo","0..1")
Element("Behavioral_Elements.State_Machines","Pseudostate",["StateVertex"],[
Attr("kind","PseudostateKind")])
Element("Behavioral_Elements.State_Machines","SynchState",["StateVertex"],[
Attr("bound","UnlimitedInteger")])
Element("Behavioral_Elements.State_Machines","StubSate",["StateVertex"],[
Attr("referenceState","Name")])
Element("Behavioral_Elements.State_Machines","CompositeState",["State"],[
Attr("isConcurrent","Boolean"),
Attr("isRegion","Boolean")])
Element("Behavioral_Elements.State_Machines","SimpleState",["State"],[])
Element("Behavioral_Elements.State_Machines","FinalState",["State"],[])
Element("Behavioral_Elements.State_Machines","SubmachineState",["CompositeState"],[])
# events
Element("Behavioral_Elements.State_Machines","Event",["ModelElement"],[])
Aggregation("Event","parameter","*",
"Parameter","event","0..1")
Element("Behavioral_Elements.State_Machines","SignalEvent",["Event"],[])
Association("SignalEvent","signal","1",
"Signal","occurrence","*")
Element("Behavioral_Elements.State_Machines","CallEvent",["Event"],[])
Association("CallEvent","operation","1",
"Operation","occurrence","*")
Element("Behavioral_Elements.State_Machines","TimeEvent",["Event"],
[Attr("when","TimeExpression")])
Element("Behavioral_Elements.State_Machines","ChangeEvent",["Event"],
[Attr("changeExpression","BooleanExpression")])
# 6-20
# model management
Element("Model_Managment","Package",["Namespace","GeneralizableElement"],[])
Element("Model_Managment","Model",["Package"],[])
Element("Model_Managment","Subsystem",["Package","Classifier"],
[Attr("isInstantiable","Boolean")])
# Use Cases
#Element("Use_Cases","Actor",["Classifier"],[])
#Element("Use_Cases","UseCase",["Classifier"],[])
#Element("Use_Cases","UseCaseInstance",["Instance"],[])
--- NEW FILE: UML13template.py ---
##class AggregationKind(MMEnumeration):
## ak_none=0
## ak_aggregate=1
## ak_composite=2
## description=["ak_none","ak_aggregate","ak_composite"]
##class ScopeKind(MMEnumeration):
## sk_instance=0
## sk_classifier=1
## description=["instance","classifier"]
##class VisibilityKind(MMEnumeration):
## vk_public=0
## vk_protected=1
## vk_private=2
## vk_package=3
## description=["public","protected","private","package"]
##class CallConcurrencyKind(MMEnumeration):
## cck_sequential=0
## cck_guarded=1
## cck_concurrent=2
## description=["sequential","guarded","concurrent"]
##class PseudostateKind(MMEnumeration):
## pk_choice=0
## pk_deepHistory=1
## pk_fork=2
## pk_initial=3
## pk_join=4
## pk_junction=5
## pk_shallowHistory=6
## description=["choice","deepHistory","fork","initial",
## "join","junction","shallowHistory"]
##class AggregationKind(MMEnumeration):
## ak_none=0
## ak_aggregate=1
## ak_composite=2
## description=['none','aggregate','composite']
##class ChangeableKind(MMEnumeration):
## ck_changeable=0
## ck_frozen=1
## ck_addOnly=2
## description=['changeable','frozen','addOnly']
##class OrderingKind(MMEnumeration):
## ok_unordered=0
## ok_ordered=1
## description=['unordered','ordered']
##class ParameterDirectionKind(MMEnumeration):
## pdk_in=0
## pdk_inout=1
## pdk_out=2
## pdk_return=3
## description=['in','inout','out','return']
def newMultiplicity(lower=1,upper=1):
m=Multiplicity()
m.addRange(MultiplicityRange(lower=lower,upper=upper))
return m
class Association:
def wfrAssociation1(self):
return self.allConnections().forAll(
lambda r1,r2: implies(r1.name==r2.name,r1==r2 or not r1.name))
def wfrAssociation2(self):
return self.allConnections().select(lambda c: c.aggregation != AggregationKind.ak_none).size()<=1
def wfrAssociation3(self):
return implies(self.allConnections().size()>=3,
self.allConnections().forAll(
lambda c: c.aggregation == AggregationKind.ak_none))
def allConnections(self):
return self.connection
class Classifier:
def allFeatures(self):
return self.feature
def allOperations(self):
return self.allFeatures().select(lambda f: f.oclIsKindOf(Operation))
def allMethods(self):
return self.allFeatures().select(lambda f: f.oclIsKindOf(Method))
class Class:
def wfrClass1(self):
"If a Class is concrete, all the Operations of the Class should have a realizing Method in the full descriptor [1.4,01.02.01,2-60]"
return self.isAbstract or self.allOperations().forAll(lambda op: self.allMethods().exist(lambda m: m.specification.asSet().includes(op)))
class Transition:
def getDescription(self):
text=''
if self.trigger:
text=self.trigger.getDescription()
if self.guard:
text=text+'['+self.guard.expression.body+']'
if self.effect:
text=text+'/'+self.effect.script.body
return text
class SignalEvent:
def getDescription(self):
return self.signal.name
class CallEvent:
def getDescription(self):
return self.operation.name
class TimeEvent:
def getDescription(self):
return self.when
class ChangeEvent:
def getDescription(self):
return self.changeExpression
class CompositeState:
def wfrCompositeState1(self):
"A composite state can have at most one initial vertex"
return self.subvertex.select(
lambda v: v.oclIsKindOf(Pseudostate) and v.kind== PseudostateKind.pk_initial).size() <=1
def wfrCompositeState2(self):
"A composite state can have at most one deep history vertex"
return self.subvertex.select(
lambda v: v.oclIsKindOf(Pseudostate) and v.kind== PseudostateKind.pk_deepHistory).size() <=1
def wfrCompositeState3(self):
"A composite state can have at most one shallow history vertex"
return self.subvertex.select(
lambda v: v.oclIsKindOf(Pseudostate) and v.kind== PseudostateKind.pk_shallowHistory).size() <=1
def wfrCompositeState4(self):
"There have to be at least two composite substates in a concurrent composite state"
return implies(self.isConcurrent,
self.subvertex.select(lambda v:
v.oclIsKindOf(CompositeState)).size()>=2)
def wfrCompositeState5(self):
"A concurrent state can only have composite states as substates"
return implies(self.isConcurrent,
self.subvertex.forAll(lambda s:
s.oclIsKindOf(CompositeState)))
def wfrCompositeState6(self):
"The substates of a composite state are part of only that composite state"
return self.subvertex.forAll(lambda s: s.container.asSet().size()==1 and s.container == self)
class FinalState:
def wfrFinalState1(self):
"A final state cannot have any outgoing transitions"
return self.outgoing.size()==0
class Pseudostate:
def wfrPseudostate1(self):
"An initial vertex can have at most one outgoing transition and no incoming transitions"
return implies(self.kind == PseudostateKind.pk_initial,
self.outgoing.size()<=1 and self.incoming.isEmpty())
def wftPseudostate2(self):
"History vertices can have at most one outgoing transition"
return implies(self.kind == PseudostateKind.pk_deepHistory or self.kind== PseudostateKind.pk_shallowHistory,
self.outgoing.size()<=1)
|
|
From: <de...@us...> - 2004-01-07 01:48:18
|
Update of /cvsroot/pymerase/smw/smw/mmgen/UML11
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mmgen/UML11
Added Files:
UML11-XMI11-UML13.xml UML11template.py uml11_Metamodel.mdl
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: UML11-XMI11-UML13.xml ---
<?xml version = '1.0' encoding = 'ISO-8859-1' ?>
<!-- <!DOCTYPE XMI SYSTEM 'UMLX13.dtd' > -->
<XMI xmi.version = '1.1' xmlns:UML='//org.omg/UML/1.3' timestamp = 'Mon Mar 04 13:33:48 2002' >
<XMI.header>
<XMI.documentation>
<XMI.exporter>Unisys.JCR.2</XMI.exporter>
<XMI.exporterVersion>1.3.2</XMI.exporterVersion>
</XMI.documentation>
<XMI.metamodel xmi.name = 'UML' xmi.version = '1.3'/>
</XMI.header>
<XMI.content>
<!-- ==================== uml11_Metamodel [Model] ==================== -->
<UML:Model xmi.id = 'G.0'
name = 'uml11_Metamodel' visibility = 'public' isSpecification = 'false'
isRoot = 'false' isLeaf = 'false' isAbstract = 'false' >
<UML:Namespace.ownedElement>
<UML:Dependency xmi.id = 'G.311'
name = '{Core?Data Types}{33F1E286026C}' visibility = 'public' isSpecification = 'false' >
<UML:Dependency.client>
[...13646 lines suppressed...]
<UML:PresentationElement.subject>
<Foundation.Core.ModelElement xmi.idref = 'G.317'/>
</UML:PresentationElement.subject>
</UML:DiagramElement>
<UML:DiagramElement xmi.id = 'XX.833'
geometry = ' 891, 639, 173, 346,' style = 'CategoryDependency' >
<UML:PresentationElement.subject>
<Foundation.Core.ModelElement xmi.idref = 'G.322'/>
</UML:PresentationElement.subject>
</UML:DiagramElement>
</UML:Diagram.element>
</UML:Diagram>
<UML:Diagram xmi.id = 'S.223'
name = 'Main' toolName = 'Rational Rose 98' diagramType = 'ModuleDiagram' style = '' >
<UML:Diagram.owner>
<Foundation.Core.ModelElement xmi.idref = 'G.0'/> <!-- uml11_Metamodel -->
</UML:Diagram.owner>
</UML:Diagram>
</XMI.content>
</XMI>
--- NEW FILE: UML11template.py ---
class AggregationKind(MMEnumeration):
ak_none=0
ak_aggregate=1
ak_composite=2
description=["ak_none","ak_aggregate","ak_composite"]
class ScopeKind(MMEnumeration):
sk_instance=0
sk_classifier=1
description=["instance","classifier"]
class VisibilityKind(MMEnumeration):
vk_public=0
vk_protected=1
vk_private=2
vk_package=3
description=["public","protected","private","package"]
class CallConcurrencyKind(MMEnumeration):
cck_sequential=0
cck_guarded=1
cck_concurrent=2
description=["sequential","guarded","concurrent"]
class PseudostateKind(MMEnumeration):
pk_choice=0
pk_deepHistory=1
pk_fork=2
pk_initial=3
pk_join=4
pk_junction=5
pk_shallowHistory=6
description=["choice","deepHistory","fork","initial",
"join","junction","shallowHistory"]
class AggregationKind(MMEnumeration):
ak_none=0
ak_aggregate=1
ak_composite=2
description=['none','aggregate','composite']
class ChangeableKind(MMEnumeration):
ck_changeable=0
ck_frozen=1
ck_addOnly=2
description=['changeable','frozen','addOnly']
class OrderingKind(MMEnumeration):
ok_unordered=0
ok_ordered=1
description=['unordered','ordered']
class ParameterDirectionKind(MMEnumeration):
pdk_in=0
pdk_inout=1
pdk_out=2
pdk_return=3
description=['in','inout','out','return']
def newMultiplicity(lower=1,upper=1):
m=Multiplicity()
m.addRange(MultiplicityRange(lower=lower,upper=upper))
return m
--- NEW FILE: uml11_Metamodel.mdl ---
(object Petal
version 45
_written "Rose 7.5.0103.1920"
charSet 0)
(object Design "Logical View"
is_unit TRUE
is_loaded TRUE
attributes (list Attribute_Set
(object Attribute
tool "Java"
name "IDE"
value "Internal Editor"))
quid "340B9A0501EF"
defaults (object defaults
rightMargin 0.250000
leftMargin 0.250000
topMargin 0.250000
[...28073 lines suppressed...]
tool "XML_DTD"
name "DefaultDeclType"
value "")))
(object Attribute
tool "XML_DTD"
name "default__Module-Spec"
value (list Attribute_Set
(object Attribute
tool "XML_DTD"
name "Assign All"
value FALSE)
(object Attribute
tool "XML_DTD"
name "ComponentPath"
value "")))
(object Attribute
tool "XML_DTD"
name "HiddenTool"
value FALSE))
quid "327A583203B1"))
|
Update of /cvsroot/pymerase/smw/smw/mmgen
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mmgen
Added Files:
__init__.py basicmm.py makefile mmdiff.py mmgen.py mmgencpp.py
mmprint.py
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: __init__.py ---
--- NEW FILE: basicmm.py ---
Element("Core","Element",[],[])
Element("Core","PresentationElement",[],[])
Aggregation("Element","presentation","*",
"PresentationElement","subject","*")
--- NEW FILE: makefile ---
all:
(cd dlg; make)
--- NEW FILE: mmdiff.py ---
import sys
from smw.metamodel import MetaMM
import types
class Diff:
def formatAttribute(self,name,t):
(kind,mmtype,multiplicity,otherRole,otherMultiplicity,ordering)=t
if kind==MetaMM.MMClass.kind__Attribute:
s="attribute "
elif kind==MetaMM.MMClass.kind__Association:
s="association "
else:
s="composition "
s=s+name+" : "
if kind!=MetaMM.MMClass.kind__Attribute:
if otherMultiplicity==1:
m="1 to "
else:
m="* to "
if multiplicity==1:
s=s+m+"1 "
else:
s=s+m+"* "
s=s+mmtype.__name__
return s
def compareElements(self,e1,e2):
s=""
definedInE1=[]
for a in e1.__mm__.keys():
found=0
for b in e1.__bases__:
if hasattr(b,"__mm__") and b.__mm__.has_key(a):
found=1
break
if not found:
definedInE1.append(a)
definedInE2=[]
for a in e2.__mm__.keys():
found=0
for b in e2.__bases__:
if hasattr(b,"__mm__") and b.__mm__.has_key(a):
found=1
break
if not found:
definedInE2.append(a)
for a in definedInE1:
if not e2.__mm__.has_key(a):
s=s+" -"+self.formatAttribute(a,e1.__mm__[a])+"\n"
for a in definedInE2:
if not e1.__mm__.has_key(a):
s=s+" +"+self.formatAttribute(a,e2.__mm__[a])+"\n"
for a in definedInE2:
if e1.__mm__.has_key(a):
if (e1.__mm__[a][0]!= e2.__mm__[a][0]) or (
e1.__mm__[a][1].__name__!= e2.__mm__[a][1].__name__) or (
e1.__mm__[a][2]!= e2.__mm__[a][2]):
#s=s+"<"+str(e1.__mm__[a])+"\n"
#s=s+">"+str(e2.__mm__[a])+"\n"
s=s+" <"+self.formatAttribute(a,e1.__mm__[a])+"\n"
s=s+" >"+self.formatAttribute(a,e2.__mm__[a])+"\n"
return s
def compare(self,n1,n2):
try:
self.metamodel1=MetaMM.getMetamodelByName(n1)
except Exception,e:
print "An error ocurred while loading",n1,":",e
sys.exit(-1)
try:
self.metamodel2=MetaMM.getMetamodelByName(n2)
except Exception,e:
print "An error ocurred while loading",n2,":",e
sys.exit(-1)
self.mm1name=self.metamodel1.MMName+' '+self.metamodel1.MMVersion
self.mm2name=self.metamodel2.MMName+' '+self.metamodel2.MMVersion
print "Comparing",self.mm1name,"and",self.mm2name
if self.metamodel1==self.metamodel2:
print "It is the same metamodel."
return
self.elements1={}
self.elements2={}
for e in self.metamodel1.__dict__.values():
if e!=MetaMM.MMClass and type(e)==types.ClassType and issubclass(e,MetaMM.MMClass):
self.elements1[e.__name__]=e
for e in self.metamodel2.__dict__.values():
if e!=MetaMM.MMClass and type(e)==types.ClassType and issubclass(e,MetaMM.MMClass):
self.elements2[e.__name__]=e
removed=0
print "Elements removed from ", self.mm2name
for n in self.elements1.keys():
if not self.elements2.has_key(n):
print "-",n
removed=removed+1
added=0
print "New elements in",self.mm2name
for n in self.elements2.keys():
if not self.elements1.has_key(n):
print "+",n
added=added+1
changed=0
print "Elements that have changed"
for n in self.elements1.keys():
if self.elements2.has_key(n):
s=self.compareElements(self.elements1[n],
self.elements2[n])
if s:
print n
print s
changed=changed+1
print removed," elements removed"
print added," elements added"
print changed," elements changed"
if __name__=='__main__':
if len(sys.argv)!=3:
print "mmdiff compares two diffrent versions of a metamodel."
print "Usage : mmdiff old new"
print " Where old is the name of the old verion and new of the new version of the metamodel to compare."
print "Example: mmdiff UML13 UML14"
else:
d=Diff()
d.compare(sys.argv[1],sys.argv[2])
--- NEW FILE: mmgen.py ---
#
# mmgen.py Ivan Porres ip...@ab...
#
#
# TO-DO:
#
# !!!!! Think and FIX data types
#
# Implement org.omg.xmi.enumerationUnprefix 3-23
# Check for name clashes with MMClass
# Some datatypes (like Geometry) should not be enumerations but Classes
import os
import copy
import string
import sys
import xml.dom
from xml.dom import minidom
from smw import io
from smw.metamodel import UML0
from smw.metamodel import UMLDatatypes
import qt
from smw.smwQtApplication import *
from smw.mmgen.dlg import GeneratorDlg
from smw import Configuration
def nameCase(s):
return string.upper(s[0])+s[1:]
class MetaElement:
pass
class MetaClass(MetaElement):
def __init__(self,pak,name,sup,attr,ops):
self.name=name
self.pak=pak
self.sup=sup
self.attr=attr
self.processed=0
self.ops=ops
self.subclasses=[]
def addSubClass(self,melements):
for c in melements.values():
if self.name in c.sup:
if c not in self.subclasses:
self.subclasses.append(c)
for c in self.subclasses:
c.addSubClass(melements)
for c in copy.copy(self.subclasses):
for c1 in c.subclasses:
if c1 not in self.subclasses:
self.subclasses.append(c1)
def generate1(self,melements,code,template):
if self.processed:
return 0
self.addSubClass(melements)
for s in self.sup:
if (melements[s]).processed==0:
return 0
#print self.name,
sys.stdout.flush()
if self.name in ["Element","PresentationElement"]:
self.processed=1
return 1
if self.sup!=[]:
super=""
for s in self.sup:
for p in melements[s].attr:
e=0
for n in self.attr:
if p[0]==n[0]:
e=1
if not e:
self.attr.append(p)
if super!="":
super=super+" ,"
super=super+s
code.add("\nclass "+self.name+"("+super+"):")
else:
self.params=self.attr
code.add("\nclass "+self.name+"(MMClass):")
code.add(" __name__='"+self.name+"'")
code.add(" __userWellFormedRule__=MMSet()")
if template.has_key(self.name):
code.addpl(string.join(
string.split(template[self.name],'\n')[1:],'\n' ))
del template[self.name]
as=""
for a in self.attr:
if len(a)!=3:
if not (
a[1].lower==0 and a[1].upper==1 or (
a[1].lower==0 and a[1].upper==-1)):
name=a[0]
if name[0]=="+":
name=name[1:]
if as!="":
as=as+" and \\\n "
if a[1].lower==1 and a[1].upper==1:
as=as+"self."+name+"!=None"
else:
if a[1].lower>0:
as=as+"self."+name+".size()>="+str(a[1].lower)
if a[1].upper!=-1:
as=as+" and "
if a[1].upper!=-1:
as=as+"self."+name+".size()<="+str(a[1].upper)
if as:
code.add("\n def wfrMetaModelMultiplicity(self):")
code.add(" return "+as)
self.processed=1
return 1
def generate2(self,melements,code,template):
s=''
for c in self.subclasses:
if s:
s=s+', '
s=s+c.name
code.add(self.name+".__subclasses__=["+s+"]")
if self.name in ["Element","PresentationElement"]:
return 1
code.add(self.name+".__mm__={")
count=0
for a in self.attr:
count+=1
if count<len(self.attr):
comma=','
else:
comma=''
if len(a)==3:
m=1
atype=a[2]
assert(atype)
code.add(" '"+a[0]+"': (MMClass.kind__Attribute,"+atype+","+str(m)+",None,None,0)"+comma)
else:
ordered=0
if a[0][0]=="+":
a[0]=a[0][1:]
ordered=1
otherName=a[5]
if otherName[0]=="+":
otherName=otherName[1:]
if a[1].upper==1:
m1=1
else:
m1=0
if a[6].upper==1:
m2=1
else:
m2=0
if a[3]=='composite':
kind="MMClass.kind__Composition"
else:
kind="MMClass.kind__Association"
code.add(" '"+a[0]+"': ("+kind+","+a[2]+","+str(m1)+
",'"+otherName+"',"+str(m2)+","+str(ordered)+")"+comma)
code.add("}")
code.add("")
# create multiplicty assertion
as=""
class CodeArtifact:
def __init__(self):
self.tabs=0
self.text=''
def indent(self,i):
self.tabs=self.tabs+i
def addpl(self,s):
for i in range(self.tabs):
self.text=self.text+' '
self.text=self.text+s
def prepend(self,s):
self.text=s+'\n'+self.text
def add(self,s):
self.addpl(s+'\n')
def dump(self,file):
f=open(file,'w')
f.write(self.text)
f.close()
class MOF2SimpleMetamodelLanguage:
def __init__(self,doc):
self.elementById={}
self.findIds(doc)
self.referenceTable={}
def findIds(self,node):
self.elementById[node.getAttribute('xmi.id')]=node
for c in node.childNodes:
if c.nodeType!= xml.dom.Node.TEXT_NODE:
self.findIds(c)
def extractMOFClass(self,node,code):
mmclass=node.nodeName
name=node.getAttribute('name')
supertypes=[]
for s in string.split(node.getAttribute('supertypes')):
supertypes.append(self.elementById[s].getAttribute('name'))
attrs=[]
for c in node.childNodes:
if c.nodeName=='Model:Namespace.contents':
for a in c.childNodes:
if a.nodeName in ['Model:Attribute','Model:StructuredField']:
atype= self.elementById[a.getAttribute('type')].getAttribute('name')
for aem in a.childNodes:
if aem.nodeName=="Model:TypedElement.type":
for item in aem.childNodes:
if item.nodeName=='Model:Classifier':
atype=self.elementById[item.getAttribute('xmi.idref')].getAttribute('name')
attrs.append([a.getAttribute('name'),"1",atype])
elif a.nodeName=='Model:EnumerationType':
self.extractMOFDataType(a,code)
elif a.nodeName=='Model:Reference':
self.extractMOFReference(a)
else:
self.cannotHandle(a,"extractMOFClass")
elif c.nodeName=='Model:GeneralizableElement.supertypes':
for a in c.childNodes:
if a.nodeName=="Model:GeneralizableElement":
id=a.getAttribute("xmi.idref")
supertypes.append(self.elementById[id].getAttribute('name'))
else:
self.cannotHandle(c,"extractMOFClass")
Element("?",name,supertypes,attrs)
def extractMOFReference(self,node):
id=node.getAttribute("xmi.id")
for c in node.childNodes:
if c.nodeName=="Model:Reference.referencedEnd":
for a in c.childNodes:
if a.nodeName=="Model:AssociationEnd":
self.referenceTable[a.getAttribute("xmi.idref")]=id
print "reference table ",self.referenceTable
def extractMOFDataType(self,dt,code):
name=dt.getAttribute('name')
if name in ['Name','Integer','Boolean','String','UnlimitedInteger']:
# we implement the basic dataypes in Python
return
code.add("class "+name+"(MMEnumeration):")
code.indent(+1)
e=0
descriptions=[]
for tc in dt.childNodes:
if tc.nodeName=='Model:DataType.typeCode':
for ctc in tc.childNodes:
if ctc.nodeName=='XMI.CorbaTypeCode':
for enum in ctc.childNodes:
if enum.nodeName=='XMI.CorbaTcEnum':
for enuml in enum.childNodes:
if enuml.nodeName=='XMI.CorbaTcEnumLabel':
label=enuml.getAttribute('xmi.tcName')
descriptions.append(label)
code.add(label+'='+str(e))
e=e+1
code.add("description="+str(descriptions))
code=code.indent(-1)
def extractMOFAssociation(self,node):
#agregation=node.getAttribute('agregation')
ends=[]
for c in node.childNodes:
if c.nodeName=='Model:Namespace.contents':
for e in c.childNodes:
if e.nodeName in ['Model:AssociationEnd','Model:Reference']:
if self.referenceTable.has_key(e.getAttribute("xmi.id")):
print "CAMBIAZO!"
e=self.elementById[self.referenceTable[e.getAttribute("xmi.id")]]
aType=self.elementById[e.getAttribute('type')].getAttribute('name')
multiplicity=[]
for aem in e.childNodes:
if aem.nodeName=="Model:TypedElement.type":
for item in aem.childNodes:
if item.nodeName=='Model:Classifier':
aType=self.elementById[item.getAttribute('xmi.idref')].getAttribute('name')
elif aem.nodeName in ['Model:AssociationEnd.multiplicity', 'Model:StructuralFeature.multiplicity']:
for item in aem.childNodes:
if item.nodeName=='XMI.field':
multiplicity.append(item.childNodes[0].data)
else:
self.cannotHandle(aem,"extractMOFAssociation2")
m=''
if multiplicity[1]=='-1':
m=multiplicity[0]+'..*'
elif multiplicity[0]==multiplicity[1]:
m=multiplicity[0]
else:
m=multiplicity[0]+'..'+multiplicity[1]
aE=[aType,
e.getAttribute('name'),
e.getAttribute('aggregation')
]
if multiplicity[2]=='true':
aE[1]="+"+aE[1]
print ">>>> Ordered ",aE
aE.append(m)
ends.append(aE)
else:
self.cannotHandle(e,"extractMOFAssociation1")
temp=ends[0][0]
ends[0][0]=ends[1][0]
ends[1][0]=temp
if ends[0][2]=='composite':
ends=[ends[1],ends[0]]
if ends[1][2]=='composite':
Composition(ends[0][0],ends[0][1],ends[0][3],
ends[1][0],ends[1][1],ends[1][3])
else:
Association(ends[0][0],ends[0][1],ends[0][3],
ends[1][0],ends[1][1],ends[1][3])
def extractMOFPackage(self,node,code):
for c in node.childNodes:
if c.nodeName=='Model:Namespace.contents':
for a in c.childNodes:
if a.nodeName in ['Model:DataType','Model:EnumerationType']:
self.extractMOFDataType(a,code)
elif a.nodeName in ['Model:Class','Model:StructureType']:
self.extractMOFClass(a,code)
elif a.nodeName=='Model:Association':
self.extractMOFAssociation(a)
else:
self.cannotHandle(a,"processPackage")
else:
self.cannotHandle(c)
def cannotHandle(self,node,context=''):
if node.nodeName!='#text' and node.nodeName not in \
['Model.Tag','Model:Tag','Model:Import'] :
print "Warning:I cannot handle element "+node.nodeName,
if context:
print "Context:"+context
else:
print
def extractMOF(self,node,code):
if node.nodeName=='Model:Package':
self.extractMOFPackage(node,code)
else:
for c in node.childNodes:
if c.nodeType!= xml.dom.Node.TEXT_NODE:
self.extractMOF(c,code)
class UML2SimpleMetamodelLanguage:
def __init__(self,metamodel):
self.metamodel=metamodel
def extractUMLClass(self,m,path):
m.name=str(m.name)
parents=[]
for p in m.generalization:
if p.parent:
pname=str(p.parent.name)
if pname!=m.name and pname not in parents:
parents.append(pname)
attrs=[]
for a in m.feature:
if isinstance(a,self.metamodel.Attribute) and a.type:
attrs.append(Attribute(str(a.name),str(a.type.name)))
if str(m.name) in UMLDatatypes.standardDataTypes:
print "skiping ",m.name," since is a basic data type"
else:
Element(path,m.name,parents,attrs)
def extractUML13Association(self,m):
if m.connection[1].aggregation==2:
c0=m.connection[1]
c1=m.connection[0]
else:
c0=m.connection[0]
c1=m.connection[1]
for c in [c0,c1]:
if not str(c.name):
c.name=string.lower(c.type.name[0])+c.type.name[1:]
c.multiplicityAsString=str(c.multiplicity.range[0].lower)
if c.multiplicity.range[0].upper!=-1:
c.multiplicityAsString+=".."+str(c.multiplicity.range[0].upper)
else:
c.multiplicityAsString+="..*"
if c0.aggregation==2:
Composition(
str(c0.type.name),str(c1.name),c1.multiplicityAsString,
str(c1.type.name),str(c0.name),c0.multiplicityAsString)
else:
Association(
str(c1.type.name),str(c0.name),c0.multiplicityAsString,
str(c0.type.name),str(c1.name),c1.multiplicityAsString)
def extractUML14Association(self,m):
if m.connection[1].aggregation==2:
c0=m.connection[1]
c1=m.connection[0]
else:
c0=m.connection[0]
c1=m.connection[1]
for c in [c0,c1]:
if not str(c.name):
c.name=string.lower(c.participant.name[0])+c.participant.name[1:]
c.multiplicityAsString=str(c.multiplicity.range[0].lower)
if c.multiplicity.range[0].upper!=-1:
c.multiplicityAsString+=".."+str(c.multiplicity.range[0].upper)
else:
c.multiplicityAsString+="..*"
if c0.aggregation==2:
Composition(
str(c0.participant.name),str(c1.name),c1.multiplicityAsString,
str(c1.participant.name),str(c0.name),c0.multiplicityAsString)
else:
Association(
str(c1.participant.name),str(c0.name),c0.multiplicityAsString,
str(c0.participant.name),str(c1.name),c1.multiplicityAsString)
def extractUML(self,package,path=''):
for m in package.ownedElement:
if isinstance(m,self.metamodel.Class) and str(m.name)!="<DummyClass>":
self.extractUMLClass(m,path)
if isinstance(m,self.metamodel.Association) and m.connection.size()==2:
if self.metamodel.MMVersion=="14":
self.extractUML14Association(m)
else:
self.extractUML13Association(m)
if isinstance(m,self.metamodel.Package):
if path:
newpath=path+"."+m.name
else:
newpath=m.name
self.extractUML(m,newpath)
class SimpleMetamodelLanguageGenerator:
def __init__(self,name,version):
global theGenerator
theGenerator=self
self.associations={}
self.melements={}
self.name=name
self.version=version
self.conflicts={}
self.conflictsCounter={}
def registerPackage(self,name):
# We ignore packages so far
pass
def registerClass(self,package,name,supertypes,attr):
self.melements[name]=MetaClass(package,name,supertypes,attr,[])
def checkAConflicts(self,c,r,c2,r2):
if self.conflicts.has_key(c):
if self.conflicts[c].has_key(r):
print "Warning: association end conflict in:",
print c+"."+r,"-",c2+"."+r2
print " Conflicting association is:",
print c+"."+r,"-",self.conflicts[c][r][0]+"."+self.conflicts[c][r][1]
finalRole=r+string.capitalize(r2[0])+r2[1:]
if self.conflicts[c].has_key(finalRole):
print " I cannot find an alternative name. Please fix the metamodel."
assert(0)
print " The association has been renamed to:",
print c+"."+finalRole,"-",c2+"."+r2
return (c,finalRole)
else:
self.conflicts[c][r]=(c2,r2)
else:
self.conflicts[c]={r: (c2,r2)}
return (c,r)
def registerAssociation(self,atype,c1,r1,n1,c2,r2,n2):
c1,r1=self.checkAConflicts(c1,r1,c2,r2)
c2,r2=self.checkAConflicts(c2,r2,c1,r1)
self.associations["A_"+c1+"."+r1+"_"+c2+"."+r2]=[atype,c1,r1,n1,c2,r2,n2]
def generate(self,code,template):
for k in self.associations.keys():
a=self.associations[k]
if a[2]=="presentation":
a[0]="composite"
if self.melements.has_key(a[4]) and self.melements.has_key(a[1]):
self.melements[a[1]].attr.append([a[2],a[3],a[4],a[0],1,a[5],a[6],a[1]])
self.melements[a[4]].attr.append([a[5],a[6],a[1],'none',2,a[2],a[3],a[1]])
else:
if not self.melements.has_key(a[4]) and UMLDatatypes.__dict__.has_key(a[4]):
self.melements[a[1]].attr.append([a[2],Multiplicity(1,1),a[4]])
if not self.melements.has_key(a[1]) and UMLDatatypes.__dict__.has_key(a[1]):
self.melements[a[4]].attr.append([a[5],Multiplicity(1,1),a[1]])
toprocess=len(self.melements)
while(toprocess>0):
for k in self.melements.keys():
e=self.melements[k]
if e.generate1(self.melements,code,template):
toprocess=toprocess-1
for k in self.melements.keys():
e=self.melements[k]
e.generate2(self.melements,code,template)
print len(self.melements),"elements generated."
s=''
for c in template.values():
s=s+c+'\n'
code.prepend(s)
code.prepend("MMName='"+str(self.name)+"'")
code.prepend("MMVersion='"+str(self.version)+"'")
code.prepend("MMFullName='"+str(self.name)+' '+str(self.version)+"'")
code.prepend('from smw.metamodel.MetaMM import *')
code.prepend('import copy')
code.prepend('from __future__ import nested_scopes')
#
#
def Package(name):
global theGenerator
assert(len(name))
theGenerator.registerPackage(name)
def Element(package,name,parent=[],attribute=[]):
global theGenerator
assert(len(name))
for p in parent:
if type(p)!=type("") and type(p)!=type(u""):
raise "Invalid parent specification",parent
theGenerator.registerClass(package,name,parent,attribute)
def Attribute(name,type):
assert(name and type)
return [name,Multiplicity(1,1),type]
def Association(participant1,role1,multiplicity1,participant2,role2,multiplicity2,kind="none"):
global theGenerator
print participant1,role1,role2
role1=fixName(role1,context=participant1+"."+role1)
role2=fixName(role2,context=participant2+"."+role2)
m1=fromStringToMultiplicity(multiplicity1)
if not m1:
raise "Invalid multiplicity "+multiplicity1+ "in ", participant1+"."+role1
m2=fromStringToMultiplicity(multiplicity2)
if not m2:
raise "Invalid multiplicity "+multiplicity2+ "in ", participant2+"."+role2
assert(participant1 and role1 and m1 and \
participant2 and role2 and m2)
theGenerator.registerAssociation(kind,participant1,role1,m1
,participant2,role2,m2)
def Composition(participant1,role1,multiplicity1,participant2,role2,multiplicity2):
Association(participant1,role1,multiplicity1,
participant2,role2,multiplicity2,
kind="composite")
def DataType():
pass
def Enumeration():
pass
###
class Multiplicity:
def __init__(self,lower=0,upper=0):
self.lower=lower
self.upper=upper
def fromStringToMultiplicity(s):
s=string.replace(s," ","")
list=string.split(s,",")
if len(list)==0:
return None
m=Multiplicity()
for temp in list:
r=string.split(temp,"..")
#If only element x in list, lower=x and upper=x
if len(r)==1:
r.append(r[0])
# r[0]=string.strip(r[0])
if r[0]=='*':
r[0]=0
r.append(-1)
else:
try:
r[0]=int(r[0])
except ValueError:
return None
if r[1]=='*':
r[1]=-1
else:
try:
r[1]=int(r[1])
except ValueError:
return None
if r[1] != -1 and r[0] > r[1] or r[0]==-1:
r[0],r[1]=r[1],r[0] #Swap
if len(r)==3 and r[1]!=-1: #if input is i.e(*..5) swap to (5..*)
r[0]=r[1]
r[1]=r[2]
m.lower=r[0]
m.upper=r[1]
return m
def removecolon(s):
if s and s[-1]==':':
return s[:-1]
else:
return s
def fixName(s,context=""):
if s:
if s[0]=="/":
print "Warning: malformed name",s,
if context:
print "in",context
else:
print
print "I will use",s[1:],"instead"
return s[1:]
return s
class MMGen:
def __init__(self,source,format,target,name,version,templateFile,baseModel=None):
self.source=source
self.format=format
self.target=target
self.version=version
self.name=name
self.templateFile=templateFile
self.baseModel=baseModel
assert(not self.baseModel) # base model not supported yet
def generateModule(self):
if len(self.target)<3 or self.target[-3:] not in ['.py','.PY'] :
self.target_noextension=self.target
self.target=self.target+".py"
else:
self.target_noextension=self.target[:-3]
if self.templateFile:
print "Reading template file "+self.templateFile
self.parseTemplateFile(self.templateFile)
else:
self.template={}
code=CodeArtifact()
generator=SimpleMetamodelLanguageGenerator(self.name,self.version)
if self.format=="mofformat":
print "Reading MOF definition "+self.source+"..."
fd=open(self.source,'r')
doc=minidom.parse(fd).documentElement
fd.close()
extractor=MOF2SimpleMetamodelLanguage(doc)
extractor.extractMOF(doc,code)
elif self.format=="umlformat":
if type(self.source)==type(""):
print "Reading UML definition "+self.source+".."
doc=io.loadModel(self.source,UML0)
else:
doc=self.source
print "USING LOADED MODEL",doc
code.add(UMLDatatypes.standardDataTypesCode)
extractor=UML2SimpleMetamodelLanguage(metamodel=doc.getMetamodel())
extractor.extractUML(doc)
else:
print "Reading python definition "+self.source+"..."
fd=open(self.source,'r')
doc= fd.read()
fd.close()
exec(doc)
print "Generating python module "+self.target+" ..."
generator.generate(code,self.template)
print "Saving python module "+self.target
code.dump(self.target)
self.checkModule(self.target_noextension)
def checkModule(self,m):
print "Trying to import module "+m+" ..."
ok=0
#sys.path.append(os.getcwd())
try:
ok=not(os.system("python2 "+m+".py"))
except Exception,e:
print e
if not ok:
try:
test=__import__(m)
ok=1
except Exception,e:
print e
if ok:
print "The module "+m+" loads correctly. Happy scripting!"
else:
print "Problems loading module"
return ok
def parseTemplateFile(self,templateFile):
self.template={}
fd=open(templateFile,'r')
inclass=0
for l in fd.readlines():
w=string.split(l)
if not inclass:
if w and w[0]=="class":
inclass=1
className=removecolon(w[1])
text=l
else:
if w and w[0]=="class":
self.template[className]=text
className=removecolon(w[1])
text=l
else:
text=text+l
if inclass:
self.template[className]=text
fd.close()
profileCode="""
from smw.metamodel.Profiles import *
from smw.Configuration import Configuration
class <<NAME>>Profile(Profile):
def createModel(self,name):
from <<MODULE>> import *
return <<ROOT>>(name=name)
blurb='<<NAME>> Profile.'
def register(modelerApp):
p= <<NAME>>Profile('<<NAME>>',
'<<MODULE>>',
[],
blurb)
modelerApp.registerProfile(p)
"""
class GeneratorGUI(GeneratorDlg.GeneratorDlg):
def __init__(self):
GeneratorDlg.GeneratorDlg.__init__(self)
self.model=None
def chooseInputFile(self):
name=qt.QFileDialog.getOpenFileName(
'','Metamodels (*.*)',self)
if str(name):
self.SourceFile.setText(name)
def chooseAditionalPythonModule(self):
name=qt.QFileDialog.getOpenFileName(
'','Python Modules (*.py)',self)
if str(name):
self.TemplateFile.setText(name)
def chooseTargetDir(self):
name=qt.QFileDialog.getExistingDirectory()
if str(name):
self.TargetDir.setText(name)
def convert(self):
if not self.model:
source=str(self.SourceFile.text())
if not input:
qt.QMessageBox.critical(self,"No source file",
"Please enter the source file containing the metamodel to generate")
return
else:
source=self.model
name=str(self.Name.text())
version=str(self.Version.text())
if not name or not version:
qt.QMessageBox.critical(self,"Target",
"Please enter the name and version of the metamodel to generate, for example: UML 14")
return
config=Configuration.Configuration()
if self.HOME.isChecked():
path=config.getParameter("user_home").get()+"/.smw/profiles/"+name
try:
os.makedirs(path+"/metamodel")
except:
pass
target=path+"/metamodel/"
else:
target=str(self.TargetDir.text())
if target[-1] not in ["/","\\"]:
target=target+"/"
target=target+name+version+".py"
templateFile=str(self.TemplateFile.text())
if self.MOFFormat.isChecked():
format="mofformat"
if self.UMLFormat.isChecked():
format="umlformat"
if self.SimpleFormat.isChecked():
format="simpleformat"
mmgen=MMGen(source=source,
target=target,
name=name,
version=version,
format=format,
templateFile=templateFile)
mmgen.generateModule()
if self.HOME.isChecked() and self.GenerateProfile.isChecked():
self.createInitFile(config.getParameter("user_home").get()+"/.smw/profiles/"+name)
self.createInitFile(config.getParameter("user_home").get()+"/.smw/profiles/"+name+"/metamodel")
fd=open(path+"/"+name+"profile.py","w")
c=profileCode
c=string.replace(c,"<<NAME>>",name)
c=string.replace(c,"<<MODULE>>",name+".metamodel."+name+version)
c=string.replace(c,"<<ROOT>>","Model")
fd.write(c)
fd.close()
self.close()
def createInitFile(self,s):
fd=open(s+"/__init__.py","w")
fd.close()
def cli():
format="mofformat"
baseModel=None
baseFlag=0
args=[]
for a in sys.argv[1:]:
if baseFlag:
baseModel=a
baseFlag=0
continue
if a=='--simple':
format="simpleformat"
continue
if a=='--uml':
format="umlformat"
continue
if a=='--mof':
format="mofformat"
continue
if a=="--base":
baseFlag=1
continue
args.append(a)
if len(args)>=5:
templateFile=args[4]
else:
templateFile=None
if baseModel:
print "Using "+baseModel+" as base metamodel"
mmgen=MMGen(source=args[0],
target=args[1],
name=args[2],
version=args[3],
format=format,
templateFile=templateFile,
baseModel=baseModel)
mmgen.generateModule()
if __name__=='__main__':
if len(sys.argv)>=5:
cli()
else:
app=qt.QApplication(sys.argv)
dlg=GeneratorGUI()
dlg.exec_loop()
--- NEW FILE: mmgencpp.py ---
#
# mmgen.py Ivan Porres ip...@ab...
#
# c++ modifications/hacks Marcus Alanen maa...@ab...
#
# TO-DO:
#
# !!!!! Think and FIX data types
#
# Implement org.omg.xmi.enumerationUnprefix 3-23
# Check for name clashes with MMClass
# Some datatypes (like Geometry) should not be enumerations but Classes
import os
import copy
import string
import sys
import xml.dom
[...1031 lines suppressed...]
version=args[3],
format=format,
templateFile=templateFile,
baseModel=baseModel)
mmgen.generateModule()
if __name__=='__main__':
if len(sys.argv)>=5:
cli()
else:
app=qt.QApplication(sys.argv)
dlg=GeneratorGUI()
dlg.exec_loop()
--- NEW FILE: mmprint.py ---
import sys
from smw.metamodel import MetaMM
import copy
import string
def mmprint(mname,ename):
try:
mm=MetaMM.getMetamodelByName(mname)
except Exception,e:
print "An error ocurred while loading",mname,":",e
sys.exit(-1)
if not mm.__dict__.has_key(ename):
print "Metamodel",mname,"does not contain an element called ",ename
sys.exit(-1)
element=mm.__dict__[ename]
for c in [element]:
print "Element",c.__name__,":"
if c.__bases__:
bases=list(c.__bases__)
bases.sort(lambda s1,s2: cmp(s1.__name__,s2.__name__))
print " Subclass of",
for sc in bases:
print sc.__name__,
print
if c.__subclasses__:
c.__subclasses__.sort(lambda s1,s2: cmp(s1.__name__,s2.__name__))
print " Inherinted by",
for sc in c.__subclasses__:
print sc.__name__,
print
print
l=copy.copy(c.__mm__.keys())
l.sort()
for name in l:
(kind,mmtype,multiplicity,otherRole,otherMultiplicity)=c.__mm__[name]
if kind==MetaMM.MMClass.kind__Attribute:
print " Attribute ",
elif kind==MetaMM.MMClass.kind__Association:
print " Association",
else:
print " Composition",
print name,
if kind!=MetaMM.MMClass.kind__Attribute:
print ":",
if otherMultiplicity==1:
m="1 to"
else:
m="* to"
if multiplicity==1:
print m+" 1",
else:
print m+" *",
print mmtype.__name__
else:
print ":",mmtype.__name__
print
if __name__=="__main__":
if len(sys.argv)!=3:
print "mmprint prints a description of a model element"
print "Usage : mmprint metamodel element"
print "Example: mmprint UML14 ModelElement"
sys.exit(0)
else:
mmprint(sys.argv[1],sys.argv[2])
|
Update of /cvsroot/pymerase/smw/smw/mathedit/unittests
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mathedit/unittests
Added Files:
CheckCorrectPyQt.py CmdList_testDocument.py
Edit_testDocument.py Edit_testEditor.py
Formula_testDocument.py Formula_testEditor.py
Formula_testParser.py Formula_testScanner.py Makefile
Outline1_testDocument.py Outline2_testEditor.py Test.py
Text_testDocument.py Text_testEditor.py __init__.py
testMTextEdit.py
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: CheckCorrectPyQt.py ---
from qt import *
from smw.mathedit.medit.Text_Document import *
doc = Text_Document()
doc.insertText(0,0,"Test")
t = doc.getText()
print "The text is \"", t, "\""
assert unicode(t) == u"Test"
--- NEW FILE: CmdList_testDocument.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Edit_testDocument.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Edit_testEditor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_testDocument.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_testEditor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_testParser.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_testScanner.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Makefile ---
clean:
rm -f *.pyc *.pyo *.log
--- NEW FILE: Outline1_testDocument.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Outline2_testEditor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Test.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_testDocument.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_testEditor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: __init__.py ---
--- NEW FILE: testMTextEdit.py ---
from smw.mathedit.medit.MTextEdit import MTextEdit
import unittest
from qt import *
class testMTextEdit( unittest.TestCase ):
def setUp( self ):
self.app = QApplication([])
self.e = MTextEdit()
self.app.setMainWidget(self.e)
self.e.show()
self.app.processEvents()
def tearDown( self ):
self.app.processEvents()
del self.e
del self.app
def testSetText( self ):
self.e.setText(u"This is the\ntext")
self.app.processEvents()
self.assertEquals(unicode((self.e.text())),u"This is the\ntext")
self.e.clear()
self.app.processEvents()
self.assertEquals(unicode((self.e.text())),u"")
def testAppend( self ):
self.e.append(u"ddd")
self.app.processEvents()
self.assertEquals(unicode(self.e.text()),u"ddd")
self.app.processEvents()
self.e.setCursorPosition(0,0)
self.app.processEvents()
self.e.append(u"\nddd");
self.app.processEvents()
self.assertEquals(unicode(self.e.text()),u"ddd\nddd")
def testInsertParagraph( self ):
self.e.insertParagraph("test",0)
self.app.processEvents()
self.assertEquals(unicode(self.e.text()),u"test\n")
self.app.processEvents()
self.e.insertParagraph("firstline",0)
self.app.processEvents()
self.assertEquals(unicode(self.e.text()),u"firstline\ntest\n")
self.app.processEvents()
self.e.insertParagraph("lastline",-1)
self.app.processEvents()
self.assertEquals(unicode(self.e.text()),
u"firstline\ntest\n\nlastline")
def testSelect( self ):
self.app.processEvents()
self.e.insertAt(u"ABCDEF",0,0)
self.app.processEvents()
self.e.setSelection(0,1,0,5)
self.app.processEvents()
self.assertEquals(self.e.getSelection(),(0,1,0,5))
self.assertEquals(unicode(self.e.selectedText()),u"BCDE")
self.e.removeSelection()
self.app.processEvents()
self.assertEquals(self.e.getSelection(),(-1,-1,-1,-1))
self.assertEquals(unicode(self.e.selectedText()),u"")
def testCutCopyPaste( self ):
self.app.processEvents()
self.e.insertAt(u"ABCDEF",0,0)
self.app.processEvents()
self.e.setSelection(0,0,0,3)
self.app.processEvents()
self.e.copy()
self.app.processEvents()
self.e.removeSelection()
self.e.setCursorPosition(0,6)
self.app.processEvents()
self.e.paste()
self.app.processEvents()
self.assertEquals(unicode((self.e.text())),u"ABCDEFABC")
self.e.setSelection(0,0,0,9)
self.app.processEvents()
self.e.cut()
self.app.processEvents()
self.assertEquals(unicode((self.e.text())),u"")
def testUndoRedo( self ):
for i in range(10):
self.e.insertAt("x"*i+"\n",i,0)
self.app.processEvents()
for i in range(10):
self.e.undo()
self.app.processEvents()
self.assertEquals(unicode((self.e.text())),u"")
for i in range(10):
self.e.redo()
self.app.processEvents()
self.assertEquals(unicode((self.e.text())),unicode("".join([u"x"*i+"\n" for i in range(10)])))
def suite():
return unittest.makeSuite(testMTextEdit,'test')
if __name__=='__main__':
unittest.main()
|
Update of /cvsroot/pymerase/smw/smw/mathedit/web
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mathedit/web
Added Files:
bg.png doc_down.png doc_up.png documentation.html
downloads.html downloads_down.png downloads_up.png
features.html features_down.png features_up.png home_down.png
home_up.png index.html links.html links_down.png links_up.png
members.html members_down.png members_up.png minieditor.png
screenshots.html screenshots_down.png screenshots_up.png
title-old.png title.png
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: bg.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: doc_down.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: doc_up.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: documentation.html ---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Mathematical Derivation Editor</title>
<script language="JavaScript">
var ctcb = new Image();
ctcb.src="pics/connectb2.jpg";
function move_in(img_name,img_src) {
document[img_name].src=img_src;
}
function move_out(img_name,img_src) {
document[img_name].src=img_src;
}
</script>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body background="bg.png">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr height="160">
<td align="Left" valign="Top" width="220"></td>
<td align="Left" valign="Top" width="640">
<h1 align="Center"><img src="title.png" alt="The Mathematical Derivation Editor"</h1>
</td>
</tr>
<tr>
<td align="Left" valign="Top">
<a href="index.html"
onmouseover="move_in('home','home_down.png')"
onmouseout="move_out('home','home_up.png')">
<img src="home_up.png" alt="home" border="0" name="home"></a><br>
<a href="features.html"
onmouseover="move_in('features','features_down.png')"
onmouseout="move_out('features','features_up.png')">
<img src="features_up.png" alt="features" border="0" name="features"></a><br>
<a href="downloads.html"
onmouseover="move_in('downloads','downloads_down.png')"
onmouseout="move_out('downloads','downloads_up.png')">
<img src="downloads_up.png" alt="downloads" border="0" name="downloads"></a><br>
<a href="screenshots.html"
onmouseover="move_in('screenshots','screenshots_down.png')"
onmouseout="move_out('screenshots','screenshots_up.png')">
<img src="screenshots_up.png" alt="screenshots" border="0" name="screenshots"></a><br>
<img src="doc_down.png" alt="documentation" border="0"><br>
<a href="members.html"
onmouseover="move_in('members','members_down.png')"
onmouseout="move_out('members','members_up.png')">
<img src="members_up.png" alt="members" border="0" name="members"></a><br>
<a href="links.html"
onmouseover="move_in('links','links_down.png')"
onmouseout="move_out('links','links_up.png')">
<img src="links_up.png" alt="links" border="0" name="links"></a><br>
</td>
<td valign="Top">
<h2 align="Center"></h2>
<div align="Left">
<h2 align="Center">Documentation</h2>
<div align="Center">
<ul>
<li><a href="html/book1.htm">User's Manual</a> (<a href="manual.pdf">PDF</a>)</li>
<li><a href="pwg/t1.htm">The Profile Writer's Guide</a> (<a href="pwg.pdf">PDF</a>)</li>
<li><a href="mathedit/t1.htm">Design and Implemenation</a> (<a href="mathedit.pdf">PDF</a>)</li>
</ul>
</div>
<h2> </h2>
</div>
<p align="Center"><font size="+1"><br>
</font> </p>
<p align="Center"> </p>
</td>
</tr>
</tbody>
</table>
<br>
</body>
</html>
--- NEW FILE: downloads.html ---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Mathematical Derivation Editor</title>
<script language="JavaScript">
var ctcb = new Image();
ctcb.src="pics/connectb2.jpg";
function move_in(img_name,img_src) {
document[img_name].src=img_src;
}
function move_out(img_name,img_src) {
document[img_name].src=img_src;
}
</script>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body background="bg.png">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr height="160">
<td align="Left" valign="Top" width="220"></td>
<td align="Left" valign="Top" width="640">
<h1 align="Center"><img src="title.png" alt="The Mathematical Derivation Editor"</h1>
</td>
</tr>
<tr>
<td align="Left" valign="Top">
<a href="index.html"
onmouseover="move_in('home','home_down.png')"
onmouseout="move_out('home','home_up.png')">
<img src="home_up.png" alt="home" border="0" name="home"></a><br>
<a href="features.html"
onmouseover="move_in('features','features_down.png')"
onmouseout="move_out('features','features_up.png')">
<img src="features_up.png" alt="features" border="0" name="features"></a><br>
<img src="downloads_down.png" alt="downloads" border="0"><br>
<a href="screenshots.html"
onmouseover="move_in('screenshots','screenshots_down.png')"
onmouseout="move_out('screenshots','screenshots_up.png')">
<img src="screenshots_up.png" alt="screenshots" border="0" name="screenshots"></a><br>
<a href="documentation.html"
onmouseover="move_in('doc','doc_down.png')"
onmouseout="move_out('doc','doc_up.png')">
<img src="doc_up.png" alt="documentation" border="0" name="doc"></a><br>
<a href="members.html"
onmouseover="move_in('members','members_down.png')"
onmouseout="move_out('members','members_up.png')">
<img src="members_up.png" alt="members" border="0" name="members"></a><br>
<a href="links.html"
onmouseover="move_in('links','links_down.png')"
onmouseout="move_out('links','links_up.png')">
<img src="links_up.png" alt="links" border="0" name="links"></a><br>
</td>
<td valign="Top" width="640">
<h2 align="Center"> </h2>
<h2 align="Center">Requirements<br>
</h2>
<p>The Derivation Editor have been developed and tested on the Linux
platform. If you have ported mathedit to another platform, please
<a href="mailto:mat...@ab...">inform us</a>.
<p>
Mathedit requires Python, the Qt toolkit, the sip C++ bindings
generator for Python and the PyQt bindings, and it requires very
special versions of them. Furthermore, the Qt source code is needed,
as well as a compiler and the build tools. You will need the
following versions:
<ul>
<li><a href="http://www.python.org">Python 2.2</a></li>
<li><a href="http://www.trolltech.com">Qt 3.0.5</a></li>
<li><a href="http://www.riverbankcomputing.co.uk/pyqt/index.php">PyQt 3.3.2</a></li>
<li><a href="http://riverbankcomputing.co.uk/sip/index.php">sip 3.3.2</a></li>
</ul>
If you want to build the documentation you also need <a href="http://openjade.sf.net">openjade</a>.
<h2 align="Center">Installation</h2>
<p>Edit Makefile and specify the paths to all necessary components.
<h2 align="Center"><br>
</h2>
<h2 align="Center"> Downloads</h2>
<h2 align="Center"></h2>
<table cellpadding="2" cellspacing="2" border="1" class="Downloads" align="Center">
<tbody>
<tr>
<td colspan="2" class="Download" align="Left"><b>Current Release</b></td>
</tr>
<tr class="Download">
<td> <a href="snapshots/mathedit-latest.tar.gz">mathedit</a></td>
<td>unknown</td>
</tr>
<tr>
<td colspan="2" align="Left" class="Download"><b>Latest developer
version</b></td>
</tr>
<tr class="Download">
<td> <a href="snapshots/mathedit-latest.tar.gz">mathedit</a></td>
<td>unknown</td>
</tr>
</tbody>
</table>
<div align="Center"> </div>
<div align="Center"> </div>
<div align="Left"><br>
</div>
</td>
</tr>
</tbody>
</table>
<br>
</body>
</html>
--- NEW FILE: downloads_down.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: downloads_up.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: features.html ---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Mathematical Derivation Editor</title>
<script language="JavaScript">
var ctcb = new Image();
ctcb.src="pics/connectb2.jpg";
function move_in(img_name,img_src) {
document[img_name].src=img_src;
}
function move_out(img_name,img_src) {
document[img_name].src=img_src;
}
</script>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body background="bg.png">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr height="160">
<td align="Left" valign="Top" width="220"></td>
<td align="Left" valign="Top" width="640">
<h1 align="Center"><img src="title.png" alt="The Mathematical Derivation Editor"</h1>
</td>
</tr>
<tr>
<td align="Left" valign="Top">
<a href="index.html"
onmouseover="move_in('home','home_down.png')"
onmouseout="move_out('home','home_up.png')">
<img src="home_up.png" alt="home" border="0" name="home"></a><br>
<img src="features_down.png" alt="features" border="0"><br>
<a href="downloads.html"
onmouseover="move_in('downloads','downloads_down.png')"
onmouseout="move_out('downloads','downloads_up.png')">
<img src="downloads_up.png" alt="downloads" border="0" name="downloads"></a><br>
<a href="screenshots.html"
onmouseover="move_in('screenshots','screenshots_down.png')"
onmouseout="move_out('screenshots','screenshots_up.png')">
<img src="screenshots_up.png" alt="screenshots" border="0" name="screenshots"></a><br>
<a href="documentation.html"
onmouseover="move_in('doc','doc_down.png')"
onmouseout="move_out('doc','doc_up.png')">
<img src="doc_up.png" alt="documentation" border="0" name="doc"></a><br>
<a href="members.html"
onmouseover="move_in('members','members_down.png')"
onmouseout="move_out('members','members_up.png')">
<img src="members_up.png" alt="members" border="0" name="members"></a><br>
<a href="links.html"
onmouseover="move_in('links','links_down.png')"
onmouseout="move_out('links','links_up.png')">
<img src="links_up.png" alt="links" border="0" name="links"></a><br>
</td>
<td>
<h2> </h2>
<h2 align="Center">Features</h2>
<ul>
<li><b>Basic Editing Features</b></li>
<ul>
<li>Open, Save, Save As and Save All</li>
<ul>
<li>Open / Save as ASCII</li>
<li>Open / Save as Latin-1</li>
<li>Open / Save as Utf-8</li>
</ul>
<li>Cut, Copy and Paste</li>
<li>Find and Replace</li>
<ul>
<li>Case Sensitive</li>
<li>Whole Words only</li>
<li>Find Backwards</li>
<li>Find in Expressions</li>
<li>Find in Rules</li>
</ul>
<li>Undo / Redo</li>
<ul>
<li>Undo Characterwise/Wordwise</li>
</ul>
<li>Word Wrapping</li>
</ul>
</ul>
<ul>
<li><b>Advanced Editing Features</b></li>
<ul>
<li>Unformat</li>
<li>Format Mathematical Expression</li>
<li>Format Mathematical Rule</li>
<li>Insert Comment</li>
</ul>
</ul>
<ul>
<li><b>Preferences</b></li>
<ul>
<li>Font</li>
<ul>
<li>Type</li>
<li>Style</li>
<li>Size</li>
<li>Script</li>
</ul>
<li>Indentation</li>
<ul>
<li>Spaces instead of Tabs</li>
<li>Spaces per Indent</li>
<li>Tab Width</li>
</ul>
</ul>
<ul>
<li>Keybindings</li>
<ul>
<li>Add, Remove and Modify</li>
</ul>
</ul>
</ul>
<ul>
<li><b>Tools</b></li>
<ul>
<li>Add, Remove and Modify External Tools</li>
</ul>
</ul>
<ul>
<li><b>Multiple Document Interface</b></li>
<ul>
<li>Multiple Documents</li>
<li>Multiple Views of the Same Document</li>
</ul>
</ul>
<ul>
<li><b>Outlining</b></li>
<ul>
<li>Indenting / Dedenting</li>
<li>Expanding / Collapsing</li>
</ul>
</ul>
<ul>
<li><b>Mathematical Derivation</b></li>
<ul>
<li>Syntax Understanding</li>
<li>Rules and Expressions</li>
<li>Abstract Syntax Tree Graphic</li>
<li>Smart Selection for Formulas</li>
<li>Support for Doing Derivations Using Self-defined Rules</li>
<li>Using Unification Algorithms</li>
<li>Check Correctness of a Derivation</li>
</ul>
</ul>
<ul>
<li><b>Profiles</b></li>
<ul>
<li>User-Defined Mathematical Systems</li>
</ul>
</ul>
<ul>
<li><b>Mathematical Notations</b></li>
<ul>
<li>Unicode Characters</li>
<li>Keyboard Support for Special Characters</li>
</ul>
</ul>
<ul>
<li><b>Import</b></li>
<ul>
<li>LaTeX</li>
</ul>
</ul>
<ul>
<li><b>Export</b></li>
<ul>
<li>Plain Text</li>
<li>HTML</li>
<ul>
<li>Keeping Outlining Structure (with Javascript)</li>
</ul>
<li>LaTeX</li>
<ul>
<li>Option for Configuring LaTeX Export Conversions</li>
</ul>
</ul>
</ul>
</td>
</tr>
<tr>
<td valign="Top"><br>
</td>
<td valign="Top"><br>
</td>
</tr>
</tbody>
</table>
<br>
</body>
</html>
--- NEW FILE: features_down.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: features_up.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: home_down.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: home_up.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: index.html ---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Mathematical Derivation Editor</title>
<script language="JavaScript">
var ctcb = new Image();
ctcb.src="pics/connectb2.jpg";
function move_in(img_name,img_src) {
document[img_name].src=img_src;
}
function move_out(img_name,img_src) {
document[img_name].src=img_src;
}
</script>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body background="bg.png">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr height="160">
<td align="Left" valign="Top" width="220"></td>
<td align="Left" valign="Top" width="640">
<h1 align="Center"><img src="title.png" alt="The Mathematical Derivation Editor"</h1>
</td>
</tr>
<tr>
<td align="Left" valign="Top" width="220">
<img src="home_down.png" alt="home" border="0"><br>
<a href="features.html"
onmouseover="move_in('features','features_down.png')"
onmouseout="move_out('features','features_up.png')">
<img src="features_up.png" alt="features" border="0" name="features"></a><br>
<a href="downloads.html"
onmouseover="move_in('downloads','downloads_down.png')"
onmouseout="move_out('downloads','downloads_up.png')">
<img src="downloads_up.png" alt="downloads" border="0" name="downloads"></a><br>
<a href="screenshots.html"
onmouseover="move_in('screenshots','screenshots_down.png')"
onmouseout="move_out('screenshots','screenshots_up.png')">
<img src="screenshots_up.png" alt="screenshots" border="0" name="screenshots"></a><br>
<a href="documentation.html"
onmouseover="move_in('doc','doc_down.png')"
onmouseout="move_out('doc','doc_up.png')">
<img src="doc_up.png" alt="documentation" border="0" name="doc"></a><br>
<a href="members.html"
onmouseover="move_in('members','members_down.png')"
onmouseout="move_out('members','members_up.png')">
<img src="members_up.png" alt="members" border="0" name="members"></a><br>
<a href="links.html"
onmouseover="move_in('links','links_down.png')"
onmouseout="move_out('links','links_up.png')">
<img src="links_up.png" alt="links" border="0" name="links"></a><br>
</td>
<td valign="Top" width="640">
<h2 align="Center">Introduction</h2>
<p>The Mathematical Derivation Editor is a text editor with support
for multiple documents, indentation, folding, mathematical
derivations and notations.<br>
<br>
</p>
<p align="Center"> <br>
<br>
</p>
</td>
</tr>
</tbody>
</table>
<br>
</body>
</html>
--- NEW FILE: links.html ---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Mathematical Derivation Editor</title>
<script language="JavaScript">
var ctcb = new Image();
ctcb.src="pics/connectb2.jpg";
function move_in(img_name,img_src) {
document[img_name].src=img_src;
}
function move_out(img_name,img_src) {
document[img_name].src=img_src;
}
</script>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body background="bg.png">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr height="160">
<td align="Left" valign="Top" width="220"></td>
<td align="Left" valign="Top" width="640">
<h1 align="Center"><img src="title.png" alt="The Mathematical Derivation Editor"</h1>
</td>
</tr>
<tr>
<td align="Left" valign="Top">
<a href="index.html"
onmouseover="move_in('home','home_down.png')"
onmouseout="move_out('home','home_up.png')">
<img src="home_up.png" alt="home" border="0" name="home"></a><br>
<a href="features.html"
onmouseover="move_in('features','features_down.png')"
onmouseout="move_out('features','features_up.png')">
<img src="features_up.png" alt="features" border="0" name="features"></a><br>
<a href="downloads.html"
onmouseover="move_in('downloads','downloads_down.png')"
onmouseout="move_out('downloads','downloads_up.png')">
<img src="downloads_up.png" alt="downloads" border="0" name="downloads"></a><br>
<a href="screenshots.html"
onmouseover="move_in('screenshots','screenshots_down.png')"
onmouseout="move_out('screenshots','screenshots_up.png')">
<img src="screenshots_up.png" alt="screenshots" border="0" name="screenshots"></a><br>
<a href="documentation.html"
onmouseover="move_in('doc','doc_down.png')"
onmouseout="move_out('doc','doc_up.png')">
<img src="doc_up.png" alt="documentation" border="0" name="doc"></a><br>
<a href="members.html"
onmouseover="move_in('members','members_down.png')"
onmouseout="move_out('members','members_up.png')">
<img src="members_up.png" alt="members" border="0" name="members"></a><br>
<img src="links_down.png" alt="links" border="0"><br>
</td>
<td valign="Top">
<h2> </h2>
<h2 align="Center">Links</h2>
<ul>
<li><a href="http://www.python.org">Python</a></li>
<li><a href="http://www.trolltech.com">Trolltech</a></li>
<li><a href="http://www.riverbankcomputing.co.uk/pyqt/index.php">
PyQt</a><br>
</li>
<li><a href="http://pages.cpsc.ucalgary.ca/%7Eaycock/spark/">Spark</a><br>
</li>
</ul>
<br>
<blockquote></blockquote>
</td>
</tr>
</tbody>
</table>
<br>
</body>
</html>
--- NEW FILE: links_down.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: links_up.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: members.html ---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Mathematical Derivation Editor</title>
<script language="JavaScript">
var ctcb = new Image();
ctcb.src="pics/connectb2.jpg";
function move_in(img_name,img_src) {
document[img_name].src=img_src;
}
function move_out(img_name,img_src) {
document[img_name].src=img_src;
}
</script>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body background="bg.png">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr height="160">
<td align="Left" valign="Top" width="220"></td>
<td align="Left" valign="Top" width="640">
<h1 align="Center"><img src="title.png" alt="The Mathematical Derivation Editor"</h1>
</td>
</tr>
<tr>
<td align="Left" valign="Top">
<a href="index.html"
onmouseover="move_in('home','home_down.png')"
onmouseout="move_out('home','home_up.png')">
<img src="home_up.png" alt="home" border="0" name="home"></a><br>
<a href="features.html"
onmouseover="move_in('features','features_down.png')"
onmouseout="move_out('features','features_up.png')">
<img src="features_up.png" alt="features" border="0" name="features"></a><br>
<a href="downloads.html"
onmouseover="move_in('downloads','downloads_down.png')"
onmouseout="move_out('downloads','downloads_up.png')">
<img src="downloads_up.png" alt="downloads" border="0" name="downloads"></a><br>
<a href="screenshots.html"
onmouseover="move_in('screenshots','screenshots_down.png')"
onmouseout="move_out('screenshots','screenshots_up.png')">
<img src="screenshots_up.png" alt="screenshots" border="0" name="screenshots"></a><br>
<a href="documentation.html"
onmouseover="move_in('doc','doc_down.png')"
onmouseout="move_out('doc','doc_up.png')">
<img src="doc_up.png" alt="documentation" border="0" name="doc"></a><br>
<img src="members_down.png" alt="members" border="0"><br>
<a href="links.html"
onmouseover="move_in('links','links_down.png')"
onmouseout="move_out('links','links_up.png')">
<img src="links_up.png" alt="links" border="0" name="links"></a><br>
</td>
<td valign="Top">
<h2 align="Center"></h2>
<div align="Center">
<div align="Center">
<h2 align="center">Members</h2>
<a href="http://www.abo.fi/%7Evbos">Victor Bos</a><br>
<br>
<a href="http://www.abo.fi/%7Elbernas">Linus Bernas</a><br>
<br>
Miika Hakala<br>
<br>
Peter Eriksson<br>
<br>
<a href="http://www.abo.fi/%7Evpreotea">Viorel Preoteasa</a><br>
<br>
<a href="http://www.infa.abo.fi/%7Ejweeriks/">Johannes
Eriksson</a><br>
<br>
</div>
<br>
<br>
<br>
<br>
</div>
<p><br>
<br>
</p>
<p align="Center"></p>
<div align="Left"><br>
</div>
<p align="Center"><font size="+1"><a href="manual/book1.html"><br>
</a><br>
</font> </p>
<p align="Center"> </p>
</td>
</tr>
</tbody>
</table>
<br>
</body>
</html>
--- NEW FILE: members_down.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: members_up.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: minieditor.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: screenshots.html ---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Mathematical Derivation Editor</title>
<script language="JavaScript">
var ctcb = new Image();
ctcb.src="pics/connectb2.jpg";
function move_in(img_name,img_src) {
document[img_name].src=img_src;
}
function move_out(img_name,img_src) {
document[img_name].src=img_src;
}
</script>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body background="bg.png">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr height="160">
<td align="Left" valign="Top" width="220"></td>
<td align="Left" valign="Top" width="640">
<h1 align="Center"><img src="title.png" alt="The Mathematical Derivation Editor"</h1>
</td>
</tr>
<tr>
<td align="Left" valign="Top">
<a href="index.html"
onmouseover="move_in('home','home_down.png')"
onmouseout="move_out('home','home_up.png')">
<img src="home_up.png" alt="home" border="0" name="home"></a><br>
<a href="features.html"
onmouseover="move_in('features','features_down.png')"
onmouseout="move_out('features','features_up.png')">
<img src="features_up.png" alt="features" border="0" name="features"></a><br>
<a href="downloads.html"
onmouseover="move_in('downloads','downloads_down.png')"
onmouseout="move_out('downloads','downloads_up.png')">
<img src="downloads_up.png" alt="downloads" border="0" name="downloads"></a><br>
<img src="screenshots_down.png" alt="screenshots" border="0"><br>
<a href="documentation.html"
onmouseover="move_in('doc','doc_down.png')"
onmouseout="move_out('doc','doc_up.png')">
<img src="doc_up.png" alt="documentation" border="0" name="doc"></a><br>
<a href="members.html"
onmouseover="move_in('members','members_down.png')"
onmouseout="move_out('members','members_up.png')">
<img src="members_up.png" alt="members" border="0" name="members"></a><br>
<a href="links.html"
onmouseover="move_in('links','links_down.png')"
onmouseout="move_out('links','links_up.png')">
<img src="links_up.png" alt="links" border="0" name="links"></a><br>
</td>
<td valign="Top">
<h2> </h2>
<h2 align="Center">Screenshots</h2>
<p align="Center"></p>
<p align="Center"> <br>
<img src="minieditor.png" alt="Picture of editor" align="Top">
<br>
</p>
</td>
</tr>
</tbody>
</table>
<br>
</body>
</html>
--- NEW FILE: screenshots_down.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: screenshots_up.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: title-old.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: title.png ---
(This appears to be a binary file; contents omitted.)
|
|
From: <de...@us...> - 2004-01-07 01:48:13
|
Update of /cvsroot/pymerase/smw/smw/mmgen/MOF In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mmgen/MOF Added Files: ptc-2001-10-08.xml Log Message: Imported version of SMW downloaded on 2003 Apr 14 --- NEW FILE: ptc-2001-10-08.xml --- <?xml version="1.0" encoding="UTF-8" ?> <!-- <!DOCTYPE XMI SYSTEM 'Model.dtd'> --> <XMI xmi.version='1.1' xmlns:Model='omg.org/mof.Model/1.3'> <XMI.header> <XMI.model xmi.name='MOF' xmi.version='1.4'/> <XMI.metamodel xmi.name='Model' xmi.version='1.4'/> </XMI.header> <XMI.content> <Model:Package isAbstract="false" isLeaf="false" isRoot="false" name="PrimitiveTypes" visibility="public_vis" annotation="" xmi.id="a1"> <Model:Namespace.contents> <Model:Tag annotation="" name="*tag" tagId="javax.jmi.packagePrefix" xmi.id="a2"> <Model:Tag.values>javax.jmi</Model:Tag.values> <Model:Tag.elements> <Model:ModelElement xmi.idref="a1"/>` </Model:Tag.elements> </Model:Tag> <Model:PrimitiveType annotation="" isAbstract="false" [...2892 lines suppressed...] visibility="public_vis" xmi.id="CorbaUnsignedLong"/> <Model:PrimitiveType annotation="" isAbstract="false" isLeaf="false" isRoot="false" name="CorbaUnsignedLongLong" visibility="public_vis" xmi.id="CorbaUnsignedLongLong"/> <Model:PrimitiveType annotation="" isAbstract="false" isLeaf="false" isRoot="false" name="CorbaLongDouble" visibility="public_vis" xmi.id="CorbaLongDouble"/> <Model:PrimitiveType annotation="" isAbstract="false" isLeaf="false" isRoot="false" name="CorbaString" visibility="public_vis" xmi.id="CorbaString"/> <Model:PrimitiveType annotation="" isAbstract="false" isLeaf="false" isRoot="false" name="CorbaChar" visibility="public_vis" xmi.id="CorbaChar"/> <Model:PrimitiveType annotation="" isAbstract="false" isLeaf="false" isRoot="false" name="CorbaWChar" visibility="public_vis" xmi.id="CorbaWChar"/> </Model:Namespace.contents> </Model:Package> </XMI.content> </XMI> |
|
From: <de...@us...> - 2004-01-07 01:48:13
|
Update of /cvsroot/pymerase/smw/smw/mmgen/MML
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mmgen/MML
Added Files:
UML2.xml uml2.mdl
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: UML2.xml ---
<?xml version = '1.0' encoding = 'ISO-8859-1' ?>
<!-- <!DOCTYPE XMI SYSTEM 'UML13.dtd' > -->
<XMI xmi.version = '1.1' xmlns:UML='//org.omg/UML/1.3' timestamp = 'Sat Dec 08 17:10:56 2001' >
<XMI.header>
<XMI.documentation>
<XMI.exporter>Unisys.JCR.1</XMI.exporter>
<XMI.exporterVersion>1.3.2</XMI.exporterVersion>
</XMI.documentation>
<XMI.metamodel xmi.name = 'UML' xmi.version = '1.3'/>
</XMI.header>
<XMI.content>
<!-- ==================== uml2 [Model] ==================== -->
<UML:Model xmi.id = 'G.0'
name = 'uml2' visibility = 'public' isSpecification = 'false'
isRoot = 'false' isLeaf = 'false' isAbstract = 'false' >
<UML:Namespace.ownedElement>
<UML:Dependency xmi.id = 'G.583'
name = '{UML?syntaxLibrary}{3961FC930119}' visibility = 'public' isSpecification = 'false' >
<UML:Dependency.client>
[...14962 lines suppressed...]
<UML:TaggedValue xmi.id = 'XX.197'
tag = 'persistence' value = 'transient' >
<UML:TaggedValue.modelElement>
<Foundation.Core.ModelElement xmi.idref = 'S.253'/> <!-- uml2::UML::statemachines::model.concepts::StateMachine -->
</UML:TaggedValue.modelElement>
</UML:TaggedValue>
<UML:TaggedValue xmi.id = 'XX.198'
tag = 'persistence' value = 'transient' >
<UML:TaggedValue.modelElement>
<Foundation.Core.ModelElement xmi.idref = 'S.254'/> <!-- uml2::UML::statemachines::model.concepts::State -->
</UML:TaggedValue.modelElement>
</UML:TaggedValue>
<UML:TaggedValue xmi.id = 'XX.199'
tag = 'persistence' value = 'transient' >
<UML:TaggedValue.modelElement>
<Foundation.Core.ModelElement xmi.idref = 'S.256'/> <!-- uml2::UML::statemachines::model.concepts::Exp -->
</UML:TaggedValue.modelElement>
</UML:TaggedValue>
</XMI.content>
</XMI>
--- NEW FILE: uml2.mdl ---
(object Petal
version 45
_written "Rose 7.5.0103.1920"
charSet 0)
(object Design "Logical View"
is_unit TRUE
is_loaded TRUE
attributes (list Attribute_Set
(object Attribute
tool "Java"
name "IDE"
value "Internal Editor"))
quid "3C122CEF038D"
defaults (object defaults
rightMargin 0.250000
leftMargin 0.250000
topMargin 0.250000
[...37075 lines suppressed...]
tool "XML_DTD"
name "DefaultDeclType"
value "")))
(object Attribute
tool "XML_DTD"
name "default__Module-Spec"
value (list Attribute_Set
(object Attribute
tool "XML_DTD"
name "Assign All"
value FALSE)
(object Attribute
tool "XML_DTD"
name "ComponentPath"
value "")))
(object Attribute
tool "XML_DTD"
name "HiddenTool"
value FALSE))
quid "3960B827002B"))
|
Update of /cvsroot/pymerase/smw/smw/mathedit/resources
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mathedit/resources
Added Files:
about.png appicon.png comment.png deriv.png docicon.png
down.png editcopy.png editcut.png editpaste.png empty.png
exit.png false.gif fileclose.png filenew.png fileopen.png
filesave.png filesaveall.png filesaveas.png find.png
mathexp.png mathrule.png ok.png redo.png title.png true.gif
ua.js undo.png unformat.png up.png xbCollapsibleLists.js
xbDOM.js xbStyle.js
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: about.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: appicon.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: comment.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: deriv.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: docicon.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: down.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: editcopy.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: editcut.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: editpaste.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: empty.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: exit.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: false.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: fileclose.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: filenew.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: fileopen.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: filesave.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: filesaveall.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: filesaveas.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: find.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: mathexp.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: mathrule.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: ok.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: redo.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: title.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: true.gif ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: ua.js ---
/*
* $Log: ua.js,v $
* Revision 1.1 2004/01/07 01:48:02 detrout
* Imported version of SMW downloaded on 2003 Apr 14
*
* Revision 1.1 2002/11/14 08:22:44 joheriks
* Added mathedit to smw.
*
* Revision 1.1 2002/07/26 23:10:27 joheriks
* Added new layer: Export
* Exports to HTML with Javascript for collapse/expand
*
* Revision 1.7 2002/05/14 16:52:52 bc6ix
* use CVS Log for revision history
*
*
*/
/* ***** BEGIN LICENSE BLOCK *****
* Licensed under Version: MPL 1.1/GPL 2.0/LGPL 2.1
* Full Terms at /xbProjects-srce/license/mpl-tri-license.txt
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Netscape code.
*
* The Initial Developer of the Original Code is
* Netscape Corporation.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Bob Clary <bc...@ne...>
*
* ***** END LICENSE BLOCK ***** */
function xbDetectBrowser()
{
var oldOnError = window.onerror;
var element = null;
window.onerror = null;
// work around bug in xpcdom Mozilla 0.9.1
window.saveNavigator = window.navigator;
navigator.OS = '';
navigator.version = parseFloat(navigator.appVersion);
navigator.org = '';
navigator.family = '';
var platform;
if (typeof(window.navigator.platform) != 'undefined')
{
platform = window.navigator.platform.toLowerCase();
if (platform.indexOf('win') != -1)
navigator.OS = 'win';
else if (platform.indexOf('mac') != -1)
navigator.OS = 'mac';
else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)
navigator.OS = 'nix';
}
var i = 0;
var ua = window.navigator.userAgent.toLowerCase();
if (ua.indexOf('opera') != -1)
{
i = ua.indexOf('opera');
navigator.family = 'opera';
navigator.org = 'opera';
navigator.version = parseFloat('0' + ua.substr(i+6), 10);
}
else if ((i = ua.indexOf('msie')) != -1)
{
navigator.org = 'microsoft';
navigator.version = parseFloat('0' + ua.substr(i+5), 10);
if (navigator.version < 4)
navigator.family = 'ie3';
else
navigator.family = 'ie4'
}
else if (ua.indexOf('gecko') != -1)
{
navigator.family = 'gecko';
var rvStart = navigator.userAgent.indexOf('rv:') + 3;
var rvEnd = navigator.userAgent.indexOf(')', rvStart);
var rv = navigator.userAgent.substring(rvStart, rvEnd);
var decIndex = rv.indexOf('.');
if (decIndex != -1)
{
rv = rv.replace(/\./g, '')
rv = rv.substring(0, decIndex) + '.' + rv.substr(decIndex)
}
navigator.version = parseFloat(rv);
if (ua.indexOf('netscape') != -1)
navigator.org = 'netscape';
else if (ua.indexOf('compuserve') != -1)
navigator.org = 'compuserve';
else
navigator.org = 'mozilla';
}
else if ((ua.indexOf('mozilla') !=-1) && (ua.indexOf('spoofer')==-1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera')==-1)&& (ua.indexOf('webtv')==-1) && (ua.indexOf('hotjava')==-1))
{
var is_major = parseFloat(navigator.appVersion);
if (is_major < 4)
navigator.version = is_major;
else
{
i = ua.lastIndexOf('/')
navigator.version = parseFloat('0' + ua.substr(i+1), 10);
}
navigator.org = 'netscape';
navigator.family = 'nn' + parseInt(navigator.appVersion);
}
else if ((i = ua.indexOf('aol')) != -1 )
{
// aol
navigator.family = 'aol';
navigator.org = 'aol';
navigator.version = parseFloat('0' + ua.substr(i+4), 10);
}
else if ((i = ua.indexOf('hotjava')) != -1 )
{
// hotjava
navigator.family = 'hotjava';
navigator.org = 'sun';
navigator.version = parseFloat(navigator.appVersion);
}
window.onerror = oldOnError;
}
xbDetectBrowser();
--- NEW FILE: undo.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: unformat.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: up.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: xbCollapsibleLists.js ---
/*
xbCollapsibleLists.js 2001-02-26
Contributor(s): Michael Bostock, Netscape Communications, Copyright 1997
Bob Clary, Netscape Communications, Copyright 2001
Seth Dillingham, Macrobyte Resources, Copyright 2001
Mark Filanowicz, Amdahl IT Services, Copyright 2002
Netscape grants you a royalty free license to use, modify or
distribute this software provided that this copyright notice
appears on all copies. This software is provided "AS IS,"
without a warranty of any kind.
See xbCollapsibleLists.js.changelog.html for details of changes.
*/
var xbcl__id = 0;
var xbcl_item_id = 0;
var xbcl_mLists = new Array();
var xbcl_parentElement = null;
document.lists = xbcl_mLists;
function List(visible, width, height, bgColor, collapsedImageURL, expandedImageURL)
{
this.lists = new Array(); // sublists
this.items = new Array(); // layers
this.types = new Array(); // type
this.strs = new Array(); // content
this.visible = visible;
this.id = xbcl__id;
this.width = width || 350;
this.height = height || 22;
this.collapsedImageURL = collapsedImageURL || 'false.gif';
this.expandedImageURL = expandedImageURL || 'true.gif';
if (bgColor)
this.bgColor = bgColor;
xbcl_mLists[xbcl__id++] = this;
}
function xbcl_SetFont(i,j)
{
this.fontIntro = i;
this.fontOutro = j;
}
function xbcl_GetFont()
{
return [this.fontIntro, this.fontOutro];
}
function xbcl_setIndent(indent)
{
this.i = indent;
if (this.i < 0)
{
this.i = 0;
this.space = false;
}
else
this.space = true;
}
function xbcl_getIndent(indent)
{
return this.i;
}
function xbcl_writeItemDOMHTML( obj, s, flList, listObj )
{
var styleObj;
var outerDiv, innerLeft, innerRight;
var str;
var leftEdge = 0;
styleObj = new xbStyle(obj);
styleObj.setVisibility('hidden');
outerDiv = document.createElement( "DIV" );
outerDiv.id = "DIV_" + obj.id;
styleObj = new xbStyle( outerDiv );
styleObj.setWidth( this.width );
if ( flList )
{
innerLeft = document.createElement( "DIV" );
innerLeft.style.position = "absolute";
innerLeft.style.valign = "middle";
leftEdge = 15;
styleObj = new xbStyle( innerLeft );
styleObj.setWidth( 15 );
styleObj.setBackgroundColor( "transparent" );
if ( listObj.visible )
str = '<A TARGET="_self" HREF="javascript:xbcl_expand(' + listObj.id + ');"><IMG BORDER="0" SRC="' + this.expandedImageURL + '" ID="_img' + listObj.id + '" NAME="_img' + listObj.id + '"></A>';
else
str = '<A TARGET="_self" HREF="javascript:xbcl_expand(' + listObj.id + ');"><IMG BORDER="0" SRC="' + this.collapsedImageURL + '" ID="_img' + listObj.id + '" NAME="_img' + listObj.id + '"></A>';
innerLeft.innerHTML = str;
outerDiv.appendChild( innerLeft );
}
else if ( this.space )
leftEdge = 15;
innerRight = document.createElement( "DIV" );
innerRight.noWrap = true;
innerRight.style.position = "absolute";
styleObj = new xbStyle( innerRight );
styleObj.setLeft( leftEdge + ( this.l * this.i ) );
styleObj.setWidth( this.width - 15 - this.l * this.i );
styleObj.setBackgroundColor( "transparent" );
// start of change by Mark Filanowicz 02-22-2002
if ( flList )
{
s = this.fontIntro + '<A TARGET="_self" STYLE="text-decoration: none;" HREF="javascript:xbcl_expand(' + listObj.id + ');">' + s + this.fontOutro;
}
else
{
s = this.fontIntro + s + this.fontOutro;
}
// end of change by Mark Filanowicz 02-22-2002
innerRight.innerHTML = s;
outerDiv.appendChild( innerRight );
obj.appendChild( outerDiv );
return;
}
function xbcl_writeItem( obj, s, flList, listObj )
{
var cellStyle = '';
var str = '';
var styleObj = new xbStyle( obj );
styleObj.setVisibility( 'hidden' );
if ( document.body && document.body.style )
cellStyle = ' style="background-color: transparent;"';
str += '<TABLE WIDTH='+this.width+' NOWRAP BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR>';
if ( flList )
{
str += '<TD WIDTH="15" NOWRAP VALIGN="MIDDLE"' + cellStyle + '>';
str += '<A TARGET="_self" HREF="javascript:xbcl_expand(' + listObj.id + ');">';
if ( listObj.visible )
str += '<IMG BORDER="0" SRC="' + this.expandedImageURL + '" ID="_img' + listObj.id + '" NAME="_img' + listObj.id + '">';
else
str += '<IMG BORDER="0" SRC="' + this.collapsedImageURL + '" ID="_img' + listObj.id + '" NAME="_img' + listObj.id + '">';
str += '</A></TD>';
}
else if (this.space)
str += '<TD WIDTH="15" NOWRAP' + cellStyle + '> </TD>';
if (this.l>0 && this.i>0)
str += '<TD WIDTH="' + this.l*this.i+ '" NOWRAP' + cellStyle + '> </TD>';
str += '<TD HEIGHT="' + ( this.height - 3) + '" WIDTH="' + ( this.width - 15 - this.l * this.i ) + '" VALIGN="MIDDLE" ALIGN="LEFT"' + cellStyle + '>';
// start of change by Mark Filanowicz 02-22-2002
if ( flList )
{
str += this.fontIntro + '<A TARGET="_self" STYLE="text-decoration: none;" HREF="javascript:xbcl_expand(' + listObj.id + ');">' + s + this.fontOutro;
}
else
{
str += this.fontIntro + s + this.fontOutro;
}
// end of change by Mark Filanowicz 02-22-2002
str += '</TD></TR></TABLE>';
styleObj.setInnerHTML( str );
return;
}
function xbcl_writeList()
{
var item;
var i;
var flList;
for ( i = 0; i < this.types.length; i++ )
{
item = this.items[ i ];
flList = ( this.types[ i ] == 'list' );
this._writeItem( item, this.strs[ i ], flList, this.lists[ i ] );
if ( flList && this.lists[ i ].visible )
this.lists[ i ]._writeList();
}
this.built = true;
this.needsRewrite = false;
self.status = '';
}
function xbcl_showList()
{
var item;
var styleObj;
var i;
for (i = 0; i < this.types.length; i++)
{
item = this.items[i];
styleObj = new xbStyle(item);
styleObj.setClipLeft(0);
styleObj.setClipRight(this.width);
styleObj.setClipTop(0);
if (item.height)
{
styleObj.setClipBottom(item.height);
styleObj.setHeight(item.height);
}
else
{
styleObj.setClipBottom(this.height);
styleObj.setHeight(this.height);
}
if ( this.visible )
styleObj.setVisibility( 'visible' );
var bg = item.oBgColor || this.bgColor;
if ((bg == null) || (bg == 'null'))
bg = '';
styleObj.setBackgroundColor(bg);
if (this.types[i] == 'list' && this.lists[i].visible)
this.lists[i]._showList();
}
this.shown = true;
this.needsUpdate = false;
}
function xbcl_setImage(list, item, file)
{
var id = '_img' + list.id;
var img = null;
// for DOMHTML or IE4 use cross browser getElementById from xbStyle
// can't use it for NN4 since it only works for layers in NN4
if (document.layers)
img = item.document.images[0];
else
img = xbGetElementById(id);
if (img)
img.src = file;
}
function xbcl_getHeight()
{
var totalHeight = 0;
var i;
if (!this.visible)
return 0;
for (i = 0; i < this.types.length; i++)
{
if (this.items[i].height)
totalHeight += this.items[i].height;
else
totalHeight += this.height;
if ((this.types[i] == 'list') && this.lists[i].visible)
{
totalHeight += this.lists[i].getHeight();
}
}
return totalHeight;
}
function xbcl_updateList(pVis, x, y)
{
var currTop = y;
var item;
var styleObj;
var i;
for (i = 0; i < this.types.length; i++)
{
item = this.items[i];
styleObj = new xbStyle(item);
if (this.visible && pVis)
{
styleObj.moveTo(x, currTop);
if (item.height) // allow custom heights for each item
currTop += item.height;
else
currTop += this.height;
styleObj.setVisibility('visible');
}
else
{
styleObj.setVisibility('hidden');
}
if (this.types[i] == 'list')
{
if (this.lists[i].visible)
{
if (!this.lists[i].built || this.lists[i].needsRewrite)
this.lists[i]._writeList();
if (!this.lists[i].shown || this.lists[i].needsUpdate)
this.lists[i]._showList();
xbcl_setImage(this.lists[i], item, this.expandedImageURL );
}
else
xbcl_setImage(this.lists[i], item, this.collapsedImageURL );
if (this.lists[i].built)
currTop = this.lists[i]._updateList(this.visible && pVis, x, currTop);
}
}
return currTop;
}
function xbcl_updateParent( pid, l )
{
var i;
if ( !l )
l = 0;
this.pid = pid;
this.l = l;
for ( i = 0; i < this.types.length; i++ )
{
if ( this.types[ i ] == 'list' )
{
this.lists[ i ]._updateParent( pid, l + 1 );
}
}
}
function xbcl_expand(i)
{
xbcl_mLists[i].visible = !xbcl_mLists[i].visible;
if (xbcl_mLists[i].onexpand != null)
xbcl_mLists[i].onexpand(xbcl_mLists[i].id);
xbcl_mLists[xbcl_mLists[i].pid].rebuild();
if (xbcl_mLists[i].postexpand != null)
xbcl_mLists[i].postexpand(xbcl_mLists[i].id);
}
function xbcl_build(x, y)
{
this._updateParent(this.id);
this._writeList();
this._showList();
this._updateList(true, x, y);
this.x = x;
this.y = y;
}
function xbcl_rebuild()
{
this._updateList(true, this.x, this.y);
}
function xbcl_getNewItem()
{
var newItem = null;
newItem = xbGetElementById('lItem' + xbcl_item_id);
if (!newItem)
{
if (document.all && !document.getElementById)
{
var parentElement = this.parentElement;
if (!parentElement)
parentElement = document.body;
parentElement.insertAdjacentHTML('beforeEnd', '<div id="lItem' + xbcl_item_id + '" style="position:absolute;"></div>');
newItem = xbGetElementById('lItem' + xbcl_item_id);
}
else if (document.layers)
{
if (this.parentElement)
newItem = new Layer(this.width, this.parentElement);
else
newItem = new Layer(this.width);
}
else if (document.createElement)
{
newItem = document.createElement('div');
newItem.id= 'lItem' + xbcl_item_id;
newItem.style.position = 'absolute';
if (this.parentElement)
this.parentElement.appendChild(newItem);
else
document.body.appendChild(newItem);
}
}
return newItem;
}
function xbcl_addItem(str, bgColor, item)
{
if (!item)
item = this._getNewItem();
if (!item)
return;
if (bgColor)
item.oBgColor = bgColor;
this.items[this.items.length] = item;
this.types[this.types.length] = 'item';
this.strs[this.strs.length] = str;
++xbcl_item_id;
if ( this.built )
{
this._writeItem( item, str, false );
xbcl_mLists[this.pid].rebuild();
if ( this.visible )
this._showList();
else
this.needsUpdate = true;
}
return item;
}
function xbcl_addList(list, str, bgColor, item)
{
if (!item)
item = this._getNewItem();
if (!item)
return;
if (bgColor)
item.oBgColor = bgColor;
this.lists[this.items.length] = list;
this.items[this.items.length] = item;
this.types[this.types.length] = 'list';
this.strs[this.strs.length] = str;
++xbcl_item_id;
list.parentList = this;
list.pid = this.pid;
list.l = this.l + 1;
if ( this.built )
{
this._writeItem( item, str, true, list );
xbcl_mLists[ this.pid ].rebuild();
if ( this.visible )
this._showList();
else
this.needsUpdate = true;
}
return item;
}
List.prototype.setIndent = xbcl_setIndent;
List.prototype.getIndent = xbcl_getIndent;
List.prototype.addItem = xbcl_addItem;
List.prototype.addList = xbcl_addList;
List.prototype.build = xbcl_build;
List.prototype.rebuild = xbcl_rebuild;
List.prototype.setFont = xbcl_SetFont;
List.prototype.getFont = xbcl_GetFont;
List.prototype.getHeight = xbcl_getHeight;
List.prototype._writeList = xbcl_writeList;
List.prototype._getNewItem = xbcl_getNewItem;
if ( document.getElementById && document.createElement )
List.prototype._writeItem = xbcl_writeItemDOMHTML;
else
List.prototype._writeItem = xbcl_writeItem;
List.prototype._showList = xbcl_showList;
List.prototype._updateList = xbcl_updateList;
List.prototype._updateParent = xbcl_updateParent;
List.prototype.onexpand = null;
List.prototype.postexpand = null;
List.prototype.lists = null; // sublists
List.prototype.items = null; // layers
List.prototype.types = null; // type
List.prototype.strs = null; // content
List.prototype.x = 0;
List.prototype.y = 0;
List.prototype.visible = false;
List.prototype.id = -1;
List.prototype.i = 18;
List.prototype.space = true;
List.prototype.pid = 0;
List.prototype.fontIntro = '';
List.prototype.fontOutro = '';
List.prototype.width = 350;
List.prototype.height = 22;
List.prototype.built = false;
List.prototype.shown = false;
List.prototype.needsUpdate = false;
List.prototype.needsRewrite = false;
List.prototype.l = 0;
List.prototype.bgColor = null;
List.prototype.parentList = null;
List.prototype.parentElement = null;
--- NEW FILE: xbDOM.js ---
/*
xbDOM.js v 0.005 2002-04-11
Contributor(s): Bob Clary, Netscape Communications, Copyright 2001, 2002
Netscape grants you a royalty free license to use, modify and
distribute this software provided that this copyright notice
appears on all copies. This software is provided "AS IS,"
without a warranty of any kind.
Change Log:
2002-04-11: v 0.005
bclary -
fix bug in IE version of xbGetElementsByName where windowRef was not correctly
used. Thanks to Jens Ellegiers for the fix.
2002-03-15: v 0.004
bclary -
fix bug in bugfix for 0.003 in xbGetElementsByName
to not confuse elements with length properties with arrays
2002-03-09: v 0.003
bclary -
fix bug in xbGetElementsByName in Internet Explorer when there is
only one instance of an element with name value.
2002-01-19: v 0.002
bclary -
nav4FindElementsByName
removed erroneous obj and return
added search of form elements
xbFindElementsByNameAndType
renamed from FindElementsByNameAndType
removed erroneouse obj and return
xbSetInnerHTML
ported over from xbStyle since it is more
appropriate here.
2001-11-27: v 0.01
bclary -
removed from xbStyle
*/
function xbToInt(s)
{
var i = parseInt(s, 10);
if (isNaN(i))
i = 0;
return i;
}
function xbGetWindowWidth(windowRef)
{
var width = 0;
if (!windowRef)
windowRef = window;
if (typeof(windowRef.innerWidth) == 'number')
width = windowRef.innerWidth;
else if (windowRef.document.body && typeof(windowRef.document.body.clientWidth) == 'number')
width = windowRef.document.body.clientWidth;
return width;
}
function xbGetWindowHeight(windowRef)
{
var height = 0;
if (!windowRef)
windowRef = window;
if (typeof(windowRef.innerWidth) == 'number')
height = windowRef.innerHeight;
else if (windowRef.document.body && typeof(windowRef.document.body.clientWidth) == 'number')
height = windowRef.document.body.clientHeight;
return height;
}
function nav4FindLayer(doc, id)
{
var i;
var subdoc;
var obj;
for (i = 0; i < doc.layers.length; ++i)
{
if (doc.layers[i].id && id == doc.layers[i].id)
return doc.layers[i];
subdoc = doc.layers[i].document;
obj = nav4FindLayer(subdoc, id);
if (obj != null)
return obj;
}
return null;
}
function nav4FindElementsByName(doc, name, elmlist)
{
var i;
var j;
var subdoc;
for (i = 0; i < doc.images.length; ++i)
{
if (doc.images[i].name && name == doc.images[i].name)
elmlist[elmlist.length] = doc.images[i];
}
for (i = 0; i < doc.forms.length; ++i)
{
for (j = 0; j < doc.forms[i].elements.length; j++)
if (doc.forms[i].elements[j].name && name == doc.forms[i].elements[j].name)
elmlist[elmlist.length] = doc.forms[i].elements[j];
if (doc.forms[i].name && name == doc.forms[i].name)
elmlist[elmlist.length] = doc.forms[i];
}
for (i = 0; i < doc.anchors.length; ++i)
{
if (doc.anchors[i].name && name == doc.anchors[i].name)
elmlist[elmlist.length] = doc.anchors[i];
}
for (i = 0; i < doc.links.length; ++i)
{
if (doc.links[i].name && name == doc.links[i].name)
elmlist[elmlist.length] = doc.links[i];
}
for (i = 0; i < doc.applets.length; ++i)
{
if (doc.applets[i].name && name == doc.applets[i].name)
elmlist[elmlist.length] = doc.applets[i];
}
for (i = 0; i < doc.embeds.length; ++i)
{
if (doc.embeds[i].name && name == doc.embeds[i].name)
elmlist[elmlist.length] = doc.embeds[i];
}
for (i = 0; i < doc.layers.length; ++i)
{
if (doc.layers[i].name && name == doc.layers[i].name)
elmlist[elmlist.length] = doc.layers[i];
subdoc = doc.layers[i].document;
nav4FindElementsByName(subdoc, name, elmlist);
}
}
function xbGetElementsByNameAndType(name, type, windowRef)
{
if (!windowRef)
windowRef = window;
var elmlist = new Array();
xbFindElementsByNameAndType(windowRef.document, name, type, elmlist);
return elmlist;
}
function xbFindElementsByNameAndType(doc, name, type, elmlist)
{
var i;
var subdoc;
for (i = 0; i < doc[type].length; ++i)
{
if (doc[type][i].name && name == doc[type][i].name)
elmlist[elmlist.length] = doc[type][i];
}
if (doc.layers)
{
for (i = 0; i < doc.layers.length; ++i)
{
subdoc = doc.layers[i].document;
xbFindElementsByNameAndType(subdoc, name, type, elmlist);
}
}
}
if (document.layers)
{
xbGetElementById = function (id, windowRef)
{
if (!windowRef)
windowRef = window;
return nav4FindLayer(windowRef.document, id);
};
xbGetElementsByName = function (name, windowRef)
{
if (!windowRef)
windowRef = window;
var elmlist = new Array();
nav4FindElementsByName(windowRef.document, name, elmlist);
return elmlist;
};
}
else if (document.all)
{
xbGetElementById = function (id, windowRef) { if (!windowRef) windowRef = window; var elm = windowRef.document.all[id]; if (!elm) elm = null; return elm; };
xbGetElementsByName = function (name, windowRef)
{
if (!windowRef)
windowRef = window;
var i;
var idnamelist = windowRef.document.all[name];
var elmlist = new Array();
if (!idnamelist.length || idnamelist.name == name)
{
if (idnamelist)
elmlist[elmlist.length] = idnamelist;
}
else
{
for (i = 0; i < idnamelist.length; i++)
{
if (idnamelist[i].name == name)
elmlist[elmlist.length] = idnamelist[i];
}
}
return elmlist;
}
}
else if (document.getElementById)
{
xbGetElementById = function (id, windowRef) { if (!windowRef) windowRef = window; return windowRef.document.getElementById(id); };
xbGetElementsByName = function (name, windowRef) { if (!windowRef) windowRef = window; return windowRef.document.getElementsByName(name); };
}
else
{
xbGetElementById = function (id, windowRef) { return null; }
xbGetElementsByName = function (name, windowRef) { return new Array(); }
}
if (typeof(window.pageXOffset) == 'number')
{
xbGetPageScrollX = function (windowRef) { if (!windowRef) windowRef = window; return windowRef.pageXOffset; };
xbGetPageScrollY = function (windowRef) { if (!windowRef) windowRef = window; return windowRef.pageYOffset; };
}
else if (document.all)
{
xbGetPageScrollX = function (windowRef) { if (!windowRef) windowRef = window; return windowRef.document.body.scrollLeft; };
xbGetPageScrollY = function (windowRef) { if (!windowRef) windowRef = window; return windowRef.document.body.scrollTop; };
}
else
{
xbGetPageScrollX = function (windowRef) { return 0; };
xbGetPageScrollY = function (windowRef) { return 0; };
}
if (document.layers)
{
xbSetInnerHTML = function (element, str) { element.document.write(str); element.document.close(); };
}
else if (document.all || document.getElementById)
{
xbSetInnerHTML = function (element, str) { if (typeof(element.innerHTML) != 'undefined') element.innerHTML = str; };
}
else
{
xbSetInnerHTML = function (element, str) {};
}
// eof: xbDOM.js
--- NEW FILE: xbStyle.js ---
/*
xbStyle.js Revision: 0.202 2002-02-11
Contributor(s): Bob Clary, Original Work, Copyright 2000
Bob Clary, Netscape Communications, Copyright 2001
Netscape grants you a royalty free license to use, modify and
distribute this software provided that this copyright notice
appears on all copies. This software is provided "AS IS,"
without a warranty of any kind.
Change Log:
2001-07-19: bclary - fixed function cssStyleGetLeft() and cssStyleGetTop() to
correctly handle the case where the initial style.left/style.top
are not initialized. This fixes positioning for relatively positioned
DIVS and as a result fixes behavior for ILAYERs exposed as relatively
positioned divs.
2001-10-02: bclary - added missing xbClipRect.getHeight/setHeight methods.
[...1310 lines suppressed...]
xbStyle.prototype.getBorderTopWidth = xbStyleNotSupported;
xbStyle.prototype.getBorderRightWidth = xbStyleNotSupported;
xbStyle.prototype.getBorderBottomWidth = xbStyleNotSupported;
xbStyle.prototype.getBorderLeftWidth = xbStyleNotSupported;
xbStyle.prototype.getMarginLeft = xbStyleNotSupported;
xbStyle.prototype.getMarginTop = xbStyleNotSupported;
xbStyle.prototype.getMarginRight = xbStyleNotSupported;
xbStyle.prototype.getMarginBottom = xbStyleNotSupported;
xbStyle.prototype.getMarginLeft = xbStyleNotSupported;
xbStyle.prototype.getPaddingTop = xbStyleNotSupported;
xbStyle.prototype.getPaddingRight = xbStyleNotSupported;
xbStyle.prototype.getPaddingBottom = xbStyleNotSupported;
xbStyle.prototype.getPaddingLeft = xbStyleNotSupported;
xbStyle.prototype.getClientTop = xbStyleNotSupported;
xbStyle.prototype.getClientLeft = xbStyleNotSupported;
xbStyle.prototype.getClientWidth = xbStyleNotSupported;
xbStyle.prototype.getClientHeight = xbStyleNotSupported;
}
|
Update of /cvsroot/pymerase/smw/smw/mathedit/medit
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mathedit/medit
Added Files:
CmdList_CompoundCommand.py CmdList_Document.py
CmdList_Editor.py CmdList_InsertTextCommand.py
CmdList_RemoveTextCommand.py Command_Command.py
Derivation_Document.py Derivation_Editor.py
Derivation_Sidebar.py Edit_Document.py Edit_Editor.py
Formula_Document.py Formula_Editor.py Formula_Exceptions.py
Formula_FormatCommand.py Formula_FormatLineCommand.py
Formula_NameRuleCommand.py Highlight_Editor.py
Highlight_LangHighlighter.py Highlight_SyntaxHighlighter.py
MTextEdit.py Makefile Message.py Outline1_Document.py
Outline1_Editor.py Outline1_IndentCommand.py
Outline1_RemoveTextCommand.py Outline2_Editor.py
Outline2_Sidebar.py Preferences.py ProfileDefs.py
Profile_Document.py Profile_Editor.py Progress.py Resources.py
Text_Document.py Text_Editor.py Text_Symbols.py __init__.py
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: CmdList_CompoundCommand.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: CmdList_Document.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: CmdList_Editor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: CmdList_InsertTextCommand.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: CmdList_RemoveTextCommand.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Command_Command.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Derivation_Document.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Derivation_Editor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Derivation_Sidebar.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Edit_Document.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Edit_Editor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_Document.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_Editor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_Exceptions.py ---
class LexicalException( Exception ):
pass
class SyntaxException( Exception ):
pass
class UnparseException( Exception ):
pass
--- NEW FILE: Formula_FormatCommand.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_FormatLineCommand.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_NameRuleCommand.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Highlight_Editor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Highlight_LangHighlighter.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Highlight_SyntaxHighlighter.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: MTextEdit.py ---
import Preferences
# load preferences, also creates ~/.mathedit if necessary
Preferences.loadPreferences()
from Highlight_Editor import Highlight_Editor
from Outline2_Sidebar import Outline2_Sidebar
from Highlight_LangHighlighter import *
from qt import *
HighlightModes = { "python": Python_Highlighter,
"spython": SPython_Highlighter,
"c": C_Highlighter,
"c++": Cpp_Highlighter,
"java": Java_Highlighter }
# MTextEdit generally mimics the interface of QTextEdit, most methods are
# simple wrappers to calls in __editor and __editor.getDocument(). Until
# am interface is defined, methods will just be added as they are needed.
# Implementation of automatic delegation through __getattr__ was unsuccessful
# due to the fact that Qt methods are not listen in objects' __dict__.
# Note that signals from QTextEdit are forwarded as PYSIGNALs. The following
# signals are emitted:
# textChanged()
# selectionChanged()
# cursorPositionChanged( int para, int column )
# returnPressed()
# copyAvailable( bool )
# undoAvailable( bool )
# redoAvailable( bool )
class MTextEdit( QWidget ):
def __init__( self, medit=None, parent=None, name=None ):
QWidget.__init__( self, parent, name )
if medit:
doc = medit.__editor.getDocument()
else:
doc = None
self.__editor = Highlight_Editor(doc,self,name)
self.__sidebar = Outline2_Sidebar(self.__editor,self)
self.connect(self.__editor,SIGNAL('textChanged()'),
PYSIGNAL('textChanged'))
self.connect(self.__editor,SIGNAL('selectionChanged()'),
PYSIGNAL('selectionChanged'))
self.connect(self.__editor,SIGNAL('cursorPositionChanged( int, int )'),
PYSIGNAL('cursorPositionChanged'))
self.connect(self.__editor,SIGNAL('returnPressed()'),
PYSIGNAL('returnPressed'))
self.connect(self.__editor,SIGNAL('copyAvailable( bool )'),
PYSIGNAL('copyAvailable'))
self.__layout = QHBoxLayout(self)
self.__layout.addWidget(self.__sidebar)
self.__layout.addWidget(self.__editor)
self.__editor.setAutoParse(0)
def showSidebar( self, yes=1 ):
if yes:
self.__sidebar.show()
else:
self.__sidebar.hide()
def setSidebarWidth( self, width ):
self.__sidebar.setWidth(width)
def getSidebarWidth( self ):
return self.__sidebar.width()
def setIndentationWidth( self, w ):
self.__editor.setIndentationWidth(w)
def getIndentationWidth( self ):
return self.__editor.getIndentationWidth()
def getHighlightMode( self ):
mode = self.__editor.setHighlightMode(HighlightModes[mode])
for str in HighlightModes:
if mode==HighlightModes[str]:
return str
return ''
def setHighlightMode( self, mode ):
ms = unicode(mode)
for mstr in HighlightModes.keys():
if mstr.lower()==ms.lower():
self.__editor.setHighlightMode(HighlightModes[mstr])
return
self.__editor.setHighlightMode(None)
def setEdited( self, e ):
self.__editor.getDocument().setDirty(e)
def edited( self ):
return self.__editor.getDocument().isDirty()
### The following methods wrap methods in the delegatee (self.__editor)
def insertAt( self, text, para, index ):
self.__editor.getDocument().insertExternalText(para,index,text)
def setSelection( self, paraFrom, indexFrom, paraTo, indexTo, selNum=0 ):
l1 = self.__editor._dl2vl(paraFrom)
l2 = self.__editor._dl2vl(paraTo)
l1,c1,l2,c2 = self.__editor.docStrip2ViewStrip(paraFrom,indexFrom,
paraTo,indexTo)
self.__editor.setSelection(l1,c1,l2,c2,selNum)
def getSelection( self, selNum=0 ):
return self.__editor.getSelection(selNum)
def removeSelection( self, selNum=0 ):
self.__editor.removeSelection(selNum)
def removeSelectedText( self, selNum=0 ):
sel = self.__editor.getSelection(selNum)
if sel[0]==-1:
return
sel = apply(self.__editor.docStrip2ViewStrip,sel)
apply(self.__editor.getDocument().deleteStrip,sel)
def selectedText( self ):
sel = self.__editor.getSelection()
if sel[0]==-1:
return QString()
sel = apply(self.__editor.docStrip2ViewStrip,sel)
return apply(self.__editor.getDocument().getTextStrip,sel)
def hasSelectedText( self ):
return self.__editor.hasSelectedText()
def setCursorPosition( self, para, index ):
self.__editor.setCursorPosition(para,index)
def getCursorPosition( self ):
return self.__editor.getCursorPosition()
def paragraphs( self ):
return self.__editor.getDocument().lines()
def text( self, para=-1 ):
if para==-1:
return self.__editor.getDocument().getText()
else:
s = QString()
s.append('\t'*self.__editor.getDocument().getLineLevel(para))
s.append(self.__editor.getDocument().getLineText(para))
return s
def setText( self, txt ):
# This should work, but crashes on Windows. The error is possibly
# buried deep within the Editor class hierarchy.
#self.__editor.getDocument().setText(txt)
self.clear()
self.append(txt)
def paragraphLength( self, para ):
return (self.__editor.getDocument().getLineLevel(para) +
self.__editor.getDocument().getLineTextLen(para))
def setFont( self, f ):
self.__editor.setFont(f)
def append( self, text ):
dl = self.__editor.getDocument().lines()-1
dc = self.__editor.getDocument().getLineTextLen(dl)
self.__editor.getDocument().insertExternalText(dl,dc,text)
def setWordWrap( self, w ):
self.__editor.setWordWrap(w)
def wordWrap( self ):
return self.__editor.wordWrap()
def clear( self ):
self.__editor.getDocument().setText()
def undo( self ):
couldUndo = self.__editor.getDocument().canUndo()
couldRedo = self.__editor.getDocument().canRedo()
self.__editor.undo()
if couldUndo and not self.__editor.getDocument().canUndo():
self.emit(PYSIGNAL('undoAvailable'),(0,))
if not couldRedo and self.__editor.getDocument().canRedo():
self.emit(PYSIGNAL('redoAvailable'),(1,))
def redo( self ):
couldUndo = self.__editor.getDocument().canUndo()
couldRedo = self.__editor.getDocument().canRedo()
self.__editor.redo()
if not couldUndo and self.__editor.getDocument().canUndo():
self.emit(PYSIGNAL('undoAvailable'),(1,))
if couldRedo and not self.__editor.getDocument().canRedo():
self.emit(PYSIGNAL('redoAvailable'),(0,))
def cut( self ): self.__editor.cut()
def copy( self ): self.__editor.copy()
def paste( self ): self.__editor.paste()
def removeParagraph( self, para ):
raise ("Do not just remove paragraphs, it can be illegal under strict "
+"outlining! Read doc/Warning if you don't understand why")
def insertParagraph( self, text, para ):
if para==-1:
self.append("\n"+unicode(text))
else:
self.__editor.getDocument().insertExternalText(para,0,
unicode(text)+"\n")
def setReadOnly( self, yes=1 ):
self.__editor.setReadOnly(yes)
def readOnly( self ):
return self.__editor.readOnly()
--- NEW FILE: Makefile ---
clean:
rm -f *.pyc *.pyo
--- NEW FILE: Message.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Outline1_Document.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Outline1_Editor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Outline1_IndentCommand.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Outline1_RemoveTextCommand.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Outline2_Editor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Outline2_Sidebar.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Preferences.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: ProfileDefs.py ---
from Formula_Exceptions import *
from Derivation_Document import Derivation_MathRule
Rule = Derivation_MathRule
--- NEW FILE: Profile_Document.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Profile_Editor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Progress.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Resources.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_Document.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_Editor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_Symbols.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: __init__.py ---
|
Update of /cvsroot/pymerase/smw/smw/mathedit/doc/latex
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mathedit/doc/latex
Added Files:
Makefile README macros.sty main.tex mainslide.tex
unicodeparser.py
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: Makefile ---
%.pdf : %.tex
pdflatex --output=pdf $<
all: spec_pdf
spec_pdf: main.pdf
clean:
rm -rf *.{aux,dvi,log,pdf}
--- NEW FILE: README ---
This directory contains LaTeX sources of the specification document of
the Mathematical Derivation Editor (MDE). This document are written by
Ralph Back,
Victor Bos, and
Viorel Preoteasa.
The following files are part of this MDE specification document:
macros.sty LaTeX macros for the MDE document
mainslide.tex LaTeX file with some slides about the MDE (outdated)
main.tex Main LaTeX source file of the MDE document
--- NEW FILE: macros.sty ---
% File: macros.sty
% CVS id: $Id: macros.sty,v 1.1 2004/01/07 01:48:02 detrout Exp $
%
\newtheorem{definition}{Definition}
\newtheorem{theorem}[definition]{Theorem}
\newtheorem{propp}[definition]{Proposition}
\newtheorem{lemma}[definition]{Lemma}
\newtheorem{corollary}[definition]{Corollary}
\newtheorem{faptt}[definition]{Fact}
\newtheorem{example}[definition]{Example}
\newtheorem{observatie}[definition]{Observation}
\newcommand{\proof}{{\bf Proof.\ }}
\newcommand{\eproof}{{\hfill $\bullet$}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% The following code is copied from ~vbos/tex/styles/derivation.sty
%% The line with RCS Id and the \ProvidesPackage line are changed
%% to prevent interference with CVS and/or LaTeX's package features.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% file: vicmath.sty
% author: Victor Bos (vb...@ab...)
% RCSid: Id: derivation.sty,v 1.2 2002/08/08 06:15:10 vbos Exp vbos
%
% Provides LaTeX macros for writing structured derivations.
% environment: derivation
% commands: \formula start a formula on a new line in a derivation
% (switches to math mode)
% \step{relsym} start a step (or comment) on a new line in
% a derivation (switches to text mode)
% \nostep work-around command for derivations with just
% one formula. The \nostep command should be used
% after the only \formula command
% It should also be used if a sub-derivation starts
% after a formula.
\NeedsTeXFormat{LaTeX2e}%
%\ProvidesPackage{derivation}[2002/08/08, v0.2]
\newcommand{\formula}{\relax}%
\newcommand{\step}{\relax}%
\newcommand{\nostep}{\relax}%
%
% \deriv@putstepsym is an internal command to pyt the relational symbol
% of a comment line (i.e., the argument of \step), left aligned, centered, or
% right aligned in the margin.
\newcommand{\deriv@putstepsym}[2]{\makebox[0pt][r]{\makebox[\leftmargin][#1]{\ensuremath{#2}}}}%
\newlength{\derivationtopskip}%
\setlength{\derivationtopskip}{1\baselineskip plus .5\baselineskip minus .5\baselineskip}%
\newenvironment{derivation}{%
\vspace{\derivationtopskip}%
\begin{list}{}{%
\setlength{\itemindent}{0pt}%
\setlength{\labelwidth}{0pt}%
\setlength{\labelsep}{.5em}%
\setlength{\leftmargin}{2em}%
\setlength{\rightmargin}{0pt}%
\setlength{\listparindent}{\parindent}%
\setlength{\parsep}{\parskip}%
\setlength{\topsep}{0pt}%
\setlength{\partopsep}{0pt}%
}%
\setlength{\derivationtopskip}{0pt}%
\renewcommand{\formula}[1][\relax]{%
\ifmmode\end{math}\else\relax\fi%
\item[\deriv@putstepsym{r}{##1}]\begin{math}\def\^^M{\ }\def\par{\ }%
}%
\renewcommand{\nostep}{%
\ifmmode\end{math}\else\relax\fi%
}%
\renewcommand{\step}[1]{%
\ifmmode\end{math}\else\relax\fi%
\item[\deriv@putstepsym{r}{##1}]%
}%
}{%
\ifmmode\end{math}\else\relax\fi%
\end{list}%
\vspace{\derivationtopskip}%
}%
--- NEW FILE: main.tex ---
% File: main.tex
% CVS id: $Id: main.tex,v 1.1 2004/01/07 01:48:02 detrout Exp $
%
\documentclass[a4paper]{article}
\usepackage{a4wide}
\usepackage{url}
\usepackage{moreverb}
\usepackage{amsmath}
\usepackage{macros}
\title{%
Requirement Specifications for the\\Mathematical Derivation Editor\\
-- draft --\\[2ex]
\Large%
Ralph Back \hfil%
Victor Bos \hfil%
Viorel Preoteasa\\
Turku Center for Computer Science%
}
\author{}%
[...1127 lines suppressed...]
too. If the editor applies a substitution found for pattern~$p_i$ in a
structured derivation, it generates a new comment line and a new
formula line. The relational symbol string~$s_i$ should be placed in
the indentation margin of the comment line.
An MPI-AST exception is raised if the mathematical profile on which
this method is called
\begin{itemize}
\item does not understand the AST~$t$,
\item does not recognize the AST~$t$ as a rule
\end{itemize}
\item[\normalfont$\textit{getPredefinedRules}()$] Returns a list of
ASTs. Each AST represents a rule of the mathematical profile on which
this method was called.
\end{description}
\end{document}
--- NEW FILE: mainslide.tex ---
% File: mainslide.tex
% CVS id: $Id: mainslide.tex,v 1.1 2004/01/07 01:48:02 detrout Exp $
%
\documentclass[12pt]{article}
\usepackage{macros}
\title{\Huge Derivation Editor - specification}
\author{\LARGE Ralph Back \and \LARGE Viorel Preoteasa}
\begin{document}
\maketitle
\newpage
\Large
\section{\LARGE Main Features}
\begin{enumerate}
\item {\bf Basic editing features}
(copy,
paste,
cut,
undo, redo,
word wrapping).
\item {\bf Multiple document interface}
(multiple documents,
multiple views).
\item {\bf Outlining} (folding, unfolding).
\item {\bf Mathematical derivation}
(syntax understanding,
definitions and lemmas (theorems, propositions),
smart selection for formulas,
support for doing derivations using definitions and lemmas,
theorem provers support,
using unification algorithms).
\item {\bf Mathematical notations}
(unicode characters,
keyboard support for special characters,
improved latex like notations).
\item {\bf Export / Inport}
(text, latex
html).
\item {\bf Preferences}
\end{enumerate}
\newpage
\section{\LARGE Outlining}
{\normalsize
\begin{verbatim}
1. - this is an example of outlined text.
2. - this line is indented one level from the previous.
3. - this line is at the same lavel with the previous one
4. - this is another level
5. - we can come back to this level
6. - some text
7. - or we can go back to the left most level.
\end{verbatim}}
\noindent
\\[1ex]
It should be possible to collapse and expand items.
\\[1ex]
The above text with the
item 1. collapsed is showed as:
\\[1ex]
{\normalsize
\begin{verbatim}
1. + this is an example of outlined text.
7. - or we can go back to the left most level.
\end{verbatim}
}
\newpage
\section{\LARGE Mathematical derivations}
\large
A structure $\langle G,\,\cdot,\,-1,\,e\rangle$ is a {\bf group} if it satisfies:
\begin{enumerate}
\item $(\forall x, y, z \in G \bullet (x\cdot y)\cdot z=x\cdot (y\cdot z) )$
\item $(\forall x\in G\bullet x\cdot e = x)$
\item $(\forall x\in G\bullet e\cdot x = x)$
\item $(\forall x \in G\bullet x^{-1}\cdot x = e)$
\item $(\forall x \in G\bullet x\cdot x^{-1} = e)$
\end{enumerate}
\begin{lemma}
$(\forall x,x'\in G \bullet x'\cdot x = e \Rightarrow x'=x^{-1})$.
\end{lemma}
\proof
\begin{itemize}
\item[] $x'$ \hfill (A).
\item[=] \{2 with $x'$ instead of $x$\}
\item[] $x'\cdot e$ \hfill (B).
\item[=] \{5 with $x$ instead of $x$\}
\item[] $x'\cdot (x\cdot x^{-1})$\hfill (C).
\item[=] \{1\}
\item[] $(x'\cdot x)\cdot x^{-1}$\hfill (D).
\item[=] \{hypothesis\}
\item[] $e\cdot x^{-1}$\hfill (E).
\item[=] \{3\}
\item[] $x^{-1}$\hfill (F).
\end{itemize}
\end{document}
--- NEW FILE: unicodeparser.py ---
from spark import GenericScanner, GenericParser
from token import Token
class UnicodeScanner(GenericScanner):
def __init__(self):
GenericScanner.__init__(self)
def tokenize(self, input):
self.rv = []
GenericScanner.tokenize(self, input)
return self.rv
def t_whitespace(self, s):
ur' \s+ '
pass
def t_op(self, s):
ur' \+ '
t = Token(type='PLUS', attr=s)
self.rv.append(t)
def t_term(self, s):
ur' a | b | \u03b1 '
t = Token(type='TERM', attr=s)
self.rv.append(t)
class UnicodeParser(GenericParser):
def __init__(self, start='expr'):
GenericParser.__init__(self, start)
def p_expr_1(self, args):
' expr ::= expr PLUS TERM '
return u'[' + args[1].attr + u', ' + args[0] + u', ' +
args[2].attr + u']'
def p_expr_2(self, args):
' expr ::= TERM '
return args[0].attr
if __name__ == '__main__':
import sys
scanner = UnicodeScanner()
tokens = scanner.tokenize(u'a+b')
parser = UnicodeParser()
print parser.parse(tokens)
|
Update of /cvsroot/pymerase/smw/smw/mathedit/doc/images In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mathedit/doc/images Added Files: aspell.png cascade.png collapsed.png colors.png dedent.png editor.png find.png fontdialog.png formattoolbar.png indent.png indentationdialog.png keybindingsdialog.png latexconvdialog.png maintoolbar.png menubar.png outputpane.png plugin.png replace.png ruleview.png sidebar.png snapshot1.png snapshot2.png snapshot3.png snapshot4.png snapshot5.png snapshot6.png spellcheck.png statusbar.png syntaxcolors.png tile.png titlebar.png toolstoolbar.png treeview.png viewbar.png Log Message: Imported version of SMW downloaded on 2003 Apr 14 --- NEW FILE: aspell.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: cascade.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: collapsed.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: colors.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: dedent.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: editor.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: find.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: fontdialog.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: formattoolbar.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: indent.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: indentationdialog.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: keybindingsdialog.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: latexconvdialog.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: maintoolbar.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: menubar.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: outputpane.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: plugin.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: replace.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ruleview.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: sidebar.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: snapshot1.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: snapshot2.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: snapshot3.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: snapshot4.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: snapshot5.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: snapshot6.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: spellcheck.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: statusbar.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: syntaxcolors.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: tile.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: titlebar.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: toolstoolbar.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: treeview.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: viewbar.png --- (This appears to be a binary file; contents omitted.) |
|
From: <de...@us...> - 2004-01-07 01:48:04
|
Update of /cvsroot/pymerase/smw/smw/mathedit/doc/devel
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mathedit/doc/devel
Added Files:
Cases Comments Conventions MathEdit-ClassDiagram.ps
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: Cases ---
Straightforward cases:
[X] #1.1
CASE: Single-line editing in an item which is collapsed in another view
BEHAVIOUR: The editing should not be visible in the view where the item
is collapsed
[X] #1.2
CASE: Multi-line deletion completely within a collapsed item
BEHAVIOUR: The deletion should not be visible in the view where the item
is collapsed
[X] #1.3
CASE: Deleting a complete collapsed item
BEHAVIOUR: The whole item should be deleted
[X] #1.4
CASE: Deleting all children within an item which is collapsed in another
view
BEHAVIOUR: The collapse state of the item should be removed.
Not-so-straightforward cases:
[X] #2.1
CASE: Dedenting an item within a collapsed structure which splits the
structure:
Document View 1 View 2
-------- ------ ------
abc -abc +abc
def def
ghi <-gdi
jkl jkl
BEHAVIOUR: The splitted item shoud first be expanded in view 2:
Document View 1 View 2
-------- ------ ------
abc -abc -abc
def def def
ghi -ghi -ghi
jkl jkl jkl
[X] #2.2
CASE: Deleting an item within a collapsed structure:
Document View 1 View 2
-------- ------ ------
abc -ab|c +abc
def def
ghi g|hi
/
delete
selection
BEHAVIOUR: Line 0 in View 2 should be updated and the collapse status of
line 0 in view 2 should be set to false.
Document View 1 View 2
-------- ------ ------
abhi abhi abhi
[X] #2.3
#2.3.1
CASE: Extending a collapsed item:
Document View
-------- ------
abc +abc
def ->
ghi \indent here
BEHAVIOUR: The view should not expand nor indent.
#2.3.2
CASE: Extending a collapsed item in another view:
Document View 1 View 2
-------- ------ ------
abc abc +abc
def def ghi
ghi ghi
\indent here
BEHAVIOUR: The ghi line should disappear from view 2.
Uncertain behaviour:
[X] #3.1
CASE: Newline after a collapsed item
Document View
-------- ------
abc +abc<--newline here
def
BEHAVIOUR: Should the new line be inserted after the last child of the
collapsed item and on the same indentation level, or should the
collapsed item be expanded and the new line added as new first
child?
Document View Document View
-------- ---- -------- ----
abc +abc or abc abc
def | | |
| def def
CHOICE: The item is first expanded.
[X] #3.2
CASE: Deleting within an item which is collapsed in another view so that
the first line of the item (which is the only visible line in the
other view) is joined with a child line
Document View 1 View 2
-------- ------ ------
abc -abc| +abc
def |def
ghi ghi
BEHAVIOUR: Should the item abc in view 2 be expanded, or should the first
line only be updated to reflect the change?
Document View 1 View 2
-------- ------ ------
abcdef -abcdef -abcdef
ghi ghi ghi
or:
Document View 1 View 2
-------- ------ ------
abcdef -abcdef +abcdef <- chose this
ghi ghi
SOLUTION: When updating a view, check if the first deleted line is visible
and if the last line invisible. If so, append the (rest) of the
last line to the first line.
[X] #3.3
CASE: Hitting backspace on the line following a collapsed line.
Document View
-------- ----
abc +abc
def | <- backspace here
BEHAVIOUR: The item should first be expanded
Document View
-------- ----
abc abc
def def|
--- NEW FILE: Comments ---
################################### SFI ##################################
24.05.2002 joheriks Stepwise feature introduction causes some extra
complexity in the GUI design - e.g. one has to create
abstraction for standard elements such as toolbars and
menus to be able to modify them in subclasses
29.05.2002 joheriks Seemingly small changes (like renaming a variable)
require unnecessarily much work as it has to be
propagated through every layer.
10.06.2002 joheriks The large number of classes makes it difficult
sometimes to understand the software. We now have an
editor which does almost nothing but consists of 60
classes.
24.06.2002 joheriks SFI requires too many imports and also causes some
circular imports. Maybe our design is flawed??
25.06.2002 joheriks A good thing about SFI is that the layered structure
makes it easy to see the code that was needed to
implement a certain feature
28.06.2002 miihakal Another good thing about SFI is that it helps you to find
where a bug was inadvertaitly inserted in the code. That
is in which layer it was inserted. This helps the
debugging process.
03.07.2002 joheriks Using multiple inheritance to combine layers is a bad
thing (in our design at least) because it requires
inheriting from two classes with the same methods and
attributes. This causes enormous name clashes which
require you to explicitly call base class methods
for _each_ method in the derived class: Anybodu care
to enlighten us why:
class A:
def f(self): do_something_A
class B:
def f(self): do_something_B
class C(A,B):
def f(self):
A.f(self)
B.f(self)
is in any way bettern than:
class A:
def f(self): do_something_A
class B(A):
def f(self):
A.f(self)
do_something_B
Even if f doesn't change in the new subclass, you still
have to define it to call the two f's in the
superclasses. Now what if f alters some state in the
object and this should be done only once - that requires
you to move out such functionality to other methods -
resulting in a complicated net of calls with intricate
interdependencies.
06.08.2002 lbernas We havn't strictly made one layer "ready" before
starting another one. Instead, we have sometimes had one
group fixing bugs and final features in the previous
layer while the other one starts working on the next.
Because of this we have almost never had the problem
that one group has to wait for the other one.
09.08.2002 miihakal Another drawback with having so many hierarchical levels
is that you start to forget methods and variables that
you defined on the lowest levels. Some of which could
still be useful in the higher levels. This can resort in
unnessesary new methods and variables in higher levels.
09.08.2002 miihakal One solution to the previous problem could be a more
organized distribution of methods in classes. You could
somehow arrange the methods according to functionality,
so that general (layer independent methods) would be
separated(by commens) from methods that implement a
certain feature or are otherwise "layer specific".
13.08.2002 lbernas In situations where we have had to choose between adding
functionality/framework needed later in an earlier layer
and overriding code, we have generally chosen the first
alternative. There would be no point in writing a layer
with less functionality if it can't serve as a base for
the next layer.
13.09.2002 lbernas SFI has the effect that the code is split into many
classes of different age which often also means that you
just look at the latest classes. This can lead to that
you don't notice for example variables that aren't
needed anymore. I have even found unnecessary stuff
today, the last day of the project.
################################ UNIT TESTING ############################
27.05.2002 lbernas We haven't been able to write automatic tests for the
classes that are based on QT because some action from
the user is required to break the QT execute loop.
Automatic tests are good, but there is no point using
them if you are forced to test "dummy" classes and
methods and not the actual ones that are used.
04.07.2002 lbernas I think that strictly writing test before implementing
the code would be very difficult. In many cases,
especially when making GUI things, you dont't know
exactly how you want the program to behave before you
see it "in action". Tests for GUI also requires a lot of
code and they run slowly.
################################## XP ####################################
03.06.2002 lbernas Even though we accordring to Extreme Programming and
Stepwise Feature Introduction should concentrate on
getting the current and previous layers working it's
sometimes better also to build framework for future
layers in underlying ones. Otherwise a lot of time
would be wasted on major refactorings that were known
before.
04.07.2002 lbernas Based on my experiences from last year I must say that
it is easier to keep people programming in pairs when
there is a lower computers/programmers ratio ;)
02.08.2002 joheriks Pair programming works does not seem to work so well
when debugging or solving a problem that requires
high concentration and/or precision.
07.08.2002 peteerik Debugging and writing documentation in pairs is not as
efficient as doing it alone.
07.08.2002 peteerik Programming in pairs can be very boring for the person
sitting beside the one who is programming. Because often
the person programming has his own thoughts about how one
problem should be solved and does not want to be
disturbed.
07.08.2002 peteerik I think discussing and solving problems in pairs is a
better idea than than programming in pairs. Once you
have the solution to a problem the programming is easy.
################################# MISC. ##################################
26.06.2002 joheriks Hacking the QTextEdit widget to make it an outlining
editor is the wrong thing to do. The results becomes
very fragile and it's a major headache to find all
possible cases which may cause inconsistency between
the document and the view.
28.06.2002 joheriks Possible optimization: store the latest mapping
(document <=> view) in global variable to avoid
having to calculate the same pair of values on
successive calls to dl2vl/vl2dl. Requires the use
of a flag to invalidate the stored mapping when the
mapping changes (document changes, expand, collapse)
28.06.2002 joheriks Possible optimization: Use a QStringList instead of a
python list in the document for storing lines to speed
up memory allocation when opening large files. Requires
creating an interface to the QStringList (by inheritance
or delegation) to make it work like an ordinary python
list.
05.07.2002 miihakal I really hope Ivan's group succeed at implementing a
tool for creating UML diagrams, then one hopefully
doesn't need a supercomputer to make a class diagram.
UNLIKE SOME OTHER PROGRAMS ...(Together)
12.07.2002 peteerik We have now over 100 classes. I guess documenting will
take some time. :)
12.07.2002 peteerik If we are supposed to implement software that also works
in Windows, a Windows machine should also be available.
28.07.2002 miihakal If we are intended to reach the derivation-part of this
project we really should work solely on the features
which are needed in derivation.
02.08.2002 joheriks "do not add buttons unless you provide functionality"
Why not do it to get a feel for how the GUI works?
02.08.2002 joheriks Why use a command pattern when there is no benefit,
likeactions that are not redoable and otherwise
don't need to be parametrized. It just seems to add more
code (and complexity) without actually providing
anything useful.
02.08.2002 joheriks We had to resort to C++ and rely on Qt internal source
code to make the QTextEdit widget do our bidding -
implementing a custom text widget would have been a
better, all-Python solution.
07.08.2002 miihakal The Gaudi Software Factory Bugtracker might not be in
that effective use in our project since the reporters
are also the developers. Often we do not even report
the bugs we find since it is much faster just to fix it.
08.08.2002 joheriks About UML diagrams: I don't think there is any idea to
create a class diagram of the whole system any more as
the number of classes has exceeded 150. UML diagrams are
only useful for communicating ideas if they are small
enough to be conceivable.
13.08.2002 lbernas Sometimes I have had the feeling that the design has
been more important than the product itself. This is a
research project but in order to give a valuable
evaluation of the methods, shouldn't we try to keep the
project as realistic as possible (and use designs that
are suitable to the product)?
--- NEW FILE: Conventions ---
CODING CONVENTIONS
------------------
1. Class names
1.1. Class names have capital letters
1.2. Files typically contain only one class, file name == class name
1.3. A class belonging to an SFI layer is prefixed by LayerName_...
1.3.1. ...and so is the filename
2. Methods and variables
1.1 Names start with lowercase with uppercase at every new word
1.2 _before a method/variable name means "protected" as in Java (convention)
1.2 __before a method/variable name means "private" (enforced by python)
3. Misc
2.1. Python assert()'s are used to check important conditions
--- NEW FILE: MathEdit-ClassDiagram.ps ---
%!PS-Adobe-3.0
%%BeginProlog
/imStr 0 def /heximageSrc{currentfile imStr readhexstring pop} def
/BD {bind def} bind def
/D {def} BD
/ISOF {
dup findfont dup length 1 add dict begin {
1 index /FID eq {pop pop} {D} ifelse
} forall /Encoding ISOLatin1Encoding D
currentdict end definefont
} BD
/NZ {dup 1 lt {pop 1} if} BD
/DS {
moveto 1 index stringwidth pop NZ sub
1 index length 1 sub NZ div 0
3 2 roll ashow newpath} BD
/F [
/AvantGarde-Book ISOF
/AvantGarde-BookOblique ISOF
[...5431 lines suppressed...]
11.5 266.5 lineto
11.5 267.5 lineto
12.0 267.5 lineto
closepath
fill
newpath
12.0 276.5 moveto
82.0 276.5 lineto
82.5 276.5 lineto
82.5 275.5 lineto
82.0 275.5 lineto
12.0 275.5 lineto
11.5 275.5 lineto
11.5 276.5 lineto
12.0 276.5 lineto
closepath
fill
pgSave restore
showpage
%%EOF
|
Update of /cvsroot/pymerase/smw/smw/mathedit/application
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mathedit/application
Added Files:
CmdList_MainWindow.py Command_AboutBox.py
Command_MainWindow.py Command_Menu.py Command_Toolbar.py
Derivation_FormatToolbar.py Derivation_MainWindow.py
Derivation_OutputPane.py Derivation_RuleView.py
Derivation_ViewWindow.py Edit_ASpellDialog.py
Edit_FindDialog.py Edit_GreekSingleLineEdit.py
Edit_MainWindow.py Edit_OptionsTabDialog.py
Edit_ReplaceDialog.py Edit_SpellChecker.py Edit_SpellDialog.py
Editor.py Export_ExportCommand.py Export_Filters.py
Export_LaTeXConv.py Export_LaTeXCustomizeDialog.py
Export_MainWindow.py Export_OptionsTabDialog.py Formula_AST.py
Formula_FindDialog.py Formula_FormatToolbar.py
Formula_MainWindow.py Formula_ReplaceDialog.py
Formula_TreeWindow.py Frame_MainWindow.py Frame_ViewWindow.py
Frame_Viewbar.py Frame_Viewtabs.py
Highlight_HighlightDialog.py Highlight_MainWindow.py
Highlight_OptionsTabDialog.py Import_Filters.py
Import_ImportCommand.py Import_MainWindow.py LayerBrowser.py
Layers.py MV_MainWindow.py MV_ViewWindow.py Makefile
Outline1_IndentationDialog.py Outline1_MainWindow.py
Outline1_OptionsTabDialog.py Outline1_ViewWindow.py
Outline2_MainWindow.py Outline2_ViewWindow.py Plugin_Dialog.py
Plugin_ImageFileDialog.py Plugin_MainWindow.py
Plugin_OptionsTabDialog.py Plugin_OutputPane.py
Plugin_RunCommand.py Plugin_Toolbar.py Profile.py
Profile_MainWindow.py Text_DialogBase.py Text_FileDialog.py
Text_KeybindingsDialog.py Text_MainWindow.py
Text_MenuButton.py Text_OptionsTabDialog.py
Text_SymbolPopup.py Text_ToggleButton.py Text_ViewWindow.py
Text_Viewbar.py Text_Viewtabs.py __init__.py addlicense.py
widgetshooter.py
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: CmdList_MainWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Command_AboutBox.py ---
from smw.mathedit.medit import Resources
from qt import *
class Command_AboutBox( QWidget ):
def __init__( self, parent=None, name=None ):
QWidget.__init__(self,parent,name,
Qt.WStyle_Customize|Qt.WStyle_NoBorder|
Qt.WStyle_Tool|Qt.WRepaintNoErase)
self.setCaption("About")
self.__pixmap = Resources.getIcon("about.png")
self.setMinimumSize(self.__pixmap.size())
self.setMaximumSize(self.__pixmap.size())
self.__buffer = QPixmap(self.__pixmap.width(),self.__pixmap.height())
self.__bufpainter = QPainter(self.__buffer)
self.__text = map(QString,["COPYRIGHT",
"",
"The Gaudi Software Factory",
"Turku Centre For Computer Science",
"",
"Published under the",
"GNU General Public License",
"",
"-+-",
"",
"AUTHORS",
"",
"Linus Bernas",
"Victor Bos",
"Johannes Eriksson",
"Peter Eriksson",
"Miika Hakala"])
self.__font = QFont("sans",10)
self.__bufpainter.setFont(self.__font)
self.__fontmetrics = QFontMetrics(self.__font)
self.__left = self.__pixmap.width()/2+20
self.__right = self.__pixmap.width()
self.__mid = (self.__right+self.__left)/2
self.__timer = QTimer(self)
self.connect(self.__timer,SIGNAL('timeout()'),self.__advance)
def reset( self ):
self.__texty = self.__pixmap.height()
self.__timer.start(50)
def stop( self ):
self.__timer.stop()
def showEvent( self, e ):
self.reset()
QWidget.showEvent(self,e)
def closeEvent( self, e ):
self.stop()
QWidget.closeEvent(self,e)
def mousePressEvent( self, e ):
if e.button() & Qt.LeftButton:
self.close()
def paintEvent( self, event ):
bitBlt(self.__buffer,0,0,self.__pixmap,0,0,self.__pixmap.width(),
self.__pixmap.height(),Qt.CopyROP,0)
ofs = 0
for t in self.__text:
x = self.__mid-self.__fontmetrics.width(t)/2
self.__bufpainter.drawText(x,self.__texty+ofs,t)
ofs += self.__fontmetrics.height()
bitBlt(self,0,0,self.__buffer,0,0,self.__pixmap.width(),
self.__pixmap.height(),Qt.CopyROP,0)
def __advance( self ):
self.__texty -= 1
if self.__texty<-1000:
self.__texty = self.__pixmap.height()
self.update()
if __name__=='__main__':
a = QApplication([])
w = Command_AboutBox(None)
a.setMainWidget(w)
w.show()
a.exec_loop()
--- NEW FILE: Command_MainWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Command_Menu.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Command_Toolbar.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Derivation_FormatToolbar.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Derivation_MainWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Derivation_OutputPane.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Derivation_RuleView.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Derivation_ViewWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Edit_ASpellDialog.py ---
from Text_DialogBase import Text_DialogBase
from smw.mathedit.medit import Preferences
from qt import *
class Edit_ASpellDialog( Text_DialogBase ):
def __init__( self, mw, parent=None, name=None ):
Text_DialogBase.__init__(self,mw,parent,name)
layout1 = QVBoxLayout(self,11,6)
self._label = QLabel("Enter the path and options to aspell "+
"(-a is mandatory):",self)
layout1.addWidget(self._label)
layout2 = QHBoxLayout(None,10,5)
self._edit = QLineEdit(self)
layout2.addWidget(self._edit)
self._browseButton = QPushButton("Browse...",self)
layout2.addWidget(self._browseButton)
layout1.addItem(layout2)
spacer = QSpacerItem(20,20,QSizePolicy.Minimum,QSizePolicy.Expanding)
layout1.addItem(spacer)
self._edit.setText(Preferences.PREF_ASPELL)
self.connect(self._browseButton,SIGNAL('clicked()'),self._browse)
def _browse( self ):
fname = QFileDialog.getOpenFileName(QString.null,QString.null,self,
None,"Browse")
if not fname.isNull():
fname.append(" -a")
self._edit.setText(fname)
def apply( self ):
Preferences.PREF_ASPELL = unicode(self._edit.text())
def cancel( self ):
self._edit.setText(Preferences.PREF_ASPELL)
--- NEW FILE: Edit_FindDialog.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Edit_GreekSingleLineEdit.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Edit_MainWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Edit_OptionsTabDialog.py ---
from Text_OptionsTabDialog import Text_OptionsTabDialog
from Edit_ASpellDialog import Edit_ASpellDialog
from qt import *
class Edit_OptionsTabDialog( Text_OptionsTabDialog ):
def _createPageList( self ):
Text_OptionsTabDialog._createPageList(self)
self._pages.append((Edit_ASpellDialog(self._mainWindow,self),
"aspell"))
--- NEW FILE: Edit_ReplaceDialog.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Edit_SpellChecker.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Edit_SpellDialog.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Editor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Export_ExportCommand.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Export_Filters.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Export_LaTeXConv.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Export_LaTeXCustomizeDialog.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Export_MainWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Export_OptionsTabDialog.py ---
from Outline1_OptionsTabDialog import Outline1_OptionsTabDialog
from Export_LaTeXCustomizeDialog import Export_LaTeXCustomizeDialog
from qt import *
class Export_OptionsTabDialog( Outline1_OptionsTabDialog ):
def _createPageList( self ):
Outline1_OptionsTabDialog._createPageList(self)
self._pages.append((Export_LaTeXCustomizeDialog(self._mainWindow,self),
"LaTeX Export"))
--- NEW FILE: Formula_AST.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_FindDialog.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_FormatToolbar.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_MainWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_ReplaceDialog.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_TreeWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Frame_MainWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Frame_ViewWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Frame_Viewbar.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Frame_Viewtabs.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Highlight_HighlightDialog.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Highlight_MainWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Highlight_OptionsTabDialog.py ---
from Export_OptionsTabDialog import Export_OptionsTabDialog
from Highlight_HighlightDialog import Highlight_HighlightDialog
from qt import *
class Highlight_OptionsTabDialog( Export_OptionsTabDialog ):
def _createPageList( self ):
Export_OptionsTabDialog._createPageList(self)
self._pages.append((Highlight_HighlightDialog(self._mainWindow,self),
"Syntax Highlighting"))
--- NEW FILE: Import_Filters.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Import_ImportCommand.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Import_MainWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: LayerBrowser.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Layers.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: MV_MainWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: MV_ViewWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Makefile ---
clean:
rm -f *.pyc *.pyo
--- NEW FILE: Outline1_IndentationDialog.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Outline1_MainWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Outline1_OptionsTabDialog.py ---
from Plugin_OptionsTabDialog import Plugin_OptionsTabDialog
from Outline1_IndentationDialog import Outline1_IndentationDialog
from qt import *
class Outline1_OptionsTabDialog( Plugin_OptionsTabDialog ):
def _createPageList( self ):
Plugin_OptionsTabDialog._createPageList(self)
self._pages.append((Outline1_IndentationDialog(self._mainWindow,self),
"Indentation"))
--- NEW FILE: Outline1_ViewWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Outline2_MainWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Outline2_ViewWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Plugin_Dialog.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Plugin_ImageFileDialog.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Plugin_MainWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Plugin_OptionsTabDialog.py ---
from Edit_OptionsTabDialog import Edit_OptionsTabDialog
from Plugin_Dialog import Plugin_Dialog
from qt import *
class Plugin_OptionsTabDialog( Edit_OptionsTabDialog ):
def _createPageList( self ):
Edit_OptionsTabDialog._createPageList(self)
self._pages.append((Plugin_Dialog(self._mainWindow,self),
"Tools"))
--- NEW FILE: Plugin_OutputPane.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Plugin_RunCommand.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Plugin_Toolbar.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Profile.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Profile_MainWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_DialogBase.py ---
from qt import *
class Text_DialogBase( QWidget ):
"""Base class for configuration dialogs"""
def __init__( self, mw, parent=None, name=None ):
"""Initialized the widget and sets the main window reference"""
QWidget.__init__(self,parent,name)
self._mainWindow = mw
def apply( self ):
"""Called when the dialog's changes should be applied"""
raise "Not implemented"
def cancel( self ):
"""Called when this dialog is about to be closed and the changes
should not be saved. This is a good place to reset text fields
and other widgets."""
raise "Not implemented"
--- NEW FILE: Text_FileDialog.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_KeybindingsDialog.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_MainWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_MenuButton.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_OptionsTabDialog.py ---
from Text_KeybindingsDialog import Text_KeybindingsDialog
from qt import *
class Text_OptionsTabDialog( QTabDialog ):
def __init__( self, mw, parent=None, name=None, modal=1 ):
QTabDialog.__init__(self,parent,name,modal)
self._mainWindow = mw
self.setCaption("Options")
self.setOkButton()
self.setCancelButton()
self.setApplyButton()
self.connect(self,SIGNAL('applyButtonPressed()'),self._apply)
self.connect(self,SIGNAL('defaultButtonPressed()'),self._apply)
self.connect(self,SIGNAL('cancelButtonPressed()'),self._cancel)
self._createPageList()
for p in self._pages:
apply(self.addTab,p)
def _createPageList( self ):
self._pages = [(Text_KeybindingsDialog(self._mainWindow,self),
"Keybindings")]
def _apply( self ):
for p,_ in self._pages:
p.apply()
def _cancel( self ):
for p,_ in self._pages:
p.cancel()
--- NEW FILE: Text_SymbolPopup.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_ToggleButton.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_ViewWindow.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_Viewbar.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_Viewtabs.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: __init__.py ---
--- NEW FILE: addlicense.py ---
#!/usr/bin/env python2
import os
import string
import glob
if __name__ == '__main__':
license = """#
# Copyright (C) 2002 Åbo Akademi University
#
# This file is part of the Mathematical Derivation Editor.
#
# Mathematical Derivation Editor is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the License,
# or (at your option) any later version.
#
# Mathematical Derivation Editor is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Mathematical Derivation Editor; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""
clicense = """//
// Copyright (C) 2002 Åbo Akademi University
//
// This file is part of the Mathematical Derivation Editor.
//
// Mathematical Derivation Editor is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the License,
// or (at your option) any later version.
//
// Mathematical Derivation Editor is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with Mathematical Derivation Editor; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
"""
filelist = glob.glob('*.py')
filelist = filelist + glob.glob('resources/profiles/*Profile.py')
for f in filelist:
file = open(f, 'r+')
haslicense = int(os.popen("grep --count 'Copyright (C) 2002 Åbo Akademi University' " + file.name).read().strip())
if not haslicense and f != 'spark.py':
print 'Adding license info to', file.name
content = file.read()
content = license + content
file.seek(0)
file.write(content)
file.close()
cfilelist = glob.glob('qt_own/*.cpp') + glob.glob('qt_own/*.h')
for f in cfilelist:
file = open(f, 'r+')
haslicense = int(os.popen("grep --count 'Copyright (C) 2002 Åbo Akademi University' " + file.name).read().strip())
if not haslicense:
print 'Adding license info to', file.name
content = file.read()
content = clicense + content
file.seek(0)
file.write(content)
file.close()
--- NEW FILE: widgetshooter.py ---
(This appears to be a binary file; contents omitted.)
|
Update of /cvsroot/pymerase/smw/smw/mathedit/cpp-sip
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mathedit/cpp-sip
Added Files:
IndentEdit.cpp IndentEdit.h IndentEdit.sip MainWindow.cpp
MainWindow.h MainWindow.sip Makefile qt_own.sip
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: IndentEdit.cpp ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: IndentEdit.h ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: IndentEdit.sip ---
%HeaderCode
#include <IndentEdit.h>
%End
class IndentEdit : QTextEdit
{
public:
IndentEdit( QWidget * /TransferThis/ =0 );
virtual bool event( QEvent * );
virtual bool acceptOverride( int, int );
virtual void ensureCursorVisible();
void updatesUp();
void updatesDown();
void setIndentationWidth( int );
void resetParagraph( int );
void simpleInsertParagraph( const QString&, int );
void indent( int, int );
void dedent( int, int );
void setCursorPositionWithoutJump( int, int );
};
--- NEW FILE: MainWindow.cpp ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: MainWindow.h ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: MainWindow.sip ---
%HeaderCode
#include <MainWindow.h>
%End
class MainWindow : QMainWindow
{
public:
MainWindow( QWidget */TransferThis/=0, const char *=0,
WFlags=WType_TopLevel);
QString saveState();
void loadState( const QString& );
};
--- NEW FILE: Makefile ---
# The following probably need to be modified only in special cases
#INCLUDES=-I$(QTDIR)/include -I$(QTSRCDIR)/src -I$(MKSPECDIR)
export MOC=$(QTDIR)/bin/moc
export CC=gcc
export CXX=g++
export CXXFLAGS=-fPIC -I$(QTDIR)/include -I$(MKSPECDIR) -I$(QTSRCDIR)/src
export LDFLAGS=-L$(QTDIR)/lib
export LDLIBS=-lqt
# Meta object (MOC) compilation rule
moc_%.cpp: %.h
$(MOC) $< -o $@
all: sip
sip: MainWindow.o
sip -I $(PYQT_SIPS) -c sipcode -t Qt_3_0_5 -t WS_X11 qt_own.sip
cd sipcode && $(MAKE)
cp sipcode/*.py .
cp sipcode/*.so .
MainWindow.o : MainWindow.cpp MainWindow.h
clean:
rm -f *.o *.so *.py *.pyc
cd sipcode && $(MAKE) clean
--- NEW FILE: qt_own.sip ---
%Module qt_own
%Import qtmod.sip
%Include MainWindow.sip
|
|
From: <de...@us...> - 2004-01-07 01:48:04
|
Update of /cvsroot/pymerase/smw/smw/mathedit/cpp-sip/sipcode
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mathedit/cpp-sip/sipcode
Added Files:
Makefile
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: Makefile ---
#QTSRCDIR=/home/joheriks/qt-x11-free-3.0.4
#MOC=/usr/bin/moc
#CXX=g++
#CXXFLAGS=-fPIC
module=qt_own
objs=$(module)cmodule.o sip$(module)MainWindow.o moc_sip$(module)Proxy$(module).o
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -I.. -I. -I$(PYTHON_INCLUDES) -I$(SIP_INCLUDES)\
-I$(QTDIR)/include -I$(QTSRCDIR)/src $<
libs: $(objs)
g++ -shared -L$(SIP_LIBS) -L$(QTDIR)/lib -L$(PYQT_LIBS) -o lib$(module)cmodule.so -lqt -lqtcmodule -lsip ../MainWindow.o $(objs)
$(objs):
moc_sip$(module)Proxy$(module).cpp: sip$(module)Proxy$(module).h
$(MOC) -o moc_sip$(module)Proxy$(module).cpp sip$(module)Proxy$(module).h
clean:
rm -f *.o *.so *.cpp *.h *.py *.pyc moc_*.cpp
|
|
From: <de...@us...> - 2004-01-07 01:48:04
|
Update of /cvsroot/pymerase/smw/smw/mathedit In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mathedit Added Files: Makefile __init__.py mathedit mathedit.bat runtests Log Message: Imported version of SMW downloaded on 2003 Apr 14 --- NEW FILE: Makefile --- # First of all, make sure the QTDIR environment variable is set right # (or set it here) #QTDIR=/usr/lib/qt3 # The root of the Qt source installation - no longer needed! #export QTSRCDIR=/home/joheriks/qt-x11-free-3.0.5 # The correct MKSPECDIR for your platform/compiler export MKSPECDIR=$(QTDIR)/mkspecs/linux-g++ # The directory where sip.h and sipQt.h are installed export PYTHON_INCLUDES=/usr/include/python2.2 # The directory where sip.h and sipQt.h are installed export SIP_INCLUDES=/usr/include/python2.2 # The directory where libsip is installed export SIP_LIBS=/usr/lib/python2.2/site-packages # The directory where libqtcmodule is installed export PYQT_LIBS=/usr/lib/python2.2/site-packages # The directory where the sip files for PyQt are installed #export PYQT_SIPS=/usr/share/sip/qt export PYQT_SIPS=/home/joheriks/sip # The path to openjade export OPENJADE=openjade # The path to pdfjadetex export PDFJADETEX=pdfjadetex all: web .PHONY: doc web tarball clean doc: cd doc && $(MAKE) all sipstuff: cd cpp-sip && $(MAKE) all cp -f cpp-sip/*.so application cp -f cpp-sip/*.py application web: doc cp -rf doc/html web cp -rf doc/pwg web cp -rf doc/mathedit web cp -rf doc/images web cp -f doc/manual.pdf web cp -f doc/pwg.pdf web cp -f doc/mathedit.pdf web tarball: mkdir -p mathedit-latest mkdir -p web/snapshots cp -r doc Makefile mathedit cpp-sip resources application medit unittests mprofiles web mathedit-latest cd mathedit-latest && $(MAKE) clean find mathedit-latest -name CVS | xargs rm -rf tar -c mathedit-latest | gzip -9 > web/snapshots/mathedit-latest.tar.gz rm -rf mathedit-latest clean: cd application && $(MAKE) clean cd unittests && $(MAKE) clean cd medit && $(MAKE) clean cd mprofiles && $(MAKE) clean cd cpp-sip && $(MAKE) clean cd doc && $(MAKE) clean rm -rf web/html rm -rf web/images rm -rf web/snapshots rm -rf web/pwg rm -rf web/mathedit rm -f web/*.pdf --- NEW FILE: __init__.py --- --- NEW FILE: mathedit --- #!/bin/bash cd $(dirname $0) export MATHEDIT_RESOURCES=resources python application/Editor.py $@ --- NEW FILE: mathedit.bat --- @echo off set MATHEDIT_RESOURCES=resources python application\Editor.py %1 %2 %3 %4 %5 --- NEW FILE: runtests --- #!/bin/bash cd $(dirname $0) export MATHEDIT_RESOURCES=resources python unittests/Test.py $@ |
|
From: <de...@us...> - 2004-01-07 01:48:04
|
Update of /cvsroot/pymerase/smw/smw/examples/tr441
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/examples/tr441
Added Files:
as.py ex1.py ex2-b.py ex2.py ex3-b.py ex3.py ex4.py ex5.py
ex6.py ex7.py ex8.py ex9.py printMM2.py readme.txt runex.py
short-ex6.py validname.py wfr1.py
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: as.py ---
def translateStateChart(sc):
text= sc.context.name+"= |[ \n"
text=text+" Var state:integer ; \n"
text=text+" do \n"
for t in sc.transitions:
text=text+self.processTransition(t)
text=text+" od\n"
text=text+"|]\n"
return text
def processTransition(t):
text=" [] state="+t.source.name
if t.trigger:
text=text+" and event="+processTrigger(t.trigger)
if t.guard:
text=text+" and "+t.guard.expression.body
text=text+" -> \n"
if t.source.exit:
text=text+" "+t.source.exit.script.body+";\n"
if t.effect:
text=text+" "+t.effect.script.body+";\n"
if t.target.entry:
text=text+" "+t.target.entry.script.body+";\n"
text=text+ " state:="+t.target.name+"\n"
return text
def processTrigger(t):
if t.isTypeOf(SignalEvent):
return t.signal.name
if t.isTypeOf(CallEvent):
return t.operation.name
if t.isTypeOf(TimeEvent):
return t.when.body
if t.isTypeOf(ChangeEvent):
return self.changeExpression.body
raise "Unknonw UML Event type",t
--- NEW FILE: ex1.py ---
from smw.metamodel import UML14 # import UML 1.4 metamodel
myModel=UML14.Model() # create a Model
myModel.ownedElement.insert( # add a class to the model
UML14.Class(name='Customer')
)
--- NEW FILE: ex2-b.py ---
from smw.metamodel import UML14 # import UML 1.4 metamodel
myModel=UML14.Model() # create a Model
customer=UML14.Class(name='Customer') # create a class
myModel.ownedElement.insert(customer) # when we add class to the model
assert(customer.namespace==myModel) # the other association end
# is updated automatically
for expr in [
'myModel.ownedElement.forAll(lambda c: c.name=="Customer")',
'myModel.ownedElement.forAll(lambda c1,c2: c1.name!=c2.name or c1==c2)']:
print expr
if eval(expr):
print " is true"
else:
print " is false"
print "Model elements:"
for c in myModel.ownedElement:
print c.name
--- NEW FILE: ex2.py ---
from smw.metamodel import UML14 # import UML 1.4 metamodel
myModel=UML14.Model() # create a Model
customer=UML14.Class(name='Customer') # create a class
myModel.ownedElement.insert(customer) # when we add class to the model
assert(customer.namespace==myModel) # the other association end
# is updated automatically
--- NEW FILE: ex3-b.py ---
from smw.Project import *
from smw.metamodel.UML14 import *
try:
sm=StateMachine(top=Class(name="Customer"))
except WFRException,e:
print "You got an exception (as expected): ",e
--- NEW FILE: ex3.py ---
from smw import Project
from smw.metamodel import UML14
prj=Project.Project() # Create a project
c=UML14.Class() # It is possible to create objects
c.name="Customer" # and modify them out of a transaction
prj.history.beginModifyCmd() # Begin a transaction
c.name="Employee" # Modify the model
prj.history.endModifyCmd() # Finish the transaction
assert(c.name=="Employee") # The changes are there
prj.history.undo() # Undo the last transaction
assert(c.name=="Customer") # We get the previous name
prj.history.redo() # Redo the last transaction
assert(c.name=="Employee") # Voila!
--- NEW FILE: ex4.py ---
from smw.Project import *
from smw.metamodel.UML14 import *
prj=Project() # Create a project
sm=StateMachine(top=CompositeState()) # Create a state machine
# Add an initial state to top
sm.top.subvertex.insert(Pseudostate(kind=PseudostateKind.pk_initial))
# Begin a strict transaction
prj.history.beginModifyCmd(mode=ModifyCmd.strictMode)
# We add a second initial state (this is wrong)
sm.top.subvertex.insert(Pseudostate(kind=PseudostateKind.pk_initial))
# Now the top state has two subvertices
assert(sm.top.subvertex.size()==2)
# We try to commit the strict transaction, we will get a WFR Exception
try:
prj.history.endModifyCmd()
except WFRException,e:
print "You got an exception (as expected): ",e
# Now the second initial state has disappeared
assert(sm.top.subvertex.size()==1)
--- NEW FILE: ex5.py ---
from validname import isNameValid
def checkNames(package):
for me in package.ownedElement:
if not isNameValid(me.name):
return 0
# if it is a Package
if me.isOclTypeOf(Package):
# check the elements inside it
if not checkNames(me):
return 0
# if it is a Classifier
if me.isOclTypeOf(Classifier):
# check its features
for f in me.feature:
if not isNameValid(f.name):
return 0
return 1
--- NEW FILE: ex6.py ---
from validname import *
from smw.metamodel.UML14 import *
# define the constrain as a wfr
def wfrNameValid(self):
return isNameValid(self.name)
# add the rule to the model elements
Model.wfrNameValid=wfrNameValid
Package.wfrNameValid=wfrNameValid
Class.wfrNameValid=wfrNameValid
Feature.wfrNameValid=wfrNameValid
# Check if the whole mode is well-formed
myModel=Model(name="MyModel") # create a Model
myModel.ownedElement.insert( # add a class to the model
Class(name='Customer')
)
myModel.isWellFormedRecursive()
# we add an ofending class
myModel.ownedElement.insert(
Class(name='Å 123 ÅA Ivan')
)
try:
myModel.isWellFormedRecursive()
except WFRException,e:
print "You got an exception (as expected): ",e
--- NEW FILE: ex7.py ---
import os
os.system("python printMM2.py smw.metamodel.UML14")
--- NEW FILE: ex8.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: ex9.py ---
import sys
from smw.metamodel import UML14
from smw.io import loadModel
myModel=loadModel(sys.argv[1],UML14)
--- NEW FILE: printMM2.py ---
import sys, string
from smw.metamodel.MetaMM import SimpleReflector
# Check the command line parameters
if len(sys.argv)<2:
print "Usage: printMM metamodel"
sys.exit(0)
# Import the metamodel, this is advanced Python
mm=__import__(sys.argv[1],globals(),locals(),
[string.split(sys.argv[1],'.')[-1]])
# Create a reflector for ModelElement
r=SimpleReflector(mm.ModelElement)
# Print the properties of the element
print "Element:",r.name
if r.generalization.nonEmpty():
print " Subclass of",
print r.generalization.collect(lambda e: SimpleReflector(e).name)
if r.specialization.nonEmpty():
print " Inherited by",
print r.specialization.collect(lambda e: SimpleReflector(e).name)
print "Attributes"
for a in r.feature:
print " ",a.name,":", a.aTypeName
print "Associations"
for a in r.association:
print " ",a.name, ":", a.otherTypeName
--- NEW FILE: readme.txt ---
This folder contains the examples of the paper "A Toolkit for
Manipulating UML Models". To run the examples you need to install the
aUML toolkit before. If python complains that it cannot find the aUML
modules, set the PYTHONPATH enviroment variable to the folder where
the aUML toolkit was installed.
Ivan Porres
ip...@ab...
--- NEW FILE: runex.py ---
import os
import glob
for file in glob.glob('ex*.py'):
print "**** Executing Example: "+file+ " ****"
print
os.system('python ' + file)
--- NEW FILE: short-ex6.py ---
from validname import *
from smw.metamodel.UML14 import *
# define the constrain as a wfr
def wfrNameValid(self):
return isNameValid(self.name)
# add the rule to the model elements
Model.wfrNameValid=wfrNameValid
Package.wfrNameValid=wfrNameValid
Classifier.wfrNameValid=wfrNameValid
Feature.wfrNameValid=wfrNameValid
# Check if the whole mode is well-formed
myModel.isWellFormedRecursive()
--- NEW FILE: validname.py ---
import string
def isNameValid(s):
if not s:
# empty strings are invalid
return 0
# First character must be a letter or an underscore
if s[0] not in string.letters+"_":
return 0
# The other characters can a letter, a digit or an underscore
for c in s[1:]:
if c not in string.letters+string.digits+"_":
return 0
return 1
--- NEW FILE: wfr1.py ---
class CompositeState:
def wfrCompositeState1(self):
"A composite state can have at most one initial vertex"
return self.subvertex.select(
lambda v: v.oclIsKindOf(Pseudostate) and
v.kind== PseudostateKind.initial).size() <=1
def wfrCompositeState2(self):
"A composite state can have at most one deep history vertex"
return self.subvertex.select(
lambda v: v.oclIsKindOf(Pseudostate) and
v.kind== PseudostateKind.deepHistory).size() <=1
def wfrCompositeState3(self):
"A composite state can have at most one shallow history vertex"
return self.subvertex.select(
lambda v: v.oclIsKindOf(Pseudostate) and
v.kind== PseudostateKind.shallowHistory).size() <=1
def wfrCompositeState4(self):
"There have to be at least two composite substates in a "
"concurrent composite state"
return implies(
self.isConcurrent,
self.subvertex.select(
lambda v: v.oclIsKindOf(CompositeState)).size()>=2
)
def wfrCompositeState5(self):
"A concurrent state can only have composite states as substates"
return implies(
self.isConcurrent,
self.subvertex.forAll(lambda s:
s.oclIsKindOf(CompositeState))
)
def wfrCompositeState6(self):
"The substates of a composite state are part of only that"
"composite state"
return self.subvertex.forAll(lambda s:
s.container.asSet().size()==1 and
s.container == self)
|