| 2177 |
|
if not role_unique and orm_object.Unique:
|
| |
2177 |
role_spans = 0
|
| |
2178 |
y0 = y
|
| |
2179 |
if role_unique: y0 -= 2
|
| |
2180 |
y1 = y0
|
| |
2181 |
for i in range(len(roles)):
|
| |
2182 |
if roles[i].UniqueOther in ('ax', 'dx'):
|
| |
2183 |
role_spans += 1
|
| |
2184 |
if roles[i].UniqueOther == 'ax':
|
| |
2185 |
pen = self.canvas.CachedPen(3, 1, wx.SOLID)
|
| |
2186 |
penx = self.canvas.CachedPen(3, 1, wx.DOT)
|
| |
2187 |
else: # 'dx'
|
| |
2188 |
pen = self.canvas.CachedPen(1, 1, wx.SOLID)
|
| |
2189 |
penx = self.canvas.CachedPen(1, 1, wx.DOT)
|
| |
2190 |
dc.SetPen(pen)
|
| |
2191 |
if i == 0:
|
| |
2192 |
x0 = x + role_box_width
|
| |
2193 |
x1 = x0 + role_box_width * (len(roles)-1)
|
| |
2194 |
dc.DrawLine(x0, y0, x1, y1)
|
| |
2195 |
elif i == len(roles)-1:
|
| |
2196 |
x0 = x
|
| |
2197 |
x1 = x0 + role_box_width * (len(roles)-1)
|
| |
2198 |
dc.DrawLine(x0, y0, x1, y1)
|
| |
2199 |
else:
|
| |
2200 |
x0 = x
|
| |
2201 |
x1 = x0 + role_box_width * i
|
| |
2202 |
dc.DrawLine(x0, y0, x1, y1)
|
| |
2203 |
|
| |
2204 |
x0 = x1 + 2 # start with a gap
|
| |
2205 |
x1 = x0 + role_box_width - 4 # end with gap
|
| |
2206 |
dc.SetPen(penx)
|
| |
2207 |
dc.DrawLine(x0, y0, x1, y1)
|
| |
2208 |
|
| |
2209 |
x0 = x1 + 2 # after gap
|
| |
2210 |
x1 = x0 + role_box_width * (len(roles)-i-1)
|
| |
2211 |
dc.SetPen(pen)
|
| |
2212 |
dc.DrawLine(x0, y0, x1, y1)
|
| |
2213 |
y0 = y0 - 2
|
| |
2214 |
y1 = y0
|
| |
2215 |
|
| |
2216 |
if not role_unique and not role_spans and orm_object.Unique:
|
| 2931 |
|
if role.Mandatory:
|
| 2932 |
|
menu.Append(self.popsID11, "Role Not Mandatory")
|
| 2933 |
|
if role.Mandatory != 'a':
|
| 2934 |
|
menu.Append(self.popsID12, "Role Mandatory Alethic")
|
| 2935 |
|
if role.Mandatory != 'd':
|
| 2936 |
|
menu.Append(self.popsID13, "Role Mandatory Deontic")
|
| |
2970 |
if role.ORMFactType.Nary <= 2 or role.Unique == 'a':
|
| |
2971 |
menu.AppendCheckItem(self.popsID15, "Set Role as Unique")
|
| |
2972 |
menu.Check(self.popsID15, (role.Unique == 'a'))
|
| |
2973 |
if role.ORMFactType.Nary > 2:
|
| |
2974 |
menu.AppendCheckItem(self.popsID16, "Set Other Roles as Unique")
|
| |
2975 |
menu.Check(self.popsID16, (role.UniqueOther == 'ax'))
|
| |
2976 |
menu.AppendCheckItem(self.popsID12, "Set Role as Mandatory")
|
| |
2977 |
menu.Check(self.popsID12, (role.Mandatory == 'a'))
|
| 2938 |
|
if role.Unique:
|
| 2939 |
|
menu.Append(self.popsID14, "Role Not Unique")
|
| 2940 |
|
if role.Unique != 'a':
|
| 2941 |
|
menu.Append(self.popsID15, "Role Unique Alethic")
|
| 2942 |
|
if role.Unique != 'd':
|
| 2943 |
|
menu.Append(self.popsID16, "Role Unique Deontic")
|
| |
2979 |
menu.AppendCheckItem(self.popsID17, "Set Role as Unique (Deontic)")
|
| |
2980 |
menu.Check(self.popsID17, (role.Unique == 'd'))
|
| |
2981 |
if role.ORMFactType.Nary > 2:
|
| |
2982 |
menu.AppendCheckItem(self.popsID18, "Set Other Roles as Unique (Deontic)")
|
| |
2983 |
menu.Check(self.popsID18, (role.UniqueOther == 'dx'))
|
| |
2984 |
menu.AppendCheckItem(self.popsID13, "Set Role as Mandatory (Deontic)")
|
| |
2985 |
menu.Check(self.popsID13, (role.Mandatory == 'd'))
|
| |
3221 |
def RoleUniqueOther(self, event, new_unique_value, undo_msg):
|
| |
3222 |
l = self.pdc.FindObjects(self.popupx, self.popupy, hitradius)
|
| |
3223 |
if l:
|
| |
3224 |
shape = self.dcid_to_shape_xref.get(l[0])
|
| |
3225 |
if shape.Subtype == 'ORMFactTypeShape':
|
| |
3226 |
target = shape.GetRole(self.popupx, self.popupy)
|
| |
3227 |
else: # role connector
|
| |
3228 |
target = shape.Get('Target')
|
| |
3229 |
target.UniqueOther = new_unique_value
|
| |
3230 |
Data.SetUndo(undo_msg)
|
| |
3231 |
self.RedrawID(shape.dcid)
|
| |
3232 |
if shape.Subtype == 'ORMFactTypeShape':
|
| |
3233 |
for x in shape.GetFollowers():
|
| |
3234 |
self.RedrawID(x.dcid)
|
| |
3235 |
else: # role
|
| |
3236 |
self.RedrawID(shape.Get('NodeA').dcid)
|
| |
3237 |
|
| 3175 |
|
self.RoleUnique(event, 'd', 'Set Unique Deontic')
|
| |
3248 |
if event.IsChecked():
|
| |
3249 |
self.RoleUniqueOther(event, 'ax', 'Set Other Roles as Unique')
|
| |
3250 |
else:
|
| |
3251 |
self.RoleUniqueOther(event, None, 'Set Other Roles as Not Unique')
|
| |
3252 |
|
| |
3253 |
def OnPops17(self, event):
|
| |
3254 |
if event.IsChecked():
|
| |
3255 |
self.RoleUnique(event, 'd', 'Set Unique (Deontic)')
|
| |
3256 |
else:
|
| |
3257 |
self.OnPops14(event)
|
| |
3258 |
|
| |
3259 |
def OnPops18(self, event):
|
| |
3260 |
if event.IsChecked():
|
| |
3261 |
self.RoleUniqueOther(event, 'dx', 'Set Other Roles as Unique (Deontic)')
|
| |
3262 |
else:
|
| |
3263 |
self.RoleUniqueOther(event, None, 'Set Other Roles as Not Unique')
|