diff --git a/README.md b/README.md index 60ca5b4..d84ea80 100644 --- a/README.md +++ b/README.md @@ -55,11 +55,12 @@ ___注:区分的原因是 `Windows-Toasts` 库只能在 Windows 下生效!___ - [x] 检查更新 (基于 __Github API__) - [ ] 进阶逻辑 - [ ] 进阶播放方式选择 -- [ ] 设置 (目前已有占位按钮 `settings_btn`, 并隐藏) +- [ ] 将主界面迁移至 `pages` 中 +- [ ] 设置 (施工中) - [ ] 系统托盘 (预计使用 `pystray` 实现) - [ ] 界面自动取色 (可能使用 __OpenCV__ 实现) - [ ] 混音器 (目前使用的组件未提供相关接口, 暂时搁置) -- [ ] SMTC 支持 +- [ ] SMTC 支持 (涉及 WinRT, 仅 Windows 支持) - [ ] 任务栏进度条与按键操作 (仅 Windows 支持) - [ ] 多线程支持 diff --git a/i18n/en_US.py b/i18n/en_US.py index de26921..41b52c7 100644 --- a/i18n/en_US.py +++ b/i18n/en_US.py @@ -105,4 +105,9 @@ "contentCurrentVer": "- Current version: ", "contentLatestVer": "\n \r- Latest version: ", "contentMore": "\n \r## Detailed Info\n \r" +} + +sets = { + "settings": "Settings", + "construction": "Under Construction" } \ No newline at end of file diff --git a/i18n/lang.py b/i18n/lang.py index 033b77d..7f4a13d 100644 --- a/i18n/lang.py +++ b/i18n/lang.py @@ -1,8 +1,16 @@ import locale +from lib import log_init + +log_init.logging.info("Basic libs imported at lang.py") + from i18n import en_US, zh_CN +log_init.logging.info("Imported language files") + langCode = locale.getdefaultlocale()[0] +log_init.logging.info("Get default locale: " + langCode) + langInfo = {} infomation = {} menuBar = {} @@ -11,9 +19,10 @@ songList = {} dialog = {} update = {} +sets = {} def loadLang(): - global langCode, langInfo, infomation, menuBar, mainMenu, tooltips, songList, dialog, update + global langCode, langInfo, infomation, menuBar, mainMenu, tooltips, songList, dialog, update, sets if langCode == 'zh_CN': langInfo = zh_CN.langInfo infomation = zh_CN.infomation @@ -23,6 +32,7 @@ def loadLang(): songList = zh_CN.songList dialog = zh_CN.dialog update = zh_CN.update + sets = zh_CN.sets else: langInfo = en_US.langInfo infomation = en_US.infomation @@ -32,3 +42,4 @@ def loadLang(): songList = en_US.songList dialog = en_US.dialog update = en_US.update + sets = en_US.sets diff --git a/i18n/zh_CN.py b/i18n/zh_CN.py index 1b85c80..907078e 100644 --- a/i18n/zh_CN.py +++ b/i18n/zh_CN.py @@ -105,4 +105,9 @@ "contentCurrentVer": "- 当前版本: ", "contentLatestVer": "\n \r- 新版本: ", "contentMore": "\n \r## 详细信息\n \r" +} + +sets = { + "settings": "设置", + "construction": "正在施工" } \ No newline at end of file diff --git a/lib/log_init.py b/lib/log_init.py index 830d5bc..9e9ef66 100644 --- a/lib/log_init.py +++ b/lib/log_init.py @@ -1,3 +1,3 @@ import logging -logging.basicConfig(filename = 'player.log', format = ' %(asctime)s | %(levelname)s | %(funcName)s | %(message)s', level = logging.INFO) \ No newline at end of file +logging.basicConfig(filename = 'player.log', format = ' %(asctime)s | %(levelname)s | %(filename)s | %(funcName)s | %(message)s', level = logging.INFO) \ No newline at end of file diff --git a/pages/settingsPage.py b/pages/settingsPage.py new file mode 100644 index 0000000..f0e7628 --- /dev/null +++ b/pages/settingsPage.py @@ -0,0 +1,13 @@ +import flet as ft +from lib import log_init + +log_init.logging.info("Basic libs imported at settingsPage.py") + +from i18n import lang + +log_init.logging.info("Languages imported at settingsPage.py") + +appBar = ft.AppBar(title = ft.Text(value = lang.sets["settings"])) +constructionNotice = ft.Row(controls = [ft.Icon(ft.icons.CONSTRUCTION_OUTLINED, color = ft.colors.AMBER), ft.Text(value = lang.sets["construction"], color = ft.colors.AMBER)]) + +settings_pageView = ft.View("/settings", controls = [appBar, constructionNotice]) \ No newline at end of file diff --git a/player.py b/player.py index 757dc9d..2017e08 100644 --- a/player.py +++ b/player.py @@ -8,7 +8,7 @@ log_init.logging.info("Languages imported at player.py") -ver = "2.0.0_experimentaltest" +ver = "2.0.0_pre" audioFile = None lyricFile = "" audioListShown = False @@ -466,6 +466,20 @@ def openAboutDlg(e): page.update() log_init.logging.info("Page updated") + def displaySettings(e): + page.views.append(settingsPage.settings_pageView) + page.go("/settings") + log_init.logging.info("Set to page: settings") + page.update + log_init.logging.info("Page updated") + + def viewPop(e): + page.views.pop() + topView = page.views[-1] + page.go(topView.route) + log_init.logging.info("View go backward") + + """ titleBar = ft.Row( [ @@ -788,7 +802,7 @@ def openAboutDlg(e): icon = ft.icons.SETTINGS_OUTLINED, tooltip = lang.tooltips["settings"], icon_size = 20, - visible = False + on_click = displaySettings ) lyrics_before = ft.Text(size = 16, visible = True, color = ft.colors.GREY) @@ -801,7 +815,11 @@ def openAboutDlg(e): page.overlay.append(audioList_menu) log_init.logging.info("Append audioList_menu") - page.add(ft.Column(controls = [ft.Row(controls = [menuBar]), audioBasicInfo, audioProgressBar, btns_row, lyrics_before, lyrics_text, lyrics_after])) + main_pageView = ft.View("/", controls = [ft.Column(controls = [ft.Row(controls = [menuBar]), audioBasicInfo, audioProgressBar, btns_row, lyrics_before, lyrics_text, lyrics_after])]) + page.views.append(main_pageView) + page.go("/") + log_init.logging.info("Set to page: main") + page.on_view_pop = viewPop log_init.logging.info("Window initialization complete") if __name__ == '__main__': @@ -824,4 +842,6 @@ def openAboutDlg(e): audioArtistText = lang.mainMenu["unknownArtist"] work.audioInfo = lang.mainMenu["none"] log_init.logging.info("Basic initialization complete") + from pages import settingsPage + log_init.logging.info("Imported settingsPage") ft.app(target = main)