Skip to content

Commit

Permalink
BUG: Fix use of backgroundcolor in stacked bandwidths (#297)
Browse files Browse the repository at this point in the history
* set default layer to current selection

* use qgis specific overloads

* swap from deprecated backgroundColor alias to background
  • Loading branch information
m-richards authored Feb 24, 2024
1 parent 19fd6eb commit 641ab08
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions qaequilibrae/modules/gis/create_bandwidths_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(self, qgis_project):
# layers and fields # For adding skims
self.mMapLayerComboBox.layerChanged.connect(self.add_fields_to_cboxes)
self.mMapLayerComboBox.setFilters(QgsMapLayerProxyModel.LineLayer)
self.mMapLayerComboBox.setLayer(self.iface.activeLayer())

self.ab_FieldComboBox.currentIndexChanged.connect(partial(self.choose_a_field, "AB"))
self.ba_FieldComboBox.currentIndexChanged.connect(partial(self.choose_a_field, "BA"))
Expand Down Expand Up @@ -182,11 +183,11 @@ def click_button_inside_the_list(self):

# if we clicked the "remove button"
if column == 0 and row < self.tot_bands - 1:
low_cl = self.bands_list.item(row + 1, 2).backgroundColor()
low_cl = self.bands_list.item(row + 1, 2).background()
low_ab = self.bands_list.item(row + 1, 0).text()
low_ba = self.bands_list.item(row + 1, 1).text()

top_cl = self.bands_list.item(row, 2).backgroundColor()
top_cl = self.bands_list.item(row, 2).background()
top_ab = self.bands_list.item(row, 0).text()
top_ba = self.bands_list.item(row, 1).text()

Expand All @@ -199,11 +200,11 @@ def click_button_inside_the_list(self):
self.bands_list.item(row + 1, 2).setBackground(top_cl)

elif column == 1 and row > 0:
low_cl = self.bands_list.item(row, 2).backgroundColor()
low_cl = self.bands_list.item(row, 2).background()
low_ab = self.bands_list.item(row, 0).text()
low_ba = self.bands_list.item(row, 1).text()

top_cl = self.bands_list.item(row - 1, 2).backgroundColor()
top_cl = self.bands_list.item(row - 1, 2).background()
top_ab = self.bands_list.item(row - 1, 0).text()
top_ba = self.bands_list.item(row - 1, 1).text()

Expand Down Expand Up @@ -279,7 +280,7 @@ def add_bands_to_map(self):
# we also build a list of bands to construct
# The function "(2 * j -1) * ba" maps the index j {1,2} and the direction to the side of the
# link the band needs to be. Try it out. it works!!
# bands.append((field, (2 * j -1) * ba, self.bands_list.item(i, 2).backgroundColor()))
# bands.append((field, (2 * j -1) * ba, self.bands_list.item(i, 2).background()))
if len(self.bands_list.item(i, 2).text()) == 0:
cl = self.bands_list.item(i, 2).background().color()
else:
Expand Down

0 comments on commit 641ab08

Please sign in to comment.