<reponame>georgepruitt/PSBChart
#-------------------------------------------------------------------------------
# Name:        module1
# Purpose:
#
# Author:      georg
#
# Created:     12/01/2018
# Copyright:   (c) georg 2018
# Licence:     <your licence>
#-------------------------------------------------------------------------------

#! /usr/bin/env python
#
# GUI module generated by PAGE version 4.10
# In conjunction with Tcl version 8.6
#    Jan 12, 2018 03:33:02 PM
import sys

try:
    from Tkinter import *
except ImportError:
    from tkinter import *

try:
    import ttk
    py3 = 0
except ImportError:
    import tkinter.ttk as ttk
    py3 = 1

import PSBChart_support

from tkinter import simpledialog

button1 = True
button5 = False
button1Val = False
button5Val = False

loadTrades = True

def vp_start_gui():
    '''Starting point when module is the main routine.'''
    global val, w, root
    root = Tk()
    top = New_Toplevel_1 (root)
    PSBChart_support.init(root, top)
    root.mainloop()

w = None
indicList = list([])
loadOrDrawTrades = list([])
def create_New_Toplevel_1(root, *args, **kwargs):
    '''Starting point when module is imported by another program.'''
    global w, w_win, rt
    rt = root
    w = Toplevel (root)
    top = New_Toplevel_1 (w)
    PSBChart_support.init(w, top, *args, **kwargs)
    return (w, top)

def destroy_New_Toplevel_1():
    global w
    w.destroy()
    w = None
    
class ManageTrades(object):
    def __init__(self):
        self.load = True
        self.draw = False
    def setLoadDraw(self,load,draw):
        self.load = load
        self.draw = draw
    
tradeInfo = ManageTrades()

class MyDialog(simpledialog.Dialog):

    def body(self, master):

        Label(master, text="MovAvg1:").grid(row=0)
        Label(master, text="MovAvg2:").grid(row=1)
        Label(master, text="MovAvg3:").grid(row=2)

        self.title("Moving Averages Inputs")

        self.e1 = Entry(master)
        self.e2 = Entry(master)
        self.e3 = Entry(master)

        self.e1.grid(row=0, column=1)
        self.e2.grid(row=1, column=1)
        self.e3.grid(row=2, column=1)

        return self.e1 # initial focus

    def apply(self):
        first = int(self.e1.get())
        second = int(self.e2.get())
        third = int(self.e3.get())
        indicList.append("movAvg")
        indicList.append(first)
        indicList.append(second)
        indicList.append(third)
        print (first, second) # or something
        PSBChart_support.loadAndDraw(False,True,indicList,tradeInfo)

class BollingerDialog(simpledialog.Dialog):

    def body(self, master):

        Label(master, text="MovAvgLen:").grid(row=0)
        Label(master, text="Num+StdDevs").grid(row=1)
        Label(master, text="Num-StdDevs").grid(row=2)

        self.e1 = Entry(master)
        self.e2 = Entry(master)
        self.e3 = Entry(master)

        self.e1.grid(row=0, column=1)
        self.e2.grid(row=1, column=1)
        self.e3.grid(row=2, column=1)

        return self.e1 # initial focus

    def apply(self):
        first = int(self.e1.get())
        second = int(self.e2.get())
        third = int(self.e3.get())
        indicList.append("bollingerBand")
        indicList.append(first)
        indicList.append(second)
        indicList.append(third)
        print (first, second) # or something
        PSBChart_support.loadAndDraw(False,True,indicList,tradeInfo)



