Exemplo n.º 1
0
 def __quitEvent__(self, b):
     """
     @summary: Handle quit event.
     @param b: GtkObject that threw event. 
     """
     __log__.debug("Closing main window...")
     FactoryDirectoryMonitor.removeAll()
     gtk.main_quit()
     __log__.debug("Main window closed.")
Exemplo n.º 2
0
 def __collapsedRowTVSignal__ (self, treeview, iter, path):
     """
     @summary: Handle collapse event of the explorer TreeView.
     @param treeview: TreeView where a TreeIter was collapsed.
     @param iter: TreeIter that was collapsed.
     @param path: TreePath of the iter.
     """
     sPath = self.__model__.get_value(iter, self.__PATH_COLUMN__)
     monitor = FactoryDirectoryMonitor.getMonitor(sPath)
     monitor.stop()
     self.collapsePath(path)
Exemplo n.º 3
0
 def collapsePath(self, path):
     """
     @summary: Collapse row at path.
     @param path: Path to collapse.
     """
     # Gets current path
     iter = self.__model__.get_iter(path)
     sPath = self.__model__.get_value(iter, self.__PATH_COLUMN__)
     
     monitor = FactoryDirectoryMonitor.getMonitor(sPath)
     if (monitor != None):
         monitor.stop()
         monitor.removeListener(self.__handlerDirectoryMonitorEvents__)
     
     self.__explorer__.collapse_row(path)
Exemplo n.º 4
0
 def __fillDirectory__(self, path):
     """
     @summary: Fills a node with sub-directories.
     @param path: Folder path to fill. 
     """
     newExpand = False
     # Gets current path
     iter = self.__model__.get_iter(path)
     sPath = self.__model__.get_value(iter, self.__PATH_COLUMN__)
     
     monitor = FactoryDirectoryMonitor.getMonitor(sPath)
     
     # Checks if first child y a temporal node. If it is, it must be removed
     itFirstChild = self.__model__.iter_children(iter)
     if (itFirstChild != None):
         if (self.__model__.get_value(itFirstChild, self.__PATH_COLUMN__) == self.__TEMP_NODE__):
             # Gets number of nodes. If nNodes > 1, 
             # there is another thread that is loading the directory 
             nNodes = self.__model__.iter_n_children(iter)
             if (nNodes > 1):
                 return
             newExpand = True
     else:
         __log__.warning("It can not get first child of %s" % sPath)
 
     # Gets directories of the path
     lDirectories = self.__ioUtils__.getDirectories(sPath,
                                                    showhidden=self.__showHiddens__)
 
     if (lDirectories != None):
         icon = FactoryControls.getPixbufFromStock(gtk.STOCK_DIRECTORY)
             
         if (not newExpand):
             __log__.debug("It is not a new expand. Checking directories...")
             
             iterStep = self.__model__.iter_children(iter)
             # Find deleted iters
             while (iterStep != None):
                 doStep = True
                 sDirFind = self.__model__.get_value(iterStep, self.__NAME_COLUMN__)
                 if (sDirFind != None):
                     try:
                         index = lDirectories.index(sDirFind)
                     except ValueError, ve:
                         __log__.debug("It can not get index of %s. %s" % (sDirFind, ve))
                         index = -1
                     if (index == -1):
                         # In case of directory does not exist, it will remove from treeview
                         iterDelete = iterStep
                         iterStep = self.__model__.iter_next(iterStep)
                         self.deleteNode(iterDelete)
                         __log__.debug("Delete node %s" % sDirFind)
                         
                         doStep = False
                     else:
                         # In case of directory just exists, it will remove from list
                         lDirectories.remove(sDirFind)
                         __log__.debug("%s skipped" % sDirFind)
     
                 if (doStep):
                     iterStep = self.__model__.iter_next(iterStep)
             
             # Check directories in the list 
             for sDir in lDirectories:
                 sFullPath = os.path.join(sPath, sDir)
                 checkIter = self.__findDirectoryOnParent__(iter, sDir)
                 if (checkIter == None):
                     self.addDirectory(sDir, sFullPath, icon, iter)
                     __log__.debug("Add %s" % sFullPath)
         
         # Insert directories
         for sDir in lDirectories:
             sFullPath = os.path.join(sPath, sDir)
             self.addDirectory(sDir, sFullPath, icon, iter)
             __log__.debug("Add %s" % sFullPath)
                 
         if ((itFirstChild != None) and newExpand):
             __log__.debug("Remove temporal node.")
             self.deleteNode(itFirstChild)
             
         monitor.addDirectories(lDirectories)
         monitor.addListener(self.__handlerDirectoryMonitorEvents__)