Exemple #1
0
class MainFrame(gui.MainFrame):
    """ Main application class. Here are defined all the methods and
        functions that control the entire application """
    def __init__(self):
        # Set info about the application
        self.info = AboutDialogInfo()
        with open('../version.txt', 'r') as version_file:
            self.info.SetVersion(version_file.read().__str__())
        self.info.SetName(u"CNC ToolDB")
        self.info.SetCopyright(
            u"Copyright (c) 2019 Simão Amorim <*****@*****.**>")
        with open('../LICENSE', 'r') as license_file:
            self.info.SetLicence(license_file.read().encode('UTF-8'))
        self.info.SetDevelopers([u"Simão Amorim ([email protected])"])
        # Initialize the window
        super().__init__(parent=None,
                         title=self.info.GetName() + " " +
                         self.info.GetVersion())
        self.DB = sql.DB()
        self.init_binds()
        self.update_chooser()
        self.Show()

    def init_binds(self):
        """Bind GUI events to the appropriate handler methods"""
        self.Bind(wx.EVT_MENU, self.menubar_handler, self.menu_bar)
        self.Bind(wx.EVT_CHOICE, self.set_machine, self.machine_chooser)

    def update_chooser(self):
        for item in self.DB.get_machines():
            self.machine_chooser.Append(item)

    def set_machine(self, event):
        temp_id = event.GetId()
        if temp_id == self.machine_chooser.Id:
            print("Choice: %s" % self.machine_chooser.GetStringSelection())

    def menubar_handler(self, event):
        """Method to handle events from the menu bar in the main frame"""
        temp_id = event.GetId()
        if temp_id == self.file_menu_exit.Id:
            self.Destroy()
        elif temp_id == self.help_menu_about.Id:
            AboutBox(
                info=self.info,
                parent=self,
            )
        event.StopPropagation()
Exemple #2
0
 def on_show_about(self, evt):
     info = AboutDialogInfo()
     info.SetDescription(
         '\n'.join(
             wrap(
                 "Ces formulaires vous proposent différents calculs "
                 "relatifs aux taux d'hydratation de la pâte et du levain",
                 width=50), ), )
     info.SetDevelopers(["Franck Barbenoire"])
     info.SetCopyright(u"Franck Barbenoire (2017)")
     info.SetLicense(u"GPL 3.0")
     info.SetName("Formulaires de boulangerie")
     info.SetVersion("1.0")
     info.SetWebSite(
         "https://github.com/franckinux/formulaires_boulangerie", "")
     AboutBox(info)