PEATDB/PEATApp.py
def addPrevProjects(self, parentmenu):
        """Add previous projects from prefs file to the DB menu"""
        import string, types
        self.recentmenu = submenu = Menu(parentmenu, tearoff=1)
        for s in self.preferences.get('recent'):
            if s and type(s) is types.TupleType:
                server,port,project,backend=s
                text=server+':'+str(port)+':'+project
                def func(**kwargs):
                    def new():
                       self.connect(**kwargs)
                    return new
                submenu.add_command(label=text,
                                    command=func(server=server,port=port,
                                                 project=project,backend=backend))
            elif type(s) is types.StringType and os.path.exists(s):
                if len(s)>30: text = s[:10]+'..'+s[20:]
                else: text = s
                def func(arg):
                    def new():
                        self.openLocal(arg)
                    return new
                submenu.add_command(label=text, command=func(s))
        parentmenu.add_separator()
        parentmenu.add_command(label='Clear Recent', command=self.clearPrevProjects)
        parentmenu.add_cascade(label='Recent Projects', menu=submenu)
        return
Add previous projects from prefs file to the DB menu
Add previous projects from prefs file to the DB menu
Add previous projects from prefs file to the DB menu
def addPrevProjects(self, parentmenu):
        import string, types
        self.recentmenu = submenu = Menu(parentmenu, tearoff=1)
        for s in self.preferences.get('recent'):
            if s and type(s) is types.TupleType:
                server,port,project,backend=s
                text=server+':'+str(port)+':'+project
                def func(**kwargs):
                    def new():
                       self.connect(**kwargs)
                    return new
                submenu.add_command(label=text,
                                    command=func(server=server,port=port,
                                                 project=project,backend=backend))
            elif type(s) is types.StringType and os.path.exists(s):
                if len(s)>30: text = s[:10]+'..'+s[20:]
                else: text = s
                def func(arg):
                    def new():
                        self.openLocal(arg)
                    return new
                submenu.add_command(label=text, command=func(s))
        parentmenu.add_separator()
        parentmenu.add_command(label='Clear Recent', command=self.clearPrevProjects)
        parentmenu.add_cascade(label='Recent Projects', menu=submenu)
        return
def addPrevProjects ( self , parentmenu ) : import string , types self . recentmenu = submenu = Menu ( parentmenu , tearoff = 1 ) for s in self . preferences . get ( 'recent' ) : if s and type ( s ) is types . TupleType : server , port , project , backend = s text = server + ':' + str ( port ) + ':' + project def func ( ** kwargs ) : def new ( ) : self . connect ( ** kwargs ) return new submenu . add_command ( label = text , command = func ( server = server , port = port , project = project , backend = backend ) ) elif type ( s ) is types . StringType and os . path . exists ( s ) : if len ( s ) > 30 : text = s [ : 10 ] + '..' + s [ 20 : ] else : text = s def func ( arg ) : def new ( ) : self . openLocal ( arg ) return new submenu . add_command ( label = text , command = func ( s ) ) parentmenu . add_separator ( ) parentmenu . add_command ( label = 'Clear Recent' , command = self . clearPrevProjects ) parentmenu . add_cascade ( label = 'Recent Projects' , menu = submenu ) return
Add previous projects from prefs file to the DB menu
Add previous projects from prefs file to the DB menu
"""Add previous projects from prefs file to the DB menu"""
self
parentmenu