mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
[ci] auto-format
This commit is contained in:
parent
6e9d698b59
commit
ec116b3506
1 changed files with 147 additions and 147 deletions
|
|
@ -18,7 +18,7 @@ from typing import TYPE_CHECKING, cast
|
|||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Callable, List, Dict, Tuple, Optional, Union
|
||||
|
||||
from os import listdir, mkdir, path, sep,remove
|
||||
from os import listdir, mkdir, path, sep, remove
|
||||
from shutil import copy, copytree
|
||||
|
||||
import ba
|
||||
|
|
@ -44,6 +44,7 @@ blue_highlight = (0.4, 0.7, 1)
|
|||
b_color = (0.6, 0.53, 0.63)
|
||||
b_textcolor = (0.75, 0.7, 0.8)
|
||||
|
||||
|
||||
def Print(*args, color=None, top=None):
|
||||
out = ""
|
||||
for arg in args:
|
||||
|
|
@ -65,7 +66,6 @@ if not path.exists(external_dir):
|
|||
Print("You are ready to share replays", color=pink)
|
||||
|
||||
|
||||
|
||||
def override(cls: ClassType) -> Callable[[MethodType], MethodType]:
|
||||
def decorator(newfunc: MethodType) -> MethodType:
|
||||
funcname = newfunc.__code__.co_name
|
||||
|
|
@ -97,27 +97,28 @@ class CommonUtilities:
|
|||
copy(external_dir+sep+i, internal_dir+sep+i)
|
||||
Print("Synced all replays", color=pink)
|
||||
|
||||
def _copy(self, selected_replay,tab_id):
|
||||
def _copy(self, selected_replay, tab_id):
|
||||
if selected_replay is None:
|
||||
Print("Select a replay", color=red)
|
||||
return
|
||||
elif tab_id==MyTabId.INTERNAL:
|
||||
elif tab_id == MyTabId.INTERNAL:
|
||||
copy(internal_dir+selected_replay, external_dir+selected_replay)
|
||||
Print(selected_replay[0:-4]+" exported", top=True, color=pink)
|
||||
else:
|
||||
copy(external_dir+selected_replay, internal_dir+selected_replay)
|
||||
Print(selected_replay[0:-4]+" imported", top=True, color=green)
|
||||
|
||||
def delete_replay(self,selected_replay,tab_id,cls_inst):
|
||||
def delete_replay(self, selected_replay, tab_id, cls_inst):
|
||||
if selected_replay is None:
|
||||
Print("Select a replay", color=red)
|
||||
return
|
||||
|
||||
def do_it():
|
||||
if tab_id==MyTabId.INTERNAL:
|
||||
if tab_id == MyTabId.INTERNAL:
|
||||
remove(internal_dir+selected_replay)
|
||||
elif tab_id==MyTabId.EXTERNAL:
|
||||
elif tab_id == MyTabId.EXTERNAL:
|
||||
remove(external_dir+selected_replay)
|
||||
cls_inst.on_tab_select(tab_id) #updating the tab
|
||||
cls_inst.on_tab_select(tab_id) # updating the tab
|
||||
Print(selected_replay[0:-4]+" was deleted", top=True, color=red)
|
||||
ConfirmWindow(text=f"Delete \"{selected_replay.split('.')[0]}\" \nfrom {'internal directory' if tab_id==MyTabId.INTERNAL else 'external directory'}?",
|
||||
action=do_it, cancel_is_selected=True)
|
||||
|
|
@ -131,6 +132,7 @@ class MyTabId(Enum):
|
|||
EXTERNAL = "external"
|
||||
SHARE_REPLAYS = "share_replay"
|
||||
|
||||
|
||||
class Help(PopupWindow):
|
||||
def __init__(self):
|
||||
self.width = 1200
|
||||
|
|
@ -139,7 +141,7 @@ class Help(PopupWindow):
|
|||
size=(self.width, self.height), on_outside_click_call=self.close, transition="in_right")).get_root_widget()
|
||||
|
||||
ba.containerwidget(edit=self.root_widget, on_outside_click_call=self.close)
|
||||
ba.textwidget(parent=self.root_widget, position=(0, self.height * 0.7),corner_scale=1.2 ,color=green,
|
||||
ba.textwidget(parent=self.root_widget, position=(0, self.height * 0.7), corner_scale=1.2, color=green,
|
||||
text=f"»Replays are exported to\n {external_dir}\n»Copy replays to the above folder to be able to import them into the game\n»I would love to hear from you,meet me on discord\n -LoupGarou(author)")
|
||||
|
||||
def close(self):
|
||||
|
|
@ -161,7 +163,6 @@ class ShareTabUi(WatchWindow):
|
|||
|
||||
self.draw_ui()
|
||||
|
||||
|
||||
def on_select_text(self, widget, name):
|
||||
existing_widgets = self.scroll2.get_children()
|
||||
for i in existing_widgets:
|
||||
|
|
@ -184,11 +185,11 @@ class ShareTabUi(WatchWindow):
|
|||
self.tab_row.update_appearance(tab_id)
|
||||
dir_list = sorted(dir_list)
|
||||
existing_widgets = self.scroll2.get_children()
|
||||
if existing_widgets:# deleting textwidgets from old tab
|
||||
if existing_widgets: # deleting textwidgets from old tab
|
||||
for i in existing_widgets:
|
||||
i.delete()
|
||||
height = 900
|
||||
for i in dir_list:# making textwidgets for all replays
|
||||
for i in dir_list: # making textwidgets for all replays
|
||||
height -= 50
|
||||
a = i
|
||||
i = ba.textwidget(
|
||||
|
|
@ -243,7 +244,7 @@ class ShareTabUi(WatchWindow):
|
|||
|
||||
b_color = (0.6, 0.53, 0.63)
|
||||
b_textcolor = (0.75, 0.7, 0.8)
|
||||
btnv = (c_height- (48
|
||||
btnv = (c_height - (48
|
||||
if uiscale is ba.UIScale.SMALL
|
||||
else 45
|
||||
if uiscale is ba.UIScale.MEDIUM
|
||||
|
|
@ -252,9 +253,9 @@ class ShareTabUi(WatchWindow):
|
|||
smlh = 190 if uiscale is ba.UIScale.SMALL else 225
|
||||
tscl = 1.0 if uiscale is ba.UIScale.SMALL else 1.2
|
||||
|
||||
stab_width=500
|
||||
stab_height=300
|
||||
stab_h=smlh
|
||||
stab_width = 500
|
||||
stab_height = 300
|
||||
stab_h = smlh
|
||||
|
||||
v -= sub_scroll_height + 23
|
||||
scroll = ba.scrollwidget(
|
||||
|
|
@ -267,16 +268,16 @@ class ShareTabUi(WatchWindow):
|
|||
size=(sub_scroll_width, sub_scroll_height))
|
||||
|
||||
tabdefs = [(MyTabId.INTERNAL, 'INTERNAL'), (MyTabId.EXTERNAL, "EXTERNAL")]
|
||||
self.tab_row = TabRow(self.root, tabdefs, pos=(stab_h,sub_scroll_height),
|
||||
size=(stab_width,stab_height), on_select_call=self.on_tab_select)
|
||||
self.tab_row = TabRow(self.root, tabdefs, pos=(stab_h, sub_scroll_height),
|
||||
size=(stab_width, stab_height), on_select_call=self.on_tab_select)
|
||||
|
||||
helpbtn_space=20
|
||||
helpbtn_v=stab_h+stab_width+helpbtn_space+120
|
||||
helpbtn_h=sub_scroll_height+helpbtn_space
|
||||
helpbtn_space = 20
|
||||
helpbtn_v = stab_h+stab_width+helpbtn_space+120
|
||||
helpbtn_h = sub_scroll_height+helpbtn_space
|
||||
|
||||
ba.buttonwidget(
|
||||
parent=self.root,
|
||||
position=(helpbtn_v ,helpbtn_h ),
|
||||
position=(helpbtn_v, helpbtn_h),
|
||||
size=(35, 35),
|
||||
button_type="square",
|
||||
label="?",
|
||||
|
|
@ -285,7 +286,7 @@ class ShareTabUi(WatchWindow):
|
|||
textcolor=b_textcolor,
|
||||
on_activate_call=Help)
|
||||
|
||||
call_copy=lambda:CommonUtils._copy(self.selected_replay,self.tab_id)
|
||||
def call_copy(): return CommonUtils._copy(self.selected_replay, self.tab_id)
|
||||
self.share_button = ba.buttonwidget(
|
||||
parent=self.root,
|
||||
size=(b_width, b_height),
|
||||
|
|
@ -310,7 +311,7 @@ class ShareTabUi(WatchWindow):
|
|||
on_activate_call=CommonUtils.sync_confirmation)
|
||||
|
||||
btnv -= b_height + b_space_extra
|
||||
call_delete = lambda:CommonUtils.delete_replay(self.selected_replay,self.tab_id,self)
|
||||
def call_delete(): return CommonUtils.delete_replay(self.selected_replay, self.tab_id, self)
|
||||
delete_replay_button = ba.buttonwidget(
|
||||
parent=self.root,
|
||||
size=(b_width, b_height),
|
||||
|
|
@ -322,7 +323,6 @@ class ShareTabUi(WatchWindow):
|
|||
textcolor=b_textcolor,
|
||||
on_activate_call=call_delete)
|
||||
|
||||
|
||||
self.on_tab_select(MyTabId.INTERNAL)
|
||||
|
||||
def close(self):
|
||||
|
|
@ -403,4 +403,4 @@ class Loup(ba.Plugin):
|
|||
return True
|
||||
|
||||
def show_settings_ui(self, button):
|
||||
Print("Open share replay tab in replay window to share your replays",color=blue)
|
||||
Print("Open share replay tab in replay window to share your replays", color=blue)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue