MultiLabel add iscjk

This commit is contained in:
cuu 2018-12-05 16:17:15 +08:00
parent 493a920500
commit 40cafe09c5
3 changed files with 34 additions and 9 deletions

View File

@ -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")

View File

@ -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()

View File

@ -26,23 +26,23 @@ AddFav=お気に入りに追加
ADdFavList=お気に入りリストに登録
Del=削除
Please upload data over Wi-Fi=Wi-Fiでデータを送信してください
ConfirmDeleteQ=削除しますか
ConfirmDeleteQ=削除しますか?
AlreadyExisted=既に存在している
Cancel=取り消す
Yes=はい
ConfirmQ=確認?
Disconnecting=接続を切断
ConfirmUpdateToFQ=%%sにアップデートしますか
UpdateToFQ=%%sにアップデート
SetupGameEngineAutoQ=ゲームエンジンの自動セットアップを希望しますか
ConfirmUpdateToFQ=%%sにアップデートしますか?
UpdateToFQ=%%sにアップデート?
SetupGameEngineAutoQ=ゲームエンジンの自動セットアップを希望しますか?
Downloading=ダウンロード中
BATOver5Pct=バッテリーは5%%以上が必要
DeleteConfirm=削除の確認
FavouriteGames=お気に入りのゲーム
ConfirmForgetQ=無視しますか
ConfirmForgetQ=無視しますか?
ConfirmForget=無視しますか
Disconnect=接続を切断
ConfirmDisconnectQ=接続を切りますか
ConfirmDisconnectQ=接続を切りますか?
Confirm Disconnect=接続を切りますか
Forget=無視
Forgeting=無視中
@ -100,7 +100,7 @@ Power saving=省エネルギー
Balanced=バランス
Server=サーバ
Performance=性能
Confirm Power OFF?=電源オフしますか
Confirm Power OFF?=電源オフしますか?
Reboot=再起動
Shutdown=シャットダウン
Play List=プレイリスト