# -*- coding: utf-8 -*-

# Import main wxPython libraries
import wx
import wx.xrc
# Import the wxGestalt module for Gestalt Machines
import Machines.wxMachines as wxMachines


###########################################################################
## Class wxGestaltPanel
###########################################################################

class wxGestaltPanel(wx.Panel):
    '''This is the main class for the app that will be launched in the fifth tab.
    Do not rename the class, or wxGestalt won't open it in the tab.
    '''

    def __init__( self, parent ):
        '''
        This function initialize the interface. Add all your GUI elements here.
        '''
        # Initialize the panel that contains all the GUI elements
        wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL )

        # Load the machine edited in the main app
        myMachine = self.GetParent().GetParent().myMachine

        # Create sizers for organizing the GUI elements here
        self.mainSizer = wx.BoxSizer( wx.VERTICAL )

        # Create GUI elements here
        txt1 = "Just a text element to show you how to create GUI widgets..."
        st1 = wx.StaticText(self, label=txt1, style=wx.ALIGN_CENTRE)

        # Add GUI elements to the sizer here
        self.mainSizer.Add(st1, flag=wx.ALL, border=5)

        # Add a button for launching your app
        self.launch_button = wx.Button( self, wx.ID_ANY, u"Run", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.mainSizer.Add( self.launch_button, 0, wx.ALL, 5 )

        # Bind GUI elements to event and functions
        self.launch_button.Bind( wx.EVT_BUTTON, self.On_Run )

        # Set up sizers and layout
        self.SetSizer( self.mainSizer )
        self.Layout()

    def On_CalculateCoords(self, event):
        '''
        Add here the function for calculating the move instructions to be sent to the machine.
        '''

        # Add here your function

        # Add here the final moves from your function
        moves = []

        # Return the value
        return moves

    def On_Run(self, event, moves):
        '''
        This function will finally control the machine after you press the "Run" button.
        Add here your code that will send data to the machine.
        '''
        # Add code here below
        myMachine.moveMachine(moves)

        event.Skip()

# -*- coding: utf-8 -*-

# Import main wxPython libraries
import wx
import wx.xrc
# Import the wxGestalt module for Gestalt Machines
import Machines.wxMachines as wxMachines


###########################################################################
## Class wxGestaltPanel
###########################################################################

class wxGestaltPanel(wx.Panel):
    '''This is the main class for the app that will be launched in the fifth tab.
    Do not rename the class, or wxGestalt won't open it in the tab.
    Please remember: if you print anything, it will go out to the second tab (2. Identify the nodes).
    Add a text widget and update its value in order to show some text / values in the GUI.
    '''

    def __init__( self, parent ):
        '''
        This function initialize the interface. Add all your GUI elements here.
        '''
        # Initialize the panel that contains all the GUI elements
        wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL )

        # Load the machine edited in the main app
        myMachine = self.GetParent().GetParent().myMachine

        # Create sizers for organizing the GUI elements here
        self.mainSizer = wx.BoxSizer( wx.VERTICAL )

        # Create GUI elements here
        txt1 = "Just a text element to show you how to create GUI widgets..."
        st1 = wx.StaticText(self, label=txt1, style=wx.ALIGN_CENTRE)

        # Add GUI elements to the sizer here
        self.mainSizer.Add(st1, flag=wx.ALL, border=5)

        # Add a button for launching your app
        self.launch_button = wx.Button( self, wx.ID_ANY, u"Run", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.mainSizer.Add( self.launch_button, 0, wx.ALL, 5 )

        # Bind GUI elements to event and functions
        self.launch_button.Bind( wx.EVT_BUTTON, self.On_Run )

        # Set up sizers and layout
        self.SetSizer( self.mainSizer )
        self.Layout()

    def On_CalculateCoords(self, event):
        '''
        Add here the function for calculating the move instructions to be sent to the machine.
        '''

        # Add here your function

        # Add here the final moves from your function
        moves = []

        # Return the value
        return moves

    def On_Run(self, event, moves):
        '''
        This function will finally control the machine after you press the "Run" button.
        Add here your code that will send data to the machine.
        '''
        # Add code here below
        myMachine.moveMachine(moves)

        event.Skip()

Improve template documentation