mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Start a small refactor in GUI code
This commit is contained in:
parent
f9f7a32f90
commit
4b627a13ff
@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import webbrowser
|
||||
import threading
|
||||
import logging
|
||||
import sound_lib
|
||||
import paths
|
||||
@ -307,6 +308,13 @@ class accountSettingsController(globalSettingsController):
|
||||
|
||||
def on_autocompletion_scan(self, *args, **kwargs):
|
||||
configuration = scan.autocompletionScan(self.buffer.session.settings, self.buffer, self.window)
|
||||
to_scan = configuration.show_dialog()
|
||||
if to_scan == True:
|
||||
configuration.prepare_progress_dialog()
|
||||
t = threading.Thread(target=configuration.scan)
|
||||
t.start()
|
||||
|
||||
|
||||
|
||||
def on_autocompletion_manage(self, *args, **kwargs):
|
||||
configuration = manage.autocompletionManage(self.buffer.session)
|
||||
|
@ -1,7 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
""" Scanning code for autocompletion feature on TWBlue. This module can retrieve user objects from the selected Twitter account automatically. """
|
||||
import time
|
||||
import threading
|
||||
import wx
|
||||
import widgetUtils
|
||||
import output
|
||||
@ -27,17 +26,19 @@ class autocompletionScan(object):
|
||||
self.config = config
|
||||
self.buffer = buffer
|
||||
self.window = window
|
||||
|
||||
def show_dialog(self):
|
||||
self.dialog = wx_scan.autocompletionScanDialog()
|
||||
self.dialog.set("friends", self.config["mysc"]["save_friends_in_autocompletion_db"])
|
||||
self.dialog.set("followers", self.config["mysc"]["save_followers_in_autocompletion_db"])
|
||||
if self.dialog.get_response() == widgetUtils.OK:
|
||||
confirmation = wx_scan.confirm()
|
||||
if confirmation == True:
|
||||
return confirmation
|
||||
|
||||
def prepare_progress_dialog(self):
|
||||
self.progress_dialog = wx_scan.get_progress_dialog(parent=self.dialog)
|
||||
# connect method to update progress dialog
|
||||
pub.subscribe(self.on_update_progress, "on-update-progress")
|
||||
scanner = threading.Thread(target=self.scan)
|
||||
scanner.start()
|
||||
|
||||
def on_update_progress(self, percent):
|
||||
if percent > 100:
|
||||
@ -77,7 +78,6 @@ class autocompletionScan(object):
|
||||
results = selff.buffer.session.twitter.lookup_users(user_id=z)
|
||||
except NameError:
|
||||
wx.CallAfter(wx_scan.show_error)
|
||||
wx.CallAfter(self.dialog.SetFocus)
|
||||
return self.done()
|
||||
users.extend(results)
|
||||
time.sleep(1)
|
||||
|
Loading…
Reference in New Issue
Block a user