-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataComboBox.py
More file actions
27 lines (21 loc) · 783 Bytes
/
Copy pathdataComboBox.py
File metadata and controls
27 lines (21 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sys
import os
from natsort import natsorted, ns
import xlrd
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QTableWidget, QApplication, QMainWindow, QTableWidgetItem, QFileDialog, QComboBox
#from PyQt5.QtCore import QSettings
class DataCombo(QtWidgets.QComboBox):
def __init__(self, dpath):
super().__init__()
self.populate(dpath)
def populate(self, dpath):
print(dpath)
dirs = os.listdir(path=dpath)
sdirs = natsorted(dirs)
sdirs.insert(0, " -- none selected -- ")
for d in sdirs:
if d[0] != '$':
p = os.path.join(dpath, d)
if os.path.isdir(p) or d == " -- none selected -- ":
self.addItem(d)