예제 #1
0
 def __str__(self):
     keys = sorted(set(self.keys()) - set(('drawable', )))
     s = utils.formatDict(utils.selectDict(self, keys))
     for i, d in enumerate(self.drawable):
         s += "** Drawable %s **\n" % i
         s += d.__str__()
     return s
예제 #2
0
    def __str__(self):
        """Format the Config in a way that can be read back.

        This function is mostly used to format the data for writing it to
        a configuration file. See the write() method.

        The return value is a multiline string with Python statements that can
        be read back through Python to recreate the Config data. Usually
        this is done with the Config.read() method.
        """
        from pyformex.utils import formatDict
        s = ''
        for k, v in self.items():
            if not isinstance(v, Dict):
                s += formatDict({k:v})
        for k, v in self.items():
            if isinstance(v, Dict):
                s += "\n[%s]\n" % k
                s += formatDict(v)
        return s
예제 #3
0
def printEnv():
    """Print the environment."""
    print(utils.formatDict(os.environ.data))
예제 #4
0
def show():
    """Accept the data and show the results"""
    from pyformex.utils import formatDict
    dialog.acceptData()
    res = dialog.results
    print(formatDict(res))
예제 #5
0
def opengl():
    """Display the OpenGL format description."""
    from pyformex.opengl import canvas
    s = utils.formatDict(canvas.glVersion()) + '\n'
    s += viewport.OpenGLFormat(pf.canvas.format())
    draw.showText(s)
예제 #6
0
 def __str__(self):
     keys = sorted(set(self.keys()) - set(('_default_dict_', )))
     print("Keys %s" % keys)
     out = utils.formatDict(utils.selectDict(self, keys))
     print(out)
     return out