diff --git a/CLAUDE.md b/CLAUDE.md index caaa97e..dca8d10 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -61,7 +61,7 @@ CI(`.github/workflows/build.yml`)가 Windows/macOS/Linux에서 테스트 → PyI - **환경설정·자동 저장**(`ui/prefs.py`): 데이터 폴더의 `prefs.json`(최근 파일, 마지막 폴더, 창 geometry·splitter)과 `autosave.kst`(+`.json` 메타). `MainWindow._dirty`가 변경을 추적해 3분마다 자동 저장하고, 시작 시 `offer_recovery()`가 복구를 묻는다. `closeEvent`는 dirty면 저장 여부를 묻는데 **테스트에서는 `window.ask_before_close = False`**로 꺼야 한다(pytest-qt가 teardown에서 창을 닫을 때 모달이 떠서 멈춤). 예제 파일은 최근 목록에 넣지 않는다. - **로그·진단**(`paths.py`): `setup_logging()`이 사용자 데이터 폴더(`KSTRUCT_DATA_DIR`로 재지정 가능)에 회전 로그를 쓰고, `install_excepthook` + `MainWindow.install_crash_dialog`가 처리되지 않은 예외를 로그·대화상자로 보낸다. "문제 보고"는 로그+환경+.kst를 zip으로 묶는다(`ui/dialogs.py`). 릴리스 버전은 `kstruct.RELEASE_VERSION`(pyproject와 일치, 테스트 확인)이고, `packaging/build.py`가 빌드마다 `packaging/build_number.txt`를 +1 하거나(CI는 `KSTRUCT_BUILD_NUMBER` = run number) `src/kstruct/_build.py`(git 무시)에 스탬프를 써서 `__version__` = `릴리스.빌드번호`(예 0.1.0.57)가 된다. 정보 창·로그·보고서·설치 파일 이름이 모두 이 값을 쓴다(`build_info()`는 날짜·커밋 포함). `kstruct --version`으로 확인. -- **업데이트·문의·후원**(`update.py`, `ui/updates.py`, 주소는 `resources/links.json`): 업데이트는 GitHub Releases(`MinaryHub/KStruct`, **공개** 저장소)의 `/releases/latest` 태그(`v0.2.0`)를 `RELEASE_VERSION`과 비교한다(빌드 번호는 비교 안 함). 토큰은 선택(비로그인 한도 시간당 60회 회피·비공개 전환 대비): 환경 변수 `KSTRUCT_GITHUB_TOKEN`(우선) 또는 업데이트 창에서 입력해 `prefs.json`에 저장. 설치 파일은 API 자산 URL로 받는데 저장소 호스트로 리다이렉트될 때 **Authorization을 떼야 한다**(`_request`; 두 인증이 겹치면 거부되고 토큰이 새어 나감). 받은 파일은 릴리스의 `SHA256SUMS.txt`와 대조해 다르면 지운다. Windows는 Inno Setup을 `/SILENT /CLOSEAPPLICATIONS`로 실행하고 앱을 닫으며(저장 확인은 `close()`가 묻고 취소하면 설치 안 함), 설치 스크립트의 `skipifnotsilent` [Run] 항목이 새 버전을 다시 연다. macOS는 dmg를 열고, Linux는 폴더를 연다. 소스 실행(`frozen()` 거짓)은 받기만 한다. 시작 시 확인은 `app.main`에서만(`check_updates_quietly`, 하루 1회, 끌 수 있음) — 테스트 창은 네트워크를 쓰지 않는다. 네트워크는 스레드 + Qt 시그널(`_Task`). 문의하기는 버전·환경을 채운 새 이슈 페이지, 후원하기는 GitHub Sponsors(MinaryHub). 툴바 오른쪽은 1280 px에서 넘치지 않게 아이콘만(업데이트가 있을 때만 '업데이트 x.y.z' 글자 버튼), 정보 버튼은 같은 항목의 메뉴. +- **업데이트·문의·후원**(`update.py`, `ui/updates.py`, 주소는 `resources/links.json`): 업데이트는 GitHub Releases(`MinaryHub/KStruct`, **공개** 저장소)의 `/releases/latest` 태그(`v0.2.0`)를 `RELEASE_VERSION`과 비교한다(빌드 번호는 비교 안 함). 토큰은 선택(비로그인 한도 시간당 60회 회피·비공개 전환 대비): 환경 변수 `KSTRUCT_GITHUB_TOKEN`(우선) 또는 업데이트 창에서 입력해 `prefs.json`에 저장. 설치 파일은 API 자산 URL로 받는데 저장소 호스트로 리다이렉트될 때 **Authorization을 떼야 한다**(`_request`; 두 인증이 겹치면 거부되고 토큰이 새어 나감). 받은 파일은 릴리스의 `SHA256SUMS.txt`와 대조해 다르면 지운다. Windows는 Inno Setup을 `/SILENT /CLOSEAPPLICATIONS`로 실행하고 앱을 닫으며(저장 확인은 `close()`가 묻고 취소하면 설치 안 함), 설치 스크립트의 `skipifnotsilent` [Run] 항목이 새 버전을 다시 연다. macOS는 dmg를 열고, Linux는 폴더를 연다. 소스 실행(`frozen()` 거짓)은 받기만 한다. 시작 시 확인은 `app.main`에서만(`check_updates_quietly`, 하루 1회, 끌 수 있음) — 테스트 창은 네트워크를 쓰지 않는다. 네트워크는 스레드 + Qt 시그널(`_Task`). 문의하기는 메뉴: '오류 신고'는 버전·환경을 채운 새 이슈 페이지(`open_contact`, 오류 대화상자도 이것), '질문·아이디어'는 GitHub Discussions(`open_discussion`, `links.json`의 `discussions`; 저장소 설정에서 Discussions가 켜져 있어야 함), 후원하기는 GitHub Sponsors(MinaryHub). 툴바 오른쪽은 1280 px에서 넘치지 않게 아이콘만(업데이트가 있을 때만 '업데이트 x.y.z' 글자 버튼), 정보 버튼은 같은 항목의 메뉴. ## OCP(cadquery-ocp 8.x, OCCT 8) 주의 diff --git a/packaging/windows/kstruct.iss b/packaging/windows/kstruct.iss index f1248b0..f91caaa 100644 --- a/packaging/windows/kstruct.iss +++ b/packaging/windows/kstruct.iss @@ -1,8 +1,8 @@ ; Inno Setup script: builds KStruct-Setup-.exe from dist\KStruct -; Build: iscc /DAppVersion=0.3.1 packaging\windows\kstruct.iss +; Build: iscc /DAppVersion=0.3.2 packaging\windows\kstruct.iss #ifndef AppVersion - #define AppVersion "0.3.1" + #define AppVersion "0.3.2" #endif [Setup] diff --git a/pyproject.toml b/pyproject.toml index b7d8ba7..c50a740 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "kstruct" -version = "0.3.1" +version = "0.3.2" description = "Mechanical part FEA for non-experts" readme = "README.md" authors = [ diff --git a/src/kstruct/__init__.py b/src/kstruct/__init__.py index df2b798..5c72b59 100644 --- a/src/kstruct/__init__.py +++ b/src/kstruct/__init__.py @@ -1,6 +1,6 @@ """KStruct: mechanical part FEA for non-experts.""" -RELEASE_VERSION = "0.3.1" # keep in sync with pyproject.toml (tests check) +RELEASE_VERSION = "0.3.2" # keep in sync with pyproject.toml (tests check) # The build number is stamped into kstruct/_build.py by packaging/build.py (and by the CI # workflow) right before freezing, so every build gets a higher version: diff --git a/src/kstruct/resources/help/en.json b/src/kstruct/resources/help/en.json index cbc3ae7..1bbf6cc 100644 --- a/src/kstruct/resources/help/en.json +++ b/src/kstruct/resources/help/en.json @@ -542,8 +542,8 @@ }, "help.contact": { "title": "Contact us", - "short": "Sends questions, suggestions or bug reports as a GitHub issue (version and environment details are filled in for you).", - "detail": "Opens the new issue page of the KStruct repository (GitHub, MinaryHub/KStruct) in your browser. The version and operating system are already filled in, so just describe what you were doing and what happened. You need to sign in with a (free) GitHub account to write an issue, and issues are visible to everyone, so do not include confidential company drawings or figures. If logs and the project file are needed, drag the zip file created with 'Report a problem' into the issue body to attach it (it will be public, so check its contents before uploading)." + "short": "Bugs go to GitHub Issues; questions and ideas to GitHub Discussions.", + "detail": "Report a bug (GitHub Issues): opens a new issue for the KStruct repository (MinaryHub/KStruct) in your browser. The version and operating system are already filled in; just describe what you were doing and what happened. If logs or the project file are needed, drag the zip made with 'Report a problem' into the issue text to attach it.

