Пример #1
0
 def writeFile(self):
     if self.checkActive():
         try:
             with open(self.path, 'w') as f:
                 f.write('#mGeo settings file\n')
                 for i in self.data.items():
                     f.write(str(i[0]) + '=' + str(i[1]) + '\n')
         except:
             cmds.warning('Cant open options file 1')
Пример #2
0
 def writeFile(self):
     if self.checkActive():
         try:
             with open(self.path, 'w') as f:
                 f.write('#mGeo settings file\n')
                 for i in self.data.items():
                     f.write(str(i[0]) + '=' + str(i[1]) + '\n')
         except:
             cmds.warning('Cant open options file 1')
Пример #3
0
 def readFile(self):
     if self.checkActive():
         lines = []
         if os.path.exists(self.path):
             try:
                 with open(self.path, 'r') as f:
                     lines = f.readlines()
             except:
                 cmds.warning('Cant open options file')
             if lines:
                 lines.pop(0)
                 return lines
             else:
                 return []
         else:
             return []
Пример #4
0
 def readFile(self):
     if self.checkActive():
         lines = []
         if os.path.exists(self.path):
             try:
                 with open(self.path, 'r') as f:
                     lines = f.readlines()
             except:
                 cmds.warning('Cant open options file 2')
             if lines:
                 lines.pop(0)
                 return lines
             else:
                 return []
         else:
             return []
Пример #5
0
 def getConfigFolder(self):
     home = os.path.dirname(__file__)
     optDir = os.path.join(home, 'config')
     try:
         if not os.path.exists(optDir):
             os.makedirs(optDir, 0777)
         return optDir
     except:
         home = os.path.expanduser('~')
         optDir = os.path.join(home, 'config')
         try:
             if not os.path.exists(optDir):
                 os.makedirs(optDir, 0777)
             cmds.warning('Access denied. Options saved in user folder')
             return optDir
         except:
             cmds.warning('Cant create options file 3')
Пример #6
0
 def getConfigFolder(self):
     #home = os.path.dirname(__file__)
     home = os.getenv('APPDATA')
     return home
     optDir = os.path.join(home, 'config')
     try:
         if not os.path.exists(optDir):
             os.makedirs(optDir, 0777)
         return optDir
     except:
         home = os.path.expanduser('~')
         optDir = os.path.join(home, 'config')
         try:
             if not os.path.exists(optDir):
                 os.makedirs(optDir, 0777)
             cmds.warning('Access denied. Options saved in user folder')
             return optDir
         except:
             cmds.warning('Cant create options file 3')
Пример #7
0
 def checkActive(self):
     if not self.active:
         cmds.warning('Options not active')
         return False
     else:
         return True
Пример #8
0
 def checkActive(self):
     if not self.active:
         cmds.warning('Options not active')
         return False
     else:
         return True