- gettext support added in frontends
- first draft of frontends french translation
This commit is contained in:
Goffi 2010-03-05 20:33:10 +11:00
commit e3ebafd8f3
5 changed files with 1701 additions and 196 deletions

View file

@ -23,12 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
from window import Window
import os,pdb
def echo(message):
return
os.system('echo "'+str(message)+'" >> /tmp/toto')
class BoxSizer:
"""This class manage the position of the window like boxes."""
@ -66,22 +60,17 @@ class BoxSizer:
#if the last win is hidden, we expand previous visible one
current_row[-1][2] = current_row[-1][2] + (win.getX() - oriX)+win.getWidth()
else:
echo ("ajout de %s à current row" % (win.__class__.__name__))
current_row.append([win, h+y-oriY, w+x-oriX, oriY, oriX])
oriX=oriX+w
if oriX!=0:
echo ("ligne visible (dernier: %s)" % win.__class__.__name__)
oriY=oriY+h
visible_row.append(current_row)
elif visible_row:
#if all the row is empty, we take the space
for box in visible_row[-1]:
echo ("on augmente %s de %d" % (box[0].__class__.__name__, h))
box[1]=box[1]+h
oriY=oriY+h #this only happen if it's not the first visible row
else:
echo ("ligne invisible")
for row in visible_row:
for win in row:

View file

@ -75,7 +75,6 @@ class Chat(Window, QuickChat):
def update(self):
if self.isHidden():
echo ("fenetre cachee")
return
Window.update(self)
content=[] #what is really printed

View file

@ -20,6 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from quick_frontend.quick_app import QuickApp
from quick_frontend.quick_chat_list import QuickChatList
from quick_frontend.quick_contact_list import QuickContactList
from quick_frontend.quick_contact_management import QuickContactManagement
import curses
import pdb
from window import Window
@ -40,10 +44,6 @@ import fcntl
import struct
import termios
from boxsizer import BoxSizer
from quick_frontend.quick_chat_list import QuickChatList
from quick_frontend.quick_contact_list import QuickContactList
from quick_frontend.quick_app import QuickApp
from quick_frontend.quick_contact_management import QuickContactManagement
### logging configuration FIXME: put this elsewhere ###
@ -86,7 +86,7 @@ class ContactList(Window, QuickContactList):
self.host = host
self.jid_list = []
self.__index=0 #indicate which contact is selected (ie: where we are)
Window.__init__(self, stdscr, stdscr.getmaxyx()[0]-2,const_CONTACT_WIDTH,0,0, True, "Contact List", code=code)
Window.__init__(self, stdscr, stdscr.getmaxyx()[0]-2,const_CONTACT_WIDTH,0,0, True, _("Contact List"), code=code)
def resize(self, height, width, y, x):
Window.resize(self, height, width, y, x)
@ -238,22 +238,22 @@ class SortilegeApp(QuickApp):
def color(self, activate=True):
if activate:
debug ("Activation des couleurs")
debug (_("Activating colors"))
curses.init_pair(1, curses.COLOR_BLUE, curses.COLOR_BLACK)
curses.init_pair(2, curses.COLOR_RED, curses.COLOR_BLACK)
else:
debug ("Desactivation des couleurs")
debug (_("Deactivating colors"))
curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_BLACK)
def showChat(self, chat):
debug ("show chat")
debug (_("show chat"))
if self.currentChat:
debug ("hiding %s", self.currentChat)
debug (_("hiding %s"), self.currentChat)
self.chat_wins[self.currentChat].hide()
self.currentChat=chat
debug ("showing %s", self.currentChat)
debug (_("showing %s"), self.currentChat)
self.chat_wins[self.currentChat].show()
self.chat_wins[self.currentChat].update()
@ -263,7 +263,7 @@ class SortilegeApp(QuickApp):
def onContactChoosed(self, jid_txt):
"""Called when a contact is selected in contact list."""
jid=JID(jid_txt)
debug ("contact choosed: %s", jid)
debug (_("contact choosed: %s"), jid)
self.showChat(jid.short)
self.statusBar.remove_item(jid.short)
if len(self.statusBar)==0:
@ -288,11 +288,11 @@ class SortilegeApp(QuickApp):
def askConfirmation(self, type, id, data):
#FIXME
info ("FIXME: askConfirmation not implemented")
info (_("FIXME: askConfirmation not implemented"))
def actionResult(self, type, id, data):
#FIXME
info ("FIXME: actionResult not implemented")
info (_("FIXME: actionResult not implemented"))
def newMessage(self, from_jid, msg, type, to_jid, profile):
QuickApp.newMessage(self, from_jid, msg, type, to_jid, profile)
@ -367,7 +367,7 @@ class SortilegeApp(QuickApp):
stdscr.erase()
height, width = stdscr.getmaxyx()
if height<5 and width<35:
stdscr.addstr("Pleeeeasse, I can't even breathe !")
stdscr.addstr(_("Pleeeeasse, I can't even breathe !"))
else:
for win in self.listWins:
win.resizeAdapt()

View file

@ -24,10 +24,6 @@ import curses
from window import Window
import os
def echo(message):
return
os.system('echo "'+str(message)+'" >> /tmp/toto')
class StatusBar(Window):
"""This class manage the edition of text"""
@ -49,9 +45,7 @@ class StatusBar(Window):
def update(self):
if self.isHidden():
echo ("status bar hidden")
return
echo ("update status bar")
Window.update(self)
x=0
for item in self.__items:

View file

@ -25,10 +25,6 @@ import os
import pdb
def echo(message):
return
os.system('echo "'+str(message)+'" >> /tmp/toto')
class Window():
def __init__(self, parent, height, width, y, x, border=False, title="", code="utf-8"):
self.__border=border
@ -93,7 +89,6 @@ class Window():
self.__coordAdjust(self.__coords)
height,width,y,x=self.__coords
echo ("newwin %d %d %d %d" % (height, width, y, x))
self.window = self.__parent.subwin(height, width, y, x)
self.defInsideCoord()