Wizard
This commit is contained in:
@@ -14,12 +14,20 @@ from .util import Util
|
||||
DEFAULT_TIMEOUT = 5
|
||||
_logger = get_logger(__name__)
|
||||
class Willexecutors:
|
||||
|
||||
def save(bal_plugin, willexecutors):
|
||||
aw=bal_plugin.WILLEXECUTORS.get()
|
||||
aw[constants.net.NET_NAME]=willexecutors
|
||||
print("save",aw)
|
||||
bal_plugin.WILLEXECUTORS.set(aw)
|
||||
|
||||
def get_willexecutors(bal_plugin, update = False,bal_window=False,force=False,task=True):
|
||||
willexecutors = bal_plugin.WILLEXECUTORS.get()
|
||||
willexecutors=willexecutors.get(constants.net.NET_NAME,{})
|
||||
for w in willexecutors:
|
||||
Willexecutors.initialize_willexecutor(willexecutors[w],w)
|
||||
|
||||
bal = bal_plugin.WILLEXECUTORS.default
|
||||
bal = bal_plugin.WILLEXECUTORS.default.get(constants.net.NET_NAME,{})
|
||||
for bal_url,bal_executor in bal.items():
|
||||
if not bal_url in willexecutors:
|
||||
_logger.debug(f"force add {bal_url} willexecutor")
|
||||
@@ -33,17 +41,16 @@ class Willexecutors:
|
||||
if bal_plugin.PING_WILLEXECUTORS.get() or force:
|
||||
ping_willexecutors = True
|
||||
if bal_plugin.ASK_PING_WILLEXECUTORS.get() and not force:
|
||||
ping_willexecutors = bal_window.window.question(_("Contact willexecutors servers to update payment informations?"))
|
||||
if bal_window:
|
||||
ping_willexecutors = bal_window.window.question(_("Contact willexecutors servers to update payment informations?"))
|
||||
|
||||
if ping_willexecutors:
|
||||
if task:
|
||||
bal_window.ping_willexecutors(willexecutors)
|
||||
else:
|
||||
bal_window.ping_willexecutors_task(willexecutors)
|
||||
return willexecutors
|
||||
def get_willexecutors_as_sorted_list(bal_plugin,update=False,bal_window=False,force=False,task=True):
|
||||
willexecutors=Willexecutors.get_willexecutors(bal_plugin,update,bal_window,force,task)
|
||||
return sorted(willexecutors,key=lambda w:w[1].get('sort',0))
|
||||
|
||||
w_sorted = dict(sorted(willexecutors.items(), key=lambda w:w[1].get('sort',0),reverse=True))
|
||||
return w_sorted
|
||||
def is_selected(willexecutor,value=None):
|
||||
if not willexecutor:
|
||||
return False
|
||||
@@ -185,6 +192,7 @@ class Willexecutors:
|
||||
if not status is None:
|
||||
willexecutor['status'] = status
|
||||
willexecutor['selected'] = Willexecutors.is_selected(willexecutor,selected)
|
||||
|
||||
def download_list(bal_plugin):
|
||||
try:
|
||||
l = Willexecutors.send_request('get',"https://welist.bitcoin-after.life/data/bitcoin?page=0&limit=100")
|
||||
@@ -192,8 +200,10 @@ class Willexecutors:
|
||||
for w in l:
|
||||
willexecutor=l[w]
|
||||
Willexecutors.initialize_willexecutor(willexecutor,w,'New',False)
|
||||
bal_plugin.config.set_key(bal_plugin.WILLEXECUTORS,l,save=True)
|
||||
#bal_plugin.WILLEXECUTORS.set(l)
|
||||
#bal_plugin.config.set_key(bal_plugin.WILLEXECUTORS,l,save=True)
|
||||
return l
|
||||
|
||||
except Exception as e:
|
||||
_logger.error(f"error downloading willexecutors list:{e}")
|
||||
return {}
|
||||
@@ -204,7 +214,7 @@ class Willexecutors:
|
||||
for w in willexecutors:
|
||||
willexecutor=willexecutors[w]
|
||||
Willexecutors.initialize_willexecutor(willexecutor,w,'New',False)
|
||||
bal_plugin.config.set_key(bal_plugin.WILLEXECUTORS,willexecutors,save=True)
|
||||
#bal_plugin.WILLEXECUTORS.set(willexecutors)
|
||||
return h
|
||||
except Exception as e:
|
||||
_logger.error(f"error opening willexecutors json: {e}")
|
||||
|
||||
Reference in New Issue
Block a user