Skip to content

Commit 60286be

Browse files
committed
Bug fixes
1 parent 1db3100 commit 60286be

File tree

4 files changed

+42
-11
lines changed

4 files changed

+42
-11
lines changed

docs/source/changelog.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ Glossary
3232
Releases
3333
----------------------
3434

35+
v2.8.4
36+
=================
37+
- Fixed web browser waiting time being too little when searching invite links
38+
- Fixed web browser could not create directory (username had a new line after it, now it auto strips that)
39+
- Fix GUI not allowing to define inherited classes (eg. logging manager's fallback that inherits LoggerBASE)
40+
- Fix item not in list error upon saving if an item was written inside a GUI's dropdown menu directly and then edited.
41+
42+
3543
v2.8.3
3644
=================
3745
- Fixed new guilds being added whenever :class:`daf.client.ACCOUNT`'s update method failed.

src/daf/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
from .misc import *
2020

2121

22-
VERSION = "2.8.3"
22+
VERSION = "2.8.4"

src/daf/web.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class GLOBALS:
6161

6262

6363
WD_TIMEOUT_SHORT = 5
64-
WD_TIMEOUT_MED = 30
64+
WD_TIMEOUT_MED = 15
6565
WD_TIMEOUT_LONG = 90
6666
WD_RD_CLICK_UPPER_N = 5
6767
WD_RD_CLICK_LOWER_N = 2
@@ -119,8 +119,8 @@ def __init__(self,
119119
"Install them with: pip install discord-advert-framework[web]"
120120
)
121121

122-
self._username = username
123-
self._password = password
122+
self._username = username.strip()
123+
self._password = password.strip()
124124
self._proxy = proxy
125125
self.driver = None
126126
self._token = None
@@ -262,7 +262,7 @@ async def fetch_invite_link(self, url: str):
262262
await self.random_sleep(0.5, 1)
263263
try:
264264
await self.async_execute(
265-
WebDriverWait(driver, WD_TIMEOUT_SHORT).until,
265+
WebDriverWait(driver, WD_TIMEOUT_MED).until,
266266
url_contains("discord.com")
267267
)
268268
await self.await_load()
@@ -681,6 +681,7 @@ class QueryMembers(Enum):
681681
QueryMembers.ALL: (None, None),
682682
QueryMembers.SUB_100: (None, 100),
683683
QueryMembers.B100_1k: (100, 1000),
684+
QueryMembers.B1k_10k: (1000, 10000),
684685
QueryMembers.ABV_10k: (10000, None),
685686
}
686687

src/daf_gui/object.py

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,16 @@ def set_origin_window(cls, window: ObjectEditWindow):
477477

478478
@classmethod
479479
def convert_types(cls, types_in):
480+
def remove_wrapped(types: list):
481+
r = types.copy()
482+
for type_ in types:
483+
# It's a wrapper of some class -> remove the wrapped class
484+
if hasattr(type_, "__wrapped__"):
485+
if type_.__wrapped__ in r:
486+
r.remove(type_.__wrapped__)
487+
488+
return r
489+
480490
while get_origin(types_in) is Union:
481491
types_in = get_args(types_in)
482492

@@ -486,7 +496,15 @@ def convert_types(cls, types_in):
486496
else:
487497
types_in = [types_in, ]
488498

489-
return types_in
499+
# Also include inherited objects
500+
subtypes = []
501+
for t in types_in:
502+
if hasattr(t, "__subclasses__") and t.__module__.split('.', 1)[0] in {"_discord", "daf"}:
503+
for st in t.__subclasses__():
504+
subtypes.extend(cls.convert_types(st))
505+
506+
# Remove wrapped classes (eg. wrapped by decorator)
507+
return remove_wrapped(types_in + subtypes)
490508

491509
def update_window_title(self):
492510
self.origin_window.title(f"{'New' if self.old_object_info is None else 'Edit'} {self.get_cls_name(self.class_)} object")
@@ -623,12 +641,16 @@ def _gui_to_object(self):
623641
def _update_old_object(self, new: Union[ObjectInfo, Any]):
624642
if self.old_object_info is not None:
625643
ret_widget = self.return_widget
626-
if isinstance(ret_widget, ListBoxScrolled):
627-
ind = ret_widget.get().index(self.old_object_info)
628-
else:
629-
ind = ret_widget["values"].index(self.old_object_info)
644+
# Ignore if not in list (Combobox allows to type values directly in instead of inserting them)
645+
# thus when edit is clicked, the old information is loaded into the object edit info, howver the actual
646+
# value while it was writen inside the combobox is not actually present in the list of it's values
647+
with suppress(ValueError):
648+
if isinstance(ret_widget, ListBoxScrolled):
649+
ind = ret_widget.get().index(self.old_object_info)
650+
else:
651+
ind = ret_widget["values"].index(self.old_object_info)
630652

631-
ret_widget.delete(ind)
653+
ret_widget.delete(ind)
632654

633655
self.return_widget.insert(tk.END, new)
634656
if isinstance(self.return_widget, ComboBoxObjects):

0 commit comments

Comments
 (0)