#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 1.0.2 on Thu Mar  2 17:42:32 2023
#

import wx

import wx.grid



class BasicFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((1472, 512))
        self.SetTitle("Peptide Matcher")

        sizer_1 = wx.BoxSizer(wx.VERTICAL)

        grid_sizer_1 = wx.GridSizer(4, 2, 0, 0)
        sizer_1.Add(grid_sizer_1, 0, 0, 0)

        self.button_fasta = wx.Button(self, wx.ID_ANY, "Choose fasta file...")
        grid_sizer_1.Add(self.button_fasta, 0, wx.ALIGN_RIGHT | wx.ALL, 5)

        sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
        grid_sizer_1.Add(sizer_3, 1, wx.EXPAND, 0)

        self.text_fasta = wx.TextCtrl(self, wx.ID_ANY, "")
        sizer_3.Add(self.text_fasta, 0, wx.ALL | wx.EXPAND, 5)

        self.radio_box_secstruct = wx.RadioBox(self, wx.ID_ANY, "Structural information?", choices=["no", "yes"], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        self.radio_box_secstruct.SetSelection(0)
        sizer_3.Add(self.radio_box_secstruct, 0, wx.ALL, 5)

        self.button_peptides = wx.Button(self, wx.ID_ANY, "Choose file with peptides...")
        grid_sizer_1.Add(self.button_peptides, 0, wx.ALIGN_RIGHT | wx.ALL, 5)

        self.text_peptides = wx.TextCtrl(self, wx.ID_ANY, "")
        grid_sizer_1.Add(self.text_peptides, 0, wx.ALL | wx.EXPAND, 5)

        label_1 = wx.StaticText(self, wx.ID_ANY, "Number of flanking residues")
        grid_sizer_1.Add(label_1, 0, wx.ALIGN_RIGHT | wx.RIGHT | wx.TOP, 10)

        self.spin_flanks = wx.SpinCtrlDouble(self, wx.ID_ANY, initial=4.0, min=1.0, max=100.0)
        grid_sizer_1.Add(self.spin_flanks, 0, wx.ALL, 5)

        sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
        grid_sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)

        self.button_run = wx.Button(self, wx.ID_ANY, "Run!")
        sizer_2.Add(self.button_run, 0, wx.ALL, 5)

        self.button_save = wx.Button(self, wx.ID_ANY, "Save as...")
        sizer_2.Add(self.button_save, 0, wx.ALL, 5)

        grid_sizer_1.Add((0, 0), 0, 0, 0)

        self.grid_matches = wx.grid.Grid(self, wx.ID_ANY, size=(1, 1))
        self.grid_matches.CreateGrid(1, 22)
        self.grid_matches.EnableEditing(0)
        self.grid_matches.SetColLabelValue(0, "Peptide")
        self.grid_matches.SetColLabelValue(1, "Length")
        self.grid_matches.SetColLabelValue(2, "Protein")
        self.grid_matches.SetColLabelValue(3, "Start")
        self.grid_matches.SetColLabelValue(4, "End")
        self.grid_matches.SetColLabelValue(5, "C-term")
        self.grid_matches.SetColLabelValue(6, "N-flank")
        self.grid_matches.SetColLabelValue(7, "C-flank")
        self.grid_matches.SetColLabelValue(8, "N-flank*")
        self.grid_matches.SetColLabelValue(9, "C-flank*")
        self.grid_matches.SetColLabelValue(10, "N-flank SS")
        self.grid_matches.SetColLabelValue(11, "Peptide SS")
        self.grid_matches.SetColLabelValue(12, "C-flank SS")
        self.grid_matches.SetColLabelValue(13, "N-flank TM")
        self.grid_matches.SetColLabelValue(14, "Peptide TM")
        self.grid_matches.SetColLabelValue(15, "C-flank TM")
        self.grid_matches.SetColLabelValue(16, "N-flank conf")
        self.grid_matches.SetColLabelValue(17, "Peptide conf")
        self.grid_matches.SetColLabelValue(18, "C-flank conf")
        self.grid_matches.SetColLabelValue(19, "N-flank RSA")
        self.grid_matches.SetColLabelValue(20, "Peptide RSA")
        self.grid_matches.SetColLabelValue(21, "C-flank RSA")
        sizer_1.Add(self.grid_matches, 1, wx.ALL | wx.EXPAND, 0)

        self.SetSizer(sizer_1)

        self.Layout()

        self.Bind(wx.EVT_BUTTON, self.on_button_fasta, self.button_fasta)
        self.Bind(wx.EVT_BUTTON, self.on_button_peptides, self.button_peptides)
        self.Bind(wx.EVT_BUTTON, self.on_button_run, self.button_run)
        self.Bind(wx.EVT_BUTTON, self.on_button_save, self.button_save)

    def on_button_fasta(self, event):
        print("Event handler 'on_button_fasta' not implemented!")
        event.Skip()

    def on_button_peptides(self, event):
        print("Event handler 'on_button_peptides' not implemented!")
        event.Skip()

    def on_button_run(self, event):
        print("Event handler 'on_button_run' not implemented!")
        event.Skip()

    def on_button_save(self, event):
        print("Event handler 'on_button_save' not implemented!")
        event.Skip()


class MyApp(wx.App):
    def OnInit(self):
        self.frame = BasicFrame(None, wx.ID_ANY, "")
        self.SetTopWindow(self.frame)
        self.frame.Show()
        return True

if __name__ == "__main__":
    peptide_matcher = MyApp(0)
    peptide_matcher.MainLoop()
