Files
Lector/settingsdialog.py
BasioMeusPuga a5c17698cc Cleanup
2017-11-26 12:45:44 +05:30

61 lines
1.8 KiB
Python

#!/usr/bin/env python3
import os
import collections
from PyQt5 import QtWidgets, QtGui, QtCore
import database
from resources import settingswindow
class SettingsUI(QtWidgets.QDialog, settingswindow.Ui_Dialog):
def __init__(self):
super(SettingsUI, self).__init__()
self.setupUi(self)
# Will be overwritten by settings
self.last_open_directory = None
self.database_path = None
self.database_data = collections.OrderedDict()
self.database_modification = False
self.addButton.clicked.connect(self.add_directories)
def generate_table(self):
# Fetch all directories in the database
paths = database.DatabaseFunctions(
self.database_path).fetch_data(
('*',),
'directories',
{'Path': ''},
'LIKE')
if not paths:
print('Database returned no paths for settings...')
return
for i in paths:
pass
def add_directories(self):
add_directory = QtWidgets.QFileDialog.getExistingDirectory(
self, 'Select Directory', self.last_open_directory,
QtWidgets.QFileDialog.ShowDirsOnly)
# Directories will be added recursively
# Sub directory addition is allowed in that files will not
# be duplicated. However, any additional tags will get
# added to file tags
# Database tags for files should not be updated each time
# a new folder gets added or deleted from the directory
# This will be done @ runtime
# Individually set file tags will be preserved
# Duplicate file tags will be removed
# Whatever code you write to recurse through directories will
# have to go into the threaded module