Skip to content

Commit

Permalink
Prerelease 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WhatDamon committed Feb 20, 2024
1 parent a741b70 commit 5b087be
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 7 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ ___注:区分的原因是 `Windows-Toasts` 库只能在 Windows 下生效!___
- [x] 检查更新 (基于 __Github API__)
- [ ] 进阶逻辑
- [ ] 进阶播放方式选择
- [ ] 设置 (目前已有占位按钮 `settings_btn`, 并隐藏)
- [ ] 将主界面迁移至 `pages`
- [ ] 设置 (施工中)
- [ ] 系统托盘 (预计使用 `pystray` 实现)
- [ ] 界面自动取色 (可能使用 __OpenCV__ 实现)
- [ ] 混音器 (目前使用的组件未提供相关接口, 暂时搁置)
- [ ] SMTC 支持
- [ ] SMTC 支持 (涉及 WinRT, 仅 Windows 支持)
- [ ] 任务栏进度条与按键操作 (仅 Windows 支持)
- [ ] 多线程支持

Expand Down
5 changes: 5 additions & 0 deletions i18n/en_US.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
13 changes: 12 additions & 1 deletion i18n/lang.py
Original file line number Diff line number Diff line change
@@ -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 = {}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -32,3 +42,4 @@ def loadLang():
songList = en_US.songList
dialog = en_US.dialog
update = en_US.update
sets = en_US.sets
5 changes: 5 additions & 0 deletions i18n/zh_CN.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,9 @@
"contentCurrentVer": "- 当前版本: ",
"contentLatestVer": "\n \r- 新版本: ",
"contentMore": "\n \r## 详细信息\n \r"
}

sets = {
"settings": "设置",
"construction": "正在施工"
}
2 changes: 1 addition & 1 deletion lib/log_init.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import logging

logging.basicConfig(filename = 'player.log', format = ' %(asctime)s | %(levelname)s | %(funcName)s | %(message)s', level = logging.INFO)
logging.basicConfig(filename = 'player.log', format = ' %(asctime)s | %(levelname)s | %(filename)s | %(funcName)s | %(message)s', level = logging.INFO)
13 changes: 13 additions & 0 deletions pages/settingsPage.py
Original file line number Diff line number Diff line change
@@ -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])
26 changes: 23 additions & 3 deletions player.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
[
Expand Down Expand Up @@ -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)
Expand All @@ -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__':
Expand All @@ -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)

0 comments on commit 5b087be

Please sign in to comment.