Report amount of imported users after scan

This commit is contained in:
Manuel Cortez 2022-08-03 09:39:45 -05:00
parent 9afd6774f2
commit 03f59064d5
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790
2 changed files with 7 additions and 6 deletions

View File

@ -36,7 +36,7 @@ class autocompletionScan(object):
return confirmation
def prepare_progress_dialog(self):
self.progress_dialog = wx_scan.get_progress_dialog(parent=self.dialog)
self.progress_dialog = wx_scan.autocompletionScanProgressDialog()
# connect method to update progress dialog
pub.subscribe(self.on_update_progress, "on-update-progress")
self.progress_dialog.Show()
@ -44,7 +44,7 @@ class autocompletionScan(object):
def on_update_progress(self, percent):
if percent > 100:
percent = 100
wx.CallAfter(self.progress_dialog.Update, percent)
wx.CallAfter(self.progress_dialog.update, percent)
def scan(self):
""" Attempts to add all users selected by current user to the autocomplete database. """
@ -76,8 +76,8 @@ class autocompletionScan(object):
if len(z) == 0:
continue
try:
results = selff.buffer.session.twitter.lookup_users(user_id=z)
except NameError:
results = self.buffer.session.twitter.lookup_users(user_id=z)
except TweepyException:
wx.CallAfter(wx_scan.show_error)
return self.done()
users.extend(results)
@ -86,6 +86,7 @@ class autocompletionScan(object):
pub.sendMessage("on-update-progress", percent=percent)
for user in users:
database.set_user(user.screen_name, user.name, 1)
wx.CallAfter(wx_scan.show_success, len(users))
self.done()
def done(self):

View File

@ -39,8 +39,8 @@ def confirm():
return True
return False
def show_success():
with wx.MessageDialog(None, _("TWBlue has imported {} users successfully."), _("Done")) as dlg:
def show_success(users):
with wx.MessageDialog(None, _("TWBlue has imported {} users successfully.").format(users), _("Done")) as dlg:
dlg.ShowModal()
def show_error():