[Uludag-commits] r20277 - trunk/staj-projeleri/sinerji

uludag-commits at pardus.org.tr uludag-commits at pardus.org.tr
15 Eyl 2008 Pzt 11:57:57 EEST


Author: fatih.arslan
Date: Mon Sep 15 11:57:56 2008
New Revision: 20277

Modified:
   trunk/staj-projeleri/sinerji/sinerji.py
   trunk/staj-projeleri/sinerji/ui_sinerjigui.py
Log:
Add gettext for i18n

Modified: trunk/staj-projeleri/sinerji/sinerji.py
=================================================================
--- trunk/staj-projeleri/sinerji/sinerji.py	(original)
+++ trunk/staj-projeleri/sinerji/sinerji.py	Mon Sep 15 11:57:56 2008
@@ -21,6 +21,9 @@
 
 __version__ = 0.1
 
+import gettext
+__trans = gettext.translation('sahip', fallback=True)
+_ = __trans.ugettext
 
 class SinerjiGui(QDialog, ui_sinerjigui.Ui_SinerjiGui):
     def __init__(self,  parent=None):
@@ -78,7 +81,7 @@
 ##################################################################
 ##################################################################
     def showPopup(self):
-        message = ("%s want to use your pc from %s" % (self.serverAndIp[0], self.clientAndPos[0]))
+        message = (_("%s want to use your pc from %s") % (self.serverAndIp[0], self.clientAndPos[0]))
         header = "Sinerji"
         buttonList = ["accept", unicode("Accept"), "reject", unicode("Reject")]
         self.notifier.show(self.iconNotify, header, message, 0, buttonList)
@@ -109,22 +112,22 @@
     ### Menu for the Tray
         self.trayMenu = QMenu()
 
-        self.actionManage = QAction(QIcon(":/manage.png"),u"Manage", self)
+        self.actionManage = QAction(QIcon(":/manage.png"),_(u"Manage"), self)
         self.connect(self.actionManage, SIGNAL("activated()"), self.show)
         self.trayMenu.addAction(self.actionManage)
 
-        self.actionAbout = QAction(QIcon(":/about.png"),u"About", self)
+        self.actionAbout = QAction(QIcon(":/about.png"),_(u"About"), self)
         self.connect(self.actionAbout, SIGNAL("activated()"), self.about)
         self.trayMenu.addAction(self.actionAbout)
 
         self.trayMenu.addSeparator()
 
-        self.actionQuit = QAction(QIcon(":/quit.png"),u"Quit", self)
+        self.actionQuit = QAction(QIcon(":/quit.png"), _(u"Quit"), self)
         self.connect(self.actionQuit, SIGNAL("activated()"), self.killSynergys)
         self.trayMenu.addAction(self.actionQuit)
         
         ## for Client
-        self.actionDisconnect = QAction(QIcon(":/disconnect.png"),u"Disconnect", self)
+        self.actionDisconnect = QAction(QIcon(":/disconnect.png"),_(u"Disconnect"), self)
         self.connect(self.actionDisconnect, SIGNAL("activated()"), self.disconnect)
 
 
@@ -188,8 +191,8 @@
             self.clientState = True
 
             time.sleep(0.5)
-            self.notifier.show(self.iconNotify, "Sinerji", ("%s is connected to you" % self.serverAndIp[0]), 1500)
-            self.trayIcon.setToolTip("%s is connected to you." % self.clientAndPos[1])
+            self.notifier.show(self.iconNotify, "Sinerji", (_("%s is connected to you") % self.serverAndIp[0]), 1500)
+            self.trayIcon.setToolTip(_("%s is connected to you.") % self.clientAndPos[1])
             self.timer.stop()
 
     def disconnect(self):
@@ -201,14 +204,14 @@
             if self.process.pid:
                 os.kill(self.process.pid, signal.SIGKILL)
         time.sleep(0.5)
-        self.notifier.show(self.iconNotify, "Sinerji", ("Disconnected from %s " % self.serverAndIp[0]))
+        self.notifier.show(self.iconNotify, "Sinerji", (_("Disconnected from %s") % self.serverAndIp[0]))
         self.clientState = None
 
 
     def rejectServer(self):
         if self.searched:
             self.timer.stop()
-            self.trayIcon.setToolTip("Idle mode, nothing to do")
+            self.trayIcon.setToolTip(_("Idle mode, nothing to do"))
         else:
             pass
 
@@ -312,11 +315,11 @@
             self.started = True
             self.hide()
             time.sleep(0.5)
-            self.notifier.show(self.iconNotify, "Sinerji", "Synergy server started successfull")
-            self.trayIcon.setToolTip("Synergy is connected to a pc")
+            self.notifier.show(self.iconNotify, "Sinerji", _("Synergy server started successfull"))
+            self.trayIcon.setToolTip(_("Synergy is connected to a pc"))
 
         elif self.clientState:
-            QMessageBox.warning(self, u"Warning", u"Somebody is using your computer. To use other computers please restart")
+            QMessageBox.warning(self, _(u"Warning"), _(u"Somebody is using your computer. To use other computers please restart"))
 
         else:
             pass

Modified: trunk/staj-projeleri/sinerji/ui_sinerjigui.py
=================================================================
--- trunk/staj-projeleri/sinerji/ui_sinerjigui.py	(original)
+++ trunk/staj-projeleri/sinerji/ui_sinerjigui.py	Mon Sep 15 11:57:56 2008
@@ -77,7 +77,7 @@
 "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
 "p, li { white-space: pre-wrap; }\n"
 "</style></head><body style=\" font-family:\'Sans Serif\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
-"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; color:#333333;\">Yönetmek istediğiniz bilgisayarı ve fiziksel konumunu seçin</span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; color:#333333;\">Choose the computer and his position to manage it</span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
         self.applyButton.setText(QtGui.QApplication.translate("SinerjiGui", "Apply", None, QtGui.QApplication.UnicodeUTF8))
         self.closeButton.setText(QtGui.QApplication.translate("SinerjiGui", "Close", None, QtGui.QApplication.UnicodeUTF8))
 


Uludag-commits mesaj listesiyle ilgili daha fazla bilgi