Closed LoopControl closed 11 months ago
Looks like some floats weren't being converted to ints. (Maybe different versions of Python/Krita were automatically doing this for other users?)
Pushed a change where it explicitly converts the denoise value to an int before setting it. Pull that change and see if that fixes the problem.
Wow that was fast. Here are the changes I had made to make some things work before you updated. I'll pull your latest and give it a go:
diff --git a/cyanic/widgets/denoise.py b/cyanic/widgets/denoise.py
index f2f829e..717bdd6 100644
--- a/cyanic/widgets/denoise.py
+++ b/cyanic/widgets/denoise.py
@@ -24,7 +24,7 @@ class DenoiseWidget(QWidget):
self.denoise_slider.setTickPosition(QSlider.TicksAbove)
self.denoise_slider.setMinimum(0)
self.denoise_slider.setMaximum(100)
- self.denoise_slider.setValue(default_noise * 100)
+ self.denoise_slider.setValue(int(default_noise * 100))
self.denoise_slider.valueChanged.connect(lambda: self.denoise_percent.setText('%s%%' % self.denoise_slider.value()))
denoise_row.layout().addWidget(self.denoise_slider)
diff --git a/cyanic/widgets/generate.py b/cyanic/widgets/generate.py
index d8f68c9..8408f7e 100644
--- a/cyanic/widgets/generate.py
+++ b/cyanic/widgets/generate.py
@@ -94,7 +94,7 @@ class GenerateWidget(QWidget):
self.progress_timer.timeout.connect(lambda: self.progress_check(x,y,w,h))
# Set the refresh rate
if self.settings_controller.has_key('previews.refresh_seconds'):
- self.progress_timer.start(1000 * self.settings_controller.get('previews.refresh_seconds'))
+ self.progress_timer.start(int(1000 * self.settings_controller.get('previews.refresh_seconds')))
else:
self.progress_timer.start(1000)
@@ -114,7 +114,7 @@ class GenerateWidget(QWidget):
self.progress_timer.stop()
self.is_generating = False
return
- self.progress_bar.setValue(results['progress'] * 100)
+ self.progress_bar.setValue(int(results['progress'] * 100))
# Show the preview
if self.settings_controller.has_key('previews.enabled') and self.settings_controller.get('previews.enabled'):
if results['current_image'] is not None and len(results['current_image']) > 0:
Just reset my changes and pulled yours as of now. Here's another float to int thing:
Exception
Python 3.10.12: /usr/bin/python3
Sun Oct 8 12:15:03 2023
A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.
/home/loopcontrol/.local/share/krita/pykrita/cyanic/widgets/generate.py in handle_generate_btn_click(self=<cyanic.widgets.generate.GenerateWidget object>)
47 self.cancel()
48 else:
49 self.generate()
50 self.update()
51
self = <cyanic.widgets.generate.GenerateWidget object>
self.generate = <bound method GenerateWidget.generate of <cyanic.widgets.generate.GenerateWidget object>>
/home/loopcontrol/.local/share/krita/pykrita/cyanic/widgets/generate.py in generate(self=<cyanic.widgets.generate.GenerateWidget object>)
103 self.update()
104 self.is_generating = False
105 raise Exception('Cyanic SD - Error getting %s: %s' % (self.mode, e))
106
107 def progress_check(self, x, y, w, h):
builtinException = <class 'Exception'>
self = <cyanic.widgets.generate.GenerateWidget object>
self.mode = 'inpaint'
e undefined
Exception: Cyanic SD - Error getting inpaint: arguments did not match any overloaded call:
start(self, int): argument 1 has unexpected type 'float'
start(self): too many arguments
__cause__ = None
----
__traceback__ = <traceback object>
args = ("Cyanic SD - Error getting inpaint: arguments did...ed type 'float'\n start(self): too many arguments",)
with_traceback = <built-in method with_traceback of Exception object>
The above is a description of an error in a Python program. Here is
the original traceback:
Traceback (most recent call last):
File "/home/loopcontrol/.local/share/krita/pykrita/cyanic/widgets/generate.py", line 97, in generate
self.progress_timer.start(1000 * self.settings_controller.get('previews.refresh_seconds'))
TypeError: arguments did not match any overloaded call:
start(self, int): argument 1 has unexpected type 'float'
start(self): too many arguments
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/loopcontrol/.local/share/krita/pykrita/cyanic/widgets/generate.py", line 49, in handle_generate_btn_click
self.generate()
File "/home/loopcontrol/.local/share/krita/pykrita/cyanic/widgets/generate.py", line 105, in generate
raise Exception('Cyanic SD - Error getting %s: %s' % (self.mode, e))
Exception: Cyanic SD - Error getting inpaint: arguments did not match any overloaded call:
start(self, int): argument 1 has unexpected type 'float'
start(self): too many arguments
I think you had the fix for that already, but I just added it to the repo - line 97 in generate.py needs to convert the refresh seconds from float to int.
self.progress_timer.start(int(1000 * self.settings_controller.get('previews.refresh_seconds')))
I wish I could reproduce your errors on my end, I'm guessing there's going to be several small changes like that which need to be made.
Yep I applied a fix for that and haven't seen any errors beyond that after doing a couple dozen generations in img2img and inpaint modes. Thanks for the script, other than the fixes above, it worked out of the box for me unlike the other Krita-SD plugin
Glad to hear it's working now.
I have got the latest version loaded on Krita 5.0.8 in Linux and getting the following error when switching to any of the generation tabs (Inpaint, txt2img, etc):