Skip to content

Commit 15a8870

Browse files
authored
Merge pull request #1447 from Salomon-Mazatlan/manage-files-filter-system
Manage Files: column header filters
2 parents cba7175 + 51b417d commit 15a8870

3 files changed

Lines changed: 479 additions & 295 deletions

File tree

src/GUI_UIs/ui_dialog_manage_files.ui

Lines changed: 79 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,85 @@
1414
<string>Files</string>
1515
</property>
1616
<layout class="QGridLayout" name="gridLayout">
17+
<item row="3" column="0">
18+
<widget class="QGroupBox" name="groupBox_2">
19+
<property name="minimumSize">
20+
<size>
21+
<width>0</width>
22+
<height>32</height>
23+
</size>
24+
</property>
25+
<property name="title">
26+
<string/>
27+
</property>
28+
<widget class="QLineEdit" name="lineEdit_search_files">
29+
<property name="geometry">
30+
<rect>
31+
<x>0</x>
32+
<y>0</y>
33+
<width>260</width>
34+
<height>28</height>
35+
</rect>
36+
</property>
37+
<property name="minimumSize">
38+
<size>
39+
<width>180</width>
40+
<height>28</height>
41+
</size>
42+
</property>
43+
<property name="maximumSize">
44+
<size>
45+
<width>260</width>
46+
<height>28</height>
47+
</size>
48+
</property>
49+
<property name="toolTip">
50+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;File name filter&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
51+
</property>
52+
</widget>
53+
<widget class="QPushButton" name="pushButton_clear_filter">
54+
<property name="geometry">
55+
<rect>
56+
<x>270</x>
57+
<y>0</y>
58+
<width>28</width>
59+
<height>28</height>
60+
</rect>
61+
</property>
62+
<property name="minimumSize">
63+
<size>
64+
<width>28</width>
65+
<height>28</height>
66+
</size>
67+
</property>
68+
<property name="maximumSize">
69+
<size>
70+
<width>28</width>
71+
<height>28</height>
72+
</size>
73+
</property>
74+
<property name="toolTip">
75+
<string>Clear filter</string>
76+
</property>
77+
<property name="text">
78+
<string/>
79+
</property>
80+
</widget>
81+
<widget class="QLabel" name="label_file">
82+
<property name="geometry">
83+
<rect>
84+
<x>310</x>
85+
<y>0</y>
86+
<width>551</width>
87+
<height>28</height>
88+
</rect>
89+
</property>
90+
<property name="text">
91+
<string/>
92+
</property>
93+
</widget>
94+
</widget>
95+
</item>
1796
<item row="1" column="0">
1897
<widget class="QGroupBox" name="groupBox">
1998
<property name="minimumSize">
@@ -360,129 +439,9 @@ Surveys with many entries (e.g. more than 1,000) please wait, as importation wil
360439
</widget>
361440
</widget>
362441
</item>
363-
<item row="2" column="0">
364-
<widget class="QWidget" name="widget_filter" native="true">
365-
<property name="minimumSize">
366-
<size>
367-
<width>0</width>
368-
<height>30</height>
369-
</size>
370-
</property>
371-
<property name="maximumSize">
372-
<size>
373-
<width>16777215</width>
374-
<height>30</height>
375-
</size>
376-
</property>
377-
<layout class="QHBoxLayout" name="horizontalLayout_filter">
378-
<property name="spacing">
379-
<number>4</number>
380-
</property>
381-
<property name="leftMargin">
382-
<number>0</number>
383-
</property>
384-
<property name="topMargin">
385-
<number>0</number>
386-
</property>
387-
<property name="rightMargin">
388-
<number>0</number>
389-
</property>
390-
<property name="bottomMargin">
391-
<number>0</number>
392-
</property>
393-
<item>
394-
<widget class="QLineEdit" name="lineEdit_search_files">
395-
<property name="minimumSize">
396-
<size>
397-
<width>180</width>
398-
<height>28</height>
399-
</size>
400-
</property>
401-
<property name="maximumSize">
402-
<size>
403-
<width>260</width>
404-
<height>28</height>
405-
</size>
406-
</property>
407-
<property name="toolTip">
408-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;File name filter&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
409-
</property>
410-
</widget>
411-
</item>
412-
<item>
413-
<widget class="QComboBox" name="comboBox_file_type">
414-
<property name="minimumSize">
415-
<size>
416-
<width>200</width>
417-
<height>28</height>
418-
</size>
419-
</property>
420-
<property name="toolTip">
421-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Filter by file type&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
422-
</property>
423-
</widget>
424-
</item>
425-
<item>
426-
<widget class="QComboBox" name="comboBox_file_ext">
427-
<property name="minimumSize">
428-
<size>
429-
<width>200</width>
430-
<height>28</height>
431-
</size>
432-
</property>
433-
<property name="toolTip">
434-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Filter by file extension&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
435-
</property>
436-
</widget>
437-
</item>
438-
<item>
439-
<widget class="QPushButton" name="pushButton_clear_filter">
440-
<property name="minimumSize">
441-
<size>
442-
<width>28</width>
443-
<height>28</height>
444-
</size>
445-
</property>
446-
<property name="maximumSize">
447-
<size>
448-
<width>28</width>
449-
<height>28</height>
450-
</size>
451-
</property>
452-
<property name="toolTip">
453-
<string>Clear filter</string>
454-
</property>
455-
<property name="text">
456-
<string/>
457-
</property>
458-
</widget>
459-
</item>
460-
<item>
461-
<spacer name="horizontalSpacer_filter">
462-
<property name="orientation">
463-
<enum>Qt::Vertical</enum>
464-
</property>
465-
<property name="sizeHint" stdset="0">
466-
<size>
467-
<width>20</width>
468-
<height>20</height>
469-
</size>
470-
</property>
471-
</spacer>
472-
</item>
473-
</layout>
474-
</widget>
475-
</item>
476442
<item row="4" column="0">
477443
<widget class="QTableWidget" name="tableWidget"/>
478444
</item>
479-
<item row="3" column="0">
480-
<widget class="QLabel" name="label_file">
481-
<property name="text">
482-
<string/>
483-
</property>
484-
</widget>
485-
</item>
486445
</layout>
487446
</widget>
488447
<tabstops>
@@ -504,8 +463,6 @@ Surveys with many entries (e.g. more than 1,000) please wait, as importation wil
504463
<tabstop>pushButton_delete</tabstop>
505464
<tabstop>pushButton_help</tabstop>
506465
<tabstop>lineEdit_search_files</tabstop>
507-
<tabstop>comboBox_file_type</tabstop>
508-
<tabstop>comboBox_file_ext</tabstop>
509466
<tabstop>pushButton_clear_filter</tabstop>
510467
<tabstop>tableWidget</tabstop>
511468
</tabstops>

