示例#1
0
 def addControls(self, sizer, parent):
     # Translators: instruction message in the audio themes studio startup dialog
     dialogMessage = wx.StaticText(self, -1, _(WELCOME_MSG))
     self.createNewThemeButton = CommandLinkButton(
         parent,
         -1,
         # Translators: the main label of a button
         _("Create &New Audio Theme"),
         # Translators: the note of a button
         _("Create a new audio theme package from scratch"),
     )
     self.editExistingThemeButton = CommandLinkButton(
         parent,
         -1,
         # Translators: the main label of a button
         _("Customize &Existing Audio Theme"),
         # Translators: the note of a button
         _("Customize an installed audio theme with your prefered  sounds."
           ),
     )
     sizer.AddMany([
         (dialogMessage, 1, wx.EXPAND | wx.ALL, 10),
         (self.createNewThemeButton, 1, wx.EXPAND | wx.ALL, 10),
         (self.editExistingThemeButton, 1, wx.EXPAND | wx.ALL, 10),
     ])
     # Bind events
     self.Bind(wx.EVT_BUTTON, self.onCreateNewTheme,
               self.createNewThemeButton)
     self.Bind(wx.EVT_BUTTON, self.onEditExistingTheme,
               self.editExistingThemeButton)
示例#2
0
 def addControls(self, parent):
     self.ext_info = sorted(get_ext_info().items())
     # Translators: instructions shown to the user in a dialog to set up file association.
     wx.StaticText(
         parent,
         -1,
         _("This dialog will help you to setup file associations.\n"
           "Associating files with Bookworm means that when you click on a file in windows explorer, it will be opened in Bookworm by default "
           ),
     )
     masterPanel = sc.SizedPanel(parent, -1)
     masterPanel.SetSizerType("horizontal")
     panel1 = sc.SizedPanel(masterPanel, -1)
     panel2 = sc.SizedPanel(masterPanel, -1)
     assoc_btn = CommandLinkButton(
         panel1,
         -1,
         # Translators: the main label of a button
         _("Associate all"),
         # Translators: the note of a button
         _("Use Bookworm to open all supported document formats"),
     )
     half = len(self.ext_info) / 2
     buttonPanel = panel1
     for i, (ext, metadata) in enumerate(self.ext_info):
         if i >= half:
             buttonPanel = panel2
         # Translators: the main label of a button
         mlbl = _("Associate files of type {format}").format(
             format=metadata[1])
         # Translators: the note of a button
         nlbl = _(
             "Associate files with {ext} extension so they always open in Bookworm"
         ).format(ext=ext)
         btn = CommandLinkButton(buttonPanel, -1, mlbl, nlbl)
         self.Bind(
             wx.EVT_BUTTON,
             lambda e, args=(ext, metadata[1]): self.onFileAssoc(*args),
             btn,
         )
     dissoc_btn = CommandLinkButton(
         panel2,
         -1,
         # Translators: the main label of a button
         _("Dissociate all supported file types"),
         # Translators: the note of a button
         _("Remove previously associated file types"),
     )
     self.Bind(wx.EVT_BUTTON, lambda e: self.onBatchAssoc(assoc=True),
               assoc_btn)
     self.Bind(wx.EVT_BUTTON, lambda e: self.onBatchAssoc(assoc=False),
               dissoc_btn)
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           name="DLG_Supprimer_facture",
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
                           | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX)
        self.parent = parent

        # Bandeau
        titre = _(u"Supprimer ou annuler des factures")
        intro = _(
            u"Sélectionnez l'action à effectuer. Attention, ces deux types d'actions sont irréversibles !"
        )
        self.SetTitle(titre)
        self.ctrl_bandeau = CTRL_Bandeau.Bandeau(
            self,
            titre=titre,
            texte=intro,
            hauteurHtml=30,
            nomImage="Images/32x32/Fermer.png")

        self.bouton_annulation = CommandLinkButton(
            self, -1, _(u"Annulation"),
            _(u"Cette action conservera les traces de la facture annulée dans la base de données. Les principales\ncaractéristiques de la facture seront mémorisées mais il sera impossible par exemple de l'imprimer\nou d'en consulter le détail. Cette action permet notamment de faire apparaître les prestations\nassociées sur une nouvelle facture."
              ))
        self.bouton_suppression = CommandLinkButton(
            self, -1, _(u"Suppression"),
            _(u"Cette action supprimera totalement la facture. Seule une trace sera conservée dans l'historique.\nLe numéro est susceptible d'être réutilisé s'il s'agit de la dernière facture générée. Cette action peut\nêtre utilisée par exemple pour supprimer une ou plusieurs factures qui viennent d'être générées par\nerreur."
              ))

        self.bouton_aide = CTRL_Bouton_image.CTRL(
            self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png")
        self.bouton_annuler = CTRL_Bouton_image.CTRL(
            self,
            id=wx.ID_CANCEL,
            texte=_(u"Annuler"),
            cheminImage="Images/32x32/Annuler.png")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.OnBoutonAnnulation,
                  self.bouton_annulation)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonSuppression,
                  self.bouton_suppression)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide)
