Logo Search packages:      
Sourcecode: pythoncard version File versions  Download package

def customDialogs::AboutDialog::buildAboutResource (   self,
  title,
  description,
  links 
)

This builds a string containing a resource description as you find in a .rsrc files

Definition at line 41 of file customDialogs.py.

00041                                                            :
        """This builds a string containing a resource description as you find in a .rsrc files"""

        description = description.replace("\n", "\\n")
        description = description.replace("'", "\\'")
        
        # build the body of the About dialog resourece string.  done first so we know the
        # total height of the whole window when we write out the main string at the end.
        bodyRSRC = " {'type':'StaticText', 'name':'labelDesc', 'position':(10,10)," + \
                  "'alignment':'center','size':(360,30),'text':'" + title + "'},"
        bodyRSRC = bodyRSRC + " {'type':'TextArea', 'name':'labelDesc', 'position':(10,40)," + \
                   "'size':(360,80),'text':'" + description + "'},"

        vert = 140

        for i in range(len(links)):
            link = links[i]
            bodyRSRC = bodyRSRC + " {'type':'StaticText', 'name':'labelLinkDesc%d', " % i + \
                      "'position':(10,%d)," % (vert) + \
                      "'text':'" + link[0] + "'},"
            vert += 20
            bodyRSRC = bodyRSRC + " {'type':'StaticText', 'name':'labelLink%d', " % i + \
                      "'position':(10,%d)," % (vert) + \
                      "'foregroundColor':'blue', 'text':'" + link[1] + "'},"
            vert += 30

        bodyRSRC = bodyRSRC + \
                  "{'type':'Button', 'name':'btnOK', 'position':(10, %d), " % vert + \
                  "'label':'OK', 'id':5100 }" + \
                  " ] } "

        vert += 60
        # construct the final resource string.
        dlgRSRC = "{'type':'CustomDialog','name':'dlgAbout'," + \
                  " 'title':'About " + title + "...','position':(-1,-1),'size':(390, %d),\n\n'components': [" % vert
        
        dlgRSRC += bodyRSRC
        
        # eval the resource string, pass it to Resource() and return it.
        return resource.Resource( eval(dlgRSRC) )
        
    def on_mouseUp(self, event):


Generated by  Doxygen 1.6.0   Back to index