src/qualcoder/GUI/ui_dialog_manage_files.py

Lines changed: 23 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,26 @@ def setupUi(self, Dialog_manage_files):
1515
Dialog_manage_files.resize(901, 538)
1616
self.gridLayout = QtWidgets.QGridLayout(Dialog_manage_files)
1717
self.gridLayout.setObjectName("gridLayout")
18+
self.groupBox_2 = QtWidgets.QGroupBox(parent=Dialog_manage_files)
19+
self.groupBox_2.setMinimumSize(QtCore.QSize(0, 32))
20+
self.groupBox_2.setTitle("")
21+
self.groupBox_2.setObjectName("groupBox_2")
22+
self.lineEdit_search_files = QtWidgets.QLineEdit(parent=self.groupBox_2)
23+
self.lineEdit_search_files.setGeometry(QtCore.QRect(0, 0, 260, 28))
24+
self.lineEdit_search_files.setMinimumSize(QtCore.QSize(180, 28))
25+
self.lineEdit_search_files.setMaximumSize(QtCore.QSize(260, 28))
26+
self.lineEdit_search_files.setObjectName("lineEdit_search_files")
27+
self.pushButton_clear_filter = QtWidgets.QPushButton(parent=self.groupBox_2)
28+
self.pushButton_clear_filter.setGeometry(QtCore.QRect(270, 0, 28, 28))
29+
self.pushButton_clear_filter.setMinimumSize(QtCore.QSize(28, 28))
30+
self.pushButton_clear_filter.setMaximumSize(QtCore.QSize(28, 28))
31+
self.pushButton_clear_filter.setText("")
32+
self.pushButton_clear_filter.setObjectName("pushButton_clear_filter")
33+
self.label_file = QtWidgets.QLabel(parent=self.groupBox_2)
34+
self.label_file.setGeometry(QtCore.QRect(310, 0, 561, 28))
35+
self.label_file.setText("")
36+
self.label_file.setObjectName("label_file")
37+
self.gridLayout.addWidget(self.groupBox_2, 3, 0, 1, 1)
1838
self.groupBox = QtWidgets.QGroupBox(parent=Dialog_manage_files)
1939
self.groupBox.setMinimumSize(QtCore.QSize(0, 38))
2040
self.groupBox.setMaximumSize(QtCore.QSize(16777215, 38))
@@ -98,45 +118,11 @@ def setupUi(self, Dialog_manage_files):
98118
self.pushButton_import_survey.setText("")
99119
self.pushButton_import_survey.setObjectName("pushButton_import_survey")
100120
self.gridLayout.addWidget(self.groupBox, 1, 0, 1, 1)
101-
self.widget_filter = QtWidgets.QWidget(parent=Dialog_manage_files)
102-
self.widget_filter.setMinimumSize(QtCore.QSize(0, 30))
103-
self.widget_filter.setMaximumSize(QtCore.QSize(16777215, 30))
104-
self.widget_filter.setObjectName("widget_filter")
105-
self.horizontalLayout_filter = QtWidgets.QHBoxLayout(self.widget_filter)
106-
self.horizontalLayout_filter.setContentsMargins(0, 0, 0, 0)
107-
self.horizontalLayout_filter.setSpacing(4)
108-
self.horizontalLayout_filter.setObjectName("horizontalLayout_filter")
109-
self.lineEdit_search_files = QtWidgets.QLineEdit(parent=self.widget_filter)
110-
self.lineEdit_search_files.setMinimumSize(QtCore.QSize(180, 28))
111-
self.lineEdit_search_files.setMaximumSize(QtCore.QSize(260, 28))
112-
self.lineEdit_search_files.setObjectName("lineEdit_search_files")
113-
self.horizontalLayout_filter.addWidget(self.lineEdit_search_files)
114-
self.comboBox_file_type = QtWidgets.QComboBox(parent=self.widget_filter)
115-
self.comboBox_file_type.setMinimumSize(QtCore.QSize(200, 28))
116-
self.comboBox_file_type.setObjectName("comboBox_file_type")
117-
self.horizontalLayout_filter.addWidget(self.comboBox_file_type)
118-
self.comboBox_file_ext = QtWidgets.QComboBox(parent=self.widget_filter)
119-
self.comboBox_file_ext.setMinimumSize(QtCore.QSize(200, 28))
120-
self.comboBox_file_ext.setObjectName("comboBox_file_ext")
121-
self.horizontalLayout_filter.addWidget(self.comboBox_file_ext)
122-
self.pushButton_clear_filter = QtWidgets.QPushButton(parent=self.widget_filter)
123-
self.pushButton_clear_filter.setMinimumSize(QtCore.QSize(28, 28))
124-
self.pushButton_clear_filter.setMaximumSize(QtCore.QSize(28, 28))
125-
self.pushButton_clear_filter.setText("")
126-
self.pushButton_clear_filter.setObjectName("pushButton_clear_filter")
127-
self.horizontalLayout_filter.addWidget(self.pushButton_clear_filter)
128-
spacerItem = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
129-
self.horizontalLayout_filter.addItem(spacerItem)
130-
self.gridLayout.addWidget(self.widget_filter, 2, 0, 1, 1)
131121
self.tableWidget = QtWidgets.QTableWidget(parent=Dialog_manage_files)
132122
self.tableWidget.setObjectName("tableWidget")
133123
self.tableWidget.setColumnCount(0)
134124
self.tableWidget.setRowCount(0)
135125
self.gridLayout.addWidget(self.tableWidget, 4, 0, 1, 1)
136-
self.label_file = QtWidgets.QLabel(parent=Dialog_manage_files)
137-
self.label_file.setText("")
138-
self.label_file.setObjectName("label_file")
139-
self.gridLayout.addWidget(self.label_file, 3, 0, 1, 1)
140126