class New_Toplevel_1:
    def __init__(self, top=None):
        '''This class configures and populates the toplevel window.
           top is the toplevel containing window.'''
        _bgcolor = '#d9d9d9'  # X11 color: 'gray85'
        _fgcolor = '#000000'  # X11 color: 'black'
        _compcolor = '#d9d9d9' # X11 color: 'gray85'
        _ana1color = '#d9d9d9' # X11 color: 'gray85'
        _ana2color = '#d9d9d9' # X11 color: 'gray85'

        top.geometry("848x521+243+127")
        top.title("New Toplevel 1")
        top.configure(background="#d9d9d9")

        self.Canvas1 = Canvas(top)
        self.Canvas1.place(relx=0.18, rely=0.04, relheight=0.91, relwidth=0.81)
        self.Canvas1.configure(background="#d9d9d9")
        self.Canvas1.configure(borderwidth="2")
        self.Canvas1.configure(insertbackground="black")
        self.Canvas1.configure(relief=RIDGE)
        self.Canvas1.configure(selectbackground="#c4c4c4")
        self.Canvas1.configure(selectforeground="black")
        self.Canvas1.configure(width=683)

        self.Button1 = Button(top)
        self.Button1.place(relx=0.04, rely=0.06, height=44, width=67)
        self.Button1.configure(activebackground="#d9d9d9")
        self.Button1.configure(activeforeground="#000000")
#        self.Button1.configure(command=PSBChart_support.loadAndDraw(True,True))
        self.Button1.configure(command=lambda:  PSBChart_support.loadAndDraw(True,True,indicList,tradeInfo));
        self.Button1.configure(background="#d9d9d9")
        self.Button1.configure(disabledforeground="#a3a3a3")
        self.Button1.configure(foreground="#000000")
        self.Button1.configure(highlightbackground="#d9d9d9")
        self.Button1.configure(highlightcolor="black")
        self.Button1.configure(pady="0")
        self.Button1.configure(text='''Load Data''')
        self.Button1.configure(width=67)

        self.Entry1 = Entry(top)
        self.Entry1.place(relx=0.02, rely=0.27,height=20, relwidth=0.12)
        self.Entry1.configure(background="white")
        self.Entry1.configure(disabledforeground="#a3a3a3")
        self.Entry1.configure(font="TkFixedFont")
        self.Entry1.configure(foreground="#000000")
        self.Entry1.configure(insertbackground="black")
        self.Entry1.configure(width=104)

        self.Label1 = Label(top)
        self.Label1.place(relx=0.01, rely=0.21, height=21, width=130)
        self.Label1.configure(background="#d9d9d9")
        self.Label1.configure(disabledforeground="#a3a3a3")
        self.Label1.configure(foreground="#000000")
        self.Label1.configure(text='''Start Date yyyymmdd''')
        self.Label1.configure(width=130)

        self.Button2 = Button(top)
        self.Button2.place(relx=0.02, rely=0.44, height=24, width=117)
        self.Button2.configure(activebackground="#d9d9d9")
        self.Button2.configure(activeforeground="#000000")
#        self.Button2.configure(command=PSBChart_support.loadAndDraw(False,True))
        self.Button2.configure(command=lambda:  PSBChart_support.loadAndDraw(False,True,indicList,tradeInfo));
        self.Button2.configure(background="#d9d9d9")
        self.Button2.configure(disabledforeground="#a3a3a3")
        self.Button2.configure(foreground="#000000")
        self.Button2.configure(highlightbackground="#d9d9d9")
        self.Button2.configure(highlightcolor="black")
        self.Button2.configure(pady="0")
        self.Button2.configure(text='''Redraw Data''')
        self.Button2.configure(width=117)

        self.Button3 = Button(top)
        self.Button3.place(relx=0.02, rely=0.66, height=24, width=117)
        self.Button3.configure(activebackground="#d9d9d9")
        self.Button3.configure(activeforeground="#000000")
#        self.Button2.configure(command=PSBChart_support.loadAndDraw(False,True))
        self.Button3.configure(command=lambda:  MyDialog(root))
        self.Button3.configure(background="#d9d9d9")
        self.Button3.configure(disabledforeground="#a3a3a3")
        self.Button3.configure(foreground="#000000")
        self.Button3.configure(highlightbackground="#d9d9d9")
        self.Button3.configure(highlightcolor="black")
        self.Button3.configure(pady="0")
        self.Button3.configure(text='''MovAvgIndicator''')
        self.Button3.configure(width=117)

        self.Button4 = Button(top)
        self.Button4.place(relx=0.02, rely=0.71, height=24, width=117)
        self.Button4.configure(activebackground="#d9d9d9")
        self.Button4.configure(activeforeground="#000000")
