示例#1
0
文件: folder.py 项目: olavgg/py-sth
 def scan_for_files(self):
     """ Scan for files """
     files = [o for o in os.listdir(
         self.sys_path) if (
             os.path.isfile(self.sys_path + '/' + o) and not
             os.path.islink(self.sys_path + '/' + o)
         )
     ]
     for line in files:
         path = u'{folder}/{file}'.format(folder=self.path, file=line)
         node = Node.get_instance(path)
         self.__files.append(node)
示例#2
0
文件: folder.py 项目: olavgg/py-sth
 def scan_for_folders(self):
     """ Scan for folders """
     sub_folders = [o for o in os.listdir(
         self.sys_path) if (
             os.path.isdir(self.sys_path + '/' + o)
             and not os.path.islink(self.sys_path + '/' + o)
         )
     ]
     for line in sub_folders:
         path = u'{folder}/{node}'.format(folder=self.path, node=line)
         node = Node.get_instance(path)
         self.__folders.append(node)
示例#3
0
 def __placeExtraNodesForASensor(self, crtX, crtY):
     for _ in range(Constants.ENERGY_LEVELS + 1):  # the energy levels + the exit node
         self.__nodeList.append(Node(crtX, crtY))
示例#4
0
文件: file.py 项目: olavgg/py-sth
 def size(self, value):
     """ Set size """
     if isinstance(value,int) or isinstance(value,long):
         self.__size = Node.sizeof_fmt(value)
     else:
         self.__size = value
示例#5
0
文件: file.py 项目: olavgg/py-sth
 def __init__(self, values):
     """ Constructor """
     Node.__init__(self, values)
     self.__parent = Node.get_instance(self.get_parent())
     self.__size = values['size']
示例#6
0
文件: folder.py 项目: olavgg/py-sth
 def __init__(self, values):
     """ Constructor """
     Node.__init__(self, values)
     self.__parent = Node.get_instance(self.get_parent())
     self.__files = []
     self.__folders = []