Example #1
0
def _withoutOrientationMap(who):
    result = (whoville.excludeProxies(who)
              and orientmapdata.getOrientationMap(who.getObject()) is None)
    return result
Example #2
0
    def buildWidgets(self, value=None, interactive=0):
        debug.mainthreadTest()
        # Construct a Chooser widget for each WhoClass in the target
        # WhoClass's hierarchy.  interactive is 1 if this call is in
        # response to a user action.
        ##        oldvalue = self.get_value()
        oldpath = self.currentPath[:]
        classlist = self.whoclass.hierarchy()
        depth = len(classlist)

        # Make sure value is a list.
        value = labeltree.makePath(value)

        # Make a list of the allowed proxies for the lowermost tier of
        # the class hierarchy for this widget.  Allowed proxies are
        # those which satisfy both the passed-in condition *and* are
        # proxies.
        self.proxy_names = [
            x[0]
            for x in classlist[-1].keys(condition=lambda x: self.condition(x)
                                        and not whoville.excludeProxies(x),
                                        sort=self.sort)
        ]

        # Make sure that value contains a setting for each chooser widget
        if value and len(value) < depth:
            value += [None] * (depth - len(value))
        for d in range(depth):
            try:
                # Exclude proxies from this part of the process...
                paths = classlist[d].keys(base=self.currentPath[:d],
                                          condition=lambda x: self.condition(x)
                                          and whoville.excludeProxies(x),
                                          sort=self.sort)
            except KeyError, exc:
                names = []
            else:
                names = [p[0] for p in paths]
            if d == 0:
                # In the top-most level of the widget, include the
                # proxy names for the lowermost level.
                names += self.proxy_names

            if self.widgets[d] is None:
                if self.widgettype == 'Chooser' or d < depth - 1:
                    self.widgets[d] = chooser.ChooserWidget(
                        names,
                        callback=self.selectCB,
                        callbackargs=(d, ),
                        name=classlist[d].name())
                else:
                    self.widgets[d] = chooser.ChooserComboWidget(
                        names, callback=self.comboCB, name=classlist[d].name())
                self.gtk[d] = self.widgets[d].gtk
                self.destroysignals[d] = self.gtk[d].connect(
                    'destroy', self.destroyCB, d)
            else:
                # Update the list of choices in an existing ChooserWidget.
                self.widgets[d].update(names)
            if value and value[d] in names:
                # Set widget to the given value
                self.widgets[d].set_state(value[d])
                self.currentPath[d] = value[d]
            elif self.currentPath[d] in names:
                # ... or retain previous value
                self.widgets[d].set_state(self.currentPath[d])
            elif len(names) > 0:
                # ... or pick the first value in the list
                self.currentPath[d] = names[0]
                self.widgets[d].set_state(0)
            else:
                # ... or don't pick anything
                self.currentPath[d] = ''
            if self.widgettype == 'Chooser':
                self.gtk[d].set_sensitive(names != [])
Example #3
0
def _withOrientationMap(who):
    return (whoville.excludeProxies(who)
            and orientmapdata.getOrientationMap(who.getObject()) is not None)
Example #4
0
def _nsync(who):
    return whoville.excludeProxies(who) and not (who.getClass() is mesh.meshes
                                                 and who.outOfSync())
Example #5
0
    def buildWidgets(self, value=None, interactive=0):
        debug.mainthreadTest()
        # Construct a Chooser widget for each WhoClass in the target
        # WhoClass's hierarchy.  interactive is 1 if this call is in
        # response to a user action.
##        oldvalue = self.get_value()
        oldpath = self.currentPath[:]
        classlist = self.whoclass.hierarchy()
        depth = len(classlist)

        # Make sure value is a list.
        value = labeltree.makePath(value)

        # Make a list of the allowed proxies for the lowermost tier of
        # the class hierarchy for this widget.  Allowed proxies are
        # those which satisfy both the passed-in condition *and* are
        # proxies.
        self.proxy_names = [x[0]  for x in classlist[-1].keys(
            condition = lambda x: self.condition(x) and not whoville.excludeProxies(x),
            sort=self.sort)]
        
        # Make sure that value contains a setting for each chooser widget
        if value and len(value) < depth:
            value += [None]*(depth-len(value))
        for d in range(depth):
            try:
                # Exclude proxies from this part of the process...
                paths = classlist[d].keys(
                    base=self.currentPath[:d],
                    condition=lambda x:
                            self.condition(x) and whoville.excludeProxies(x),
                    sort=self.sort)
            except KeyError, exc:
                names = []
            else:
                names = [p[0] for p in paths]
            if d==0:
                # In the top-most level of the widget, include the
                # proxy names for the lowermost level.
                names += self.proxy_names
                
            if self.widgets[d] is None:
                if self.widgettype == 'Chooser' or d < depth-1:
                    self.widgets[d] = chooser.ChooserWidget(
                        names, callback=self.selectCB, callbackargs=(d,),
                        name=classlist[d].name())
                else:
                    self.widgets[d] = chooser.ChooserComboWidget(
                        names, callback=self.comboCB,
                        name=classlist[d].name())
                self.gtk[d] = self.widgets[d].gtk
                self.destroysignals[d] = self.gtk[d].connect('destroy',
                                                             self.destroyCB, d)
            else:
                # Update the list of choices in an existing ChooserWidget.
                self.widgets[d].update(names)
            if value and value[d] in names:
                # Set widget to the given value
                self.widgets[d].set_state(value[d])
                self.currentPath[d] = value[d]
            elif self.currentPath[d] in names:
                # ... or retain previous value
                self.widgets[d].set_state(self.currentPath[d])
            elif len(names) > 0:
                # ... or pick the first value in the list
                self.currentPath[d] = names[0]
                self.widgets[d].set_state(0)
            else:
                # ... or don't pick anything
                self.currentPath[d] = ''
            if self.widgettype == 'Chooser':
                self.gtk[d].set_sensitive(names != [])
Example #6
0
def _withoutOrientationMap(who):
    result = whoville.excludeProxies(who) and orientmapdata.getOrientationMap(who.getObject()) is None
    return result
Example #7
0
def _withOrientationMap(who):
    return whoville.excludeProxies(who) and orientmapdata.getOrientationMap(who.getObject()) is not None
Example #8
0
def _nsync(who):
    return whoville.excludeProxies(who) and not (who.getClass() is mesh.meshes
                                                 and who.outOfSync())