Fix: Misspelling & Line-end spaces

This commit is contained in:
hgjazhgj 2022-06-25 20:04:45 +08:00
parent 5bae649009
commit e779fd7e64
37 changed files with 79 additions and 83 deletions

View File

@ -22,7 +22,6 @@ MAP.weight_data = """
90 90 90 90 90 90 90 90
90 90 90 90 90 90 90 90
90 90 90 90 90 90 90 90
"""
MAP.spawn_data = [
{'battle': 0, 'enemy': 2},

View File

@ -22,7 +22,6 @@ MAP.weight_data = """
90 90 90 90 90 90 90 10 05 90 90
90 90 90 90 90 25 20 15 90 90 90
90 90 90 40 35 30 90 90 90 90 90
"""
MAP.spawn_data = [
{'battle': 0, 'enemy': 3},

View File

@ -23,7 +23,7 @@ MAP.weight_data = """
90 90 90 90 90 90 90 90 90
90 90 90 90 90 90 90 90 90
90 90 90 90 90 90 90 90 90
90 90 90 90 90 90 90 90 90
90 90 90 90 90 90 90 90 90
"""
MAP.spawn_data = [
{'battle': 0, 'enemy': 3},

View File

@ -22,7 +22,6 @@ MAP.weight_data = """
20 20 20 10 10 20 20 35
50 90 90 60 60 90 90 90
90 90 90 70 80 90 90 90
"""
MAP.spawn_data = [
{'battle': 0, 'enemy': 3},

View File

@ -14,7 +14,6 @@ MAP.map_data = '''
++ ++ ++ -- -- -- -- ++ --
MB -- ME ME -- ++ -- ME --
-- ME -- -- SP ++ -- -- --
'''
MAP.weight_data = '''
10 10 10 10 10 10 10 10 10

View File

@ -14,7 +14,7 @@ MAP.map_data = '''
-- ME ++ -- -- ME ++ ++ ++
-- -- MS -- ++ ME -- ME --
SP -- -- -- ++ -- -- ME --
SP -- MS -- -- ME -- -- --
SP -- MS -- -- ME -- -- --
'''
A1, B1, C1, D1, E1, F1, G1, H1, I1, \
A2, B2, C2, D2, E2, F2, G2, H2, I2, \

View File

@ -5,13 +5,13 @@ MAP = CampaignMap('d2')
MAP.shape = 'I7'
MAP.camera_data = ['D2', 'D5', 'F3', 'F5']
MAP.map_data = '''
SP -- -- -- -- -- ME ++ MB
-- ME -- MS ME -- -- ++ --
-- -- ME ++ ++ ++ -- -- --
ME __ -- ME ME ME -- MS --
ME MS -- ++ ++ ++ -- -- --
-- ME -- ME -- -- -- ++ --
SP -- -- -- -- ME -- ++ MB
SP -- -- -- -- -- ME ++ MB
-- ME -- MS ME -- -- ++ --
-- -- ME ++ ++ ++ -- -- --
ME __ -- ME ME ME -- MS --
ME MS -- ++ ++ ++ -- -- --
-- ME -- ME -- -- -- ++ --
SP -- -- -- -- ME -- ++ MB
'''
MAP.weight_data = '''
10 10 10 10 10 10 10 10 10

View File

@ -14,7 +14,7 @@ MAP.map_data = '''
-- ME ++ -- -- ME ++ ++ ++
-- -- MS -- ++ ME -- ME --
SP -- -- -- ++ -- -- ME --
SP -- MS -- -- ME -- -- --
SP -- MS -- -- ME -- -- --
'''
A1, B1, C1, D1, E1, F1, G1, H1, I1, \
A2, B2, C2, D2, E2, F2, G2, H2, I2, \

View File

@ -6,8 +6,8 @@ from module.map.map_grids import RoadGrids, SelectedGrids
MAP = CampaignMap('sp3')
MAP.shape = 'i6'
MAP.map_data = '''
++ MB -- ME -- ME -- ++ ++
MB -- ME -- ++ -- ME ++ ++
++ MB -- ME -- ME -- ++ ++
MB -- ME -- ++ -- ME ++ ++
MB ME -- ME -- ME -- ME --
++ ++ ++ -- ME -- ME ++ --
MB -- ME ME -- ++ -- -- SP

View File

@ -19,7 +19,7 @@ class CampaignBase(CampaignBase_):
Override full scan methods to make sure that, Dace can be kept when tracking siren movements.
"""
dace = None
def full_scan_movable(self, *args, **kwargs):
self.dace = self.map.select(enemy_genre='Siren_Dace')
logger.attr('Submarine_Dace', self.dace)

View File

@ -48,7 +48,7 @@ class OSChapter:
if not isinstance(index, int) or index >= 200:
continue
name = chapter['name']
name = name.replace('é', 'e') # OCR can't recognise letter "é"
name = name.replace('é', 'e') # OCR can't recognize letter "é"
out[index] = name
# Zone 40000 is zone 154

View File

@ -64,7 +64,7 @@ class LuaLoader:
pg = pg or {}
slot0 = pg
slot0.chapter_template = {}
(function ()
...
end)()

2
gui.py
View File

@ -14,7 +14,7 @@ def func(ev: threading.Event):
if sys.platform.startswith("win"):
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
State.researt_event = ev
State.restart_event = ev
parser = argparse.ArgumentParser(description="Alas web service")
parser.add_argument(

View File

@ -221,7 +221,7 @@ class Button(Resource):
def match_binary(self, image, offset=30, threshold=0.85):
"""Detects button by template matching. To Some button, its location may not be static.
This method will apply template matching under binarization.
Args:
image: Screenshot.
offset (int, tuple): Detection area offset.
@ -241,7 +241,7 @@ class Button(Resource):
else:
offset = np.array((-3, -offset, 3, offset))
image = crop(image, offset + self.area)
if self.is_gif:
for template in self.image_binary:
# graying

View File

@ -124,7 +124,7 @@ class Template(Resource):
def match_binary(self, image, similarity=0.85):
"""
Use template match after binarization.
Args:
image:
similarity (float): 0 to 1.

View File

@ -70,7 +70,7 @@ class GemsFarming(CampaignRun, Dock, EquipmentChange):
def flagship_change(self):
"""
Change flagship and flagship's equipment
Change flagship and flagship's equipment
If config.GemsFarming_CommonCV == 'any', only change auxiliary equipment
"""
@ -98,7 +98,7 @@ class GemsFarming(CampaignRun, Dock, EquipmentChange):
def vanguard_change(self):
"""
Change vanguard and vanguard's equipment
Change vanguard and vanguard's equipment
"""
logger.hr('CHANGING VANGUARD.')
if self.config.GemsFarming_VanguardEquipChange:

View File

@ -21,7 +21,7 @@ class ManualConfig:
> Daily > Hard > OpsiAshAssist
> Sos > EventSp > EventAb > EventCd > RaidDaily > WarArchives > MaritimeEscort
> Event > Event2 > Raid > Main > Main2 > Main3
> OpsiMeowfficerFarming
> OpsiMeowfficerFarming
> GemsFarming
"""

View File

@ -119,7 +119,7 @@ class EquipmentChange(Equipment):
def _find_equip(self, index):
'''
Find the equipment previously recorded
Find the equipment previously recorded
Pages:
in: EQUIPMENT STATUS
'''

View File

@ -18,13 +18,13 @@ OCR_BUILD_SUBMIT_WW_COUNT = Digit(BUILD_SUBMIT_WW_COUNT, letter=(255, 247, 247),
class RewardGacha(GachaUI, GeneralShop, Retirement):
build_cube_count = 0
def gacha_prep(self, target, skip_first_scrrenshot=True):
def gacha_prep(self, target, skip_first_screenshot=True):
"""
Initiate preparation to submit build orders.
Args:
target (int): Number of build orders to submit
skip_first_scrrenshot (bool):
skip_first_screenshot (bool):
Returns:
bool: True if prep complete otherwise False.
@ -51,8 +51,8 @@ class RewardGacha(GachaUI, GeneralShop, Retirement):
ocr_submit = None
index_offset = (60, 20)
while 1:
if skip_first_scrrenshot:
skip_first_scrrenshot = False
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()

View File

@ -55,7 +55,7 @@ class AmbushHandler(Combat):
logger.attr('Ambush_evade', 'failed')
self.combat(expected_end='no_searching', fleet_index=self.fleet_show_index)
else:
logger.warning('Unrecognised info when ambush evade.')
logger.warning('Unrecognized info when ambush evade.')
self.ensure_no_info_bar()
if self.combat_appear():
self.combat(fleet_index=self.fleet_show_index)

View File

@ -207,7 +207,7 @@ class InfoHandler(ModuleBase):
"""
Story
"""
story_popup_timout = Timer(10, count=20)
story_popup_timeout = Timer(10, count=20)
map_has_clear_mode = False # Will be override in fast_forward.py
# Area to detect the options, should include at least 3 options.
@ -255,14 +255,14 @@ class InfoHandler(ModuleBase):
return buttons
def story_skip(self, drop=None):
if self.story_popup_timout.started() and not self.story_popup_timout.reached():
if self.story_popup_timeout.started() and not self.story_popup_timeout.reached():
if self.handle_popup_confirm('STORY_SKIP'):
self.story_popup_timout = Timer(10)
self.story_popup_timeout = Timer(10)
self.interval_reset(STORY_SKIP)
self.interval_reset(STORY_LETTERS_ONLY)
return True
if self.appear(STORY_LETTER_BLACK) and self.appear_then_click(STORY_LETTERS_ONLY, offset=(20, 20), interval=2):
self.story_popup_timout.reset()
self.story_popup_timeout.reset()
return True
if self._story_option_timer.reached() and self.appear(STORY_SKIP, offset=(20, 20), interval=0):
options = self._story_option_buttons()
@ -279,7 +279,7 @@ class InfoHandler(ModuleBase):
select = options[0]
self.device.click(select)
self._story_option_timer.reset()
self.story_popup_timout.reset()
self.story_popup_timeout.reset()
self.interval_reset(STORY_SKIP)
self.interval_reset(STORY_LETTERS_ONLY)
self._story_option_record = 0
@ -292,10 +292,10 @@ class InfoHandler(ModuleBase):
if drop:
drop.handle_add(self, before=2)
self.device.click(STORY_SKIP)
self.story_popup_timout.reset()
self.story_popup_timeout.reset()
return True
if self.appear_then_click(GAME_TIPS, offset=(20, 20), interval=2):
self.story_popup_timout.reset()
self.story_popup_timeout.reset()
return True
return False

View File

@ -645,7 +645,7 @@ class Map(Fleet):
def clear_filter_enemy(self, string, preserve=0):
"""
if EnemyPriority_EnemyScaleBalanceWeight != default_mode
if EnemyPriority_EnemyScaleBalanceWeight != default_mode
Filter will be covered
Args:

View File

@ -61,7 +61,7 @@ class MeowfficerEnhance(MeowfficerBase):
Scan for meowfficers that can be fed
according to the MEOWFFICER_FEED_GRID (4x3)
into target meowfficer for enhancement
Ensure through green check mark apperance
Ensure through green check mark appearance
after click
Pages:

View File

@ -147,7 +147,7 @@ class AlOcr(CnOcr):
"""
:param img: image array with type mx.nd.NDArray or np.ndarray,
with shape [height, width] or [height, width, channel].
channel shoule be 1 (gray image) or 3 (color image).
channel should be 1 (gray image) or 3 (color image).
:return: np.ndarray, with shape (1, height, width)
"""

View File

@ -526,7 +526,7 @@ class OSFleet(OSCamera, Combat, Fleet, OSAsh):
logger.info('Fleet left boss, boss found')
break
# Re-enter boss accidently
# Re-enter boss accidentally
if self.combat_appear():
self.ui_back(check_button=self.is_in_map)

View File

@ -26,7 +26,7 @@ class FleetSelector:
def get(self):
"""
Returns:
int: Index of current fleet, 1 to 4. return 0 if unrecognised.
int: Index of current fleet, 1 to 4. return 0 if unrecognized.
"""
for index, button in enumerate([FLEET_1, FLEET_2, FLEET_3, FLEET_4]):
if self.main.appear(button, offset=(20, 20)):

View File

@ -2,7 +2,7 @@ FILTER_STRING_SHORTEST = '0.5 > 1 > 1.5 > 2 > 2.5 > 3 > 4 > 5 > 6 > 8 > 10 > 12'
FILTER_STRING_CHEAPEST = 'Q1 > Q2 > T3 > T4 > Q4 > C6 > T6 > C8 > C12 > G1.5 > D2.5 > G2.5 > D5 > Q0.5 > G4 > D8 > H1 > H2 > H0.5 > D0.5 > H4'
DICT_FILTER_PRESET = {
'series_4_blueprint_tenrai_cube': """
S4-Q0.5 > S4-DR0.5 > S4-PRY0.5 > S4-H0.5 > S4-DR2.5 > 0.5 > S4-Q1
S4-Q0.5 > S4-DR0.5 > S4-PRY0.5 > S4-H0.5 > S4-DR2.5 > 0.5 > S4-Q1
> S4-H1 > S4-Q2 > reset > S4-Q4 > S4-G1.5 > Q1 > 1 > S4-H2 > S4-G4
> 1.5 > S4-G2.5 > S4-PRY2.5 > 2.5 > S4-DR5 > Q2 > 2 > 3
> S4-H4 > S4-DR8 > S4-PRY5 > Q4 > G4 > 4 > 5 > S4-PRY8
@ -14,7 +14,7 @@ DICT_FILTER_PRESET = {
> Q4 > G4 > 4 > 5 > S4-C6 > C6 > 6 > S4-C8 > 8
> S4-C12 > 12""",
'series_4_blueprint_only_cube': """
S4-DR0.5 > S4-H0.5 > S4-PRY0.5 > S4-H1 > S4-H2 > S4-DR2.5 > S4-Q0.5
S4-DR0.5 > S4-H0.5 > S4-PRY0.5 > S4-H1 > S4-H2 > S4-DR2.5 > S4-Q0.5
> 0.5 > S4-DR5 > reset > S4-DR8 > S4-H4 > S4-Q1 > Q1 > 1 > S4-G1.5
> 1.5 > S4-Q2 > Q2 > 2 > S4-G2.5 > S4-PRY2.5 > 2.5 > 3
> S4-Q4 > S4-G4 > Q4 > G4 > 4 > S4-PRY5 > 5 > S4-PRY8 > S4-C6
@ -26,21 +26,21 @@ DICT_FILTER_PRESET = {
> Q4 > G4 > 4 > 5 > S4-C6 > C6 > 6 > S4-C8 > 8
> S4-C12 > 12""",
'series_4_tenrai_only_cube': """
S4-Q0.5 > S4-DR0.5 > S4-PRY0.5 > S4-Q1 > S4-Q4 > S4-Q2 > S4-H0.5 > 0.5
> S4-G4 > S4-G1.5 > Q1 > S4-H1 > 1 > reset > S4-DR2.5 > S4-PRY2.5
S4-Q0.5 > S4-DR0.5 > S4-PRY0.5 > S4-Q1 > S4-Q4 > S4-Q2 > S4-H0.5 > 0.5
> S4-G4 > S4-G1.5 > Q1 > S4-H1 > 1 > reset > S4-DR2.5 > S4-PRY2.5
> S4-G2.5 > 1.5 > Q2 > S4-H2 > 2 > 2.5 > 3 > S4-DR5 > S4-PRY5
> Q4 > G4 > S4-H4 > H4 > 4 > 5 > S4-DR8 > S4-PRY8 > S4-C6
> C6 > S4-C8 > 8 > S4-C12 > 12""",
'series_4_tenrai_only': """
S4-Q0.5 > S4-DR0.5 > S4-PRY0.5 > S4-Q4 > S4-Q1 > S4-Q2 > S4-H0.5 > 0.5
> S4-G4 > S4-G1.5 > Q1 > 1 > S4-DR2.5 > S4-PRY2.5 > reset > S4-G2.5 > 1.5
> Q2 > 2 > 2.5 > 3 > S4-DR5 > S4-PRY5 > Q4 > G4
> Q2 > 2 > 2.5 > 3 > S4-DR5 > S4-PRY5 > Q4 > G4
> 4 > 5 > S4-C6 > S4-DR8 > S4-PRY8 > S4-C8 > C6 > 6 > 8
> S4-C12 > 12""",
'series_2_than_3_457_234': """
S2-Q0.5 > S2-PRY0.5 > S2-DR0.5 > S2-Q4 > S2-Q1 > S2-Q2 > S2-H0.5 > 0.5
> S3-Q1 > S3-Q2 > S2-G4 > S3-Q4 > S2-G1.5 > S2-DR2.5 > reset > Q1 > S2-PRY2.5 > S2-G2.5 > H1 > 1.5
> Q2 > 2.5 > S2-DR5 > S2-PRY5 > Q4 > G4 > 5 > H2 > S2-C6 > S2-DR8 > S2-PRY8 > S2-C8
> S3-Q1 > S3-Q2 > S2-G4 > S3-Q4 > S2-G1.5 > S2-DR2.5 > reset > Q1 > S2-PRY2.5 > S2-G2.5 > H1 > 1.5
> Q2 > 2.5 > S2-DR5 > S2-PRY5 > Q4 > G4 > 5 > H2 > S2-C6 > S2-DR8 > S2-PRY8 > S2-C8
> 6 > 8 > 4 > S2-C12 > 12""",
'series_3_234_only': """
S2-Q0.5 > S2-PRY0.5 > S2-DR0.5 > S3-Q4 > S3-Q1 > S3-Q2 > S2-H0.5 > 0.5
@ -69,7 +69,7 @@ DICT_FILTER_PRESET = {
> 6 > S2-C8 > 8 > S2-C12 > 12""",
'series_2_457_only': """
S2-Q0.5 > S2-PRY0.5 > S2-DR0.5 > S2-Q4 > S2-Q1 > S2-Q2 > S2-H0.5 > 0.5
> Q1 > S2-G4 > S2-G1.5 > S2-DR2.5 > reset > S2-PRY2.5 > S2-G2.5 > H1 > 1.5
> Q2 > 2.5 > S2-DR5 > S2-PRY5 > Q4 > G4 > 5 > H2 > S2-C6 > S2-DR8 > S2-PRY8 > S2-C8
> Q1 > S2-G4 > S2-G1.5 > S2-DR2.5 > reset > S2-PRY2.5 > S2-G2.5 > H1 > 1.5
> Q2 > 2.5 > S2-DR5 > S2-PRY5 > Q4 > G4 > 5 > H2 > S2-C6 > S2-DR8 > S2-PRY8 > S2-C8
> 6 > 8 > 4 > S2-C12 > 12"""
}

View File

@ -225,7 +225,7 @@ def get_research_cost_jp(image):
When the research has 2 cost items, the size of each is 77*77.
However, templates of coins, cubes, and plates differ a lot with each other,
so simply setting a lower threshold while matching can do the job.
Args:
image (np.ndarray): Screenshot
@ -252,7 +252,7 @@ def get_research_cost_jp(image):
costs[cost] = True
continue
# Rename keys to be the same as attrs of ResearchProjectJp.
# Rename keys to be the same as attrs of ResearchProjectJp.
costs['need_coin'] = costs.pop('coin')
costs['need_cube'] = costs.pop('cube')
costs['need_part'] = costs.pop('plate')
@ -263,7 +263,7 @@ def get_research_ship_jp(image):
"""
Notice that 2.5, 5, and 8 hours' D research have 4 items, while 0.5 hours' one has 3,
so the button DETAIL_BLUEPRINT should not cover only the first one of 4 items.
Args:
image (np.ndarray): Screenshot
@ -292,7 +292,7 @@ def research_jp_detect(image):
"""
Args:
image (np.ndarray): Screenshot
Return:
project (ResearchProjectJp):
"""
@ -565,7 +565,7 @@ class ResearchSelector(UI):
self.research_detail_quit()
"""
page_research should remain the same as before.
Since we entered the 4th entrance first,
Since we entered the 4th entrance first,
the indexes from left to right are (2, 3, 4, 0, 1).
"""
for pos in range(5):

View File

@ -415,7 +415,7 @@ class RewardResearch(ResearchSelector):
research_duration_remain = self.research_get_remain()
if research_duration_remain == 0:
# Reseach finished or project requirements not satisfied (B/E/T)
# Need to check in page_research
# Need to check in page_research
self.interval_clear(MAIN_GOTO_CAMPAIGN)
self.ui_ensure_research()
if self.research_has_finished():

View File

@ -23,7 +23,7 @@ CARD_RARITY_COLORS = {
class Retirement(Enhancement):
_unable_to_enhance = False
_have_keeped_cv = True
_have_kept_cv = True
def _retirement_choose(self, amount=10, target_rarity=('N',)):
"""
@ -92,7 +92,7 @@ class Retirement(Enhancement):
self.device.click(SHIP_CONFIRM)
continue
if self.appear(SHIP_CONFIRM_2, offset=(30, 30), interval=2):
if self.config.RETIRE_KEEP_COMMON_CV and not self._have_keeped_cv:
if self.config.RETIRE_KEEP_COMMON_CV and not self._have_kept_cv:
self.keep_one_common_cv()
self.device.click(SHIP_CONFIRM_2)
self.interval_clear(GET_ITEMS_1)
@ -154,7 +154,7 @@ class Retirement(Enhancement):
total = 0
if self.config.RETIRE_KEEP_COMMON_CV:
self._have_keeped_cv = False
self._have_kept_cv = False
while 1:
self.handle_info_bar()
@ -217,7 +217,7 @@ class Retirement(Enhancement):
total = 0
if self.config.RETIRE_KEEP_COMMON_CV:
self._have_keeped_cv = False
self._have_kept_cv = False
while amount:
selected = self._retirement_choose(
@ -364,15 +364,15 @@ class Retirement(Enhancement):
Button:
"""
if self.config.GemsFarming_CommonCV == 'any':
for commen_cv_name in ['BOGUE', 'HERMES', 'LANGLEY', 'RANGER']:
template = globals()[f'TEMPLATE_{commen_cv_name}']
for common_cv_name in ['BOGUE', 'HERMES', 'LANGLEY', 'RANGER']:
template = globals()[f'TEMPLATE_{common_cv_name}']
sim, button = template.match_result(
resize(self.device.image, size=(1189, 669)))
if sim > self.config.COMMON_CV_THRESHOLD:
return Button(button=tuple(_ * 155 // 144 for _ in button.button), area=button.area,
color=button.color,
name=f'TEMPLATE_{commen_cv_name}_RETIRE')
name=f'TEMPLATE_{common_cv_name}_RETIRE')
return None
else:
@ -392,4 +392,4 @@ class Retirement(Enhancement):
button = self.retirement_get_common_rarity_cv()
if button is not None:
self._retire_select_one(button, skip_first_screenshot=False)
self._have_keeped_cv = True
self._have_kept_cv = True

View File

@ -113,7 +113,7 @@ class ShopBase(ModuleBase):
Custom steps for variant shop
if needed to ensure shop has
loaded completely
ShopMedal for example will initally
ShopMedal for example will initially
display default items at default prices
Args:

View File

@ -141,7 +141,7 @@ class ShopClerk(ShopBase, Retirement):
click_timer.reset()
# Scan for plus/minus locations; searching within
# offset will update the click posiion automatically
# offset will update the click position automatically
self.device.screenshot()
if self.appear(SELECT_MINUS, offset=select_offset) and self.appear(SELECT_PLUS, offset=select_offset):
break

View File

@ -39,7 +39,7 @@ class CampaignSos(CampaignRun, CampaignBase):
@Config.when(SERVER='tw')
def _sos_scroll(self):
return Scroll(SOS_SCROLL_AREA, color=(247, 210, 66), name='SOS_SCROLL')
@cached_property
@Config.when(SERVER=None)
def _sos_scroll(self):

View File

@ -373,7 +373,7 @@ class AlasGUI(Frame):
self.task_handler.add(switch_scheduler.g(), 1, True)
self.task_handler.add(switch_log_scroll.g(), 1, True)
self.task_handler.add(self.alas_update_overiew_task, 10, True)
self.task_handler.add(self.alas_update_overview_task, 10, True)
self.task_handler.add(log.put_log(self.alas), 0.25, True)
def _alas_thread_wait_config_change(self) -> None:
@ -457,7 +457,7 @@ class AlasGUI(Frame):
invalid.clear()
break
def alas_update_overiew_task(self) -> None:
def alas_update_overview_task(self) -> None:
if not self.visible:
return
self.alas_config.load()
@ -628,10 +628,10 @@ class AlasGUI(Frame):
# ).style(f'--menu-Raise--')
def _force_restart():
if State.researt_event is not None:
if State.restart_event is not None:
toast("Alas will restart in 3 seconds", duration=0, color="error")
clearup()
State.researt_event.set()
State.restart_event.set()
else:
toast("Reload not enabled", color="error")
@ -651,7 +651,7 @@ class AlasGUI(Frame):
self.init_menu(name="Update")
self.set_title(t("Gui.MenuDevelop.Update"))
if State.researt_event is None:
if State.restart_event is None:
put_warning(t("Gui.Update.DisabledWarn"))
put_row(
@ -995,7 +995,7 @@ class AlasGUI(Frame):
status={
True: [
lambda: self.__setattr__("visible", True),
lambda: self.alas_update_overiew_task()
lambda: self.alas_update_overview_task()
if self.page == "Overview"
else 0,
lambda: self.task_handler._task.__setattr__("delay", 15),

View File

@ -16,7 +16,7 @@ class State:
deploy_config = DeployConfig()
config_updater = ConfigUpdater()
researt_event: threading.Event = None
restart_event: threading.Event = None
manager: SyncManager = None
electron: bool = False
theme: str = "default"

View File

@ -34,7 +34,7 @@ def translate():
"en-US": {},
"ja-JP": {},
}
list_path = [] # Menu.Task.name
list_group = [] # Menu
list_arg = [] # Task

View File

@ -117,7 +117,7 @@ class Updater(DeployConfig, GitManager, PipManager):
sha1, _, _, message = self.get_commit(f"..{source}/{self.Branch}")
if sha1:
logger.info(f"New update avaliable")
logger.info(f"New update available")
logger.info(f"{sha1[:8]} - {message}")
return True
else:
@ -191,7 +191,7 @@ class Updater(DeployConfig, GitManager, PipManager):
)
return 0
logger.info(f"Update {sha[:8]} avaliable")
logger.info(f"Update {sha[:8]} available")
return 1
def check_update(self):
@ -258,7 +258,7 @@ class Updater(DeployConfig, GitManager, PipManager):
logger.info("All alas stopped, start updating")
if self.update():
if State.researt_event is not None:
if State.restart_event is not None:
self.state = "reload"
with open("./config/reloadalas", mode="w") as f:
f.writelines(names)
@ -281,7 +281,7 @@ class Updater(DeployConfig, GitManager, PipManager):
# with open("./config/reloadflag", mode="w"):
# # app ended here and uvicorn will restart whole app
# pass
State.researt_event.set()
State.restart_event.set()
timer = threading.Timer(delay, trigger)
timer.start()
@ -300,7 +300,7 @@ class Updater(DeployConfig, GitManager, PipManager):
th._task.delay = get_next_time(self.schedule_time)
yield
continue
if State.researt_event is None:
if State.restart_event is None:
yield
continue
if not self.run_update():