示例#4
0
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           name="DLG_Choix_format",
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
                           | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX)
        self.parent = parent
        self.format = None

        # Bandeau
        titre = _(u"Sélection du format")
        intro = _(u"Cliquez sur le format d'export souhaité.")
        self.SetTitle(titre)
        self.ctrl_bandeau = CTRL_Bandeau.Bandeau(
            self,
            titre=titre,
            texte=intro,
            hauteurHtml=30,
            nomImage="Images/32x32/Helios.png")

        self.liste_boutons = []
        for dict_format in FORMATS:
            ctrl = CommandLinkButton(self,
                                     -1,
                                     dict_format["label"],
                                     dict_format["description"],
                                     size=(200, -1))
            ctrl.SetMinSize((500, -1))
            self.Bind(wx.EVT_BUTTON, self.OnBoutonChoix, ctrl)
            self.liste_boutons.append({
                "id": ctrl.GetId(),
                "ctrl": ctrl,
                "dict_format": dict_format
            })

        self.bouton_aide = CTRL_Bouton_image.CTRL(
            self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png")
        self.bouton_annuler = CTRL_Bouton_image.CTRL(
            self,
            id=wx.ID_CANCEL,
            texte=_(u"Annuler"),
            cheminImage="Images/32x32/Annuler.png")

        self.__set_properties()
        self.__do_layout()
示例#5
0
 def addControls(self, parent):
     self.ext_info = sorted(get_ext_info().items())
     # Translators: instructions shown to the user in a dialog to set up file association.
     wx.StaticText(
         parent,
         -1,
         _("This dialog will help you to setup file associations.\n"
           "Associating files with Bookworm means that when you click on a file in windows explorer, it will be opend in Bookworm by default "
           ),
     )
     assoc_btn = CommandLinkButton(
         parent,
         -1,
         # Translators: the main label of a button
         _("Associate all"),
         # Translators: the note of a button
         _("Use Bookworm to open all supported ebook formats"),
     )
     for ext, metadata in self.ext_info:
         # Translators: the main label of a button
         mlbl = _("Associate files of type {format}").format(
             format=metadata[1])
         # Translators: the note of a button
         nlbl = _(
             "Associate files with {ext} extension so they always open in Bookworm"
         ).format(ext=ext)
         btn = CommandLinkButton(parent, -1, mlbl, nlbl)
         self.Bind(
             wx.EVT_BUTTON,
             lambda e, args=(ext, metadata[1]): self.onFileAssoc(*args),
             btn,
         )
     dissoc_btn = CommandLinkButton(
         parent,
         -1,
         # Translators: the main label of a button
         _("Dissociate all supported file types"),
         # Translators: the note of a button
         _("Unregister previously associated file types"),
     )
     self.Bind(wx.EVT_BUTTON, lambda e: self.onBatchAssoc(assoc=True),
               assoc_btn)
     self.Bind(wx.EVT_BUTTON, lambda e: self.onBatchAssoc(assoc=False),
               dissoc_btn)
示例#6
0
    def __init__(
        self,
        parent,
        listeBoutons=[],
        titre=_(u"Quel type de prélèvement souhaitez-vous créer ?"),
        intro=_(u"Cliquez sur la norme souhaitée..."),
        minSize=(500, 400)):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
                           | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX)
        self.parent = parent
        self.minSize = minSize

        # Bandeau
        self.ctrl_bandeau = CTRL_Bandeau.Bandeau(self,
                                                 titre=titre,
                                                 texte=intro,
                                                 hauteurHtml=30,
                                                 nomImage=None)

        # Activation
        self.listeControles = []
        index = 0
        for label, description in listeBoutons:
            ctrl = CommandLinkButton(self, index, label,
                                     textwrap.fill(description, 80))
            self.listeControles.append(ctrl)
            self.Bind(wx.EVT_BUTTON, self.OnBouton, ctrl)
            index += 1

        # Boutons
        self.bouton_fermer = CTRL_Bouton_image.CTRL(
            self, texte=_(u"Annuler"), cheminImage="Images/32x32/Annuler.png")

        self.__set_properties()
        self.__do_layout()

        # Binds
        self.Bind(wx.EVT_BUTTON, self.OnBoutonFermer, self.bouton_fermer)
