Skip to content

Commit

Permalink
Merge pull request #303 from k-dominik/fix-depr-warnings
Browse files Browse the repository at this point in the history
reduce number of deprecation warnings
  • Loading branch information
k-dominik authored Aug 28, 2023
2 parents 1dca59c + 85e026a commit bcdec24
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/etc/ilastik-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ channels:
- conda-forge
- ilastik-forge
dependencies:
- python 3.7.*
- python 3.9.*
- ilastik-core
- qimage2ndarray
- pyqtgraph
- conda-build
- pytest >=3,<4
- pytest >4
- pytest-qt
- pytest-cov
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
# for codecov
fetch-depth: 5
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
# auto activation of env does not seem to work on win
run: |
pip install -e . & pytest
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v3
if: matrix.os == 'ubuntu-latest'
with:
files: ./coverage.xml,
Expand All @@ -61,7 +61,7 @@ jobs:

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: ""
Expand Down
12 changes: 6 additions & 6 deletions volumina/colortables.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ def matplotlib_to_qt4_colortable(cmap_name, N, asLong=True):
cmap_name can be any matplotlib colortable
"""
try:
import matplotlib.cm as cm
import matplotlib
except:
raise RuntimeError("this function requires matplotlib")

cmap = cm.get_cmap(cmap_name, N)
cmap = cmap(np.arange(N))[:, :-1]
cmap = matplotlib.colormaps.get_cmap(cmap_name).resampled(N)
cmap = cmap(np.arange(N))[:, :-1].astype(int)
colortable = []
for el in cmap:
r, g, b = el * 255
Expand Down Expand Up @@ -400,7 +400,7 @@ def create_default_8bit():
Repeatedly applies the default16 colortable to the whole 8bit range.
"""
return [color for color in itertools.islice(itertools.cycle(default16), 0, 2 ** 8)]
return [color for color in itertools.islice(itertools.cycle(default16), 0, 2**8)]


def create_default_16bit():
Expand All @@ -409,7 +409,7 @@ def create_default_16bit():
Repeatedly applies the default16 colortable to the whole 16bit range.
"""
return [color for color in itertools.islice(itertools.cycle(default16), 0, 2 ** 16)]
return [color for color in itertools.islice(itertools.cycle(default16), 0, 2**16)]


def create_random_8bit():
Expand All @@ -423,7 +423,7 @@ def create_random_16bit():
"""Create a colortable suitable for 16bit data.
Repeatedly applies a pseudo-random colortable to the whole 16bit range"""
return [color for color in itertools.islice(itertools.cycle(random256), 0, 2 ** 16)]
return [color for color in itertools.islice(itertools.cycle(random256), 0, 2**16)]


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions volumina/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def isDifferentEnough(self, other_layer):

def __init__(self, datasources, direct=False):
super(Layer, self).__init__()
self._name = u"Unnamed Layer"
self._name = "Unnamed Layer"
self._visible = True
self._opacity = 1.0
self._datasources = datasources
Expand Down Expand Up @@ -438,7 +438,7 @@ def generateRandomColors(M=256, colormodel="hsv", clamp=None, zeroIsTransparent=
colors.append(QColor(0, 0, 0, 0).rgba())
else:
h, s, v = r[i, :]
color = numpy.asarray(colorsys.hsv_to_rgb(h, s, v)) * 255
color = (numpy.asarray(colorsys.hsv_to_rgb(h, s, v)) * 255).astype(int)
qColor = QColor(*color)
colors.append(qColor.rgba())
return colors
Expand Down
10 changes: 4 additions & 6 deletions volumina/sliceSelectorHud.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def setNewValue(self, value):
self.spinBox.setSuffix("/" + str(value))

def on_upLabel(self):

imgView = self.parent().parent().parent().parent()
try:
roi_3d = imgView._croppingMarkers.crop_extents_model.get_roi_3d()
Expand All @@ -207,7 +206,6 @@ def on_upLabel(self):
self.spinBox.setValue(self.spinBox.value() + 1)

def on_downLabel(self):

imgView = self.parent().parent().parent().parent()
try:
roi_3d = imgView._croppingMarkers.crop_extents_model.get_roi_3d()
Expand Down Expand Up @@ -587,7 +585,7 @@ def createQuadViewStatusBar(
self._registerTimeframeShortcuts()

def _registerTimeframeShortcuts(self, enabled=True, remove=True):
""" Register or deregister "," and "." as keyboard shortcuts for scrolling in time """
"""Register or deregister "," and "." as keyboard shortcuts for scrolling in time"""
mgr = ShortcutManager()
ActionInfo = ShortcutManager.ActionInfo

Expand Down Expand Up @@ -700,9 +698,9 @@ def updateShape5Dcropped(self, shape5DcropMin, shape5Dmax):
self.timeSlider.setValue(shape5DcropMin[0])

def setMouseCoords(self, x, y, z):
self.xSpinBox.setValueWithoutSignal(x)
self.ySpinBox.setValueWithoutSignal(y)
self.zSpinBox.setValueWithoutSignal(z)
self.xSpinBox.setValueWithoutSignal(int(x))
self.ySpinBox.setValueWithoutSignal(int(y))
self.zSpinBox.setValueWithoutSignal(int(z))


if __name__ == "__main__":
Expand Down
7 changes: 3 additions & 4 deletions volumina/widgets/layerwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def paintEvent(self, ev):
painter.restore()

# fraction indicator
painter.drawRect(QRect(QPoint(0, y_offset), QSize(self._barWidth() * self._fraction, self._barHeight())))
painter.drawRect(QRect(QPoint(0, y_offset), QSize(int(self._barWidth() * self._fraction), self._barHeight())))

def sizeHint(self):
return QSize(100, 10)
Expand Down Expand Up @@ -191,7 +191,7 @@ def __init__(self, parent=None):
self.opacityLabel = QLabel(parent=self)
self.opacityLabel.setAlignment(Qt.AlignRight)
self.opacityLabel.setFont(self._font)
self.opacityLabel.setText(u"\u03B1=%0.1f%%" % (100.0 * (self.bar.fraction())))
self.opacityLabel.setText("\u03B1=%0.1f%%" % (100.0 * (self.bar.fraction())))
self.toggleEye = ToggleEye(parent=self)
self.toggleEye.setActive(False)
self.toggleEye.setFixedWidth(35)
Expand Down Expand Up @@ -245,7 +245,6 @@ def _onFractionChanged(self, fraction):

def _onEyeToggle(self, active):
if self._layer and (active != self._layer.visible):

if self._layer._allowToggleVisible:
self._layer.visible = active
else:
Expand All @@ -259,7 +258,7 @@ def _updateState(self):
if self._layer:
self.toggleEye.setActive(self._layer.visible)
self.bar.setFraction(self._layer.opacity)
self.opacityLabel.setText(u"\u03B1=%0.1f%%" % (100.0 * (self.bar.fraction())))
self.opacityLabel.setText(f"\u03B1={(100.0 * (self.bar.fraction())):0.1f}")
self.nameLabel.setText(self._layer.name)

if self._layer.numberOfChannels > 1:
Expand Down

0 comments on commit bcdec24

Please sign in to comment.