Don't use try for fittingView, and don't show remove item for modes.
This commit is contained in:
@@ -492,10 +492,11 @@ class FittingView(d.Display):
|
|||||||
while sel != -1 and sel not in self.blanks:
|
while sel != -1 and sel not in self.blanks:
|
||||||
mod = self.mods[self.GetItemData(sel)]
|
mod = self.mods[self.GetItemData(sel)]
|
||||||
|
|
||||||
# Test if mod.isEmpty exists.
|
# Test if mod.isEmpty does not exist.
|
||||||
try:
|
# Certain special module can be missing this trait
|
||||||
mod.isEmpty
|
# Example: T3D modes
|
||||||
except AttributeError:
|
if not hasattr(mod, 'isEmpty'):
|
||||||
|
# Set it if missing, prevents later stack traces.
|
||||||
mod.isEmpty = False
|
mod.isEmpty = False
|
||||||
|
|
||||||
if not mod.isEmpty:
|
if not mod.isEmpty:
|
||||||
|
|||||||
@@ -69,6 +69,17 @@ class ContextMenu(object):
|
|||||||
if m.display(srcContext, selection):
|
if m.display(srcContext, selection):
|
||||||
amount += 1
|
amount += 1
|
||||||
texts = m.getText(itemContext, selection)
|
texts = m.getText(itemContext, selection)
|
||||||
|
|
||||||
|
# Check the selected item to see if it has special reasons for not showing the menu item
|
||||||
|
skip_menu_item = False
|
||||||
|
for sel in selection:
|
||||||
|
if hasattr(sel, "_Mode__item") and texts == "Remove Module":
|
||||||
|
# Don't show remove for modes, these are special modules that cannot be removed
|
||||||
|
skip_menu_item = True
|
||||||
|
|
||||||
|
if skip_menu_item == True:
|
||||||
|
continue
|
||||||
|
|
||||||
if isinstance(texts, basestring):
|
if isinstance(texts, basestring):
|
||||||
texts = (texts,)
|
texts = (texts,)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user