LPCBeremiz.py
changeset 526 68375ccdf968
parent 521 02cb9e5fb6f6
child 530 862d9adcd904
equal deleted inserted replaced
522:6bd373f930f2 526:68375ccdf968
   802         
   802         
   803         self.PluginRoot.KillDebugThread()
   803         self.PluginRoot.KillDebugThread()
   804         self.KillLocalRuntime()
   804         self.KillLocalRuntime()
   805         
   805         
   806         print "Closed"
   806         print "Closed"
       
   807         sys.stdout.flush()
   807         
   808         
   808         event.Skip()
   809         event.Skip()
   809 
   810 
   810     def ShowProperties(self):
   811     def ShowProperties(self):
   811         old_values = self.Controler.GetProjectProperties()
   812         old_values = self.Controler.GetProjectProperties()
  1299         arg_number = len(arg_types)
  1300         arg_number = len(arg_types)
  1300         def CmdFunction(self, line):
  1301         def CmdFunction(self, line):
  1301             args_toks = line.split('"')
  1302             args_toks = line.split('"')
  1302             if len(args_toks) % 2 == 0:
  1303             if len(args_toks) % 2 == 0:
  1303                 print "Error: Invalid command"
  1304                 print "Error: Invalid command"
       
  1305                 sys.stdout.flush()
  1304                 return
  1306                 return
  1305             args = []
  1307             args = []
  1306             for num, arg in enumerate(args_toks):
  1308             for num, arg in enumerate(args_toks):
  1307                 if num % 2 == 0:
  1309                 if num % 2 == 0:
  1308                     stripped = arg.strip()
  1310                     stripped = arg.strip()
  1325                     print "Error: No argument%s expected" % extra
  1327                     print "Error: No argument%s expected" % extra
  1326                 elif number == 1:
  1328                 elif number == 1:
  1327                     print "Error: 1 argument%s expected" % extra
  1329                     print "Error: 1 argument%s expected" % extra
  1328                 else:
  1330                 else:
  1329                     print "Error: %d arguments%s expected" % (number, extra)
  1331                     print "Error: %d arguments%s expected" % (number, extra)
       
  1332                 sys.stdout.flush()
  1330                 return
  1333                 return
  1331             for num, arg in enumerate(args):
  1334             for num, arg in enumerate(args):
  1332                 try:
  1335                 try:
  1333                     args[num] = arg_types[num](arg)
  1336                     args[num] = arg_types[num](arg)
  1334                 except:
  1337                 except:
  1335                     print "Error: Invalid value for argument %d" % (num + 1)
  1338                     print "Error: Invalid value for argument %d" % (num + 1)
       
  1339                     sys.stdout.flush()
  1336                     return
  1340                     return
  1337             res = getattr(self, function)(*args)
  1341             res = getattr(self, function)(*args)
  1338             if isinstance(res, (StringType, UnicodeType)):
  1342             if isinstance(res, (StringType, UnicodeType)):
  1339                 print res
  1343                 print res
       
  1344                 sys.stdout.flush()
  1340                 return False
  1345                 return False
  1341             else:
  1346             else:
  1342                 return res
  1347                 return res
  1343         return CmdFunction
  1348         return CmdFunction
  1344     
  1349