示例#7
0
 def addControls(self):
     self._service = wx.GetApp().service_handler.get_service("ocr")
     self._engines = self._service._available_ocr_engines
     _engines_display = [_(e.display_name) for e in self._engines]
     # Translators: the label of a group of controls in the reading page
     generalOcrBox = self.make_static_box(_("OCR Options"))
     self.ocrEngine = wx.RadioBox(
         generalOcrBox,
         -1,
         # Translators: the title of a group of radio buttons in the OCR page
         # in the application settings.
         _("Default OCR Engine"),
         majorDimension=1,
         style=wx.RA_SPECIFY_COLS,
         choices=_engines_display,
     )
     # Translators: the label of a group of controls in the OCR page
     # of the settings related to Tesseract OCR engine
     tessBox = self.make_static_box(_("Tesseract OCR Engine"))
     if not tesseract_download.is_tesseract_available():
         tessEngineDlBtn = CommandLinkButton(
             tessBox,
             -1,
             _("Download Tesseract OCR Engine"),
             _("Get a free, high-quality OCR engine that supports over 100 languages."
               ),
         )
         self.Bind(wx.EVT_BUTTON, self.onDownloadTesseractEngine,
                   tessEngineDlBtn)
     else:
         tessLangDlBtn = CommandLinkButton(
             tessBox,
             -1,
             # Translators: label of a button
             _("Manage Tesseract OCR Languages"),
             # Translators: description of a button
             _("Add support for new languages, and /or remove installed languages."
               ),
         )
         updateTesseractBtn = CommandLinkButton(
             tessBox,
             -1,
             # Translators: label of a button
             _("Update Tesseract OCr Engine"),
             # Translators: description of a button
             _("Check for and install updates for Tesseract OCR Engine"),
         )
         self.Bind(wx.EVT_BUTTON, self.onDownloadTesseractLanguages,
                   tessLangDlBtn)
         self.Bind(wx.EVT_BUTTON, self.onUpdateTesseractEngine,
                   updateTesseractBtn)
     # Translators: the label of a group of controls in the reading page
     # of the settings related to image enhancement
     miscBox = self.make_static_box(_("Image processing"))
     wx.CheckBox(
         miscBox,
         -1,
         # Translators: the label of a checkbox
         _("Enable default image enhancement filters"),
         name="ocr.enhance_images",
     )
class Dialog(wx.Dialog):
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           name="DLG_Supprimer_facture",
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
                           | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX)
        self.parent = parent

        # Bandeau
        titre = _(u"Supprimer ou annuler des factures")
        intro = _(
            u"Sélectionnez l'action à effectuer. Attention, ces deux types d'actions sont irréversibles !"
        )
        self.SetTitle(titre)
        self.ctrl_bandeau = CTRL_Bandeau.Bandeau(
            self,
            titre=titre,
            texte=intro,
            hauteurHtml=30,
            nomImage="Images/32x32/Fermer.png")

        self.bouton_annulation = CommandLinkButton(
            self, -1, _(u"Annulation"),
            _(u"Cette action conservera les traces de la facture annulée dans la base de données. Les principales\ncaractéristiques de la facture seront mémorisées mais il sera impossible par exemple de l'imprimer\nou d'en consulter le détail. Cette action permet notamment de faire apparaître les prestations\nassociées sur une nouvelle facture."
              ))
        self.bouton_suppression = CommandLinkButton(
            self, -1, _(u"Suppression"),
            _(u"Cette action supprimera totalement la facture. Seule une trace sera conservée dans l'historique.\nLe numéro est susceptible d'être réutilisé s'il s'agit de la dernière facture générée. Cette action peut\nêtre utilisée par exemple pour supprimer une ou plusieurs factures qui viennent d'être générées par\nerreur."
              ))

        self.bouton_aide = CTRL_Bouton_image.CTRL(
            self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png")
        self.bouton_annuler = CTRL_Bouton_image.CTRL(
            self,
            id=wx.ID_CANCEL,
            texte=_(u"Annuler"),
            cheminImage="Images/32x32/Annuler.png")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.OnBoutonAnnulation,
                  self.bouton_annulation)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonSuppression,
                  self.bouton_suppression)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide)

    def __set_properties(self):
        self.bouton_annulation.SetToolTip(
            wx.ToolTip(
                _(u"Cliquez ici pour annuler la ou les factures sélectionnées"
                  )))
        self.bouton_suppression.SetToolTip(
            wx.ToolTip(
                _(u"Cliquez ici pour supprimer totalement la ou les factures sélectionnées"
                  )))
        self.bouton_aide.SetToolTip(wx.ToolTip(_(u"Obtenir de l'aide")))
        self.bouton_annuler.SetToolTip(wx.ToolTip(_(u"Annuler")))

    def __do_layout(self):
        grid_sizer_base = wx.FlexGridSizer(rows=3, cols=1, vgap=10, hgap=10)
        grid_sizer_base.Add(self.ctrl_bandeau, 0, wx.EXPAND, 0)

        grid_sizer_contenu = wx.FlexGridSizer(rows=2, cols=1, vgap=10, hgap=10)

        grid_sizer_contenu.Add(self.bouton_annulation, 0, wx.EXPAND, 10)
        grid_sizer_contenu.Add(self.bouton_suppression, 0, wx.EXPAND, 10)
        grid_sizer_contenu.AddGrowableCol(0)
        grid_sizer_base.Add(grid_sizer_contenu, 1,
                            wx.LEFT | wx.RIGHT | wx.EXPAND, 10)

        grid_sizer_boutons = wx.FlexGridSizer(rows=1, cols=3, vgap=10, hgap=10)
        grid_sizer_boutons.Add(self.bouton_aide, 0, 0, 0)
        grid_sizer_boutons.Add((20, 20), 0, wx.EXPAND, 0)
        grid_sizer_boutons.Add(self.bouton_annuler, 0, 0, 0)
        grid_sizer_boutons.AddGrowableCol(1)
        grid_sizer_base.Add(grid_sizer_boutons, 1,
                            wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, 10)
        self.SetSizer(grid_sizer_base)
        grid_sizer_base.Fit(self)
        grid_sizer_base.AddGrowableRow(1)
        grid_sizer_base.AddGrowableCol(0)
        self.Layout()
        self.SetMinSize(self.GetSize())
        self.CenterOnScreen()

    def OnBoutonAnnulation(self, event):
        self.EndModal(100)

    def OnBoutonSuppression(self, event):
        self.EndModal(200)

    def OnBoutonAide(self, event):
        from Utils import UTILS_Aide
        UTILS_Aide.Aide("")