Пример #1
0
    def OnClick_DrawIPDsFile(self):
        path = GUI.get.GetLineEditText(self, "edit_ipds_file")
        if not path:
            Debug.printWarning("无法绘制图像:IPDs文件为空")
            return

        def readCSV(filePath, start=0, end=-1) -> list:
            ans = []
            with open(filePath) as f:
                reader = csv.reader(f)
                next(reader)
                next(reader)
                for row in reader:
                    try:
                        ans.append((float)(row[0]))
                    except ValueError as ve:
                        Debug.printError(str(ve))
            return ans

        ipds = readCSV(path)[0:150000]
        Debug.printInfo("读取完成,开始排序...")
        ipds.sort()
        Debug.printInfo("排序完成")
        plt.figure(1)
        plt.plot(x=list(range(len(ipds))),
                 y=ipds,
                 seriesName="IPCTC",
                 rgb=[0, 0, 255],
                 lineWidth=5,
                 xlabel="Times",
                 ylabel="Inter-packet delay",
                 windowTitle="TRCTC信道排序后 IPDs 分布规律")
        plt.displayAll()
Пример #2
0
 def __init__(self, IP, port):
     # socket列表
     self.socket_list = []
     self.IP = IP
     self.port = port
     self.clientMap = {}
     Debug.printInfo("Test Info")
     Debug.printWarning("Test Warning")
     Debug.printError("Test Error")
Пример #3
0
 def __PraseShortCut(shortCut):
     def is_english_char(ch):
         if ord(ch) not in range(97,122) and ord(ch) not in range(65,90):
             return False
         else:
             return True
     splitted = shortCut.split('+')
     modifierCtrl = False
     modifierShift = False
     keyCode = None
     for s in splitted:
         if s.upper() == "CTRL":
             if not modifierCtrl:
                 modifierCtrl = True
             else:
                 Debug.printWarning("Reuse of 'CTRL' modifier")
         elif s.upper() == "SHIFT":
             if not modifierShift:
                 modifierShift = True
             else:
                 Debug.printWarning("Reuse of 'SHIFT' modifier")
         else:
              if len(s) == 1 and is_english_char(s[0]):
                 if not keyCode:
                     keyCode = s.upper()[0]
                 else:
                     Debug.printWarning("Cannot use two key for shortCut")
              else:
                 Debug.printWarning("Unidentified str:"+s)
                 return []
     return [modifierCtrl,modifierShift,keyCode]
Пример #4
0
 def wrapper(*args,**kwarg):
     if not GUI.CurrentWidgetCommands:
         Debug.printWarning("you should call GUI.Begin(ptr) first")
         return
     func(*args,**kwarg)