Questions & ideas (GitHub Discussions): a forum for anything that is not a bug, such as how-to questions, feature ideas or comments on results. You can also read other users' questions and answers.

Both need a (free) GitHub account and are public, so do not post confidential drawings or figures (attachments are public too; check them before uploading)." }, "help.sponsor": { "title": "Sponsor", diff --git a/src/kstruct/resources/help/ko.json b/src/kstruct/resources/help/ko.json index 2addf03..3bb4bb8 100644 --- a/src/kstruct/resources/help/ko.json +++ b/src/kstruct/resources/help/ko.json @@ -542,8 +542,8 @@ }, "help.contact": { "title": "문의하기", - "short": "질문·건의·오류를 GitHub 이슈로 보냅니다(버전·환경 정보가 미리 채워짐).", - "detail": "브라우저에서 KStruct 저장소(GitHub, MinaryHub/KStruct)의 새 이슈 작성 화면을 엽니다. 버전과 운영체제 정보가 미리 채워져 있으니 무엇을 하다가 어떤 일이 있었는지만 적어 주세요. 이슈를 쓰려면 GitHub 계정(무료)으로 로그인해야 하고, 이슈는 누구나 볼 수 있으니 회사 기밀 도면·수치는 적지 마세요. 로그와 프로젝트 파일이 필요하면 '문제 보고'로 만든 zip 파일을 이슈 본문에 끌어다 놓으면 첨부됩니다(공개되므로 내용을 확인한 뒤 올리세요)." + "short": "오류는 GitHub 이슈로, 질문·아이디어는 GitHub 토론으로 보냅니다.", + "detail": "오류 신고 (GitHub 이슈): 브라우저에서 KStruct 저장소(MinaryHub/KStruct)의 새 이슈 작성 화면을 엽니다. 버전과 운영체제 정보가 미리 채워져 있으니 무엇을 하다가 어떤 일이 있었는지만 적어 주세요. 로그와 프로젝트 파일이 필요하면 '문제 보고'로 만든 zip 파일을 이슈 본문에 끌어다 놓으면 첨부됩니다.

