mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Report amount of imported users after scan
This commit is contained in:
parent
9afd6774f2
commit
03f59064d5
@ -36,7 +36,7 @@ class autocompletionScan(object):
|
|||||||
return confirmation
|
return confirmation
|
||||||
|
|
||||||
def prepare_progress_dialog(self):
|
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
|
# connect method to update progress dialog
|
||||||
pub.subscribe(self.on_update_progress, "on-update-progress")
|
pub.subscribe(self.on_update_progress, "on-update-progress")
|
||||||
self.progress_dialog.Show()
|
self.progress_dialog.Show()
|
||||||
@ -44,7 +44,7 @@ class autocompletionScan(object):
|
|||||||
def on_update_progress(self, percent):
|
def on_update_progress(self, percent):
|
||||||
if percent > 100:
|
if percent > 100:
|
||||||
percent = 100
|
percent = 100
|
||||||
wx.CallAfter(self.progress_dialog.Update, percent)
|
wx.CallAfter(self.progress_dialog.update, percent)
|
||||||
|
|
||||||
def scan(self):
|
def scan(self):
|
||||||
""" Attempts to add all users selected by current user to the autocomplete database. """
|
""" Attempts to add all users selected by current user to the autocomplete database. """
|
||||||
@ -76,8 +76,8 @@ class autocompletionScan(object):
|
|||||||
if len(z) == 0:
|
if len(z) == 0:
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
results = selff.buffer.session.twitter.lookup_users(user_id=z)
|
results = self.buffer.session.twitter.lookup_users(user_id=z)
|
||||||
except NameError:
|
except TweepyException:
|
||||||
wx.CallAfter(wx_scan.show_error)
|
wx.CallAfter(wx_scan.show_error)
|
||||||
return self.done()
|
return self.done()
|
||||||
users.extend(results)
|
users.extend(results)
|
||||||
@ -86,6 +86,7 @@ class autocompletionScan(object):
|
|||||||
pub.sendMessage("on-update-progress", percent=percent)
|
pub.sendMessage("on-update-progress", percent=percent)
|
||||||
for user in users:
|
for user in users:
|
||||||
database.set_user(user.screen_name, user.name, 1)
|
database.set_user(user.screen_name, user.name, 1)
|
||||||
|
wx.CallAfter(wx_scan.show_success, len(users))
|
||||||
self.done()
|
self.done()
|
||||||
|
|
||||||
def done(self):
|
def done(self):
|
||||||
|
@ -39,8 +39,8 @@ def confirm():
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def show_success():
|
def show_success(users):
|
||||||
with wx.MessageDialog(None, _("TWBlue has imported {} users successfully."), _("Done")) as dlg:
|
with wx.MessageDialog(None, _("TWBlue has imported {} users successfully.").format(users), _("Done")) as dlg:
|
||||||
dlg.ShowModal()
|
dlg.ShowModal()
|
||||||
|
|
||||||
def show_error():
|
def show_error():
|
||||||
|
Loading…
Reference in New Issue
Block a user