示例#1
0
 def reconcile(self, strategy=ReconciliationStrategies.load):
     if strategy is ReconciliationStrategies.save:
         selection = self.languageChoice.GetSelection()
         if selection == wx.NOT_FOUND:
             return
         selected_lang = self.languageChoice.GetClientData(selection)
         if selected_lang.LCID != app.current_language.LCID:
             self.config["language"] = selected_lang.pylang
             config.save()
             set_active_language(selected_lang.pylang)
             msg = wx.MessageBox(
                 # Translators: the content of a message asking the user to restart
                 _("You have changed the display language of Bookworm.\n"
                   "For this setting to fully take effect, you need to restart the application.\n"
                   "Would you like to restart the application right now?"),
                 # Translators: the title of a message telling the user
                 # that the display language have been changed
                 _("Language Changed"),
                 style=wx.YES_NO | wx.ICON_WARNING,
             )
             if msg == wx.YES:
                 restart_application()
     super().reconcile(strategy=strategy)
示例#2
0
 def onFind(self, event):
     # Translators: the title of the search dialog
     dlg = SearchBookDialog(parent=self, title=_("Search book"))
     if dlg.ShowModal() != wx.ID_OK:
         return
     request = dlg.GetValue()
     term = request.term
     dlg.Destroy()
     del dlg
     if not term:
         return
     last_searches = config.conf["history"]["recent_terms"]
     if len(last_searches) > 9:
         config.conf["history"]["recent_terms"] = last_searches[:9]
     config.conf["history"]["recent_terms"].insert(0, term)
     config.save()
     self._reset_search_history()
     self._recent_search_term = term
     # Translators: the initial title of the search results dialog
     # shown when the search process is not done yet
     dlg = SearchResultsDialog(
         self, title=_("Searching For '{term}'").format(term=term))
     dlg.Show()
     self._add_search_results(request, dlg)
示例#3
0
 def onClearRecentFileList(self, event):
     config.conf["history"]["recently_opened"] = []
     config.save()
     self.populate_recent_file_list()
示例#4
0
 def save(self):
     for profile in self.profiles.values():
         profile.write()
     config.save()