Exemplo n.º 1
0
class ContactPanel(wx.Panel):
    def __init__(self, parent):
        super().__init__(parent=parent)
        self.parent = parent

        self.surname = wx.TextCtrl(self, style=wx.ALIGN_LEFT)
        self.name = wx.TextCtrl(self, style=wx.ALIGN_LEFT)
        self.address = wx.TextCtrl(self, style=wx.ALIGN_LEFT)
        self.mail = wx.TextCtrl(self, style=wx.ALIGN_LEFT)
        self.phone = wx.TextCtrl(self, style=wx.ALIGN_LEFT)
        self.mobile = wx.TextCtrl(self, style=wx.ALIGN_LEFT)
        
        self.btn_save = GenBitmapTextButton(
            self, wx.ID_ANY, wx.Bitmap("%ssave.png" % IMG_PATH),
            'Save'.rjust(20), size=(200, 45))

        self.btn_quit = GenBitmapTextButton(
            self, wx.ID_ANY, wx.Bitmap("%sexit.png" % IMG_PATH),
            'Exit'.rjust(20), size=(200, 45))

        for button in (self.btn_save, self.btn_quit):
            button.SetBezelWidth(1)
            button.SetBackgroundColour(BTN_BG)

        self.btn_save.Disable()
        # sizer
        sizer = wx.FlexGridSizer(rows=7, cols=2, hgap=5, vgap=1)
        sizer.Add(wx.StaticText(self, -1, 'Surname*', style=wx.ALIGN_LEFT))
        sizer.Add(self.surname, 0, wx.EXPAND | wx.ALL, 4)
        sizer.Add(wx.StaticText(self, -1, 'Name*', style=wx.ALIGN_LEFT))
        sizer.Add(self.name, 0, wx.EXPAND | wx.ALL, 4)
        sizer.Add(wx.StaticText(self, -1, 'Address', style=wx.ALIGN_LEFT))
        sizer.Add(self.address, 0, wx.EXPAND | wx.ALL, 4)
        sizer.Add(wx.StaticText(self, -1, 'Mail', style=wx.ALIGN_LEFT))
        sizer.Add(self.mail, 0, wx.EXPAND | wx.ALL, 4)
        sizer.Add(wx.StaticText(self, -1, 'Phone', style=wx.ALIGN_LEFT))
        sizer.Add(self.phone, 0, wx.EXPAND | wx.ALL, 4)
        sizer.Add(wx.StaticText(self, -1, 'Mobile*', style=wx.ALIGN_LEFT))
        sizer.Add(self.mobile, 0, wx.EXPAND | wx.ALL, 4)
        sizer.Add(self.btn_save, 0, wx.EXPAND | wx.ALL, 1)
        sizer.Add(self.btn_quit, 0, wx.EXPAND | wx.ALL, 1)
        sizer.AddGrowableCol(1)
        self.SetSizer(sizer)
Exemplo n.º 2
0
class DeletePanel(wx.Panel):
    def __init__(self, parent):
        super().__init__(parent=parent)
        self.parent = parent
        self.contacts = wx.ComboBox(self,
                                    -1,
                                    "",
                                    choices=[],
                                    style=wx.CB_DROPDOWN)
        self.surname = wx.StaticText(self)
        self.name = wx.StaticText(self)
        self.btn_delete = GenBitmapTextButton(self,
                                              wx.ID_ANY,
                                              wx.Bitmap("%strash.png" %
                                                        IMG_PATH),
                                              'Delete'.rjust(20),
                                              size=(150, -1))

        self.btn_quit = GenBitmapTextButton(self,
                                            wx.ID_ANY,
                                            wx.Bitmap("%sexit.png" % IMG_PATH),
                                            'Exit'.rjust(20),
                                            size=(150, -1))

        for button in (self.btn_delete, self.btn_quit):
            button.SetBezelWidth(1)
            button.SetBackgroundColour(BTN_BG)

        self.btn_delete.Disable()
        # Sizer
        sizer = wx.FlexGridSizer(rows=3, cols=2, hgap=5, vgap=1)
        sizer.Add(wx.StaticText(self, -1, 'Surname', style=wx.ALIGN_LEFT))
        sizer.Add(self.surname, 0, wx.EXPAND | wx.ALL, 4)
        sizer.Add(wx.StaticText(self, -1, 'Name', style=wx.ALIGN_LEFT))
        sizer.Add(self.name, 0, wx.EXPAND | wx.ALL, 4)
        sizer.Add(self.btn_delete, 0, wx.EXPAND | wx.ALL, 1)
        sizer.Add(self.btn_quit, 0, wx.EXPAND | wx.ALL, 1)
        sizer.AddGrowableCol(1)
        outer_sizer = wx.BoxSizer(wx.VERTICAL)
        outer_sizer.Add(self.contacts, 0, wx.EXPAND | wx.ALL, 5)
        outer_sizer.Add(sizer, 0, wx.EXPAND | wx.ALL, 5)
        self.SetSizer(outer_sizer)
Exemplo n.º 3
0
class FindPanel(wx.Panel):
    def __init__(self, parent):
        super().__init__(parent=parent)
        self.parent = parent
        letters = [chr(i).upper() for i in range(ord('a'), ord('z') + 1)]
        self.pos = 5
        for letter in letters:
            button = wx.Button(self, wx.ID_ANY, letter, (self.pos, 3),
                               (26, 30))
            button.SetBackgroundColour(BTN_BG)
            self.pos += 26

        wx.StaticLine(self, wx.ID_ANY, (0, 35), (700, 3))

        self.list_ctrl = wx.ListCtrl(
            self, wx.ID_ANY, (0, 50), (690, 200),
            wx.LC_REPORT | wx.LC_HRULES | wx.LC_VRULES)
        self.list_ctrl.InsertColumn(0, "Surname", wx.LIST_FORMAT_LEFT, 100)
        self.list_ctrl.InsertColumn(1, "Name", wx.LIST_FORMAT_LEFT, 100)
        self.list_ctrl.InsertColumn(2, "Address", wx.LIST_FORMAT_LEFT, 150)
        self.list_ctrl.InsertColumn(3, "mail", wx.LIST_FORMAT_LEFT, 150)
        self.list_ctrl.InsertColumn(4, "phone", wx.LIST_FORMAT_LEFT, 100)
        self.list_ctrl.InsertColumn(5, "mobile", wx.LIST_FORMAT_LEFT, 100)

        wx.StaticLine(self, wx.ID_ANY, (0, 270), (700, 3))

        self.btn_delete = GenBitmapTextButton(
            self, wx.ID_ANY, wx.Bitmap("%strash.png" % IMG_PATH),
            'Delete'.rjust(20), (10, 300), (340, -1))

        self.btn_quit = GenBitmapTextButton(self, wx.ID_ANY,
                                            wx.Bitmap("%sexit.png" % IMG_PATH),
                                            'Exit'.rjust(20), (345, 300),
                                            (340, -1))

        for button in (self.btn_delete, self.btn_quit):
            button.SetBezelWidth(1)
            button.SetBackgroundColour(BTN_BG)

        self.btn_delete.Disable()