fix: bug with path
This commit is contained in:
parent
9361f3f658
commit
cfdf60d840
@ -64,5 +64,13 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</description>
|
</description>
|
||||||
</release>
|
</release>
|
||||||
|
<release version="0.1.1" date="2023-5-3" type="stable">
|
||||||
|
<description>
|
||||||
|
<p>Bug fixes</p>
|
||||||
|
<ul>
|
||||||
|
<li>Fix a bug causing the app to crash when the path is not selected</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
</releases>
|
</releases>
|
||||||
</component>
|
</component>
|
||||||
|
10
src/main.py
10
src/main.py
@ -156,14 +156,16 @@ class ImaginerApplication(Adw.Application):
|
|||||||
self.token = self.win.token.get_text()
|
self.token = self.win.token.get_text()
|
||||||
openai.api_key = self.token
|
openai.api_key = self.token
|
||||||
|
|
||||||
|
|
||||||
|
def thread_run():
|
||||||
try:
|
try:
|
||||||
path = self.file_path
|
path = self.file_path
|
||||||
print(path)
|
print(path)
|
||||||
path = f"{path}/imaginer-{self.slugify(prompt)}-{strftime('%d-%b-%Y-%H-%M-%S', gmtime())}"
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
path = "imaginer"
|
path = "imaginer"
|
||||||
|
else:
|
||||||
|
path = f"{path}/imaginer-{self.slugify(prompt)}-{strftime('%d-%b-%Y-%H-%M-%S', gmtime())}"
|
||||||
|
|
||||||
def thread_run():
|
|
||||||
match self.provider:
|
match self.provider:
|
||||||
case ProvidersEnum.OPENAI.value:
|
case ProvidersEnum.OPENAI.value:
|
||||||
try:
|
try:
|
||||||
@ -236,9 +238,9 @@ class ImaginerApplication(Adw.Application):
|
|||||||
else:
|
else:
|
||||||
image = None
|
image = None
|
||||||
|
|
||||||
GLib.idle_add(cleanup, image)
|
GLib.idle_add(cleanup, image, path)
|
||||||
|
|
||||||
def cleanup(image):
|
def cleanup(image, path):
|
||||||
self.win.spinner_loading.stop()
|
self.win.spinner_loading.stop()
|
||||||
self.win.stack_imaginer.set_visible_child_name("stack_imagine")
|
self.win.stack_imaginer.set_visible_child_name("stack_imagine")
|
||||||
t.join()
|
t.join()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user