Skip to content

Commit

Permalink
update desc
Browse files Browse the repository at this point in the history
  • Loading branch information
jshsakura committed Sep 25, 2023
1 parent b87bf34 commit 5b210ff
Show file tree
Hide file tree
Showing 20 changed files with 175 additions and 48 deletions.
43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<img src="https://github.com/jshsakura/passion-gamer/blob/master/screenshots/preview-passion-gamer2.png?raw=true"></img>
</p>

- `์„ค์ •`์˜ ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ์„ค์ • ํŒ์—…์„ ๋„์šฐ๊ณ  `ํด๋” ์„ ํƒ` ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ๋กฌ ํŒŒ์ผ ๊ฒฝ๋กœ๋ฅผ ์ง€์ •ํ•˜๊ณ  `์ €์žฅ`์„ ๋ˆŒ๋Ÿฌ์ค๋‹ˆ๋‹ค.
- `์„ค์ •`์˜ ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ์„ค์ • ํŒ์—…์„ ๋„์šฐ๊ณ  `ํด๋” ์„ ํƒ` ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ๋กฌ ํด๋” ๊ฒฝ๋กœ๋ฅผ ์ง€์ •ํ•˜๊ณ  `์ €์žฅ`์„ ๋ˆŒ๋Ÿฌ์ค๋‹ˆ๋‹ค.
<br/>
<p align="center">
<img src="https://github.com/jshsakura/passion-gamer/blob/master/screenshots/preview-passion-gamer3.png?raw=true"></img>
Expand All @@ -47,7 +47,8 @@
</p>

