Пример #1
0
 def _addCommands(self,moduleList):
     for module in [AUTOCommands]:
         # Now we copy the commands from the module
         for key in module.__dict__.keys():
             # Check to see if it is a descendent of AUTOCommands.command
             if AUTOutil.findBaseClass(module.__dict__[key],AUTOCommands.command):
                 exec _functionTemplate%(key,module.__name__,key,key,key)
Пример #2
0
 def expert(self,keys):
     baseList = []
     for key in keys:
         # Check to see if it is a descendent of AUTOCommands.command
         if AUTOutil.findBaseClass(AUTOCommands.__dict__[key],AUTOCommands.command):
             bases = AUTOCommands.__dict__[key].__bases__
             for base in bases:
                 if not(base in baseList):
                     baseList.append(base)
     
     for base in baseList:
         if base.__name__[:7] == "command" and len(base.__name__) > 7: 
             self.addmenu(base.__name__[7:],'Commands which inherit from %s'%base.__name__)
         else:
             self.addmenu(base.__name__,'Commands which inherit from %s'%base.__name__)
     self.addExpertCommands([AUTOCommands])
Пример #3
0
 def addExpertCommands(self,moduleList):
     for module in moduleList:
         keys = module.__dict__.keys()
         keys.sort()
         for key in keys:
             # Check to see if it is a descendent of AUTOCommands.command
             if AUTOutil.findBaseClass(module.__dict__[key],AUTOCommands.command):
                 if module.__dict__[key].__bases__[0] == AUTOCommands.command:
                     self.addmenuitem('command',
                                      'command',
                                      key,label=key,
                                      command=lambda obj=self,name=key,command=module.__dict__[key]:obj._getArgs(name,command))
                 else:
                     self.addmenuitem(module.__dict__[key].__bases__[0].__name__[7:],
                                      'command',
                                      key,label=key,
                                      command=lambda obj=self,name=key,command=module.__dict__[key]:obj._getArgs(name,command))
Пример #4
0
 def addSimpleCommands(self,moduleList):
     self.defaultEntry = Pmw.EntryField(self,
                                        labelpos = 'w',
                                        label_text = 'Default name:',
                                        validate = None,
                                        command = self.__setDefault)
     self.defaultEntry.grid(row=0,columnspan=2)
     for module in moduleList:
         keys = module.__dict__.keys()
         keys.sort()
         i = 0
         for key in keys:
             # Check to see if it is a descendent of AUTOCommands.command
             if AUTOutil.findBaseClass(module.__dict__[key],AUTOCommands.command):
                 try:
                     if module.__dict__[key].type==AUTOCommands.SIMPLE:
                         button = Tkinter.Button(self,text=module.__dict__[key].shortName,
                                                 command=lambda obj=self,name=key,command=module.__dict__[key]:obj._getArgs(name,command))
                         button.grid(row=i/2 + 1,column=i%2)
                         i = i + 1
                 except AttributeError:
                     pass