⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guimanager.py

📁 BitTorrentABC-Linux-V.2.4.3源码
💻 PY
字号:
from os.path import join
from os import path

class GUIManager:
    def __init__(self, abcpath):
        self.maxid = 21
        self.configdata = []
        self.numcol = 0
        self.colid = []
        self.abcpath = abcpath
        # read abc.ini
        ################
        ini = open(path.join(abcpath, "abc.ini"), "rb")
        while True:
            iniline = ini.readline()
            if iniline == "" or iniline == "\n":
                break
            iniarg = iniline.split("|")        
            self.configdata.append([ int(iniarg[0]), int(iniarg[1]), iniarg[2], int(iniarg[3][0:-1])])
            if int(iniarg[1]) != -1:
                self.numcol += 1
        ini.close()
        self.arrangeRank()

    def reloadINI(self):
        self.configdata = []
        self.numcol = 0
        self.colid = []

        ini = open(path.join(self.abcpath, "abc.ini"), "rb")
        while True:
            iniline = ini.readline()
            if iniline == "" or iniline == "\n":
                break
            iniarg = iniline.split("|")        
            self.configdata.append([ int(iniarg[0]), int(iniarg[1]), iniarg[2], int(iniarg[3][0:-1])])
            if int(iniarg[1]) != -1:
                self.numcol += 1
        ini.close()
        self.arrangeRank()
        
    def arrangeRank(self):
        for i in range(0, self.numcol):
            self.colid.append(0)
            
        for i in range(0, self.maxid):
            rank = self.configdata[i][1]
            if rank != -1:
                self.colid[rank] = self.configdata[i][0] #ID
        
    def getNumCol(self):
        return self.numcol
    
    def getRankfromID(self, id):
        return self.configdata[id][1]
            
    def getIDfromRank(self, rank):
        return self.colid[rank]
    
    def getText(self, id):
        return self.configdata[id][2]
    def getTextfromRank(self, rankid):
        return self.configdata[self.colid[rankid]][2]
    
    def getValue(self, id):
        return self.configdata[id][3]
    def getValuefromRank(self, rankid):
        return self.configdata[self.colid[rankid]][3]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -