Changeset 115:fa8178825b29 for src/mlx


Ignore:
Timestamp:
04/27/12 18:29:22 (13 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Internationalized the automatic update window

Location:
src/mlx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/update.py

    r105 r115  
    66
    77from mlx.update import update
     8from mlx.i18n import xstr
    89
    910import mlx.const as const
     
    3940
    4041        Updater._progressWindow = window = gtk.Window()
    41         window.set_title(WINDOW_TITLE_BASE + " Update")
     42        window.set_title(WINDOW_TITLE_BASE + " " + xstr("update_title"))
    4243        window.set_transient_for(parentWindow)
    4344        #win.set_icon_from_file(os.path.join(iconDirectory, "logo.ico"))
     
    7273
    7374        Updater._sudoDialog = sudoDialog = \
    74             gtk.Dialog(WINDOW_TITLE_BASE + " Update",
     75            gtk.Dialog(WINDOW_TITLE_BASE + " " + xstr("update_title"),
    7576                       parentWindow,
    7677                       gtk.DialogFlags.MODAL if pygobject else gtk.DIALOG_MODAL,
     
    8283                                       padding_left = 16, padding_right = 16)
    8384
    84         infoLabel = gtk.Label("There is an update available, but the program cannot write\n"
    85                               "its directory due to insufficient privileges.\n\n"
    86                               "Click OK, if you want to run a helper program\n"
    87                               "with administrator privileges "
    88                               "to complete the update,\n"
    89                               "Cancel otherwise.")
     85        infoLabel = gtk.Label(xstr("update_needsudo"))
    9086        infoLabel.set_justify(gtk.Justification.CENTER if pygobject
    9187                              else gtk.JUSTIFY_CENTER)
     
    128124    def _downloadingManifest(self):
    129125        """Called when the downloading of the manifest has started."""
    130         self._progressLabel.set_text("Downloading manifest...")
     126        self._progressLabel.set_text(xstr("update_manifest_progress"))
    131127        self._progressBar.set_fraction(0)
    132128
     
    137133    def _downloadedManifest(self):
    138134        """Called when the downloading of the manifest has finished."""
    139         self._progressLabel.set_text("Downloaded manifest...")
     135        self._progressLabel.set_text(xstr("update_manifest_done"))
    140136        self._progressBar.set_fraction(0.05)
    141137
     
    178174    def _startDownload(self):
    179175        """Called when the download has started."""
    180         self._progressLabel.set_text("Downloading files...")
     176        self._progressLabel.set_text(xstr("update_files_progress"))
    181177
    182178    def setDownloaded(self, downloaded):
     
    187183    def _setDownloaded(self, downloaded):
    188184        """Called when a certain number of bytes are downloaded."""
    189         self._progressLabel.set_text("Downloaded %d of %d" % \
     185        self._progressLabel.set_text(xstr("update_files_bytes") % \
    190186                                     (downloaded, self._totalSize))
    191187        self._setProgress()
     
    197193    def _startRenaming(self):
    198194        """Called when the renaming of files has started."""
    199         self._progressLabel.set_text("Renaming downloaded files...")
     195        self._progressLabel.set_text(xstr("update_renaming"))
    200196
    201197    def renamed(self, path, count):
     
    206202    def _renamed(self, path, count):
    207203        """Called when a file has been renamed."""
    208         self._progressLabel.set_text("Renamed %s" % (path,))
     204        self._progressLabel.set_text(xstr("update_renamed") % (path,))
    209205        self._setProgress()
    210206
     
    215211    def _startRemoving(self):
    216212        """Called when the removing of files has started."""
    217         self._progressLabel.set_text("Removing files...")
     213        self._progressLabel.set_text(xstr("update_removing"))
    218214
    219215    def removed(self, path, count):
     
    224220    def _removed(self, path, count):
    225221        """Called when a file has been removed."""
    226         self._progressLabel.set_text("Removed %s" % (path,))
     222        self._progressLabel.set_text(xstr("update_removed") % (path,))
    227223        self._setProgress()
    228224
     
    233229    def _writingManifest(self):
    234230        """Called when the writing of the new manifest file has started."""
    235         self._progressLabel.set_text("Writing the new manifest")
     231        self._progressLabel.set_text(xstr("update_writing_manifest"))
    236232       
    237233    def done(self):
     
    244240        self._progressBar.set_fraction(1)
    245241        if self._totalProgress>0:
    246             self._progressLabel.set_text("Finished updating. Press OK to restart the program.")
     242            self._progressLabel.set_text(xstr("update_finished"))
    247243            self._progressOKButton.set_sensitive(True)
    248244        else:
    249             self._progressLabel.set_text("There was nothing to update")
     245            self._progressLabel.set_text(xstr("update_nothing"))
    250246       
    251247    def _setProgress(self):
     
    264260    def _failed(self, what):
    265261        """Called when the downloading has failed."""       
    266         self._progressLabel.set_text("Failed, see the debug log for details.")
     262        self._progressLabel.set_text(xstr("update_failed"))
    267263        self._progressBar.set_fraction(1)
    268264        self._progressOKButton.set_sensitive(True)
  • src/mlx/i18n.py

    r114 r115  
    453453        self.add("statusicon_stage", "Stage:")
    454454        self.add("statusicon_rating", "Rating:")
     455
     456        self.add("update_title", "Update")
     457        self.add("update_needsudo",
     458                 "There is an update available, but the program cannot write\n"
     459                 "its directory due to insufficient privileges.\n\n"
     460                 "Click OK, if you want to run a helper program\n"
     461                 "with administrator privileges "
     462                 "to complete the update,\n"
     463                 "Cancel otherwise.")
     464        self.add("update_manifest_progress", "Downloading manifest...")
     465        self.add("update_manifest_done", "Downloaded manifest...")
     466        self.add("update_files_progress", "Downloading files...")
     467        self.add("update_files_bytes", "Downloaded %d of %d bytes")
     468        self.add("update_renaming", "Renaming downloaded files...")
     469        self.add("update_renamed", "Renamed %s")
     470        self.add("update_removing", "Removing files...")
     471        self.add("update_removed", "Removed %s")
     472        self.add("update_writing_manifest", "Writing the new manifest")
     473        self.add("update_finished",
     474                 "Finished updating. Press OK to restart the program.")
     475        self.add("update_nothing", "There was nothing to update")
     476        self.add("update_failed", "Failed, see the debug log for details.")
    455477                 
    456478#------------------------------------------------------------------------------
     
    799821        self.add("statusicon_rating", "Pontszám:")
    800822
     823        self.add("update_title", "Frissítés")
     824        self.add("update_needsudo",
     825                 "Lenne mit frissíteni, de a program hozzáférési jogok\n"
     826                 "hiányában nem tud írni a saját könyvtárába.\n\n"
     827                 "Kattints az OK gombra, ha el szeretnél indítani egy\n"
     828                 "segédprogramot adminisztrátori jogokkal, amely\n"
     829                 "befejezné a frissítést, egyébként a Mégse gombra.")
     830        self.add("update_manifest_progress", "A manifesztum letöltése...")
     831        self.add("update_manifest_done", "A manifesztum letöltve...")
     832        self.add("update_files_progress", "Fájlok letöltése...")
     833        self.add("update_files_bytes", "%d bájtot töltöttem le %d bájtból")
     834        self.add("update_renaming", "A letöltött fájlok átnevezése...")
     835        self.add("update_renamed", "Átneveztem a(z) %s fájlt")
     836        self.add("update_removing", "Fájlok törlése...")
     837        self.add("update_removed", "Letöröltem a(z) %s fájlt")
     838        self.add("update_writing_manifest", "Az új manifesztum írása")
     839        self.add("update_finished",
     840                 "A frissítés sikerült. Kattints az OK-ra a program újraindításához.")
     841        self.add("update_nothing", "Nem volt mit frissíteni")
     842        self.add("update_failed", "Nem sikerült, a részleteket lásd a debug naplóban.")
     843
    801844#------------------------------------------------------------------------------
    802845
  • src/mlx/update.py

    r39 r115  
    425425
    426426        serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     427        serverSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    427428        serverSocket.bind(("127.0.0.1", 0))
    428429        (_host, port) = serverSocket.getsockname()
Note: See TracChangeset for help on using the changeset viewer.