141127
self.retranslateUi(Dialog_manage_files)
142128
QtCore.QMetaObject.connectSlotsByName(Dialog_manage_files)
@@ -157,14 +143,14 @@ def setupUi(self, Dialog_manage_files):
157143
Dialog_manage_files.setTabOrder(self.pushButton_undo, self.pushButton_delete)
158144
Dialog_manage_files.setTabOrder(self.pushButton_delete, self.pushButton_help)
159145
Dialog_manage_files.setTabOrder(self.pushButton_help, self.lineEdit_search_files)
160-
Dialog_manage_files.setTabOrder(self.lineEdit_search_files, self.comboBox_file_type)
161-
Dialog_manage_files.setTabOrder(self.comboBox_file_type, self.comboBox_file_ext)
162-
Dialog_manage_files.setTabOrder(self.comboBox_file_ext, self.pushButton_clear_filter)
146+
Dialog_manage_files.setTabOrder(self.lineEdit_search_files, self.pushButton_clear_filter)
163147
Dialog_manage_files.setTabOrder(self.pushButton_clear_filter, self.tableWidget)
164148

165149
def retranslateUi(self, Dialog_manage_files):
166150
_translate = QtCore.QCoreApplication.translate
167151
Dialog_manage_files.setWindowTitle(_translate("Dialog_manage_files", "Files"))
152+
self.lineEdit_search_files.setToolTip(_translate("Dialog_manage_files", "<html><head/><body><p>File name filter</p></body></html>"))
153+
self.pushButton_clear_filter.setToolTip(_translate("Dialog_manage_files", "Clear filter"))
168154
self.pushButton_view.setToolTip(_translate("Dialog_manage_files", "<html><head/><body><p>View file</p></body></html>"))
169155
self.pushButton_create.setToolTip(_translate("Dialog_manage_files", "<html><head/><body><p>Create a text file</p></body></html>"))
170156
self.pushButton_export.setToolTip(_translate("Dialog_manage_files", "Export selected file.\n"
@@ -204,17 +190,3 @@ def retranslateUi(self, Dialog_manage_files):
204190
"For csv and tsv files, please avoid using the following in the column names: , ; |\n"
205191
"\n"
206192
"Surveys with many entries (e.g. more than 1,000) please wait, as importation will be slow."))
207-
self.lineEdit_search_files.setToolTip(_translate("Dialog_manage_files", "<html><head/><body><p>File name filter</p></body></html>"))
208-
self.comboBox_file_type.setToolTip(_translate("Dialog_manage_files", "<html><head/><body><p>Filter by file type</p></body></html>"))
209-
self.comboBox_file_ext.setToolTip(_translate("Dialog_manage_files", "<html><head/><body><p>Filter by file extension</p></body></html>"))
210-
self.pushButton_clear_filter.setToolTip(_translate("Dialog_manage_files", "Clear filter"))
211-
212-
213-
if __name__ == "__main__":
214-
import sys
215-
app = QtWidgets.QApplication(sys.argv)
216-
Dialog_manage_files = QtWidgets.QDialog()
217-
ui = Ui_Dialog_manage_files()
218-
ui.setupUi(Dialog_manage_files)
219-
Dialog_manage_files.show()
220-
sys.exit(app.exec())

0 commit comments

Comments
 (0)