Beispiel #1
0
 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)
Beispiel #2
0
 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)
Beispiel #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))
Beispiel #4
0
 def size(self, value):
     """ Set size """
     if isinstance(value,int) or isinstance(value,long):
         self.__size = Node.sizeof_fmt(value)
     else:
         self.__size = value
Beispiel #5
0
 def __init__(self, values):
     """ Constructor """
     Node.__init__(self, values)
     self.__parent = Node.get_instance(self.get_parent())
     self.__size = values['size']
Beispiel #6
0
 def __init__(self, values):
     """ Constructor """
     Node.__init__(self, values)
     self.__parent = Node.get_instance(self.get_parent())
     self.__files = []
     self.__folders = []