- ๋งŒ์•ฝ ์กฐํšŒ๋œ ๋ชฉ๋ก์—์„œ ๋กฌ ํŒŒ์ผ ๋ช…์„ ํ™•์ธํ•˜๊ณ  ๋ˆ„๋ฝ๋œ ๊ฑด์ด ์žˆ๋‹ค๋ฉด ์ž…๋ ฅํ•ด์ค๋‹ˆ๋‹ค.
- ์‚ฌ์ „ ์ž…๋ ฅ๋œ ํ•œ๊ธ€ ๋กฌํŒŒ์ผ ๋ชฉ๋ก์€ ๋ฌด์ ํ’ํ™”๋ฅœ ์†Œํ†ต์นดํŽ˜์˜ `์‚ผ์ƒ‰์ด๋ƒฅ`๋‹˜์ด ๊ณ ์ƒํ•ด์ฃผ์…จ์Šต๋‹ˆ๋‹ค. (๋„ˆ๋ฌด๋‚˜ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.)
- ์‚ฌ์ „ ์ž…๋ ฅ๋œ ํ•œ๊ธ€ ๋กฌํŒŒ์ผ ๋ชฉ๋ก์€ ๋ฌด์ ํ’ํ™”๋ฅœ ์†Œํ†ต์นดํŽ˜์˜ `์‚ผ์ƒ‰์ด๋ƒฅ`๋‹˜์ด ๊ณ ์ƒํ•ด์ฃผ์…จ์Šต๋‹ˆ๋‹ค. ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.
- ์•„์ผ€์ด๋“œ ํ•œ๊ธ€ ๋ฐ”๋กœ๊ฐ€๊ธฐ์˜ ๊ฒฝ์šฐ `๋“œ๋“œ๋ผ`๋‹˜์ด ๊ณ ์ƒํ•ด์ฃผ์…จ์Šต๋‹ˆ๋‹ค. ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.
- ์ „์ฒด ํ•œ๊ธ€ ๋กฌ ํŒŒ์ผ๋ช… ๋ชฉ๋ก์€ [๊ตฌ๊ธ€ ๋…์Šค](https://docs.google.com/spreadsheets/d/1TCoolDlFeeaH3LgBsC6shHvN7u_Tk5liIAX56BhsfSs/edit?usp=sharing)์—์„œ ํ™•์ธ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

<br/>
Expand Down Expand Up @@ -85,10 +86,47 @@
</p>

- ๋ณธ ํ”„๋กœ๊ทธ๋žจ์€ SD ์นด๋“œ์˜ ๋กฌ ํด๋” ๋‚ด์˜ ํŒŒ์ผ ๋ช…์„ ์‹ค์ œ๋กœ ์ง์ ‘ ๋ณ€๊ฒฝํ•˜๊ธฐ ๋•Œ๋ฌธ์—, ์•„๋ฌด์ชผ๋ก ๋ฐฑ์—…์ด ์ค‘์š”ํ•˜๋ฉฐ ์‚ฌ์šฉ์— ์ฃผ์˜๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

<br/>
<p align="center">
<img src="https://github.com/jshsakura/passion-gamer/blob/master/screenshots/preview-passion-gamer10.png?raw=true"></img>
</p>

- ํ•œ๊ธ€ ๋ชฉ๋ก์œผ๋กœ ๋ณ€ํ™˜ ์ดํ›„ ์˜๋ฌธ ํ‚ค๋ณด๋“œ๋งŒ ์ง€์›ํ•˜๋Š” ๋•์— ๊ฒ€์ƒ‰์ด ๋ถˆ๊ฐ€๋Šฅํ•ด์ง€๊ฑฐ๋‚˜ ๊ธฐ์กด ๊ฒŒ์ž„์˜ [์ˆ์ปท ๋งํฌ](https://cafe.naver.com/moopung?iframe_url=/ArticleSearchList.nhn%3Fsearch.clubid=29771102%26search.searchdate=all%26search.searchBy=3%26search.query=%BB%EF%BB%F6%C0%CC%B3%C9%26search.defaultValue=1%26search.sortBy=date) ๊ฐ€ ๋™์ž‘ํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ์ง์ ‘ ์‚ฌ์šฉ์ž๊ฐ€ ์ˆ˜์ •์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

- ๋„ค์ด๋ฒ„ ๋ฌด์ ํ’ํ™”๋ฅœ๋‹˜์˜ ์†Œํ†ต์นดํŽ˜ ์ธก [์ˆ์ปท ๋งํฌ](https://cafe.naver.com/moopung?iframe_url=/ArticleSearchList.nhn%3Fsearch.clubid=29771102%26search.searchdate=all%26search.searchBy=3%26search.query=%BB%EF%BB%F6%C0%CC%B3%C9%26search.defaultValue=1%26search.sortBy=date) ์ˆ˜์ • ๋ฐฉ๋ฒ•์„ ์ฐธ๊ณ ํ•ด `SF2000`์˜ SD ์นด๋“œ ์•ˆ์— `Resource` ํด๋”์˜ `xfgle.hgp` ํŒŒ์ผ์„ ๊ต์ฒดํ•˜๊ฑฐ๋‚˜ ์ˆ˜์ •ํ•ด์ค˜์•ผ๋งŒ ์ •์ƒ์ ์œผ๋กœ ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

- ํ•œ๊ธ€๋ช…์œผ๋กœ ํ•ด๋‹น ๋กฌ์˜ ํŒŒ์ผ๋ช…์„ ์ˆ˜์ •ํ•œ ๊ฒฝ์šฐ, ๋งํฌ ๊ธฐ๋Šฅ์€ ํ•˜๋‹จ์˜ `ํ•œ๊ธ€ ์ˆ์ปท ์„ค์น˜` ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ์„ค์น˜๊ฐ€ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

<br/>
<p align="center">
<img src="https://github.com/jshsakura/passion-gamer/blob/master/screenshots/preview-passion-gamer11.png?raw=true"></img>
</p>

- `ํ•œ๊ธ€ ์ˆ์ปท`์ด ์ ์šฉ๋˜๋Š” ๋กฌ ํŒŒ์ผ ํ•ญ๋ชฉ์˜ ๊ฒฝ์šฐ ํŒŒ์ผ๋ช… ์ˆ˜์ •์‹œ ์ง์ ‘ `Resources` ํด๋”์˜ ํŒŒ์ผ์„ ์ˆ˜์ •ํ•ด์•ผํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ˆ˜์ •ํ•˜๋ ค๋Š” ๊ฒฝ์šฐ ์œ„์™€ ๊ฐ™์€ ๊ฒฝ๊ณ ๊ฐ€ ๋‚˜ํƒ€๋‚ฉ๋‹ˆ๋‹ค.

<br/>
<p align="center">
<img src="https://github.com/jshsakura/passion-gamer/blob/master/screenshots/preview-passion-gamer12.png?raw=true"></img>
</p>

- ์ถ”๊ฐ€๋กœ ๋ฌด์ž‘์ • ํŒŒ์ผ ๊ต์ฒด๋ฅผ ํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹Œ, ๋กฌ ํด๋”์— ์‹ค์ œ ํ•œ๊ธ€ ์ˆ์ปท์„ ์œ„ํ•œ ๋กฌ ํŒŒ์ผ์ด ์กด์žฌํ•˜๋Š” ๊ฒฝ์šฐ์—๋งŒ `ํ•œ๊ธ€ ์ˆ์ปท`์ด ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.

<br/>
<p align="center">
<img src="https://github.com/jshsakura/passion-gamer/blob/master/screenshots/preview-passion-gamer13.png?raw=true"></img>
</p>

- `SF2000`์˜ SD ์นด๋“œ ๋‚ด๊ธฐ๋ณธ ํ…Œ๋งˆ๋ฅผ ์ธ๋””์ผ€์ดํ„ฐ๊ฐ€ ํฌํ•จ๋œ ๋ฌด๋ ค ํ•œ๊ธ€ ํ…Œ๋งˆ๋กœ ๋ณ€๊ฒฝํ•˜๋Š” `๋“œ๋“œ๋ผ`๋‹˜์˜ ์ปค์Šคํ…€ ์—ํ”ฝ ๋Š์™€๋ฅด ํ…Œ๋งˆ์ž…๋‹ˆ๋‹ค.

<br/>
<p align="center">
<img src="https://github.com/jshsakura/passion-gamer/blob/master/screenshots/preview-passion-gamer14.png?raw=true"></img>
</p>

- ์ƒ๋‹จ์˜ `๋“œ๋“œ๋ผ ํ…Œ๋งˆ` ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด `SF2000`์˜ `Resources` ํด๋”์— ํŒŒ์ผ์„ ํ™•์ธํ•˜๊ณ , ํ…Œ๋งˆ ์ ์šฉ์— ํ•„์š”ํ•œ 44๊ฐœ์˜ ํŒŒ์ผ์ด ์กด์žฌํ•˜๋ฉด ํ•ด๋‹น ํŒŒ์ผ๋“ค์„ ๋ฎ์–ด ์“ฐ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
- ํ˜ผ์พŒํžˆ ํ…Œ๋งˆ๋ฅผ ์ œ๊ณตํ•ด์ฃผ์‹  `๋“œ๋“œ๋ผ`๋‹˜๊ป˜ ๊ฐ์‚ฌ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

<br/>

## ๐Ÿ’Œ ๋ฌดํ•œํ•œ ๊ฐ์‚ฌ๋ฅผ ๋“œ๋ฆฝ๋‹ˆ๋‹ค. ๐Ÿซถ
Expand All @@ -98,4 +136,5 @@
- ํ”„๋กœ๊ทธ๋žจ์˜ ๋กœ๋”ฉ ์˜ค๋ฒ„๋ ˆ์ด ์•„์ด์ฝ˜์€ [loading.io](https://loading.io) ์—์„œ ๋ฌด๋ฃŒ `svg` ์•„์ด์ฝ˜์„ ์ด์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
- ๋กฌํŒŒ์ผ์˜ ์ธ๋„ค์ผ ์ถ”์ถœ์„ ์œ„ํ•ด [tadpole](https://github.com/EricGoldsteinNz/tadpole) ์ด ์ˆ˜์ •ํ•œ `frogtool.py`์„ ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.
- ๊ธฐ์ข…๋ณ„ ์•„์ด์ฝ˜์€ `Onion OS`์˜ [Dot-art by Yoshi-kun](https://github.com/OnionUI/Themes) ๋ฅผ ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.
- ํ…Œ๋งˆ ์„ค์น˜ ๊ธฐ๋Šฅ์€ ๋ฌด์ ํ’ํ™”๋ฅœ ์†Œํ†ต์นดํŽ˜์˜ [๋“œ๋“œ๋ผ ํ…Œ๋งˆ](https://cafe.naver.com/moopung?iframe_url_utf8=%2FArticleRead.nhn%253Fclubid%3D29771102%2526articleid%3D147884%2526commentFocus%3Dtrue) ๋ฅผ ํ—ˆ๋ฝ ๋ฐ›์•„ ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.
- ์นœ์ ˆํ•œ ๋„์šฐ๋ฏธ, ๊ทธ๋Ÿฌ๋‚˜ ์‹ฌ๊ฐํ•˜๊ฒŒ ๋ฉ์ฒญํ•œ [ChatGPT](https://chat.openai.com/)์˜ ์ฝ”๋“œ ๋ฆฌํŒฉํ† ๋ง ์„œํฌํŠธ.
90 changes: 81 additions & 9 deletions core/gui/behavior.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import os
import logging
from pathlib import Path
import shutil
from .frogtool import zxx_ext

from PyQt5.QtCore import Qt, QThreadPool, QSize
from PyQt5.QtCore import Qt, QThreadPool, QSize, QTimer
from PyQt5.QtGui import QColor
from core.gui.worker import RomScannerWorker
from .helpers import *
from PyQt5.QtWidgets import QFileDialog
from PyQt5.QtGui import QStandardItem, QImage, QIcon, QPixmap
from PyQt5.QtWidgets import QApplication


class GuiBehavior:
Expand All @@ -26,6 +24,7 @@ def __init__(self, gui):
self.current_roms_list = [] # ํ˜„์žฌ ํŽ˜์ด์ง€์˜ ๋กฌ ๋ชฉ๋ก
self.remove_roms_list = [] # ์‚ญ์ œํ•  ๋กฌ ๋ชฉ๋ก
self.except_roms_list = [] # ์‚ญ์ œํ•  ๋กฌ ๋ชฉ๋ก
self.msg_box = None

def get_current_page_roms(self):
# ํ˜„์žฌ ํŽ˜์ด์ง€์— ํ•ด๋‹นํ•˜๋Š” ๋กฌ ๋ชฉ๋ก์„ ๋ฐ˜ํ™˜
Expand Down Expand Up @@ -82,13 +81,54 @@ def handle_init(self):
settings.append(1)
self.settings = settings

def set_resource_install(self, action):
def check_shortcut_files(self):
# ๋กฌ ํด๋” ๊ฒฝ๋กœ (์ด๋ฏธ ์•Œ๊ณ  ์žˆ๋Š” ๊ฒฝ๋กœ๋กœ ์„ค์ •ํ•˜์„ธ์š”)
roms_folder = get_settings('directory')
roms_list = []
# ๊ฒ€์ƒ‰ํ•  platform_name ๊ฐ’๋“ค
target_platforms = ['ARCADE', 'FC', 'GB', 'GBA', 'GBC',
'MD', 'SFC'] # 'ARCADE'๋Š” zfb ๊ต์ฒด
target_file_extension = ['.zfb', '.zfc',
'.zgb', '.zmd', '.zsf']
# ์ˆ์ปท ๋Œ€์ƒ ํŒŒ์ผ
shortcut_links = get_db_shortcut_game_name()

if roms_folder:
for root, dirs, files in os.walk(roms_folder):
for file in files:
rom_path = os.path.normpath(os.path.join(root, file))
file_extension = os.path.splitext(file)[-1].lower()
origin_filename = get_file_name_without_extension(rom_path)
platform_name = get_platform_name(rom_path)

if file_extension in target_file_extension and platform_name in target_platforms and origin_filename in shortcut_links:
shortcut_links.remove(origin_filename)
logging.debug(
f'ํ•œ๊ธ€ ์ˆ์ปท ๋Œ€์ƒ์ธ {platform_name} ํ”Œ๋žซํผ์˜ [ {origin_filename} ] ์„ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค!')

# ์ˆ์ปท ๊ฐฏ์ˆ˜ ์ฒดํฌ
if len(shortcut_links) == 0:
return True
else:
return False

def set_resource_install(self, action):
# ๋กฌ ํด๋” ๊ฒฝ๋กœ
roms_folder = get_settings('directory')
# ๊ฒ€์ƒ‰ํ•  ํด๋”
target_folder = 'Resources'
resources_path = None
custom_resources_files = []
# ์ž‘์—…๋ช… ์„ค์ •
work_name = '๋“œ๋“œ๋ผ ํ…Œ๋งˆ' if action == 'theme' else 'ํ•œ๊ธ€ ์ˆ์ปท'

if action == 'shortcut':
find_shortcut = self.check_shortcut_files()
if not find_shortcut:
alert(
f'๋กฌ ํด๋”์— {work_name}์„ ์„ค์ •ํ•˜๋ ค๋ฉด ์šฐ์„  ๋กฌ ํŒŒ์ผ์„ ํ•œ๊ธ€ ํŒŒ์ผ๋ช…์œผ๋กœ ์ˆ˜์ •ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.\n์„ค์ •ํ•˜์‹  ํŒŒ์ผ ๊ฒฝ๋กœ์—์„œ ํ•œ๊ธ€ ์ˆ์ปท์— ํ•ด๋‹น๋˜๋Š” ํ•œ๊ธ€ ๋กฌ ํŒŒ์ผ๋ช…์„ ๊ฒ€์ƒ‰ํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค.\n์•„์ง ํŒŒ์ผ๋ช…์„ ๋ณ€๊ฒฝํ•˜์ง€ ์•Š์•˜๋‹ค๋ฉด ๋จผ์ € ํŒŒ์ผ๋ช…์„ ๋ณ€๊ฒฝํ•ด์ฃผ์„ธ์š”.')
return

# ๋ฆฌ์†Œ์Šค ํด๋” ๊ฒ€์ƒ‰
if roms_folder:
# ๋ฆฌ์†Œ์Šค ํด๋” ๊ฒ€์ƒ‰
Expand Down Expand Up @@ -160,9 +200,9 @@ def set_resource_install(self, action):
logging.debug(f"ํŒจ์น˜๋ฅผ ์œ„ํ•ด {custom_file}๋ฅผ ๋ฎ์–ด์ผ์Šต๋‹ˆ๋‹ค.")

# 5. ์ตœ์ข… ์ž‘์—… ๊ฒฐ๊ณผ ์•Œ๋ฆผ.
work_name = '๋“œ๋“œ๋ผ ํ…Œ๋งˆ' if action == 'theme' else 'ํ•œ๊ธ€ ์ˆ์ปท'
if change_files > 0 and change_files == target_resources_cnt:
alert(f'Resources ํด๋” ์•ˆ์— ํŒŒ์ผ์„ ๋ฎ์–ด์“ฐ๊ณ , {work_name} ์„ค์น˜ ์ž‘์—…์ด ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.')
alert(
f'Resources ํด๋” ์•ˆ์— ํŒŒ์ผ์„ ๋ฎ์–ด์“ฐ๊ณ , {work_name} ์„ค์น˜ ์ž‘์—…์ด ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.')
elif change_files > 0:
alert(
f'{work_name} ์„ค์น˜๋ฅผ ์œ„ํ•ด ํ•„์š”ํ•œ ์ด {target_resources_cnt} ๊ฐœ์˜ ํŒŒ์ผ ์ค‘ {change_files} ๊ฐœ๋งŒ ๊ฒ€์ƒ‰๋˜์—ˆ์Šต๋‹ˆ๋‹ค.\n[์„ค์ •] ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ์„ ํƒํ•˜์‹  SD ์นด๋“œ ๊ฒฝ๋กœ๋ฅผ ํ™•์ธํ•ด์ฃผ์„ธ์š”.')
Expand Down Expand Up @@ -246,8 +286,8 @@ def get_roms_list(self, action):

roms_list.append({"file_path": rom_path, "platform_name": platform_name, "origin_filename": origin_filename, "shortcut_link": shortcut_link,
"new_filename": new_filename, "status": status, "status_name": status_name, "file_size": file_size, "file_byte_size": file_byte_size, "thumbnail": thumbnail, "platform_icon": platform_icon})
else:
alert('์„ค์ •ํ•˜์‹  ๋กฌ ํŒŒ์ผ ๊ฒฝ๋กœ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.')
# else:
# alert('์„ค์ •ํ•˜์‹  ๋กฌ ํด๋” ๊ฒฝ๋กœ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.')

self.all_roms_list = roms_list

Expand Down Expand Up @@ -440,6 +480,12 @@ def roms_scan(self):
self.all_roms_list = []
self.current_roms_list = []

# ๋กฌ ํด๋” ๊ฒฝ๋กœ ์„ค์ • ํ™•์ธ
roms_folder = get_settings('directory')
if not roms_folder:
alert('์„ค์ •ํ•˜์‹  ๋กฌ ํด๋” ๊ฒฝ๋กœ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.')
return

# ์Šค์บ” ์‹œ์ž‘ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅผ ๋•Œ ๋กœ๋”ฉ ์˜ค๋ฒ„๋ ˆ์ด๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
worker = RomScannerWorker(self, action='scan')
worker.signals.showLoading.connect(self.gui.show_loading_overlay)
Expand All @@ -454,6 +500,12 @@ def roms_unnecessary(self):
self.all_roms_list = []
self.current_roms_list = []

# ๋กฌ ํด๋” ๊ฒฝ๋กœ ์„ค์ • ํ™•์ธ
roms_folder = get_settings('directory')
if not roms_folder:
alert('์„ค์ •ํ•˜์‹  ๋กฌ ํด๋” ๊ฒฝ๋กœ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.')
return

# ์Šค์บ” ์‹œ์ž‘ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅผ ๋•Œ ๋กœ๋”ฉ ์˜ค๋ฒ„๋ ˆ์ด๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
worker = RomScannerWorker(self, action='unnecessary')
worker.signals.showLoading.connect(self.gui.show_loading_overlay)
Expand All @@ -464,7 +516,8 @@ def roms_unnecessary(self):
def roms_replace(self):
# ํ…Œ์ด๋ธ”์ด ๋น„์—ˆ๋Š”์ง€ ํ™•์ธ
if self.gui.table_model.rowCount() == 0:
alert('ํ˜„์žฌ ํ™”๋ฉด์˜ ์ˆ˜์ • ๋ชฉ๋ก์ด ๋น„์–ด ์žˆ์Šต๋‹ˆ๋‹ค.\n๋จผ์ € ์„ค์ •์—์„œ ๋กฌ ํด๋”๋ฅผ ์ง€์ •ํ•˜๊ณ  ๋กฌ ํŒŒ์ผ์„ ๊ฒ€์ƒ‰ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.')
alert(
'ํ˜„์žฌ ํ™”๋ฉด์˜ ์ˆ˜์ • ๋ชฉ๋ก์ด ๋น„์–ด ์žˆ์Šต๋‹ˆ๋‹ค.\n๋จผ์ € ์„ค์ •์—์„œ ๋กฌ ํด๋”๋ฅผ ์ง€์ •ํ•˜๊ณ  ๋กฌ ํŒŒ์ผ์„ ๊ฒ€์ƒ‰ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.')
return

if not self.confirm_bulk_rename():
Expand Down Expand Up @@ -762,3 +815,22 @@ def sort_all_roms_list(self, column, order):

# ํ˜„์žฌ ํŽ˜์ด์ง€๋ฅผ ๋‹ค์‹œ ๊ทธ๋ฆฝ๋‹ˆ๋‹ค.
self.populate_table_with_roms()

# def alert(self, text):
# # ์ด๋ฏธ ์—ด๋ ค ์žˆ๋Š” ๋ฉ”์‹œ์ง€ ๋ฐ•์Šค๋ฅผ ๋‹ซ์Œ
# if self.msg_box:
# self.msg_box.close()

# # ์ƒˆ๋กœ์šด ๋ฉ”์‹œ์ง€ ๋ฐ•์Šค ์ƒ์„ฑ
# self.msg_box = QMessageBox()
# self.msg_box.setIcon(QMessageBox.Information)
# self.msg_box.setWindowTitle('์•ˆ๋‚ด')
# self.msg_box.setText(text)
# self.msg_box.setGeometry(
# int(self.gui.main.geometry().center().x() - 150 // 2),
# int(self.gui.main.geometry().center().y() - 100 // 2),
# 150,
# 100
# )

# self.msg_box.exec_()
17 changes: 9 additions & 8 deletions core/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
from PyQt5.QtGui import QIcon, QStandardItemModel, QPixmap, QFontDatabase, QFont, QColor
from PyQt5.QtWidgets import (QApplication, QMainWindow, QGridLayout, QPushButton, QWidget,
QTableView, QHBoxLayout, QVBoxLayout, QAbstractItemView, QMenu, QAction,
QAbstractScrollArea, QLabel, QLineEdit, QStackedWidget, QToolTip,
QAbstractScrollArea, QLabel, QLineEdit, QStackedWidget, QMessageBox,
QFormLayout, QListWidget, QComboBox, QSizePolicy, QHeaderView, QHeaderView, QStyledItemDelegate)
from .helpers import absp, database_init, alert
from .helpers import *


class Gui:
Expand All @@ -24,6 +24,7 @@ def __init__(self):
self.app_name = 'Retro Passion gamer'
self.font = None
self.table_model = None
self.msg_box = None

# Init DB
database_init()
Expand Down Expand Up @@ -142,7 +143,7 @@ def main_init(self):
self.main.settings_btn.clicked.connect(lambda: self.settings.show(
) if not self.settings.isVisible() else self.settings.raise_())
self.main.theme_btn = QPushButton(
QIcon(absp('res/icon/smile.svg')), ' ๋“œ๋“œ๋ผ ํ…Œ๋งˆ ์„ค์น˜')
QIcon(absp('res/icon/smile.svg')), ' ๋“œ๋“œ๋ผ ํ…Œ๋งˆ')
self.main.shortcut_btn = QPushButton(
QIcon(absp('res/icon/external-link.svg')), ' ํ•œ๊ธ€ ์ˆ์ปท ์„ค์น˜')

Expand Down Expand Up @@ -177,6 +178,7 @@ def main_init(self):

hbox.addWidget(self.main.refresh_btn)
hbox.addWidget(self.main.remove_cn_btn)
hbox.addWidget(self.main.shortcut_btn)
hbox.addWidget(self.main.except_btn)
hbox.addWidget(self.main.remove_btn)
hbox.addWidget(self.main.edit_btn)
Expand Down Expand Up @@ -211,16 +213,15 @@ def main_init(self):

grid.addWidget(self.main.settings_btn, 1, 0)
grid.addWidget(self.main.theme_btn, 1, 1)
grid.addWidget(self.main.shortcut_btn, 1, 2)
grid.addWidget(self.main.page_label, 1, 3)
grid.addWidget(button_container, 1, 4)
grid.addWidget(self.main.page_label, 1, 4)
grid.addWidget(button_container, 1, 5)

self.main.setWindowFlags(self.main.windowFlags()
& Qt.CustomizeWindowHint)

# Append widgets to grid
grid.addWidget(self.table, 2, 0, 1, 5)
grid.addLayout(hbox, 3, 0, 1, 5)
grid.addWidget(self.table, 2, 0, 1, 6)
grid.addLayout(hbox, 3, 0, 1, 6)
widget.setLayout(grid)
self.main.resize(720, 450)
# Set size policies for the table
Expand Down
67 changes: 41 additions & 26 deletions core/gui/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,6 @@ def abs_config(path):
return resolved_path


def alert(text):
'''
Create and show QMessageBox Alert.
'''
msg = QMessageBox()
msg.setIcon(QMessageBox.Warning)
msg.setWindowTitle('์•ˆ๋‚ด')
# ํ™”๋ฉด ์ค‘์•™ ์ขŒํ‘œ ๊ณ„์‚ฐ
screen_geo = QApplication.primaryScreen().geometry()
screen_center = screen_geo.center()

# ๋ฉ”์‹œ์ง€ ๋ฐ•์Šค์˜ ํฌ๊ธฐ๋ฅผ ์„ค์ •
msg_box_width = 300 # ๋ฉ”์‹œ์ง€ ๋ฐ•์Šค์˜ ๋„ˆ๋น„
msg_box_height = 200 # ๋ฉ”์‹œ์ง€ ๋ฐ•์Šค์˜ ๋†’์ด

# ๋ฉ”์‹œ์ง€ ๋ฐ•์Šค๋ฅผ ํ™”๋ฉด ์ค‘์•™์œผ๋กœ ์ด๋™
msg.setGeometry(
screen_center.x() - msg_box_width // 2,
screen_center.y() - msg_box_height // 2,
msg_box_width,
msg_box_height
)
msg.setText(text)
msg.exec_()


def create_file(f):
'''
Create empty file.
Expand Down Expand Up @@ -149,6 +123,20 @@ def get_db_game_name(platform_name, origin_filename):
return {"kr_filename": '', "shortcut_link": ''}


def get_db_shortcut_game_name():
category = 'gamelists'
conn = sqlite3.connect('app/local.db')
c = conn.cursor()
c.execute(
"SELECT kr_filename FROM gamelists WHERE shortcut_link IS NOT NULL AND shortcut_link != ''")
# ๋ชจ๋“  ๋ ˆ์ฝ”๋“œ ๊ฐ€์ ธ์˜ค๊ธฐ
results = c.fetchall()
# ์—ฐ๊ฒฐ ์ข…๋ฃŒ
conn.close()
# ๊ฒฐ๊ณผ ๋ฐ˜ํ™˜
return [row[0] for row in results] if results else []


def set_settings(key, value):
category = 'settings'
conn = sqlite3.connect('app/local.db')
Expand Down Expand Up @@ -189,3 +177,30 @@ def get_platform_name(file_path):
last_folder = directories[-1]

return last_folder


def alert(text):
'''
Create and show QMessageBox Alert.
'''
msg = QMessageBox()
msg.setIcon(QMessageBox.Warning)
msg.setWindowTitle('์•ˆ๋‚ด')
# ํ™”๋ฉด ์ค‘์•™ ์ขŒํ‘œ ๊ณ„์‚ฐ
screen_geo = QApplication.primaryScreen().geometry()
screen_center = screen_geo.center()

# ๋ฉ”์‹œ์ง€ ๋ฐ•์Šค์˜ ํฌ๊ธฐ๋ฅผ ์„ค์ •
msg_box_width = 300 # ๋ฉ”์‹œ์ง€ ๋ฐ•์Šค์˜ ๋„ˆ๋น„
msg_box_height = 200 # ๋ฉ”์‹œ์ง€ ๋ฐ•์Šค์˜ ๋†’์ด

# ๋ฉ”์‹œ์ง€ ๋ฐ•์Šค๋ฅผ ํ™”๋ฉด ์ค‘์•™์œผ๋กœ ์ด๋™
msg.setGeometry(
screen_center.x() - msg_box_width // 2,
screen_center.y() - msg_box_height // 2,
msg_box_width,
msg_box_height
)

msg.setText(text)
msg.exec_()
Loading

0 comments on commit 5b210ff

Please sign in to comment.