def __loadConfig(self):
     op = Public.Public_ConfigOp(self.configPath)
     rt = op.ReadConfig(self.title, 'name')
     if True is rt[0]:
         self.lineEdit.setText(rt[1])
     else:
         logger.warn('读取路径失败:{path}'.format(path=self.title))
 def __saveHistory(self):
     ipOp = Public.Public_ConfigOp(self.configPath)
     if True is self.HistoryListChanged:
         ipOp.RemoveSection(self.sectionName)
         ipOp.SaveAll()
         for index, item in enumerate(self.inputList):
             ipOp.SaveConfig(self.sectionName, str(index), item)
 def __getPath(self):
     op = Public.Public_ConfigOp(self.configPath)
     filePath = op.OldPathReadAndNewPathSave(self.title,
                                             "path",
                                             ifDir=self.ifDir)
     if "" != filePath:
         self.returnPath.emit(filePath)
    def __loadConfig(self):
        op = Public.Public_ConfigOp(self.configPath)
        rt = op.ReadConfig(self.title,
                           'maxLogLine',
                           Type='int',
                           defaultValue=self.maxLogLine)
        if True is rt[0]:
            self.maxLogLine = rt[1]

        rt = op.ReadConfig(self.title,
                           'ifRedirect',
                           Type='bool',
                           defaultValue=self.ifRedirect)
        if True is rt[0]:
            self.ifRedirect = rt[1]

        rt = op.ReadConfig(self.title,
                           'ifClearLogAtStart',
                           Type='bool',
                           defaultValue=self.ifClearLogAtStart)
        if True is rt[0]:
            self.ifClearLogAtStart = rt[1]

        rt = op.ReadConfig(self.title,
                           'logLevel',
                           Type='int',
                           defaultValue=self.logLevel)
        if True is rt[0]:
            self.logLevel = rt[1]

        rt = op.ReadConfig(self.title,
                           'ifAddTime',
                           Type='bool',
                           defaultValue=self.ifAddTime)
        if True is rt[0]:
            self.ifAddTime = rt[1]

        rt = op.ReadConfig(self.title, 'logDir', defaultValue=self.logDir)
        if True is rt[0]:
            self.logDir = rt[1]

        rt = op.ReadConfig(self.title,
                           'colorInfo',
                           defaultValue=self.colorInfo)
        if True is rt[0]:
            self.colorInfo = rt[1]

        rt = op.ReadConfig(self.title,
                           'colorWarning',
                           defaultValue=self.colorWarning)
        if True is rt[0]:
            self.colorWarning = rt[1]

        rt = op.ReadConfig(self.title,
                           'colorError',
                           defaultValue=self.colorError)
        if True is rt[0]:
            self.colorError = rt[1]
 def __loadHistory(self):
     historyList = self.inputList
     historyOp = Public.Public_ConfigOp(self.configPath)
     rt = historyOp.ReadAllBySection(self.sectionName)
     if True is rt[0]:
         for item in rt[1]:
             if (item[1] not in historyList) and ("" != item[1]):
                 historyList.append(item[1])
     else:
         logger.info(rt[1])
 def dropEvent(self, e):
     fileNameList = []
     fileList = e.mimeData().urls()
     for file in fileList:
         fileName = file.toString()
         if fileName.startswith('file:///'):
             fileNameList.append(fileName[len('file:///'):])
     if 1 == len(fileNameList):
         self.setText(fileNameList[0])
         op = Public.Public_ConfigOp(self.configPath)
         op.SaveConfig(self.title, 'path', fileNameList[0])
    def __loadConfig(self):
        op = Public.Public_ConfigOp(self.configPath)
        rt = op.ReadConfig('Global', 'ifAutoLoad', Type='bool')
        if True is rt[0]:
            self.ifAutoLoad = rt[1]
        else:
            op.SaveConfig('Global', 'ifAutoLoad', 'True')

        if False is self.ifAutoLoad:
            return
        rt = op.ReadConfig(self.title, 'path')
        if True is rt[0]:
            self.setText(rt[1])
        else:
            logger.warn('读取路径失败:{path}'.format(path=self.title))
 def saveConfig(self):
     op = Public.Public_ConfigOp(self.configPath)
     op.SaveConfig(self.title, 'name', self.lineEdit.text())
 def savePath(self):
     op = Public.Public_ConfigOp(self.configPath)
     op.SaveConfig(self.title, 'path', self.text())