mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-12 17:58:50 +01:00
Merge pull request #121 from cuu/master
translations and add launchergo switch
This commit is contained in:
commit
43d57620cb
@ -23,60 +23,6 @@ from UI.lang_manager import MyLangManager
|
||||
|
||||
from UI.multilabel import MultiLabel
|
||||
|
||||
class InfoPageListItem(object):
|
||||
_PosX = 0
|
||||
_PosY = 0
|
||||
_Width = 0
|
||||
_Height = 20
|
||||
|
||||
_Labels = {}
|
||||
_Icons = {}
|
||||
_Fonts = {}
|
||||
|
||||
_LinkObj = None
|
||||
|
||||
def __init__(self):
|
||||
self._Labels = {}
|
||||
self._Icons = {}
|
||||
self._Fonts = {}
|
||||
|
||||
def SetSmallText(self,text):
|
||||
|
||||
l = MultiLabel()
|
||||
l.SetCanvasHWND(self._Parent._CanvasHWND)
|
||||
l.Init(text,self._Fonts["small"])
|
||||
|
||||
self._Labels["Small"] = l
|
||||
|
||||
#if self._Labels["Small"]._Width > self._Width:
|
||||
# self._Width = self._Labels["Small"]._Width
|
||||
if self._Labels["Small"]._Height >= self._Height:
|
||||
self._Height = self._Labels["Small"]._Height+10
|
||||
|
||||
def Init(self,text):
|
||||
|
||||
#self._Fonts["normal"] = fonts["veramono12"]
|
||||
|
||||
l = Label()
|
||||
l._PosX = 10
|
||||
l.SetCanvasHWND(self._Parent._CanvasHWND)
|
||||
|
||||
l.Init(text,self._Fonts["normal"])
|
||||
self._Labels["Text"] = l
|
||||
|
||||
def Draw(self):
|
||||
|
||||
self._Labels["Text"]._PosY = self._PosY
|
||||
self._Labels["Text"].Draw()
|
||||
|
||||
if "Small" in self._Labels:
|
||||
self._Labels["Small"]._PosX = self._Labels["Text"]._Width + 16
|
||||
self._Labels["Small"]._PosY = self._PosY
|
||||
self._Labels["Small"].Draw()
|
||||
|
||||
|
||||
|
||||
|
||||
class AirplanePage(Page):
|
||||
_FootMsg = ["Nav","Rescue","","Back","Toggle"]
|
||||
_MyList = []
|
||||
|
||||
34
Menu/GameShell/10_Settings/LauncherGo/__init__.py
Normal file
34
Menu/GameShell/10_Settings/LauncherGo/__init__.py
Normal file
@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import pygame
|
||||
#import math
|
||||
#mport subprocess
|
||||
import glob
|
||||
#from beeprint import pp
|
||||
from libs.roundrects import aa_round_rect
|
||||
|
||||
## local UI import
|
||||
from UI.lang_manager import MyLangManager
|
||||
|
||||
class APIOBJ(object):
|
||||
|
||||
_Page = None
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
def Init(self,main_screen):
|
||||
pass
|
||||
def API(self,main_screen):
|
||||
if main_screen !=None:
|
||||
main_screen._MsgBox.SetText("Rebooting to LauncherGo")
|
||||
main_screen._MsgBox.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
pygame.time.delay(300)
|
||||
os.system("sed -i s/launcher/launchergo/g ~/.bashrc" )
|
||||
os.system("sudo reboot")
|
||||
|
||||
OBJ = APIOBJ()
|
||||
def Init(main_screen):
|
||||
OBJ.Init(main_screen)
|
||||
def API(main_screen):
|
||||
OBJ.API(main_screen)
|
||||
@ -29,6 +29,8 @@ from libs.DBUS import is_wifi_connected_now
|
||||
|
||||
import config
|
||||
|
||||
LauncherLoc = "/home/cpi/launcher"
|
||||
|
||||
class UpdateDownloadPage(DownloadProcessPage):
|
||||
_MD5 = ""
|
||||
|
||||
@ -42,7 +44,7 @@ class UpdateDownloadPage(DownloadProcessPage):
|
||||
|
||||
if filename.endswith(".tar.gz"):
|
||||
#/home/cpi/apps/[launcher]
|
||||
cmdpath = "tar zxf " + CmdClean(filename) + " -C /home/cpi/apps ;rm -rf "+ filename
|
||||
cmdpath = "tar zxf " + CmdClean(filename) + " -C /home/cpi/ ;rm -rf "+ filename
|
||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||
|
||||
self.ReturnToUpLevelPage()
|
||||
@ -108,6 +110,7 @@ class UpdateConfirmPage(ConfirmPage):
|
||||
_GIT = False
|
||||
|
||||
def KeyDown(self,event):
|
||||
global LauncherLoc
|
||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
@ -115,7 +118,7 @@ class UpdateConfirmPage(ConfirmPage):
|
||||
|
||||
if event.key == CurKeys["B"]:
|
||||
if self._GIT == True:
|
||||
cmdpath = "feh --bg-center /home/cpi/apps/launcher/sys.py/gameshell/wallpaper/updating.png; cd /home/cpi/apps/launcher ;git pull; git reset --hard %s ; feh --bg-center /home/cpi/apps/launcher/sys.py/gameshell/wallpaper/loading.png " % self._Version
|
||||
cmdpath = "feh --bg-center %s/sys.py/gameshell/wallpaper/updating.png; cd %s ;git pull; git reset --hard %s ; feh --bg-center %s/sys.py/gameshell/wallpaper/loading.png " % (LauncherLoc,LauncherLoc,self._Version,LauncherLoc)
|
||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||
self._GIT = False
|
||||
return
|
||||
@ -159,7 +162,6 @@ class UpdatePage(Page):
|
||||
_ConfirmPage = None
|
||||
_AList = {}
|
||||
_MyList = []
|
||||
|
||||
def __init__(self):
|
||||
Page.__init__(self)
|
||||
self._Icons = {}
|
||||
@ -209,6 +211,7 @@ class UpdatePage(Page):
|
||||
self.GenList()
|
||||
|
||||
def CheckUpdate(self):
|
||||
global LauncherLoc
|
||||
self._Screen._MsgBox.SetText("CheckingUpdate")
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
@ -233,12 +236,12 @@ class UpdatePage(Page):
|
||||
self._Screen.PushPage(self._ConfirmPage)
|
||||
|
||||
self._Screen.Draw()
|
||||
self._ConfirmPage.SnapMsg("Confirm Update to %s ?" % json_["version"] )
|
||||
self._ConfirmPage.SnapMsg(MyLangManager.Tr("ConfirmUpdateToFQ") % json_["version"] )
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
elif "gitversion" in json_: ### just use git to run update
|
||||
cur_dir = os.getcwd()
|
||||
os.chdir("/home/cpi/apps/launcher")
|
||||
os.chdir(LauncherLoc)
|
||||
current_git_version = get_git_revision_short_hash()
|
||||
current_git_version = current_git_version.strip("\n")
|
||||
current_git_version = current_git_version.strip("\t")
|
||||
@ -252,7 +255,7 @@ class UpdatePage(Page):
|
||||
self._Screen.PushPage(self._ConfirmPage)
|
||||
|
||||
self._Screen.Draw()
|
||||
self._ConfirmPage.SnapMsg("Update to %s ?" % json_["gitversion"] )
|
||||
self._ConfirmPage.SnapMsg(MyLangManager.Tr("UpdateToFQ") % json_["gitversion"] )
|
||||
self._Screen.SwapAndShow()
|
||||
else:
|
||||
self._Screen.Draw()
|
||||
|
||||
@ -21,6 +21,8 @@ from UI.lang_manager import MyLangManager
|
||||
from UI.info_page_list_item import InfoPageListItem
|
||||
from UI.info_page_selector import InfoPageSelector
|
||||
|
||||
from libs.DBUS import is_wifi_connected_now
|
||||
|
||||
from net_item import NetItem
|
||||
|
||||
import myvars
|
||||
@ -608,7 +610,9 @@ class WifiList(Page):
|
||||
|
||||
def OnReturnBackCb(self):
|
||||
password_inputed = "".join(myvars.PasswordPage._Textarea._MyWords)
|
||||
self.ConfigWireless(password_inputed)
|
||||
if is_wifi_connected_now() == False:
|
||||
self.ConfigWireless(password_inputed)
|
||||
|
||||
|
||||
def KeyDown(self,event):
|
||||
|
||||
|
||||
@ -65,7 +65,8 @@ class ListPage(Page):
|
||||
["","Update", ""],
|
||||
["","About", "About"],
|
||||
["","PowerOFF","Power off"],
|
||||
["","ButtonsLayout","Buttons Layout"],]
|
||||
["","ButtonsLayout","Buttons Layout"],
|
||||
["","LauncherGo","Switch to LauncherGo"]]
|
||||
|
||||
start_x = 0
|
||||
start_y = 0
|
||||
|
||||
@ -75,7 +75,8 @@ class CounterScreen(FullScreen):
|
||||
return
|
||||
self._Counting = False
|
||||
self._Number = 10
|
||||
|
||||
self._inter_counter = 0
|
||||
|
||||
if self._GobjectIntervalId != -1:
|
||||
gobject.source_remove(self._GobjectIntervalId)
|
||||
self._GobjectIntervalId = -1
|
||||
|
||||
@ -17,6 +17,7 @@ class LangManager(object):
|
||||
_Langs = {}
|
||||
_Config = None
|
||||
_ConfigFileName = "00_English.ini" ## double % to escape
|
||||
_CJKMode = False
|
||||
|
||||
def __init__(self):
|
||||
self.Init()
|
||||
@ -29,6 +30,17 @@ class LangManager(object):
|
||||
self._Langs = {}
|
||||
self.SetLangs()
|
||||
|
||||
def IsCJKMode(self):## in MultiLabel, latins seped by white spaces,CJK no needs for that
|
||||
latins = ["English"]
|
||||
self._CJKMode = True
|
||||
|
||||
for i in latins:
|
||||
if i in self._ConfigFileName:
|
||||
self._CJKMode= False
|
||||
break
|
||||
|
||||
return self._CJKMode
|
||||
|
||||
def SetLangs(self):
|
||||
self._Config = CaseConfigParser()
|
||||
#print("SetLangs")
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
import pygame
|
||||
|
||||
from skin_manager import MySkinManager
|
||||
from lang_manager import MyLangManager
|
||||
|
||||
|
||||
class MultiLabel: ##Multi Line Label
|
||||
@ -49,15 +50,27 @@ class MultiLabel: ##Multi Line Label
|
||||
self._CanvasHWND = _canvashwnd
|
||||
|
||||
def blit_text(self, surface,text, pos, font):
|
||||
iscjk = MyLangManager.IsCJKMode()
|
||||
|
||||
color = self._Color
|
||||
words = [word.split(' ') for word in text.splitlines()]
|
||||
space = font.size(' ')[0]
|
||||
|
||||
if iscjk:
|
||||
space = 0
|
||||
words = [list(word.decode("utf8")) for word in text.splitlines()]
|
||||
|
||||
max_width = self._Width
|
||||
x ,y = pos
|
||||
row_total_width = 0
|
||||
lines = 0
|
||||
for i,line in enumerate(words[:4]):
|
||||
for word in line[:12]:
|
||||
line_max = 12
|
||||
row_max = 4
|
||||
if iscjk:
|
||||
line_max = line_max*2
|
||||
|
||||
for i,line in enumerate(words[:row_max]):
|
||||
for word in line[:line_max]:
|
||||
word_surface = font.render(word, True, color)
|
||||
word_width = word_surface.get_width()
|
||||
word_height = word_surface.get_height()
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
Settings=Settings
|
||||
Retro Games=Retro Games
|
||||
Music Player=Music Player
|
||||
TinyCloud=TinyCloud
|
||||
TinyCloud=Tiny Cloud
|
||||
PowerOFF=PowerOFF
|
||||
Reload UI=Reload UI
|
||||
freeDM=freeDM
|
||||
@ -14,6 +14,8 @@ Scan=Scan
|
||||
Back=Back
|
||||
Enter=Enter
|
||||
Remove=Remove
|
||||
Backspace=Backspace
|
||||
Done=Done
|
||||
Run=Run
|
||||
AddToPlayList=Add to Playlist
|
||||
Add to Playlist=Add to Playlist
|
||||
@ -102,3 +104,4 @@ Confirm Power OFF?=Confirm Power OFF?
|
||||
Reboot=Reboot
|
||||
Shutdown=Shutdown
|
||||
my favourites=my favourites
|
||||
Check Update=Check Update
|
||||
|
||||
@ -1,107 +1,110 @@
|
||||
[Langs]
|
||||
Settings=設定
|
||||
Retro Games=レトロ ゲーム
|
||||
Retro Games=Retro Games
|
||||
Music Player=音楽プレーヤー
|
||||
TinyCloud=彩雲
|
||||
PowerOFF=電源を切る
|
||||
TinyCloud=Tiny Cloud
|
||||
PowerOFF=電源オフ
|
||||
Reload UI=リロードUI
|
||||
freeDM=freeDM
|
||||
freeDM=デュークニューケム
|
||||
CaveStory=洞窟物語
|
||||
RetroArch=RetroArch
|
||||
Launching=打ち上げ
|
||||
Launching=起動中...
|
||||
Nav=ナビ
|
||||
Scan=スキャン
|
||||
Back=後ろ
|
||||
Enter=入る
|
||||
Enter=エンター
|
||||
Remove=削除
|
||||
Backspace=後退
|
||||
Done=完了
|
||||
Run=起動
|
||||
AddToPlayList=再生リストに追加
|
||||
Add to Playlist=再生リストに追加
|
||||
DownloadConfirm=ダウンロード確認
|
||||
MyFavGames=私の好きなゲーム
|
||||
MyFavGames=お気に入りのゲーム
|
||||
Deleting=削除
|
||||
AddFav=好みを加える
|
||||
ADdFavList=好みのリストに追加
|
||||
Del=削
|
||||
Please upload data over Wi-Fi=Wifiを通じてデータをアップロードする
|
||||
ConfirmDeleteQ=削除の確認?
|
||||
AlreadyExisted=存在している
|
||||
AddFav=お気に入りに追加
|
||||
ADdFavList=お気に入りリストに登録
|
||||
Del=削除
|
||||
Please upload data over Wi-Fi=Wi-Fiでデータ転送
|
||||
ConfirmDeleteQ=削除しますか?
|
||||
AlreadyExisted=既に存在している
|
||||
Cancel=取り消す
|
||||
Yes=は
|
||||
Yes=はい
|
||||
ConfirmQ=確認?
|
||||
Disconnecting=接続を切る
|
||||
ConfirmUpdateToFQ=にアップグレードする%%s?
|
||||
UpdateToFQ=にアップする%%s ?
|
||||
SetupGameEngineAutoQ=ゲームエンジンを自動化しますか?
|
||||
Disconnecting=接続を切断
|
||||
ConfirmUpdateToFQ=%%sにアップデートしますか?
|
||||
UpdateToFQ=%%sにアップデート?
|
||||
SetupGameEngineAutoQ=ゲームエンジンの自動セットアップを希望しますか?
|
||||
Downloading=ダウンロード中
|
||||
BATOver5Pct=電気の量は少なくとも5%%
|
||||
BATOver5Pct=バッテリーは5%%以上が必要
|
||||
DeleteConfirm=削除の確認
|
||||
FavouriteGames=好きなゲーム
|
||||
ConfirmForgetQ=見落としを確認します?
|
||||
ConfirmForget=見落としを確認する
|
||||
Disconnect=接続を切る
|
||||
ConfirmDisconnectQ=接続を確認しますか?
|
||||
Confirm Disconnect=接続を確認する?
|
||||
FavouriteGames=お気に入りのゲーム
|
||||
ConfirmForgetQ=無視しますか?
|
||||
ConfirmForget=無視しますか
|
||||
Disconnect=接続を切断
|
||||
ConfirmDisconnectQ=接続を切りますか?
|
||||
Confirm Disconnect=接続を切りますか
|
||||
Forget=無視
|
||||
Forgeting=見落としている
|
||||
Forgeting=無視中
|
||||
Info=情報
|
||||
TryConnect=接続を試みる
|
||||
Bluetooth Info=青歯設備情報
|
||||
Bluetooth Info=ブルートゥース情報
|
||||
Connecting=接続中
|
||||
BluetoothScanning=青い歯のスキャン中
|
||||
BluetoothScanning=ブルートゥーススキャン中
|
||||
Scanning=スキャン中
|
||||
ShutDownConnecting=接続を閉じている
|
||||
ShutDownConnecting=接続を切断
|
||||
Select=選択
|
||||
Detail=詳細
|
||||
Applying=応用中
|
||||
DownloadFailed=ダウンロード失敗
|
||||
LauncherIsUpToDate=Launcherもう一番新しい
|
||||
LauncherIsUpToDate=Launcher更新済み
|
||||
CheckWifiConnection=wifi接続をチェックしてください
|
||||
TurningOn=開けている
|
||||
TurningOff=閉まっている
|
||||
TurningOff=閉じている
|
||||
Invalid=無効
|
||||
CheckingUpdate=チェックアップ中
|
||||
CheckingUpdateFailed=チェックの更新に失敗しました
|
||||
CheckingUpdate=アップデート確認中
|
||||
CheckingUpdateFailed=アップデート確認失敗
|
||||
Update=更新
|
||||
Toggle=トグル
|
||||
Toggle=切り替え
|
||||
Rescue=救う
|
||||
Airplane Mode=飛行モード
|
||||
Airplane Mode=機内モード
|
||||
minutes=分
|
||||
seconds=秒
|
||||
second=秒
|
||||
minute=分
|
||||
Never=いつまでも
|
||||
Never=決してしない
|
||||
Power Options=電源オプション
|
||||
Languages=言語
|
||||
Notify=通知ウィジェット
|
||||
Setting List=設定リスト
|
||||
Wi-Fi=Wi-Fi
|
||||
Bluetooth=青歯
|
||||
Bluetooth=ブルートゥース
|
||||
Sound Volume=音量
|
||||
Sound Volume=音量
|
||||
Brightness=明るさ
|
||||
BackLight Brightness=光の明るさ
|
||||
Storage=メモリスペース
|
||||
BackLight Brightness=バックライトの明るさ
|
||||
Storage=ストレージ
|
||||
Timezone=時地
|
||||
Timezone Selection=タイムゾーン選択
|
||||
Notification=注意を通知する
|
||||
About=について
|
||||
Power off=関機
|
||||
Power off=電源オフ
|
||||
Buttons Layout=ボタンの配置
|
||||
UpdateRetroArch=更新RetroArch
|
||||
UpdateRetroArch=RetroArchを更新
|
||||
Wifi scanning=wifiスキャン中
|
||||
Power option detail=電源オプションの詳細
|
||||
Power option detail=電源オプション
|
||||
Screen dimming=画面が暗くなる
|
||||
Screen OFF=スクリーンを閉
|
||||
Power OFF=関機
|
||||
Screen OFF=スクリーンオフ
|
||||
Power OFF=電源オフ
|
||||
Power saving=省エネルギー
|
||||
Balanced=バランス
|
||||
Server=サーバ
|
||||
Performance=性能
|
||||
Confirm Power OFF?=電源を確認しますか?
|
||||
Confirm Power OFF?=電源オフしますか?
|
||||
Reboot=再起動
|
||||
Shutdown=操業停止
|
||||
Shutdown=シャットダウン
|
||||
Play List=プレイリスト
|
||||
Music Library=音楽庫
|
||||
Music Library=ミュージックライブラリ
|
||||
Play/Pause=再生/停止
|
||||
my favourites=お気に入り
|
||||
Check Update=アップデートをチェック
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
[Langs]
|
||||
Settings=설치
|
||||
Retro Games=클래식게임
|
||||
Retro Games=Retro Games
|
||||
Music Player=음악플레이어
|
||||
TinyCloud=채색구름
|
||||
TinyCloud=Tiny Cloud
|
||||
PowerOFF=전원닫기
|
||||
Reload UI=재개UI
|
||||
freeDM=freeDM
|
||||
@ -14,6 +14,8 @@ Scan=스캐닝
|
||||
Back=반퇴
|
||||
Enter=진입
|
||||
Remove=삭제
|
||||
Backspace=체크
|
||||
Done=완료
|
||||
Run=운행
|
||||
AddToPlayList=재생목록에추가하기
|
||||
Add to Playlist=재생목록에추가하기
|
||||
@ -105,3 +107,4 @@ Play List=음악목록
|
||||
Music Library=음악라이브러리
|
||||
Play/Pause=재생/정지
|
||||
my favourites=내즐겨찾기
|
||||
Check Update=보기 업데이트
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
[Langs]
|
||||
Settings=设置
|
||||
Retro Games=经典游戏
|
||||
Retro Games=Retro Games
|
||||
Music Player=音乐播放器
|
||||
TinyCloud=彩云
|
||||
TinyCloud=Tiny Cloud
|
||||
PowerOFF=关机
|
||||
Reload UI=重载菜单
|
||||
freeDM=freeDM
|
||||
@ -13,6 +13,8 @@ Scan=扫描
|
||||
Back=返回
|
||||
Enter=进入
|
||||
Remove=删除
|
||||
Backspace=退格
|
||||
Done=完成
|
||||
Run=运行
|
||||
AddToPlayList=添加到播放列表
|
||||
Add to Playlist=添加到播放列表
|
||||
@ -103,3 +105,4 @@ Play List=播放列表
|
||||
Music Library=乐库
|
||||
Play/Pause=播放/暂停
|
||||
my favourites=我的收藏夹
|
||||
Check Update=检查更新
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
[Langs]
|
||||
Settings=設置
|
||||
Retro Games=經典遊戲
|
||||
Retro Games=Retro Games
|
||||
Music Player=音樂播放器
|
||||
TinyCloud=彩雲
|
||||
TinyCloud=Tiny Cloud
|
||||
PowerOFF=關機
|
||||
Reload UI=重載菜單
|
||||
freeDM=freeDM
|
||||
@ -13,6 +13,8 @@ Scan=掃描
|
||||
Back=返回
|
||||
Enter=進入
|
||||
Remove=刪除
|
||||
Backspace=退格
|
||||
Done=完成
|
||||
Run=運行
|
||||
AddToPlayList=添加到播放列表
|
||||
Add to Playlist=添加到播放列表
|
||||
@ -103,3 +105,4 @@ Play List=播放列表
|
||||
Music Library=樂庫
|
||||
Play/Pause=播放/暫停
|
||||
my favourites=我的收藏夾
|
||||
Check Update=檢查更新
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user