- Fixed an issue which caused JavaScript variables of the same name to be declared twice.

- Refactoring to allow the widget classes to use the subscribe_click method.
This commit is contained in:
louisnw
2023-05-17 12:45:54 +01:00
parent 993fbe8ed8
commit 88c8a266ec
5 changed files with 75 additions and 52 deletions

View File

@ -1,3 +1,5 @@
from random import choices
from string import ascii_lowercase
from typing import Literal
@ -58,4 +60,17 @@ def _js_bool(b: bool): return 'true' if b is True else 'false' if b is False els
def _price_scale_mode(mode: PRICE_SCALE_MODE):
return 'IndexedTo100' if mode == 'index100' else mode.title() if mode else None
return 'IndexedTo100' if mode == 'index100' else mode.title() if mode else None
class IDGen:
def __init__(self):
self.list = []
def generate(self):
var = ''.join(choices(ascii_lowercase, k=8))
if var in self.list:
self.generate()
else:
self.list.append(var)
return var