mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 05:39:13 +00:00
Remove unused methods in file browser widget. Improve name of existing
This commit is contained in:
@@ -28,13 +28,10 @@ class FileBrowser(QtWidgets.QWidget):
|
|||||||
layout.addWidget(self.lineEdit)
|
layout.addWidget(self.lineEdit)
|
||||||
|
|
||||||
self.button = QtWidgets.QPushButton('Add')
|
self.button = QtWidgets.QPushButton('Add')
|
||||||
self.button.clicked.connect(self.getFile)
|
self.button.clicked.connect(self.storeFilesSelectedInFileDialog)
|
||||||
layout.addWidget(self.button)
|
layout.addWidget(self.button)
|
||||||
layout.addStretch()
|
layout.addStretch()
|
||||||
|
|
||||||
def setMode(self, search_type):
|
|
||||||
self.search_type = search_type
|
|
||||||
|
|
||||||
def getFileFilter(self, search_type):
|
def getFileFilter(self, search_type):
|
||||||
if search_type == SearchType.Org:
|
if search_type == SearchType.Org:
|
||||||
return 'Org-Mode Files (*.org)'
|
return 'Org-Mode Files (*.org)'
|
||||||
@@ -47,13 +44,10 @@ class FileBrowser(QtWidgets.QWidget):
|
|||||||
elif search_type == SearchType.Image:
|
elif search_type == SearchType.Image:
|
||||||
return 'Images (*.jp[e]g)'
|
return 'Images (*.jp[e]g)'
|
||||||
|
|
||||||
def setDefaultDir(self, path):
|
def storeFilesSelectedInFileDialog(self):
|
||||||
self.dirpath = path
|
|
||||||
|
|
||||||
def getFile(self):
|
|
||||||
filepaths = []
|
filepaths = []
|
||||||
if self.search_type == SearchType.Image:
|
if self.search_type == SearchType.Image:
|
||||||
filepaths.append(QtWidgets.QFileDialog.getExistingDirectory(self, caption='Choose Directory',
|
filepaths.append(QtWidgets.QFileDialog.getExistingDirectory(self, caption='Choose Folder',
|
||||||
directory=self.dirpath))
|
directory=self.dirpath))
|
||||||
else:
|
else:
|
||||||
filepaths.extend(QtWidgets.QFileDialog.getOpenFileNames(self, caption='Choose Files',
|
filepaths.extend(QtWidgets.QFileDialog.getOpenFileNames(self, caption='Choose Files',
|
||||||
@@ -70,11 +64,5 @@ class FileBrowser(QtWidgets.QWidget):
|
|||||||
else:
|
else:
|
||||||
self.lineEdit.setText(",".join(self.filepaths))
|
self.lineEdit.setText(",".join(self.filepaths))
|
||||||
|
|
||||||
def setLabelWidth(self, width):
|
|
||||||
self.label.setFixedWidth(width)
|
|
||||||
|
|
||||||
def setlineEditWidth(self, width):
|
|
||||||
self.lineEdit.setFixedWidth(width)
|
|
||||||
|
|
||||||
def getPaths(self):
|
def getPaths(self):
|
||||||
return self.filepaths
|
return self.filepaths
|
||||||
|
|||||||
Reference in New Issue
Block a user