#        self.Button2.configure(command=PSBChart_support.loadAndDraw(False,True))
        self.Button4.configure(command=lambda:  BollingerDialog(root))
        self.Button4.configure(background="#d9d9d9")
        self.Button4.configure(disabledforeground="#a3a3a3")
        self.Button4.configure(foreground="#000000")
        self.Button4.configure(highlightbackground="#d9d9d9")
        self.Button4.configure(highlightcolor="black")
        self.Button4.configure(pady="0")
        self.Button4.configure(text='''Bollinger Bands''')
        self.Button4.configure(width=117)

        self.Button5 = Button(top)
        self.Button5.place(relx=0.02, rely=0.81, height=24, width=117)
        self.Button5.configure(activebackground="#d9d9d9")
        self.Button5.configure(activeforeground="#000000")
#        self.Button2.configure(command=PSBChart_support.loadAndDraw(False,True))
        self.Button5.configure(command=lambda: PSBChart_support.manageTrades(tradeInfo,indicList)) 
        self.Button5.configure(background="#d9d9d9")
        self.Button5.configure(disabledforeground="#a3a3a3")
        self.Button5.configure(foreground="#000000")
        self.Button5.configure(highlightbackground="#d9d9d9")
        self.Button5.configure(highlightcolor="black")
        self.Button5.configure(pady="0")
        self.Button5.configure(text='''Load Trades File''')
        self.Button5.configure(width=117)
        if button5 == False:
            self.Button5.configure(state="disabled")
        if button5 == True:
            self.Button5.configure(state="normal")







if __name__ == '__main__':
    vp_start_gui()

#-------------------------------------------------------------------------------
# Name:        module1
# Purpose:
#
# Author:      georg
#
# Created:     12/01/2018
# Copyright:   (c) georg 2018
# Licence:     <your licence>
#-------------------------------------------------------------------------------

#! /usr/bin/env python
#
# GUI module generated by PAGE version 4.10
# In conjunction with Tcl version 8.6
#    Jan 12, 2018 03:33:02 PM
import sys

try:
    from Tkinter import *
except ImportError:
    from tkinter import *

try:
    import ttk
    py3 = 0
except ImportError:
    import tkinter.ttk as ttk
    py3 = 1

import PSBChart_support

from tkinter import simpledialog

button1 = True
button5 = False
button1Val = False
button5Val = False

loadTrades = True

def vp_start_gui():
    '''Starting point when module is the main routine.'''
    global val, w, root
    root = Tk()
    top = New_Toplevel_1 (root)
    PSBChart_support.init(root, top)
    root.mainloop()

w = None
indicList = list([])
loadOrDrawTrades = list([])
def create_New_Toplevel_1(root, *args, **kwargs):
    '''Starting point when module is imported by another program.'''
    global w, w_win, rt
    rt = root
    w = Toplevel (root)
    top = New_Toplevel_1 (w)
    PSBChart_support.init(w, top, *args, **kwargs)
    return (w, top)

def destroy_New_Toplevel_1():
    global w
    w.destroy()
    w = None
    
class ManageTrades(object):
    def __init__(self):
        self.load = True
        self.draw = False
    def setLoadDraw(self,load,draw):
        self.load = load
        self.draw = draw
    
tradeInfo = ManageTrades()

class MyDialog(simpledialog.Dialog):

    def body(self, master):

        Label(master, text="MovAvg1:").grid(row=0)
        Label(master, text="MovAvg2:").grid(row=1)
        Label(master, text="MovAvg3:").grid(row=2)

        self.title("Moving Averages Inputs")

        self.e1 = Entry(master)
        self.e2 = Entry(master)
        self.e3 = Entry(master)

        self.e1.grid(row=0, column=1)
        self.e2.grid(row=1, column=1)
        self.e3.grid(row=2, column=1)

        return self.e1 # initial focus

    def apply(self):
        first = int(self.e1.get())
        second = int(self.e2.get())
        third = int(self.e3.get())
        indicList.append("movAvg")
        indicList.append(first)
        indicList.append(second)
        indicList.append(third)
        print (first, second) # or something
        PSBChart_support.loadAndDraw(False,True,indicList,tradeInfo)

