Currently I have two combo boxes, one contains a sitecode
the other a folder
, these are read in from a csv which has two columns SITECODE
and FOLDER
. Any row contains these two related values. Therefore having them displayed as two individual comboboxes makes no sense.
What I want to do is pass the SITECODE
and FOLDER
values to only the one combobox so it displays like: sitecode | folder
My current code which needs merging:
job_list = pd.read_csv(filepath_or_buffer="data/job_list.csv", header=0)
self.sitecodes = job_list[['SITECODE', 'SITECODE']]
self.comboSiteCodes.addItem("", "")
for row in self.sitecodes.itertuples():
self.comboSiteCodes.addItem(row.SITECODE, row.SITECODE)
self.comboSiteCodes.currentIndexChanged.connect(self.comboSiteCodes_index_changed)
self.jobs = job_list[['FOLDER', 'FOLDER']]
self.comboJobs.addItem("", "")
for row in self.jobs.itertuples():
self.comboJobs.addItem(row.FOLDER, row.FOLDER)
self.comboJobs.currentIndexChanged.connect(self.comboJobs_index_changed)
The values, once selected need to update two lineEdit boxes, one for the sitecode
, one for the folder
.
Again, my current code to handle this:
def comboSiteCodes_index_changed(self, index):
global comboSiteCodes_gbl
comboSiteCodes_gbl = f'{self.comboSiteCodes.itemData(index)}'
self.lineEditSiteCode.setText('{}'.format(comboSiteCodes_gbl))
def comboJobs_index_changed(self, index):
global comboJobs_gbl
comboJobs_gbl = f'{self.comboJobs.itemData(index)}'
self.lineEditJob.setText('{}'.format(comboJobs_gbl))
I've been googling, but I cannot find such a use case.