Skip to content

Commit

Permalink
deprecation warning (and ignore) for "formatText(prev)" usage; remove…
Browse files Browse the repository at this point in the history
… unused variable
  • Loading branch information
outofculture committed Jan 17, 2024
1 parent b74e55f commit 4d2fb1f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 10 additions & 3 deletions pyqtgraph/widgets/SpinBox.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import decimal
import re
import warnings
from math import isinf, isnan

from .. import functions as fn
Expand Down Expand Up @@ -447,11 +448,11 @@ def valueInRange(self, value):
return False
return True

def updateText(self):
def updateText(self, **kwargs):
# temporarily disable validation
self.skipValidate = True

txt = self.formatText()
txt = self.formatText(**kwargs)

# actually set the text
self.lineEdit().setText(txt)
Expand All @@ -460,7 +461,13 @@ def updateText(self):
# re-enable the validation
self.skipValidate = False

def formatText(self):
def formatText(self, **kwargs):
if 'prev' in kwargs:
warnings.warn(
"updateText and formatText no longer take prev argument. This will error after January 2025.",
DeprecationWarning,
stacklevel=2
) # TODO remove all kwargs handling here and updateText after January 2025
# get the number of decimal places to print
decimals = self.opts['decimals']
suffix = self.opts['suffix']
Expand Down
3 changes: 1 addition & 2 deletions tests/test_stability.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
from pyqtgraph.Qt import QtTest
from pyqtgraph.util.garbage_collector import GarbageCollector


app = pg.mkQApp()


def test_garbage_collector():
gc = GarbageCollector(interval=0.1)
GarbageCollector(interval=0.1)
time.sleep(1)


Expand Down

0 comments on commit 4d2fb1f

Please sign in to comment.