class BollingerDialog(simpledialog.Dialog):

    def body(self, master):

        Label(master, text="MovAvgLen:").grid(row=0)
        Label(master, text="Num+StdDevs").grid(row=1)
        Label(master, text="Num-StdDevs").grid(row=2)

        self.e1 = Entry(master)
        self.e2 = Entry(master)
        self.e3 = Entry(master)

        self.e1.grid(row=0, column=1)
        self.e2.grid(row=1, column=1)
        self.e3.grid(row=2, column=1)

        return self.e1 # initial focus

    def apply(self):
        first = int(self.e1.get())
        second = int(self.e2.get())
        third = int(self.e3.get())
        indicList.append("bollingerBand")
        indicList.append(first)
        indicList.append(second)
        indicList.append(third)
        print (first, second) # or something
        PSBChart_support.loadAndDraw(False,True,indicList,tradeInfo)



class New_Toplevel_1:
    def __init__(self, top=None):
        '''This class configures and populates the toplevel window.
           top is the toplevel containing window.'''
        _bgcolor = '#d9d9d9'  # X11 color: 'gray85'
        _fgcolor = '#000000'  # X11 color: 'black'
        _compcolor = '#d9d9d9' # X11 color: 'gray85'
        _ana1color = '#d9d9d9' # X11 color: 'gray85'
        _ana2color = '#d9d9d9' # X11 color: 'gray85'

        top.geometry("848x521+243+127")
        top.title("New Toplevel 1")
        top.configure(background="#d9d9d9")

        self.Canvas1 = Canvas(top)
        self.Canvas1.place(relx=0.18, rely=0.04, relheight=0.91, relwidth=0.81)
        self.Canvas1.configure(background="#d9d9d9")
        self.Canvas1.configure(borderwidth="2")
        self.Canvas1.configure(insertbackground="black")
        self.Canvas1.configure(relief=RIDGE)
        self.Canvas1.configure(selectbackground="#c4c4c4")
        self.Canvas1.configure(selectforeground="black")
        self.Canvas1.configure(width=683)

        self.Button1 = Button(top)
        self.Button1.place(relx=0.04, rely=0.06, height=44, width=67)
        self.Button1.configure(activebackground="#d9d9d9")
        self.Button1.configure(activeforeground="#000000")
#        self.Button1.configure(command=PSBChart_support.loadAndDraw(True,True))
        self.Button1.configure(command=lambda:  PSBChart_support.loadAndDraw(True,True,indicList,tradeInfo));
        self.Button1.configure(background="#d9d9d9")
        self.Button1.configure(disabledforeground="#a3a3a3")
        self.Button1.configure(foreground="#000000")
        self.Button1.configure(highlightbackground="#d9d9d9")
        self.Button1.configure(highlightcolor="black")
        self.Button1.configure(pady="0")
        self.Button1.configure(text='''Load Data''')
        self.Button1.configure(width=67)

        self.Entry1 = Entry(top)
        self.Entry1.place(relx=0.02, rely=0.27,height=20, relwidth=0.12)
        self.Entry1.configure(background="white")
        self.Entry1.configure(disabledforeground="#a3a3a3")
        self.Entry1.configure(font="TkFixedFont")
        self.Entry1.configure(foreground="#000000")
        self.Entry1.configure(insertbackground="black")
        self.Entry1.configure(width=104)

        self.Label1 = Label(top)
        self.Label1.place(relx=0.01, rely=0.21, height=21, width=130)
        self.Label1.configure(background="#d9d9d9")
        self.Label1.configure(disabledforeground="#a3a3a3")
        self.Label1.configure(foreground="#000000")
        self.Label1.configure(text='''Start Date yyyymmdd''')
        self.Label1.configure(width=130)

        self.Button2 = Button(top)
        self.Button2.place(relx=0.02, rely=0.44, height=24, width=117)
        self.Button2.configure(activebackground="#d9d9d9")
        self.Button2.configure(activeforeground="#000000")
