99import nanite
1010import nanite .fit as nfit
1111import numpy as np
12- from PyQt5 import uic , QtCore , QtGui , QtWidgets
12+ from PyQt6 import uic , QtCore , QtGui , QtWidgets
1313
1414from .. import colormap
1515from ..head .custom_widgets import show_wait_cursor
@@ -38,10 +38,9 @@ def __init__(self, *args, **kwargs):
3838 uic .loadUi (path_ui , self )
3939
4040 self .settings = QtCore .QSettings ()
41- self .settings .setIniCodec ("utf-8" )
4241 if not self .settings .value ("force-distance/rate ts path" , "" ):
4342 dataloc = pathlib .Path (QtCore .QStandardPaths .writableLocation (
44- QtCore .QStandardPaths .AppDataLocation ))
43+ QtCore .QStandardPaths .StandardLocation . AppDataLocation ))
4544 ts_import_path = dataloc / "force-distance_rate-ts-user"
4645 self .settings .setValue ("force-distance/rate ts path" ,
4746 str (ts_import_path ))
@@ -175,7 +174,7 @@ def selected_curves(self):
175174 for ar in self .data_set :
176175 idx = self .data_set .index (ar )
177176 item = self .list_curves .topLevelItem (idx )
178- if item .checkState (3 ) == QtCore .Qt .Checked :
177+ if item .checkState (3 ) == QtCore .Qt .CheckState . Checked :
179178 curves .append (ar )
180179 return curves
181180
@@ -213,7 +212,7 @@ def callback(partial):
213212 """
214213 bar .setValue (int ((ii + partial )* mult ))
215214 QtCore .QCoreApplication .instance ().processEvents (
216- QtCore .QEventLoop .AllEvents , 300 )
215+ QtCore .QEventLoop .ProcessEventsFlag . AllEvents , 300 )
217216 if bar .wasCanceled ():
218217 # Raise a custom `AbortProgress` error, such that
219218 # we can exit the parent for-loop.
@@ -237,7 +236,7 @@ def callback(partial):
237236
238237 def autosave (self , fdist ):
239238 """Performs autosaving for all files"""
240- if (self .cb_autosave .checkState () == QtCore .Qt .Checked
239+ if (self .cb_autosave .checkState () == QtCore .Qt .CheckState . Checked
241240 and fdist .fit_properties .get ("success" , False )):
242241 # Determine the directory of the current curve
243242 adir = os .path .dirname (fdist .path )
@@ -256,7 +255,7 @@ def autosave(self, fdist):
256255 # fdist was fitted with same model
257256 ar .fit_properties ["model_key" ] == model_key and
258257 # user selected curve for export ("use")
259- it .checkState (3 ) == QtCore .Qt .Checked
258+ it .checkState (3 ) == QtCore .Qt .CheckState . Checked
260259 ):
261260 exp_curv .append (ar )
262261 # The file to export
@@ -271,10 +270,11 @@ def autosave(self, fdist):
271270 if oride == - 1 :
272271 # Ask user what to do
273272 dlgwin = QtWidgets .QDialog (self )
274- dlgwin .setWindowModality (QtCore .Qt .ApplicationModal )
273+ dlgwin .setWindowModality (
274+ QtCore .Qt .WindowModality .ApplicationModal )
275275 dlgui = DlgAutosave ()
276276 dlgui .setupUi (dlgwin )
277- if dlgwin .exec_ ():
277+ if dlgwin .exec ():
278278 if dlgui .btn_nothing .isChecked ():
279279 oride = 0
280280 elif dlgui .btn_override .isChecked ():
@@ -310,7 +310,8 @@ def curve_list_setup(self):
310310 """Add items to the tree widget"""
311311 header = self .list_curves .header ()
312312 header .setStretchLastSection (False )
313- header .setSectionResizeMode (0 , QtWidgets .QHeaderView .Stretch )
313+ header .setSectionResizeMode (0 ,
314+ QtWidgets .QHeaderView .ResizeMode .Stretch )
314315 self .list_curves .setColumnWidth (1 , 70 )
315316 self .list_curves .setColumnWidth (2 , 70 )
316317 self .list_curves .setColumnWidth (3 , 40 )
@@ -320,7 +321,7 @@ def curve_list_setup(self):
320321 str (ar .enum ),
321322 "{:.1f}" .format (- 1 )])
322323 self .list_curves .addTopLevelItem (it )
323- it .setCheckState (3 , QtCore .Qt .Checked )
324+ it .setCheckState (3 , QtCore .Qt .CheckState . Checked )
324325 # Connect signals:
325326 # Selection of curves
326327 self .list_curves .itemSelectionChanged .connect (self .on_curve_list )
@@ -462,7 +463,7 @@ def on_export_edelta(self):
462463 else :
463464 res += [d , e ]
464465 QtCore .QCoreApplication .instance ().processEvents (
465- QtCore .QEventLoop .AllEvents , 300 )
466+ QtCore .QEventLoop .ProcessEventsFlag . AllEvents , 300 )
466467 bar .setValue (ii + 1 )
467468
468469 # export curves with numpy
@@ -496,7 +497,7 @@ def on_fit_all(self):
496497 errored = []
497498 for ii , fdist in enumerate (self .data_set ):
498499 QtCore .QCoreApplication .instance ().processEvents (
499- QtCore .QEventLoop .AllEvents , 300 )
500+ QtCore .QEventLoop .ProcessEventsFlag . AllEvents , 300 )
500501 if bar .wasCanceled ():
501502 break
502503 try :
@@ -562,9 +563,9 @@ def on_rating_threshold(self):
562563 it = self .list_curves .topLevelItem (ii )
563564 if not np .isnan (rating ):
564565 if rating >= thresh :
565- it .setCheckState (3 , QtCore .Qt .Checked )
566+ it .setCheckState (3 , QtCore .Qt .CheckState . Checked )
566567 else :
567- it .setCheckState (3 , QtCore .Qt .Unchecked )
568+ it .setCheckState (3 , QtCore .Qt .CheckState . Unchecked )
568569 self .list_curves .blockSignals (False )
569570 # TODO:
570571 # - make this more efficient. There is a lot written to disk here.
@@ -614,8 +615,8 @@ def on_user_rate(self):
614615 caption = "Please select a rating container" ,
615616 directory = "" ,
616617 filter = "Rating containers (*.h5)" ,
617- options = QtWidgets .QFileDialog .DontConfirmOverwrite
618- | QtWidgets .QFileDialog .DontUseNativeDialog )
618+ options = QtWidgets .QFileDialog .Option . DontConfirmOverwrite
619+ | QtWidgets .QFileDialog .Option . DontUseNativeDialog )
619620
620621 path = cont [0 ]
621622 if path :
0 commit comments