9 |
BROWSER_FIXED_COLOR = "#008800" |
BROWSER_FIXED_COLOR = "#008800" |
10 |
BROWSER_FREE_COLOR = "#000088" |
BROWSER_FREE_COLOR = "#000088" |
11 |
|
|
12 |
|
BROWSER_ACTIVE_COLOR = "black" |
13 |
|
BROWSER_INACTIVE_COLOR = "#888888" |
14 |
|
|
15 |
class ModelView: |
class ModelView: |
16 |
def __init__(self,browser,glade): |
def __init__(self,browser,glade): |
17 |
self.browser = browser # the parent object: the entire ASCEND browser |
self.browser = browser # the parent object: the entire ASCEND browser |
128 |
_value = str(instance.getValue()) |
_value = str(instance.getValue()) |
129 |
_type = str(instance.getType()) |
_type = str(instance.getType()) |
130 |
_name = str(instance.getName()) |
_name = str(instance.getName()) |
131 |
_fgcolor = "black" |
_fgcolor = BROWSER_ACTIVE_COLOR |
132 |
_fontweight = pango.WEIGHT_NORMAL |
_fontweight = pango.WEIGHT_NORMAL |
133 |
_editable = False |
_editable = False |
134 |
_statusicon = None |
_statusicon = None |
143 |
_status = instance.getVarStatus(); |
_status = instance.getVarStatus(); |
144 |
_statusicon = self.browser.statusicons[_status] |
_statusicon = self.browser.statusicons[_status] |
145 |
elif instance.isRelation(): |
elif instance.isRelation(): |
146 |
if not instance.isIncluded(): |
if not instance.isActive(): |
147 |
_fgcolor = "#888888" |
_fgcolor = BROWSER_INACTIVE_COLOR |
148 |
elif instance.isBool() or instance.isReal() or instance.isInt(): |
elif instance.isBool() or instance.isReal() or instance.isInt(): |
149 |
# TODO can't edit constants that have already been refined |
# TODO can't edit constants that have already been refined |
150 |
_editable = True |
_editable = True |
171 |
elif not _instance.isFixed() and self.modelstore.get_value(_iter,3)==BROWSER_FIXED_COLOR: |
elif not _instance.isFixed() and self.modelstore.get_value(_iter,3)==BROWSER_FIXED_COLOR: |
172 |
self.modelstore.set_value(_iter,3,BROWSER_FREE_COLOR) |
self.modelstore.set_value(_iter,3,BROWSER_FREE_COLOR) |
173 |
self.modelstore.set_value(_iter, 6, self.browser.statusicons[_instance.getVarStatus()]) |
self.modelstore.set_value(_iter, 6, self.browser.statusicons[_instance.getVarStatus()]) |
174 |
|
elif _instance.isRelation(): |
175 |
|
if _instance.isActive(): |
176 |
|
self.modelstore.set_value(_iter,3,BROWSER_ACTIVE_COLOR) |
177 |
|
else: |
178 |
|
self.modelstore.set_value(_iter,3,BROWSER_INACTIVE_COLOR) |
179 |
|
|
180 |
def cell_edited_callback(self, renderer, path, newtext, **kwargs): |
def cell_edited_callback(self, renderer, path, newtext, **kwargs): |
181 |
# get back the Instance object we just edited (having to use this seems like a bug) |
# get back the Instance object we just edited (having to use this seems like a bug) |