#        self.Button2.configure(command=PSBChart_support.loadAndDraw(False,True))
        self.Button2.configure(command=lambda:  PSBChart_support.loadAndDraw(False,True,indicList,tradeInfo));
        self.Button2.configure(background="#d9d9d9")
        self.Button2.configure(disabledforeground="#a3a3a3")
        self.Button2.configure(foreground="#000000")
        self.Button2.configure(highlightbackground="#d9d9d9")
        self.Button2.configure(highlightcolor="black")
        self.Button2.configure(pady="0")
        self.Button2.configure(text='''Redraw Data''')
        self.Button2.configure(width=117)

        self.Button3 = Button(top)
        self.Button3.place(relx=0.02, rely=0.66, height=24, width=117)
        self.Button3.configure(activebackground="#d9d9d9")
        self.Button3.configure(activeforeground="#000000")
#        self.Button2.configure(command=PSBChart_support.loadAndDraw(False,True))
        self.Button3.configure(command=lambda:  MyDialog(root))
        self.Button3.configure(background="#d9d9d9")
        self.Button3.configure(disabledforeground="#a3a3a3")
        self.Button3.configure(foreground="#000000")
        self.Button3.configure(highlightbackground="#d9d9d9")
        self.Button3.configure(highlightcolor="black")
        self.Button3.configure(pady="0")
        self.Button3.configure(text='''MovAvgIndicator''')
        self.Button3.configure(width=117)

        self.Button4 = Button(top)
        self.Button4.place(relx=0.02, rely=0.71, height=24, width=117)
        self.Button4.configure(activebackground="#d9d9d9")
        self.Button4.configure(activeforeground="#000000")
#        self.Button2.configure(command=PSBChart_support.loadAndDraw(False,True))
        self.Button4.configure(command=lambda:  BollingerDialog(root))
        self.Button4.configure(background="#d9d9d9")
        self.Button4.configure(disabledforeground="#a3a3a3")
        self.Button4.configure(foreground="#000000")
        self.Button4.configure(highlightbackground="#d9d9d9")
        self.Button4.configure(highlightcolor="black")
        self.Button4.configure(pady="0")
        self.Button4.configure(text='''Bollinger Bands''')
        self.Button4.configure(width=117)

        self.Button5 = Button(top)
        self.Button5.place(relx=0.02, rely=0.81, height=24, width=117)
        self.Button5.configure(activebackground="#d9d9d9")
        self.Button5.configure(activeforeground="#000000")
#        self.Button2.configure(command=PSBChart_support.loadAndDraw(False,True))
        self.Button5.configure(command=lambda: PSBChart_support.manageTrades(tradeInfo,indicList)) 
        self.Button5.configure(background="#d9d9d9")
        self.Button5.configure(disabledforeground="#a3a3a3")
        self.Button5.configure(foreground="#000000")
        self.Button5.configure(highlightbackground="#d9d9d9")
        self.Button5.configure(highlightcolor="black")
        self.Button5.configure(pady="0")
        self.Button5.configure(text='''Load Trades File''')
        self.Button5.configure(width=117)
        if button5 == False:
            self.Button5.configure(state="disabled")
        if button5 == True:
            self.Button5.configure(state="normal")







if __name__ == '__main__':
    vp_start_gui()
#------------------------------------------------------------------------------- # Name:        module1 # Purpose: # # Author:      georg # # Created:     12/01/2018 # Copyright:   (c) georg 2018 # Licence:     <your licence> #------------------------------------------------------------------------------- #! /usr/bin/env python # # GUI module generated by PAGE version 4.10 # In conjunction with Tcl version 8.6 #    Jan 12, 2018 03:33:02 PM Starting point when module is the main routine. Starting point when module is imported by another program. # initial focus # or something # initial focus # or something This class configures and populates the toplevel window.
            top is the toplevel containing window. # X11 color: 'gray85' # X11 color: 'black' # X11 color: 'gray85' # X11 color: 'gray85' # X11 color: 'gray85' #        self.Button1.configure(command=PSBChart_support.loadAndDraw(True,True)) Load Data Start Date yyyymmdd #        self.Button2.configure(command=PSBChart_support.loadAndDraw(False,True)) Redraw Data #        self.Button2.configure(command=PSBChart_support.loadAndDraw(False,True)) MovAvgIndicator #        self.Button2.configure(command=PSBChart_support.loadAndDraw(False,True)) Bollinger Bands #        self.Button2.configure(command=PSBChart_support.loadAndDraw(False,True)) Load Trades File