Skip to content

Commit e67bd6a

Browse files
committed
Find solution for bug in deepl translator
Deepl does not translte the string with a special character (Ex: |)
1 parent d1699c6 commit e67bd6a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

transimage/transimage.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def run(self):
5353
time.sleep(2)
5454
if self.stop==False:
5555
self.image_translator=results.get()
56-
self.process.close()
56+
#self.process.close()
5757
evt = EvtImageProcess(data=self.image_translator)
5858
wx.PostEvent(self.notify_window, evt)
5959

@@ -104,7 +104,6 @@ def __init__(self,parent):
104104
buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
105105

106106
self.cancelButton = wx.Button(self,wx.ID_CANCEL,"Cancel",wx.DefaultPosition,wx.DefaultSize,0)
107-
self.cancelButton.Disable()
108107
self.cancelButton.SetForegroundColour(TEXT_COLOR)
109108
self.cancelButton.SetBackgroundColour(BACKGROUND_COLOR)
110109

@@ -304,12 +303,13 @@ def update_dest_lang(self,event):
304303

305304
def callback_image_process(self,event):
306305
self.progressDialog.Close()
307-
self.processImage.abort()
308-
self.imageCanvas.delete_all()
309306
self.translator=event.data[0]
310307
if self.processImage.mode_process==True:
308+
self.imageCanvas.delete_all()
311309
self.imageCanvas.update_image(self.translator.img_out)
312310
for text in self.translator.text:
311+
if text['translated_string']=='':
312+
wx.MessageDialog(None, 'This translator does not work with the text on image. Change the text or translator', 'Error', wx.OK | wx.ICON_EXCLAMATION).ShowModal()
313313
self.imageCanvas.add_text(text['string'],text['translated_string'],(text['x'],text['y']),text['max_width'],text['font_size'])
314314
else:#Saving image
315315
wildcard = "JPG Files (*.jpg)|*.jpg|PNG files (*.png)|*.png"

0 commit comments

Comments
 (0)