コード例 #1
0
ファイル: factory.py プロジェクト: godlike64/indexor
 def __init__(self, dbmanager):
     self._dbmanager = dbmanager
     self._conn = dbmanager.conn
     MetaDir.createTable(connection = self._conn)
     FileAbstract.createTable(connection = self._conn)
     File.createTable(connection = self._conn)
     Directory.createTable(connection = self._conn)
     Video.createTable(connection = self._conn)
     Audio.createTable(connection = self._conn)
     Photo.createTable(connection = self._conn)
コード例 #2
0
ファイル: tvhandler.py プロジェクト: godlike64/indexor
 def print_output(self):
     """Populates the directory tree treestore.
     
     This method is called after the indexing process finishes.
     First it populates the left treestore with all the dirs from the
     indexing process. Then does the needed thingies in the GUI to
     keep it consistent.
     """
     
     self._is_scanning = False
     was_scanned = self._dbmanager.create_metadir()
     self._dbmanager.set_root_node()
     rootselect = Directory.select(Directory.q.relpath == "/",
                                   connection = self._conn)
     root = rootselect[0]
     self._root = root
     self._mainhandler.populate_catalog_list()
     if self._root is not None:
         self._mainhandler.root = self._root
         self._rootiter = self._tsdirtree.append(None,
                                                 ['drive-harddisk',
                                                  self._root.name + 
                                                  " (" + 
                                                  self._root.strsize + 
                                                  ")",
                                                  self._root.__str__()])
         #self.append_directories(self._rootiter, self._root)
         t = threading.Thread(target=self.append_directories, args=(self._rootiter, self._root))
         t.start()
         gobject.timeout_add(2000, self.hide_progressbar)
     self._mainhandler.set_buttons_sensitivity(True)
     
     if was_scanned == 0:
         notification = pynotify.Notification("Indexing finished", "Indexing of " + root.name + " has finished successfully.")
         notification.show()
コード例 #3
0
ファイル: dbmanager.py プロジェクト: godlike64/indexor
 def create_metadir(self):
     metadircount = MetaDir.select(connection = self._conn).count()
     if not metadircount == 1:
         root = Directory.select(Directory.q.strabs == self._indexer.path, connection = self._conn).getOne()
         self._factory.new_metadir(self._date, self._indexer.path,
                                   self._indexer.countfiles,
                                   self._indexer.countdirs, root.size,
                                   root.strsize, root.name, self._indexer.timer)
         return 0
     else:
         return 1
コード例 #4
0
ファイル: tvhandler.py プロジェクト: godlike64/indexor
 def tvdirtree_cursor_changed_cb(self, tvdt):
     """Callback that handles the selection in the directory treeview.
     
     Each time the directory tree selection changes, gets the node which
     was selected and loads its contents in the file list treeview. Some
     variables are saved for consistency and later checks.
     """
     (_model, _iter) = tvdt.get_selection().get_selected()
     self._currentpath = tvdt.get_model().get_path(_iter)
     parent = tvdt.get_model().get_value(_iter, 2)
     self._current = _iter
     self._mainhandler.currentpath = self._currentpath
     self._mainhandler.current = self._current
     #self._currentnode = self._mainhandler.\
     #                        find_dir_with_fs_path(parent, self._root)
     self._currentnode = Directory.select(Directory.q.strabs == parent,
                                          connection = self._conn)[0]
     self._mainhandler.currentnode = self._currentnode
     self._tvfilelist.columns_autosize()
     self.generate_file_list(self._currentnode, self._lsfilelist)
コード例 #5
0
ファイル: tvhandler.py プロジェクト: godlike64/indexor
 def tvfilelist_row_activated_cb(self, tvfl, path, view_column):
     """Callback that handles row activation in the file list treeview.
     
     Each time a row is activated in the file list treeview, this method
     checks if it is a directory, and if it is, switchs to it on the left
     treeview, causing it to load the directory contents in the right
     treeview.
     """
     _iter = tvfl.get_model().get_iter(path)
     fs_path = self._tmffilelist.get(_iter, 3)[0]
     nodelist = Directory.select(Directory.q.strabs == fs_path,
                                 connection = self._conn)
     if nodelist.count() == 1:
         node = nodelist[0]
         activated = tvfl.get_model().get_value(_iter, 3)
         dtcursor = self._tvdirtree.get_cursor()
         parentiter = iter(self._tmfdirtree).next()
         self._candidate = None
         self._iterate_inside(parentiter, activated)
         path = self._tmfdirtree.get_path(self._candidate)
         self._tvdirtree.expand_to_path(path)
         self._tvdirtree.set_cursor(path)
コード例 #6
0
ファイル: dbmanager.py プロジェクト: godlike64/indexor
 def set_root_node(self):
     rootselect = Directory.select(Directory.q.relpath == "/",
                                   connection = self._conn)
     self._root = rootselect[0]