Skip to content

Commit

Permalink
Merge pull request #3 from karpitony/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
karpitony authored May 22, 2024
2 parents 22cbf8a + d9307ba commit 7a08af7
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
## 사용 방법
![screenshot01](assets/screenshot01.png)
- **맵을 고른 후 꼭 `적용` 버튼을 눌러주세요!**
- 이 앱은 스크린샷 키가 눌릴 때 작동합니다. **타르코프의 기본 스크린샷 키는 `PrtSc` 키입니다.**
- Press to Record` 버튼을 통해 원하는 키로 변경이 가능하며 이 설정은 계속 유지됩니다!
- ~~이 앱은 스크린샷 키가 눌릴 때 작동합니다. **타르코프의 기본 스크린샷 키는 `PrtSc` 키입니다.**~~
- 코딩 이슈로 일단 스샷을 찍고 `Force Run` 버튼을 눌러주세요.
- Press to Record` 버튼을 통해 원하는 키로 변경이 가능하며 이 설정은 계속 유지됩니다!
11 changes: 11 additions & 0 deletions README_ko_kr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# eft-where-am-i
- `Tarkov-Market``Maps` 기능을 손쉽게 사용할 수 있도록 도와주는 Python + GUI 프로그램입니다.
- [Rok님의 게시글 및 소스코드](https://gall.dcinside.com/m/eft/2143712)를 기반으로 작성했습니다.
- 본 프로그램은 `MIT 라이선스`이며 **본 프로그램으로 인한 어떠한 피해에도 책임지지 않습니다.**

## 사용 방법
![screenshot01](assets/screenshot01.png)
- **맵을 고른 후 꼭 `적용` 버튼을 눌러주세요!**
- ~~이 앱은 스크린샷 키가 눌릴 때 작동합니다. **타르코프의 기본 스크린샷 키는 `PrtSc` 키입니다.**~~
- 코딩 이슈로 일단 스샷을 찍고 `Force Run` 버튼을 눌러주세요.
- Press to Record` 버튼을 통해 원하는 키로 변경이 가능하며 이 설정은 계속 유지됩니다!
Binary file modified assets/screenshot01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 30 additions & 15 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@
def change_map() -> None:
global map
global site_url
global where_am_i_click
select_map = combobox.get()
if map != select_map:
site_url = f"https://tarkov-market.com/maps/{select_map}"
map = select_map
driver.get(site_url)
where_am_i_click=False

def set_trigger(event):
global trigger
trigger = event.name
with open(txt_file_path, 'w') as file:
file.write(trigger)
label3.config(text=f'Now: \"{trigger}\"')
keyboard.add_hotkey(trigger, lambda: checkLocation())

def get_latest_file(folder_path):
files = glob.glob(os.path.join(folder_path, '*'))
Expand Down Expand Up @@ -60,29 +63,39 @@ def checkLocation():
break

if screenshot is None:
print("Error: Cant find Screenshot Files.")
return

textArea = driver.find_element(By.XPATH,'//*[@id="__nuxt"]/div/div/div[2]/div/div/div[1]/div[2]/button')
textArea.click()
textArea2 = driver.find_element(By.XPATH,'//*[@id="__nuxt"]/div/div/div[2]/div/div/div[1]/div[2]/input')
textArea2.click()
textArea2.send_keys(Keys.DELETE)
textArea2.send_keys(screenshot.replace(".png",""))
changeMarker()

global where_am_i_click
if where_am_i_click == False:
where_am_i_click = True
textArea = driver.find_element(By.XPATH,'//*[@id="__nuxt"]/div/div/div[2]/div/div/div[1]/div[2]/button')
textArea.click()
textArea2 = driver.find_element(By.XPATH,'//*[@id="__nuxt"]/div/div/div[2]/div/div/div[1]/div[2]/input')
textArea2.click()
textArea2.send_keys(Keys.DELETE)
textArea2.send_keys(screenshot.replace(".png",""))
changeMarker()
else:
textArea2 = driver.find_element(By.XPATH,'//*[@id="__nuxt"]/div/div/div[2]/div/div/div[1]/div[2]/input')
textArea2.click()
textArea2.send_keys(Keys.DELETE)
textArea2.send_keys(screenshot.replace(".png",""))
changeMarker()

mapList = ['ground-zero', 'factory', 'customs', 'interchange', 'woods', 'shoreline', 'lighthouse', 'reserve', 'streets', 'lab']

map = "ground-zero"
site_url = f"https://tarkov-market.com/maps/{map}"
txt_file_path = 'key_data.txt'
where_am_i_click = False # where am i 클릭 되어 있으면 값만 입력하게끔


# 스크린샷 및 위치 표시할 키 불러오기
if os.path.exists(txt_file_path):
with open(txt_file_path, 'r') as file:
trigger = file.read().strip()
else:
trigger = None
trigger = 'print screen'

chrome_options = Options()
chrome_options.add_experimental_option("detach", True)
Expand All @@ -93,8 +106,6 @@ def checkLocation():

keyboard.add_hotkey(trigger, lambda: checkLocation())



# 색상 변수
bg_color = 'gray'
box_color = '#333333'
Expand All @@ -103,7 +114,7 @@ def checkLocation():
# UI 생성
window = Tk()
window.geometry("500x600")
window.title("EFT Where am I? v1.0")
window.title("EFT Where am I? v1.1")
window.resizable(False, False)
window.configure(bg=bg_color)

Expand Down Expand Up @@ -167,12 +178,16 @@ def open_url(url):
label3.grid(row=1, column=0, columnspan=3, pady=(0, 10))

b2 = Button(frame2, text='Press to Record', command=lambda: keyboard.hook(set_trigger), font=('Helvetica', 16))
b2.grid(row=2, column=0, columnspan=3, pady=(10, 10))
b2.grid(row=2, column=0, pady=(10, 10))

# 강제 실행 버튼 추가
b_force = Button(frame2, text='Force Run', command=checkLocation, font=('Helvetica', 16))
b_force.grid(row=2, column=1, pady=(10, 10), padx=(10, 0))

b3 = Button(main_frame, text='How to use', font=('Helvetica', 12, 'bold'), bg=bg_color, fg="#0645AD", command=lambda: open_url("https://github.com/karpitony/eft-where-am-i/blob/main/README.md"))
b3.grid(row=2, column=0, pady=(10, 10))

b4 = Button(main_frame, text='사용 방법', font=('Helvetica', 12, 'bold'), bg=bg_color, fg="#0645AD", command=lambda: open_url("https://github.com/karpitony/eft-where-am-i/blob/main/README_ko_kr.md"))
b4.grid(row=3, column=0)

window.mainloop()
window.mainloop()
3 changes: 1 addition & 2 deletions requirments.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
keyboard==0.13.5
pyinstaller==6.6.0
pyinstaller-hooks-contrib==2024.6
cx-Freeze==7.0.0
selenium==4.20.0
26 changes: 26 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from cx_Freeze import setup, Executable

name = "EFT Where am I"
version = "1.1"
description = "Description of EFT Where am I"

executables = [
Executable("main.py", base="Win32GUI", target_name="EFT_Where_am_I.exe")
]

options = {
'build_exe': {
'packages': ["keyboard", "selenium"],
'includes': [],
'include_files': [],
'excludes': [],
}
}

setup(
name=name,
version=version,
description=description,
options=options,
executables=executables
)

0 comments on commit 7a08af7

Please sign in to comment.