This commit is contained in:
9700X_PC 2024-12-18 16:57:33 +09:00
parent fa970f6f53
commit 2cd308d64c
4 changed files with 5021 additions and 11 deletions

1681
app.log

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -54,22 +54,54 @@ class KeywordManager(QDialog):
self.logger.log(f"금지어 로드 중 오류 발생: {e}", level=logging.ERROR, exc_info=True)
def add_keyword(self):
new_keyword = self.new_keyword_input.text().strip()
if new_keyword:
# 중복 체크
existing_keywords = [self.keyword_list.item(i).text().strip() for i in range(self.keyword_list.count())]
if new_keyword in existing_keywords:
new_keyword_input = self.new_keyword_input.text().strip()
if not new_keyword_input:
QMessageBox.warning(self, "추가 실패", "금지어를 입력해주세요!")
return
existing_keywords = [self.keyword_list.item(i).text().strip() for i in range(self.keyword_list.count())]
# 콤마로 구분된 단어가 있을 경우
if ',' in new_keyword_input:
# 콤마로 분리
new_keywords = [kw.strip() for kw in new_keyword_input.split(',') if kw.strip()]
# 중복 단어 추적용 리스트
duplicate_words = []
# 새로운 단어 중복 체크 후 추가
for word in new_keywords:
if word in existing_keywords or word in [self.keyword_list.item(i).text().strip() for i in range(self.keyword_list.count())]:
# 중복 발생시 리스트에 추가
duplicate_words.append(word)
else:
# 신규 단어 추가
self.keyword_list.addItem(word)
# 완료 후 파일 저장
self.save_keywords()
self.logger.log(f"금지어 추가(콤마단위): {new_keywords}", level=logging.DEBUG)
# 중복단어가 있었다면 마지막에 한번에 경고
if duplicate_words:
duplicates_str = ", ".join(set(duplicate_words))
QMessageBox.warning(self, "중복 단어", f"다음 단어들은 이미 존재합니다: {duplicates_str}")
# 입력창 비우기
self.new_keyword_input.clear()
else:
# 기존 단일 단어 추가 로직
if new_keyword_input in existing_keywords:
QMessageBox.warning(self, "추가 실패", "이미 존재하는 금지어입니다!")
self.logger.log(f"중복 금지어 추가 시도: {new_keyword}", level=logging.WARNING)
self.logger.log(f"중복 금지어 추가 시도: {new_keyword_input}", level=logging.WARNING)
return
# 금지어 추가
self.keyword_list.addItem(new_keyword)
self.keyword_list.addItem(new_keyword_input)
self.save_keywords()
self.new_keyword_input.clear()
self.logger.log(f"금지어 추가: {new_keyword}", level=logging.DEBUG)
else:
QMessageBox.warning(self, "추가 실패", "금지어를 입력해주세요!")
self.logger.log(f"금지어 추가: {new_keyword_input}", level=logging.DEBUG)
def get_BAN_List(self):
"""