Skip to content

Conversation

@ssuzzukki
Copy link

ディレクトリ名を指定するとそのディレクトリ内のmapファイルからpngを生成する機能を作成しました。生成された画像は指定したディレクトリの中に作った新たなディレクトリに格納されます。icons内の画像を変えると生成される画像の見た目を変えることができます。

@ssuzzukki ssuzzukki added the enhancement New feature or request label Apr 16, 2025
@ssuzzukki ssuzzukki requested a review from noko1024 April 16, 2025 08:57
@ssuzzukki ssuzzukki self-assigned this Apr 16, 2025
import sys
from typing import List

from PIL import Image

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [mypy] reported by reviewdog 🐶
Cannot find implementation or library stub for module named "PIL" [import-not-found]

Copy link
Contributor

@polyacetal polyacetal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

いくつか気になった点をコメントしました.
先頭についてる文字で意味が変わります.

  • IMO : 私の意見では
  • FYI: ご参考までに
  • want: できればやってほしい
  • nits: 些細な指摘

Comment on lines 80 to 91
# mapファイルが入ったディレクトリに移動
os.chdir(dir_name)

# 画像を格納するディレクトリを作成し移動
os.mkdir("map_images")
os.chdir("map_images")

for i in range(len(file_list)):
draWPng(file_list[i])

# もとのディレクトリに戻る
os.chdir("../../")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

want: ディレクトリ移動ではなく, 相対パスで指定してマップファイルの読み取りと画像ファイルの書き出しをしてほしい.

Copy link
Member

@noko1024 noko1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

全体的にコメントしました!
分からないことや気になることがあったら,コメントやVCでいつでも相談してください!

Linterが怒っているところも修正をお願いします!
テストも書いてみよう!

map_list = changEArray(map_data)

# アイコン用の画像を開く
yuka = Image.open("../../icons/yuka.png")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

パスは相対表記ではなく, __file__os.getcwd()を用いた方がOSなどの影響を受けづらいです

map_list = changEArray(map_data)

# アイコン用の画像を開く
yuka = Image.open("../../icons/yuka.png")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

item,hot,coolは英語表記なのでyuka,kabeも合わせたい!

Comment on lines 14 to 19
if map_data[i] != "" and map_data[i][0] == "D":
map_list.append(re.split(",|\n", map_data[i].replace("D:", "")))
elif map_data[i] != "" and map_data[i][0] == "H":
hot = re.split(",|\n", map_data[i].replace("H:", ""))
elif map_data[i] != "" and map_data[i][0] == "C":
cool = re.split(",|\n", map_data[i].replace("C:", ""))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map_data[i] != ""は共通の条件だから先に確認してbreakできるね!

elif map_data[i] != "" and map_data[i][0] == "C":
cool = re.split(",|\n", map_data[i].replace("C:", ""))

map_list[int(cool[1])][int(cool[0])] = "C"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"H"や”C"だとなんのことか分かりづらいので
列挙型(Enum)を定義して管理したい!

Comment on lines 77 to 78
dir_name = sys.argv[1]
file_list = os.listdir(dir_name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

実行時の引数をParseして処理する関数に切り出して
任意のパス型などをこの先の関数で渡してあげれると
文字列の連結などを考えなくてもよくなるのでトライして欲しい!

Copy link
Author

@ssuzzukki ssuzzukki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

タイポ修正、関数名の修正、型ヒントの修正、if文の条件文の修正、ファイル開閉や文字列操作に使うメソッドの変更

@polyacetal
Copy link
Contributor

もう一度レビューしてほしいときは, レビュワーの横の矢印を選んでもう一度レビューできるようにしてください

@polyacetal polyacetal marked this pull request as draft April 24, 2025 06:41
@polyacetal
Copy link
Contributor

一旦Generaterだけでmainにマージしちゃいたいので,
draftにします

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants