Esempio n. 1
0
    def __init__(self, master, customers, payments, output_text, refresh):
        Frame.__init__(self, master)

        self.refresh = refresh
        self.master = master
        self.output_text = output_text
        self.customers = customers
        self.payments = payments

        self.pname = StringVar()
        self.pnames = []
        self.mname = StringVar()
        self.mnames = []
        self.date = StringVar()
        self.nmonths = StringVar()
        self.punches = StringVar()

        self.nmonths.set('1')
        self.punches.set(str(10))
        self.date.set(strftime("%m/%d/%Y"))

        self.columnconfigure(0,weight=1)

        # Monthly Customers
        monthly_lf = LabelFrame(self, text="Monthly Customers Payment")
        monthly_lf.grid(padx=5,pady=5,row=0,column=0,sticky='ew')
        
        Label(monthly_lf,text="Name:").grid(row=0,column=0,sticky='e',padx=(10,0),pady=(10,2))
        Label(monthly_lf,text="Date:").grid(row=0,column=3,sticky='e',padx=(10,0),pady=(10,2))
        Label(monthly_lf,text="# Months:").grid(row=1,column=0,columnspan=2,sticky='e',padx=(10,0),pady=(2,10))
        self.mname_cb = Combobox(monthly_lf,textvariable=self.mname,width=20,values=self.mnames,
            state='readonly')
        self.mname_cb.grid(row=0,column=1,columnspan=2,sticky='ew',pady=(10,2))
        Entry(monthly_lf,textvariable=self.date,width=15).grid(row=0,column=4,sticky='ew',padx=(0,10),pady=(10,2))
        Entry(monthly_lf,textvariable=self.nmonths).grid(row=1,column=2,sticky='ew',pady=(2,10))
        Button(monthly_lf,text='Submit',command=self.monthly_payment).grid(row=1,column=4,sticky='ew',padx=(0,10),pady=(2,10))

        for i in range(5):
            monthly_lf.columnconfigure(i,weight=1)

        # Punch Card Customers
        puch_lf = LabelFrame(self, text="Punch Card Customers (Purchace Card)")
        puch_lf.grid(padx=5,pady=5,row=1,column=0,sticky='ew')

        Label(puch_lf,text="Name:").grid(row=0,column=0,sticky='e',padx=(10,0),pady=(10,2))
        Label(puch_lf,text="Punches:").grid(row=0,column=2,sticky='e',pady=(10,2))
        self.pname_cb = Combobox(puch_lf,textvariable=self.pname,width=20,values=self.pnames,state='readonly')
        self.pname_cb.grid(row=0,column=1,sticky='ew',pady=(10,2))
        Entry(puch_lf,textvariable=self.punches,width=15).grid(row=0,column=3,sticky='ew',padx=(0,10),pady=(10,2))
        Button(puch_lf,text='Submit',command=self.new_punchcard).grid(row=3,column=3,sticky='ew',padx=(0,10),pady=(2,10))

        for i in range(4):
            puch_lf.columnconfigure(i,weight=1)

        self.update_names()
    def initUI(self):

        self.MPDInitialize()
        self.parent.title("RaspiPlayer")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        #self.columnconfigure(1, weight=1)
        #self.columnconfigure(3, pad=7)
        #self.rowconfigure(3, weight=1)
        #self.rowconfigure(5, pad=7)

        #self.CurrentSongInfo()
        self.poll()

        titleframe = LabelFrame(self, width=200, height=70)
        titleframe.grid(row=0, column=0, columnspan=2)
        titleframe.grid_propagate(0)
        titlelbl = Label(titleframe,
                         text="RaspPi Player",
                         font=('Garamond', (20), 'bold'))
        titlelbl.grid(row=0, column=0)

        PreviousButton = Button(self,
                                text="Previous",
                                command=self.PreviousClick)
        PreviousButton.grid(row=2, column=0)

        PlayButton = Button(self, text="Play", command=self.PlayClick)
        PlayButton.grid(row=2, column=1, padx=4)

        StopButton = Button(self, text="Stop", command=self.StopClick)
        StopButton.grid(row=2, column=2)

        PauseButton = Button(self, text="Pause", command=self.PauseClick)
        PauseButton.grid(row=2, column=3, padx=4)

        NextButton = Button(self, text="Next", command=self.NextClick)
        NextButton.grid(row=2, column=4)

        UploadButton = Button(self, text="Upload", command=self.UploadClick)
        UploadButton.grid(row=2, column=5, padx=4)

        VolumeBar = Scale(self,
                          from_=0,
                          to=100,
                          orient="horizontal",
                          label="Volume",
                          command=self.VolumeBar)
        VolumeBar.grid(row=2, column=6, padx=5)
        VolumeBar.set(50)
Esempio n. 3
0
    def initUI(self):
      
        self.parent.title("TRAM")
        self.style = Style()
        self.style.theme_use("default")

        self.pack(fill=BOTH, expand=1)

        #Model Text
        self.t = Text(self, borderwidth=3, relief="sunken")
        self.t.config(font=("consolas", 12), undo=True, wrap='word')
        self.t.grid(row=0, column=0, padx=2, pady=2, sticky=(N, W, E, S))
        
        
        
        #Search Panel
        searchPanel = LabelFrame(self, text="Find your model")
        searchPanel.grid(row=0, column=1, padx=2, pady=2, sticky=N) 
        
        Label(searchPanel, text="Model name").grid(row=0, column=0, padx=2, pady=2, sticky=W)
        
        searchQueryEntry = Entry(searchPanel, textvariable=self.searchQuery)
        searchQueryEntry.grid(row=0, column=1, padx=2, pady=2, sticky=W)
        
        Label(searchPanel, text="Transformation").grid(row=1, column=0, padx=2, pady=2, sticky=W)
        preferredTransformation = StringVar()
        box = Combobox(searchPanel, textvariable=preferredTransformation, state='readonly')
        box['values'] = ('Any...', 'Object Change', 'Object Extension', 'Specialization', 'Functionality Extension', 'System Extension', 'Soft Simplification', 'Hard Simplification')
        box.current(0)
        box.grid(row=1, column=1, padx=2, pady=2, sticky=W)
        
        findButton = Button(searchPanel, text="Find", command = self.__findModels)
        findButton.grid(row=2, column=1, padx=2, pady=2, sticky=E)
        
        #Listbox with recommendations
        recommendationPanel = LabelFrame(self, text="Recommended models (transformations)")
        recommendationPanel.grid(row=0, column=1, padx=2, pady=2, sticky=(W,E,S))
        self.l = Listbox(recommendationPanel)
        self.l.pack(fill=BOTH, expand=1)
        
        #Button frame
        transformButtonPanel = Frame(recommendationPanel)
        transformButtonPanel.pack(fill=BOTH, expand=1)
        
        viewButton = Button(transformButtonPanel, text="View", command = self.__loadSelectedModel)
        viewButton.grid(row=1, column=0, padx=2, pady=2)
        
        transformButton = Button(transformButtonPanel, text="Transform", command = self.__transformModel)
        transformButton.grid(row=1, column=2, padx=2, pady=2)
Esempio n. 4
0
    def __init__(self,master,customers,payments,output_text):
        Frame.__init__(self,master)
        self.customers = customers
        self.payments = payments
        self.master = master
        self.output_text = output_text

        self.year_months = find_years_months(getcwd()) # use cwd, this should be set

        self.year = StringVar()
        self.month = StringVar()
        self.years = sorted(self.year_months.keys())
        self.months = []

        lf = LabelFrame(self, text="Generate Report")
        lf.grid(padx=5,pady=5,row=0,column=0,sticky='ew')

        Label(lf,text="Year: ").grid(row=0,column=0,sticky='e',padx=(10,0),pady=(10,2))
        Label(lf,text="Month: ").grid(row=1,column=0,sticky='e',padx=(10,0),pady=2)

        self.year_cb = Combobox(lf,textvariable=self.year,width=12,values=self.years,state='readonly')
        self.month_cb = Combobox(lf,textvariable=self.month,width=12,values=self.months,state='readonly')
        
        self.year_cb.grid(row=0,column=1,sticky='w',padx=(0,10),pady=(10,2))
        self.month_cb.grid(row=1,column=1,sticky='w',padx=(0,10),pady=2)

        btn = Button(lf,text="Save Report",command=self.report,width=30)
        btn.grid(row=2,column=0,columnspan=2,sticky='n',pady=(2,10),padx=10)

        #configure the grid to expand
        self.columnconfigure(0,weight=1)
        lf.rowconfigure(0,weight=1)
        lf.rowconfigure(1,weight=1)
        lf.columnconfigure(0,weight=1)
        lf.columnconfigure(1,weight=1)

        self.year_cb.bind('<<ComboboxSelected>>',self.year_selected)

        self.update() #update the values
Esempio n. 5
0
class window(object):
    def __init__(self):
        self.version = 'V 1.0.0'
        self.root = tk.Tk()
        self.root.title('Olshop Scrapper ' + self.version)

        self.frame1 = tk.Frame(self.root)
        self.frame1.grid(row=0, column=0, sticky='snew')
        
        #Label Frame
        self.west = LabelFrame(self.frame1, text=' Source ')
        self.west.grid(column=0, row=0, sticky='wn', padx=5, pady=5)
        self.east = LabelFrame(self.frame1, text=' Excel ')
        self.east.grid(column=1, row=0, sticky='wn', padx=5, pady=5)

        #Making Source form
        self.src = []
        for i in range(6):
            self.src.append(Io.source(self.west, i, 0))
            
        #Output form
        self.outputName = Io.output(self.east, 1, 0)
        self.outputName.button.configure(state='disabled')
        self.excel = Io.excelInput(self.east, 3, 0)
        self.excel.sheet.bind('<<ComboboxSelected>>',self.check)
        self.work = calc(self.frame1, 1, 0, self.compare, self.load)
        self.work.proccess.configure(state='disabled')
        
        self.root.mainloop()
        
    def check(self, event): 
        self.work.update_status('Getting cell information...')
        self.workingSheet = self.wb.get_sheet_by_name(self.excel.sheet.get())
        self.excel.sku['values'] = [self.workingSheet.cell(row=1, column=i).value \
                                    for i in range(1, self.workingSheet.max_column, 1)\
                                    if self.workingSheet.cell(row=1, column=i).value != None]
        self.excel.sku.current(0) 
        self.excel.stock['values'] = [self.workingSheet.cell(row=1, column=i).value \
                                    for i in range(1, self.workingSheet.max_column, 1)\
                                    if self.workingSheet.cell(row=1, column=i).value != None]
        self.excel.stock.current(0)
        self.work.proccess.configure(state='active')
        self.work.status.set('Done.')  
        
    def load(self):
        self.work.update_status('Scrapping HTML...')
        self.scSoup = []
        #Get HTML into soup
        for url in self.src:
            if url.getFile() == '':
                continue
            scFile = open(url.getFile())
            self.scSoup.append(bs4.BeautifulSoup(scFile.read(), "html.parser"))
        
        #Opening Excel from excel input
        self.work.update_status('Getting excel sheet...')
        self.wb = openpyxl.load_workbook(self.excel.getFile(), data_only=True)
        self.excel.sheet['values'] = self.wb.get_sheet_names()
        self.excel.sheet.current(0)
        self.check(self)
        
    def compare(self):  
        self.columnSku = 0
        self.startColumnSku = self.workingSheet.max_column #start writing from last column + 1
        self.columnStock = 0
        self.startColumnStock = self.workingSheet.max_column+1 #start writing from last column + 1
        self.work.update_status('Getting column...')
        
        for name in self.excel.sku['values']:#getting sku ceolumn number
            self.columnSku += 1
            if name == self.excel.sku.get():
                break
        for name in self.excel.stock['values']:#getting stok ceolumn number
            self.columnStock += 1
            if name == self.excel.stock.get():
                break
            
        self.work.update_status('Please wait, proccessing...')
        self.workingSheet.cell(row=1, column=self.startColumnSku).value = 'SKU'
        self.workingSheet.cell(row=1, column=self.startColumnStock).value = 'Stock'
        
        for i in range(2, self.workingSheet.max_row+1, 1):#Getting each of cell in sku column
            y = 1
            for soup in self.scSoup:#check it with every soup available
                sku = soup.select('tr > td')
                stock = soup.select(' .stockOnSales')
                for index in range(3, len(sku), 11):
                    if self.workingSheet.cell(row=i, column=self.columnSku).value == sku[index].getText():
                        self.workingSheet.cell(row=i, column=self.startColumnSku).value = 'TRUE'
                        if (self.workingSheet.cell(row=i, column=self.columnStock).value) != (int(stock[y].getText())):
                            self.workingSheet.cell(row=i, column=self.startColumnStock).value = int(stock[y].getText())
                        else: self.workingSheet.cell(row=i, column=self.startColumnStock).value = '-'
                        break
                    y += 1
                break    
                        
        self.wb.save(self.excel.getFile())
        self.outputName.path.set(self.excel.getFile())
        self.outputName.button.configure(state='active')
        self.work.status.set('Complete.')
    
    '''                 
Esempio n. 6
0
    def __init__(self, master, customers, output_text, refresh):
        Frame.__init__(self, master)
        self.output_text = output_text
        self.refresh = refresh
        self.root = master
        self.customers = customers

        self.name = StringVar() #edit customer
        self.names = []
        self.ncd = NewCustomerDialog(self.root, self.customers, self.refresh, edit=True)

        self.fname = StringVar()
        self.lname = StringVar()
        self.mname = StringVar()
        self.payment = StringVar()
        self.date = StringVar()
        self.iconname="New Customer"

        lf = LabelFrame(self, text="New Customer")
        lf.grid(padx=5,pady=5,row=0,column=0,sticky='ew')
        
        ### dialog content        
        Label(lf, text="Name: ").grid(row=0,column=0,sticky='e',padx=(10,0),pady=(10,2))
        Label(lf, text="Type: ").grid(row=1,sticky='e',pady=2,padx=(10,0))
        Label(lf, text="Date: ").grid(row=1,column=2,sticky='e',ipady=2,padx=(10,0))

        self.fname_en = Entry(lf, width=20, textvariable=self.fname)
        self.mname_en = Entry(lf, width=4, textvariable=self.mname)
        self.lname_en = Entry(lf, width=20, textvariable=self.lname)
        self.payment_cb = Combobox(lf, textvariable=self.payment, width=12,
                                   values=("Drop In", "Punch Card", "Monthly", "Inactive"))
        self.date_en = Entry(lf, width=15, textvariable=self.date)
        
        self.fname_en.grid(row=0,column=1,sticky='ew',pady=(10,2))
        self.mname_en.grid(row=0,column=2,sticky='ew',pady=(10,2))
        self.lname_en.grid(row=0,column=3,sticky='ew',padx=(0,10),pady=(10,2))
        self.payment_cb.grid(row=1,column=1,sticky='ew')
        self.date_en.grid(row=1,column=3,columnspan=2,sticky='ew',padx=(0,10))
        
        ### buttons
        Button(lf, text='Reset Values', width=15,
               command=self.reset_values).grid(row=3,column=0,columnspan=2,sticky='ew',padx=10,pady=(2,10))
        Button(lf, text='Submit', width=15,
               command=self.add_customer).grid(row=3,column=3,sticky='ew',padx=(0,10),pady=(2,10))

        for i in range(4):
            lf.columnconfigure(i, weight=1)

        # edit customer
        lf = LabelFrame(self, text="Edit Customer")
        lf.grid(padx=5,pady=5,row=1,column=0,sticky='ew')

        Label(lf, text="Name: ").grid(row=0,column=0,sticky='e',pady=10,padx=(10,0))
        self.name_cb = Combobox(lf, textvariable=self.name, width=30, values=self.names)
        self.name_cb.grid(row=0,column=1,sticky='ew',pady=10)
        Button(lf, text="Edit",width=15,command=self.edit).grid(row=0,column=2,sticky='ew',padx=10,pady=10)

        for i in range(3):
            lf.columnconfigure(i,weight=1)
        self.columnconfigure(0,weight=1)

        self.fname_en.focus_set() #cursor goes here when frame is created
        self.update_names()
        self.reset_values() #zero out all values in new customer
Esempio n. 7
0
def createSettings(self,frame,d):


    #name frame
    row = 0
    col = 0

    
    lblFrame = Frame(frame)
    lblFrame.grid(row=row,column=col,columnspan=5,sticky=W+E,pady=0,padx=5)

    frame.columnconfigure(col, weight=1)
    frame.rowconfigure(row, weight=0)

    row = 0
    col = 0

    Label(lblFrame, text="Script Name").grid(row=row,column=col,sticky=W) 
    lblFrame.columnconfigure(col, weight=0)
    lblFrame.rowconfigure(row, weight=0)
    

    row = 0
    col = 1
    
    entryMain = Entry(lblFrame)
    entryMain.grid(row=row,column=col,sticky=W+E,columnspan=5)
    self.entryName = entryMain
    lblFrame.columnconfigure(col, weight=1)
    lblFrame.rowconfigure(row, weight=0)


    #python plugin script file
    row = 1
    col = 0
    mainGroup = LabelFrame(frame,text="Python Script File", padding="5 5 5 5")
    mainGroup.grid(row=row,column=col,columnspan=5,sticky=W+E+N,pady=5,padx=5)
          


    row = 0
    col = 0
    mainGroup.columnconfigure(col, weight=1)
    mainGroup.rowconfigure(row, weight=0)  
    
    entryMain = Entry(mainGroup)
    entryMain.grid(row=row,column=col,columnspan=4,sticky=W+E)
    entryMain.bind("<Return>",self.entryFileEvent)
    self.entryFile = entryMain


    row = 0
    col = 4
    btnMainBrowse = Button(mainGroup,text="Browse")
    btnMainBrowse.grid(row=row,column=col,columnspan=1,sticky=W+E,padx=5,pady=2.5)
    self.btnBrowse = btnMainBrowse

    
    row = 1
    col = 0   
    Label(mainGroup, text="Plugin Class").grid(row=row,column=col,sticky=E)
    self.cbPluginClass = comboBox([],mainGroup,col+1,row)
    mainGroup.columnconfigure(col, weight=0)
    row = 2
    col = 0   
    Label(mainGroup, text="GUI Class").grid(row=row,column=col,sticky=E)
    self.cbGuiClass = comboBox([],mainGroup,col+1,row)

    col = 1
    mainGroup.columnconfigure(1, weight=1)
    mainGroup.columnconfigure(2, weight=1)
    mainGroup.columnconfigure(3, weight=1)  
   

    row=1
    col=4
    
    button = Button(mainGroup,text="Edit Script File")
    button.grid(row=row,column=col,sticky=W+E,padx=5,pady=2.5)
    self.btnEditScript = button

    row = 2
    col = 4
    button = Button(mainGroup,text="Open Contaning Folder")
    button.grid(row=row,column=col,sticky=W+E,padx=5,pady=2.5)
    self.btnOpenFolder = button
Esempio n. 8
0
class ScriptManager:
    def __init__(self,sourceData):
        self.sourceData = sourceData


        self.jsonPath = OBS.GetAppDataPath()+"/pluginData/Python/scripts.json"        
        self.scriptDict = loadJSON(self.jsonPath)
        self.currentDict = []
        self.selectedScript = None
        
        print(getScriptNames(self.scriptDict))

        self.initUI()

    def initUI(self):
        self.width = 700
        self.height = 350
        self.left = 0
        self.right = 0
        
        
        self.parent = Tk()
        self.parent.attributes("-topmost", 1)
        
        self.getHWNDS()
        r = self.winPos(self.obshwnd)
        self.centerOverOBS(r)

        self.parent.geometry("%sx%s+%s+%s" % (self.width,self.height,int(self.left),int(self.top)))
        
        self.parent.focus()
        self.parent.wm_title("Python Script Manager")
       

        #title label frame
        row = 0
        col = 0
        self.parent.columnconfigure(col,weight=1) 
        self.parent.rowconfigure(row,weight=0)
        
        titleFrame = Frame(self.parent)   
        titleFrame.grid(row=row,column=col,sticky=W+E,pady=5,padx=10)      

        row = 0
        col = 0
        labelfont = ('bold', 15)
        Label(titleFrame, text="Python Script Manager",font=labelfont).grid(row=row,column=col,sticky=W)

        titleFrame.columnconfigure(row,weight=1)
        titleFrame.rowconfigure(col,weight=0)
        
       
        #sidebyside frame
        row = 1
        col = 0
        self.parent.rowconfigure(row,weight=1)
        self.parent.columnconfigure(col,weight=1)
        
        sidebyside = Frame(self.parent)
        sidebyside.grid(row=row,column=col,sticky=W+E+N+S,pady=0,padx=5)

        
        
        #listbox frame
        row = 0
        col = 0
        sidebyside.rowconfigure(row,weight=1)
        sidebyside.columnconfigure(col,weight=1)        
        
        leftFrame = Frame(sidebyside)
        leftFrame.grid(row=row,column=col,sticky=W+E+N+S,pady=5,padx=5)

        #listbox
        row = 0
        col = 0
        self.listbox = Listbox(leftFrame)
        self.listbox.grid(row=row,column=col,columnspan=5,sticky=W+E+N+S)
        listboxReload(self.listbox,getScriptNames(self.scriptDict))
        self.listbox.bind('<<ListboxSelect>>',self.listboxSelectionEevent)

        leftFrame.columnconfigure(col,weight=1)
        leftFrame.rowconfigure(row,weight=1)

        

        row=1
        col=0
        buttonFrame = Frame(leftFrame)   
        buttonFrame.grid(row=row,column=col,sticky=W,pady=0,padx=0)

        row=0
        col=0
        #btnAdd
        button = Button(buttonFrame,text="Add")
        button.grid(row=row,column=col,sticky=E)        
        self.btnAdd = button
        self.btnAdd.config(command=self.btnAddEvent)

        #btnRemove
        button = Button(buttonFrame,text="Remove")
        button.grid(row=row,column=col+1,sticky=W)
        self.btnRemove = button
        self.btnRemove.config(command=self.btnRemoveEvent)
        
       
        #settings frame

        row = 0
        col = 1
        sidebyside.rowconfigure(row,weight=1)
        sidebyside.columnconfigure(col,weight=10)


        rightFrame = Frame(sidebyside)
        rightFrame.grid(row=row,column=col,sticky=W+E+N+S,pady=5,padx=5)

        

        row = 0
        col = 0
        rightFrame.columnconfigure(col,weight=1)
        rightFrame.rowconfigure(row,weight=1)
                
        self.frmSettings = LabelFrame(rightFrame,text="Settings", padding="5 5 5 5")
        self.frmSettings.grid(row=row,column=col,sticky=W+E+N+S,pady=0,padx=0) 
        
 
        self.frmSettings.columnconfigure(col,weight=1)
        self.frmSettings.rowconfigure(row,weight=1)


        d = createScriptDict()
        createSettings(self,self.frmSettings,d)


        row=1
        col=0
        
        buttonFrame = Frame(rightFrame)   
        buttonFrame.grid(row=row,column=col,sticky=W,pady=0,padx=0)        
        
    
        row = 0
        col = 0
        button = Button(buttonFrame,text="Save")
        button.grid(row=row,column=col)
        self.btnSave = button
        self.btnSave.config(command=self.btnSaveEvent)
    


    








        #ok cancel buttons
        row = 2
        col = 0
        self.parent.columnconfigure(col,weight=1)
        self.parent.rowconfigure(row,weight=0)
        
        bottomframe = Frame(self.parent)   
        bottomframe.grid(row=row,column=col,sticky=W+E,pady=5,padx=10)

        row = 0
        col = 0
        
        bottomframe.columnconfigure(col,weight=1)
        bottomframe.rowconfigure(row,weight=0)
        
        logFrame = Frame(bottomframe)   
        logFrame.grid(row=row,column=col,sticky=W,pady=0,padx=0)
        logFrame.rowconfigure(row,weight=0)

        row=0
        col=0
        #btnOpenLogs
        button = Button(logFrame,text="Open Logs",command=self.btnOpenLogsEvent)
        button.grid(row=row,column=col,sticky=E,padx=0,pady=0)        
        self.btnOpenLogs = button
 

        row = 0
        col = 1
        

        bottomframe.columnconfigure(col,weight=1)
        bottomframe.rowconfigure(row,weight=0)

        ccFrame = Frame(bottomframe)   
        ccFrame.grid(row=row,column=col,sticky=E,pady=0,padx=5)
        ccFrame.rowconfigure(row,weight=0)

        row=0
        col=0
        
        button = Button(ccFrame,text="Create",command=self.btnCreateEvent)
        button.grid(row=row,column=col,sticky=E,padx=10,pady=0)
        self.btnCreate = button

        button = Button(ccFrame,text="Cancel",command=self.btnCancelEvent)
        button.grid(row=row,column=col+1,sticky=W,padx=0,pady=0) 
        self.btnCancel = button
       

        
        self.clearSettings()
        self.parent.after(1,self.lockWindow)
        self.parent.mainloop()

        self.unlockWindow()



    def btnAddEvent(self):
        self.clearSettings()
        
    def btnSaveEvent(self):
        name = self.entryName.get()        
        print (name)
        self.saveSettings(name)


    def getHWNDS(self):
        self.obshwnd = OBS.GetMainWindow()
        self.hwndTkinter =  self.parent.winfo_id()

    def centerWindow(self):
        self.winPos(self.parent.winfo_id())
    

    def winPos(self,hwnd):
        f = ctypes.windll.user32.GetWindowRect
        rect = ctypes.wintypes.RECT()
        DWMWA_EXTENDED_FRAME_BOUNDS = 9
        f(ctypes.wintypes.HWND(hwnd),
          ctypes.byref(rect)
          )
        return rect
    
    def centerOverOBS(self,r):
        obsWidth = r.right-r.left
        obsHeight = r.bottom-r.top
        self.left = r.left + (obsWidth/2) - (self.width/2)
        self.top = r.top + (obsHeight/2) - (self.height/2)
        

    def lockWindow(self):
        #ctypes.windll.user32.SetWindowLongA(self.hwndTkinter,-8,self.obshwnd)
        #ctypes.windll.user32.SetParent(self.hwndTkinter, self.obshwnd)
            
        ctypes.windll.user32.SetActiveWindow(self.hwndTkinter)
        ctypes.windll.user32.EnableWindow(self.obshwnd,False)
        

    def unlockWindow(self):        
        ctypes.windll.user32.EnableWindow(self.obshwnd,True)
        ctypes.windll.user32.SetActiveWindow(self.obshwnd)


    def listboxSelectionEevent(self,evt):
        self.clearSettings()
        print("Select")
        w = evt.widget
        index = int(w.curselection()[0])
        value = w.get(index)
        d = self.scriptDict[value]
        self.loadSettings(d,value)
        

    def loadSettings(self,d,name):
        self.clearSettings()
        self.entryName.insert(0,name)
        self.entryFile.insert(0,d['file'])
        file = d['file']
        print ("osetuh"+ file)
        if file is not None:
            classes = getClasses(d['file'])
            print (classes)
            if  not classes:
                self.cbPluginClass['values']= ['']
                self.cbGuiClass['values']= ['']
                self.cbPluginClass.current(0)
                self.cbGuiClass.current(0)
            else:
                print (classes.index(d['mainClass']))
                self.cbPluginClass['values']= classes
                self.cbPluginClass.current(classes.index(d['mainClass']))
                self.cbGuiClass['values']= classes
                self.cbGuiClass.current(classes.index(d['guiClass']))
        else:
            file= OBS.GetAppDataPath()+"/pluginData/Python"
           
        print ("LoadSettings" + file)
        self.btnBrowse.config(command=lambda arg=os.path.dirname(file):self.btnBrowseEvent(arg))
        self.btnOpenFolder.config(command=lambda arg=os.path.dirname(file): openContaningFolder(arg))
        self.btnEditScript.config(command=lambda arg=file: openFileWithDefaultOSApp(arg))
        
    def clearSettings(self):
        self.entryName.delete(0,END) 
        self.entryFile.delete(0,END)
        self.btnBrowse.config(command=None)
        self.cbPluginClass['values'] = ['']
        self.cbGuiClass['values'] = ['']
        self.cbPluginClass.current(0)
        self.cbGuiClass.current(0)
        self.btnEditScript.config(command=None)
        self.btnOpenFolder.config(command=None)
        self.btnBrowse.config(command=lambda file= OBS.GetAppDataPath()+"/pluginData/Python" :self.btnBrowseEvent(file))

    def saveSettings(self,name):

        #check if dict exists
        d = self.scriptDict.get(name)
        if d is None:
            d= createScriptDict()

        d['guiClass']= self.cbGuiClass.get()
        d['file'] = self.entryFile.get()
        d['mainClass']= self.cbPluginClass.get()
        if validateSettings(d['file'],name,d['guiClass'],d['mainClass']) == False:
            self.listbox.focus_set()
            return True
        #add to dict
        self.scriptDict[name] = d
        print (d)
        #reload listbox
        listboxReload(self.listbox,getScriptNames(self.scriptDict))
        #save to json
        saveJSON(self.scriptDict,self.jsonPath)

    def updateClasses(self,file):
        classes = getClasses(file)        
        if  not classes:
            self.cbPluginClass['values']= ['']
            self.cbGuiClass['values']= ['']
            self.cbPluginClass.current(0)
            self.cbGuiClass.current(0)
        else:
            self.cbPluginClass['values']= classes
            self.cbPluginClass.current(0)
            self.cbGuiClass['values']= classes
            self.cbGuiClass.current(0)

    def btnRemoveEvent(self):
        #remove the selected item from list box.
        w = self.listbox
        try:
            index = int(w.curselection()[0])
            value = w.get(index)
            del self.scriptDict[value]
            self.clearSettings()
            listboxReload(self.listbox,getScriptNames(self.scriptDict))
        except:
            pass
        
    def entryFileEvent(self,event):
        path = self.entryFile.get()
        self.updateComboBoxes(path)

    def btnBrowseEvent(self,file):
        print ("btnbrowsefile " + file)
        if file is None:
            #path = askopenfilename(parent=self.parent,initialdir=("C:\\"))
            path = askopenfilename(parent=self.parent,initialdir=(OBS.GetAppDataPath()+"/pluginData/Python"))
        else:
            path = askopenfilename(parent=self.parent,initialdir=(file))
        if path == '':
            #user cancled do nothing.
            return
        self.updateComboBoxes(path)
            
    def updateComboBoxes(self,path):
        #need to update comboboxes, edit and open contatining folder.
        self.updateClasses(path)
        self.entryFile.delete(0,END)
        self.entryFile.insert(0,path)

        self.btnOpenFolder.config(command=lambda arg=os.path.dirname(path): openContaningFolder(arg))
        self.btnEditScript.config(command=lambda arg=path: openFileWithDefaultOSApp(arg))

    def btnCancelEvent(self):
        self.parent.destroy()

    
    def btnCreateEvent(self):
        file = self.entryFile.get()
        pluginClass = self.cbPluginClass.get()
        guiClass = self.cbGuiClass.get()
        name = " "
        if validateSettings(file,name,guiClass,pluginClass) == True:
            self.sourceData.SetString(u"PythonFile",u(file))
            self.sourceData.SetString(u"PythonPluginClass",u(pluginClass))
            self.sourceData.SetString(u"PythonGUIClass",u(guiClass))
            self.sourceData.SetInt(u"Debug",0)
            self.btnCancelEvent()
    
    def btnOpenLogsEvent(self):
        stdErr = OBS.GetAppDataPath()+"/pluginData/Python/stdErr.txt"        
        stdOut = OBS.GetAppDataPath()+"/pluginData/Python/stdOut.txt"        
        openFileWithDefaultOSApp(stdErr)
        openFileWithDefaultOSApp(stdOut)
    def CurrentSongInfo(self):
        def OnPlayListClick(event):
            newsongtitle = PlayList.get(PlayList.curselection())
            for i in range(0, int(length)):
                try:
                    if (songlist[i]['title'] == newsongtitle):
                        newsongindex = i
                        break
                except KeyError:
                    if (songlist[i]['artist'] == newsongtitle):
                        newsongindex = i
                        break

            rpi.playid(songlist[newsongindex]['id'])
            rpi.update()

        def ftime(time):
            time = int(time)
            return str(int(time / 60)) + ':' + '%.2d' % int(time % 60)

        self.currentsong = StringVar(self)
        rpi.update()
        cs = rpi.currentsong()
        ss = rpi.status()
        try:
            artist = cs['artist']
        except KeyError:
            artist = '**'
        try:
            album = cs['album']
        except KeyError:
            album = '**'
        try:
            title = cs['title']
        except KeyError:
            title = '**'
        #track = cs['track']
        try:
            num = str(int(ss['song']) + 1)
        except KeyError:
            num = ''
        length = ss['playlistlength']
        try:
            cur_time = ftime(ss['time'].split(':')[0])
        except KeyError:
            cur_time = "0:00"
        # total time
        try:
            total_time = ftime(cs['time'])
        except KeyError:
            total_time = "0:00"
        self.currentsong.set(artist + ' - ' + title + '\n' + album + '\n' +
                             num + '/' + length + '\n\n' + cur_time + '/' +
                             total_time)
        lblframe = LabelFrame(self, text="Now Playing", width=600, height=100)
        lblframe.grid(row=1, column=0, columnspan=7, pady=40)
        #lblframe.grid(row=0, column=1)
        lblframe.grid_propagate(0)
        lbl = Label(lblframe,
                    textvariable=self.currentsong,
                    font=('Tahoma', (9)))
        lbl.grid(row=1, column=0)
        lbl.grid_propagate(0)

        PlayList = Listbox(self, width=80)
        PlayList.grid(row=3, column=1, columnspan=5, padx=20)

        songlist = rpi.playlistid()
        for i in range(0, int(length)):
            try:
                PlayList.insert(i, songlist[i]['title'])
            except KeyError:
                PlayList.insert(i, songlist[i]['artist'])
            if (len(cs) != 0):
                if (cs['id'] == songlist[i]['id']):
                    PlayList.itemconfig(i,
                                        background='blue',
                                        foreground='white')

        PlayList.bind('<<ListboxSelect>>', OnPlayListClick)