Skip to content

Commit

Permalink
fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
shenjackyuanjie committed Feb 10, 2025
1 parent b4a7708 commit a88f5a3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions Difficult_Rocket/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ClientOption(Options):
background_color: List[float] = [21 / 255, 22 / 255, 23 / 255, 0.0]
caption: str = "Difficult Rocket v{DR_version}"

def load_file(self) -> None:
def load_file(self):
file = DR_runtime.main_config
self.fps = int(file["runtime"]["fps"])
self.width = int(file["window"]["width"])
Expand All @@ -76,6 +76,7 @@ def load_file(self) -> None:
alpha = file["window"]["background_color"][3]
self.background_color = [*color, alpha]
self.caption = DR_runtime.format(self.caption)
return True


class Client:
Expand Down Expand Up @@ -398,7 +399,7 @@ def add_sub_screen_without_name(self, sub_screen: Type[BaseScreen]):
def get_sub_screen(self, title: str) -> BaseScreen | None:
"""获取一个页面
添加自: 0.9.2.0"""
self.screen_list.setdefault(title, None)
self.screen_list.setdefault(title, None) # type: ignore
return self.screen_list.get(title)

def remove_sub_screen(self, title: str) -> BaseScreen | None:
Expand Down
14 changes: 7 additions & 7 deletions mods/dr_game/sr1_ship.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def set_folder(self, path: Path):
if not file.is_file:
continue
# 尝试加载一下
if assert_ship(str(file)):
if assert_ship(str(file)): # type: ignore
logger.info(
sr_tr().sr1.ship.ship.valid().format(file), tag="ship explorer"
)
Expand Down Expand Up @@ -293,7 +293,7 @@ def select(explorer: SR1ShipSelecter, file_path: Path):
# Optional data
self.textures: SR1Textures = SR1Textures()
self.gen_draw: Generator | None = None
self.rust_ship: SR1Ship_rs | None = None
self.rust_ship: SR1Ship_rs | None = None # type: ignore
self.ship_name: str | None = None

# List/Dict data
Expand All @@ -303,7 +303,7 @@ def select(explorer: SR1ShipSelecter, file_path: Path):

if DR_mod_runtime.use_DR_rust:
self.rust_parts = None
self.part_list_rs = SR1PartList_rs(
self.part_list_rs = SR1PartList_rs( # type: ignore
"assets/builtin/PartList.xml", "builtin_part_list"
)

Expand Down Expand Up @@ -342,7 +342,7 @@ def load_xml(self, file_path: Path) -> bool:
logger.info(sr_tr().sr1.ship.xml.loading().format(file_path), tag="load_xml")
self.ship_name = file_path.stem
if DR_mod_runtime.use_DR_rust:
self.rust_ship = SR1Ship_rs(
self.rust_ship = SR1Ship_rs( # type: ignore
str(file_path), self.part_list_rs, "a_new_ship"
)
logger.info(sr_tr().sr1.ship.xml.load_done(), tag="load_xml")
Expand Down Expand Up @@ -556,7 +556,7 @@ def draw_batch(self, window: ClientWindow):

explorer = window.get_sub_screen(SR1ShipSelecter.name)
if explorer is not None:
explorer.draw_batch_(window)
explorer.draw_batch(window)

def on_draw(self, window: ClientWindow):
if self.status.draw_call:
Expand Down Expand Up @@ -584,7 +584,7 @@ def on_resize(self, width: int, height: int, window: ClientWindow):
self.height = height

def on_mouse_scroll(
self, x: int, y: int, scroll_x: int, scroll_y: int, window: ClientWindow
self, x: int, y: int, scroll_x: float, scroll_y: float, window: ClientWindow
):
if self.status.focus:
mouse_dx = x - (self.width / 2) + self.dx
Expand Down Expand Up @@ -748,7 +748,7 @@ def on_mouse_drag(
self.dx += dx
self.dy += dy

def on_file_drop(self, x: int, y: int, paths: list[str], window: ClientWindow):
def on_file_drop(self, x: int, y: int, paths: list[str], window: ClientWindow): # type: ignore
if len(paths) == 1:
# only file/path
self.load_xml(Path(paths[0]))
Expand Down

0 comments on commit a88f5a3

Please sign in to comment.