질문·아이디어 (GitHub 토론): 사용법 질문, 기능 제안, 해석 결과에 대한 의견처럼 오류가 아닌 이야기를 나누는 게시판입니다. 다른 사용자의 질문과 답도 볼 수 있습니다.

둘 다 GitHub 계정(무료)으로 로그인해야 하고 누구나 볼 수 있으니 회사 기밀 도면·수치는 적지 마세요(첨부 파일도 공개되므로 내용을 확인한 뒤 올리세요)." }, "help.sponsor": { "title": "후원하기", diff --git a/src/kstruct/resources/i18n/en/main.json b/src/kstruct/resources/i18n/en/main.json index 767564c..a7bfed9 100644 --- a/src/kstruct/resources/i18n/en/main.json +++ b/src/kstruct/resources/i18n/en/main.json @@ -73,7 +73,6 @@ "모든 부품이 숨겨져 있습니다. 1단계에서 부품을 체크하세요": "All parts are hidden. Tick a part in step 1", "무한": "infinite", "문의하기": "Contact us", - "문의하기 (GitHub)": "Contact us (GitHub)", "문제 보고": "Report a problem", "문제 보고 (로그·프로젝트 묶기)": "Report a problem (bundle logs and project)", "변형량": "Deformation", @@ -120,6 +119,7 @@ "예상하지 못한 오류": "Unexpected error", "예상하지 못한 오류가 발생했습니다:\n{kind}: {error}": "An unexpected error occurred:\n{kind}: {error}", "예제로 시작하기": "Start with an example", + "오류 신고 (GitHub 이슈)": "Report a bug (GitHub Issues)", "온도": "Temperature", "온도 (°C)": "Temperature (°C)", "온도 분포": "Temperature distribution", @@ -143,6 +143,7 @@ "지난번에 저장하지 않은 작업이 있습니다({when}, {source}).\n복구할까요?": "There is unsaved work from last time ({when}, {source}).\nRecover it?", "진동 모양 (상대 크기)": "Mode shape", "진동 모양 (상대값)": "Mode shape", + "질문·아이디어 (GitHub 토론)": "Questions & ideas (GitHub Discussions)", "최근 파일": "Recent files", "최대 주응력 (MPa)": "Max principal stress (MPa)", "취소": "Cancel", diff --git a/src/kstruct/resources/links.json b/src/kstruct/resources/links.json index 2a9882f..f1130ae 100644 --- a/src/kstruct/resources/links.json +++ b/src/kstruct/resources/links.json @@ -1,6 +1,7 @@ { "repository": "MinaryHub/KStruct", "issues": "https://github.com/MinaryHub/KStruct/issues/new", + "discussions": "https://github.com/MinaryHub/KStruct/discussions/new/choose", "releases": "https://github.com/MinaryHub/KStruct/releases", "sponsor": "https://github.com/sponsors/MinaryHub" } diff --git a/src/kstruct/ui/main_window.py b/src/kstruct/ui/main_window.py index 84dd4c5..cd2b1ce 100644 --- a/src/kstruct/ui/main_window.py +++ b/src/kstruct/ui/main_window.py @@ -78,7 +78,13 @@ from kstruct.ui import prefs, steps, theme from kstruct.ui.dialogs import AboutDialog, save_bug_report from kstruct.ui.help import HelpDialog, topic -from kstruct.ui.updates import UpdateChecker, UpdateDialog, open_contact, open_sponsor +from kstruct.ui.updates import ( + UpdateChecker, + UpdateDialog, + open_contact, + open_discussion, + open_sponsor, +) from kstruct.ui.viewer import ModelViewer, ResultField from kstruct.ui.worker import Cancelled, JobHandle, run_job from kstruct.units import fmt, quantity, system_of @@ -443,13 +449,26 @@ def action(text, slot, key=None, shortcut=None, icon=None, icon_only=False): "help", True, ) - action( + # 문의하기: bug reports go to GitHub Issues (version and environment filled in), + # questions and ideas to GitHub Discussions + self.contact_menu = QMenu(self) + self.contact_menu.addAction(tr("오류 신고 (GitHub 이슈)"), lambda: open_contact(self)) + self.contact_menu.addAction( + tr("질문·아이디어 (GitHub 토론)"), lambda: open_discussion(self) + ) + contact = action( tr("문의하기"), - lambda: open_contact(self), + lambda: self.contact_menu.exec( + bar.widgetForAction(contact).mapToGlobal( + bar.widgetForAction(contact).rect().bottomLeft() + ) + ), "help.contact", icon="contact", icon_only=True, ) + contact.setMenu(self.contact_menu) + bar.widgetForAction(contact).setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup) action(tr("문제 보고"), self.report_problem, "help.report", icon="report", icon_only=True) action( tr("후원하기"), lambda: open_sponsor(self), "help.sponsor", icon="heart", icon_only=True @@ -465,7 +484,8 @@ def action(text, slot, key=None, shortcut=None, icon=None, icon_only=False): info_menu.addAction(tr("사용 안내"), lambda: HelpDialog("help.mode", self).exec()) info_menu.addAction(tr("업데이트 확인…"), self.show_update) info_menu.addSeparator() - info_menu.addAction(tr("문의하기 (GitHub)"), lambda: open_contact(self)) + info_menu.addAction(tr("오류 신고 (GitHub 이슈)"), lambda: open_contact(self)) + info_menu.addAction(tr("질문·아이디어 (GitHub 토론)"), lambda: open_discussion(self)) info_menu.addAction(tr("문제 보고 (로그·프로젝트 묶기)"), self.report_problem) info_menu.addAction(tr("후원하기 (GitHub Sponsors)"), lambda: open_sponsor(self)) info_menu.addSeparator() diff --git a/src/kstruct/ui/updates.py b/src/kstruct/ui/updates.py index ba9cc0e..f927685 100644 --- a/src/kstruct/ui/updates.py +++ b/src/kstruct/ui/updates.py @@ -99,6 +99,15 @@ def open_contact(parent: QWidget | None = None, detail: str = "") -> None: ) +def open_discussion(parent: QWidget | None = None) -> None: + """GitHub Discussions: questions, ideas and how-to, as opposed to bug reports.""" + url = update.links().get("discussions", "") + if not url or not open_url(url): + QMessageBox.information( + parent, tr("문의하기"), tr("브라우저를 열 수 없습니다.\n\n{url}", url=url) + ) + + def open_sponsor(parent: QWidget | None = None) -> None: url = update.links().get("sponsor", "") if not url or not open_url(url): diff --git a/tests/test_ui.py b/tests/test_ui.py index 94ce156..068eac4 100644 --- a/tests/test_ui.py +++ b/tests/test_ui.py @@ -967,8 +967,9 @@ def test_nonlinear_run_from_the_panel(qtbot): def test_contact_sponsor_and_update_from_the_toolbar(qtbot, monkeypatch, tmp_path): - """문의하기 opens a pre-filled GitHub issue, 후원하기 the sponsor page, and an update - found at start-up shows the toolbar button whose dialog offers the installer.""" + """문의하기 offers a pre-filled GitHub issue (bugs) and GitHub Discussions (questions, + ideas), 후원하기 opens the sponsor page, and an update found at start-up shows the + toolbar button whose dialog offers the installer.""" from kstruct import update from kstruct.ui import updates @@ -977,10 +978,15 @@ def test_contact_sponsor_and_update_from_the_toolbar(qtbot, monkeypatch, tmp_pat monkeypatch.setattr(updates, "open_url", lambda url: opened.append(url) or True) window = _window(qtbot) actions = {a.text(): a for a in window.findChildren(type(window.update_action))} - actions["문의하기"].trigger() + contact = [a.text() for a in actions["문의하기"].menu().actions()] + assert contact == ["오류 신고 (GitHub 이슈)", "질문·아이디어 (GitHub 토론)"] + actions["오류 신고 (GitHub 이슈)"].trigger() + actions["질문·아이디어 (GitHub 토론)"].trigger() actions["후원하기"].trigger() assert opened[0].startswith("https://github.com/MinaryHub/KStruct/issues/new?") - assert "KStruct" in opened[0] and opened[1] == "https://github.com/sponsors/MinaryHub" + assert "KStruct" in opened[0] + assert opened[1] == "https://github.com/MinaryHub/KStruct/discussions/new/choose" + assert opened[2] == "https://github.com/sponsors/MinaryHub" release = update.Release( "v99.0.0", diff --git a/uv.lock b/uv.lock index 72dcaf4..3fa0719 100644 --- a/uv.lock +++ b/uv.lock @@ -245,7 +245,7 @@ wheels = [ [[package]] name = "kstruct" -version = "0.3.1" +version = "0.3.2" source = { editable = "." } dependencies = [ { name = "cadquery-ocp" },