Пример #1
0
class playar(Frame):

    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.filenm=None
        self.pack(fill=BOTH, expand=1)
        self.parent = parent
        self.initplayer()

    def initplayer(self):
        self.videoFrame = Frame(self, width=800, height=480)
        self.videoFrame.pack(side="top", fill="both", expand=True)
        self.buttonframe = Frame(self, padding="2 2 11 11")
        self.buttonframe.pack(side="bottom", fill="x", expand=True)

        self.selectbutton = Button(self.buttonframe, text="Select")
        self.selectbutton.grid(column=0, row=0, sticky=W)
        self.playbutton = Button(self.buttonframe, text="Play").grid(column=1, row=0, sticky=W)
        for child in self.buttonframe.winfo_children(): child.grid_configure(padx=5, pady=5)
        self.buttonframe.rowconfigure(0, weight=1)
        self.buttonframe.columnconfigure(0, weight=1)
        self.buttonframe.columnconfigure(1, weight=1)

    def setwh(self,w,h):
        self.videoFrame.configure(width=w, height=h)

    def quit(self):
        print "QUIT CALLED"
        pg.quit()
        self.destroy()
Пример #2
0
 def _create_treeview(self, parent):
     f = Frame(parent)
     #f.pack(side=TOP, fill=BOTH, expand=Y)
     f.grid(row=0, column=0, sticky=NSEW, columnspan=3)
     
     # create the tree and scrollbars
     self.dataCols = ('fullpath', 'type', 'status')       
     self.tree = Treeview(columns=self.dataCols,
                              displaycolumns='status')
     
     ysb = Scrollbar(orient=VERTICAL, command= self.tree.yview)
     xsb = Scrollbar(orient=HORIZONTAL, command= self.tree.xview)
     self.tree['yscroll'] = ysb.set
     self.tree['xscroll'] = xsb.set
     
     # setup column headings
     self.tree.heading('#0', text='Directory Structure', anchor=W)
     self.tree.heading('status', text='Status', anchor=W)
     self.tree.column('status', stretch=0, width=100)
     
     # add tree and scrollbars to frame
     self.tree.grid(in_=f, row=0, column=0, sticky=NSEW)
     ysb.grid(in_=f, row=0, column=1, sticky=NS)
     xsb.grid(in_=f, row=1, column=0, sticky=EW)
     
     # set frame resizing priorities
     f.rowconfigure(0, weight=1)
     f.columnconfigure(0, weight=1)
     
     # action to perform when a node is expanded
     self.tree.bind('<<TreeviewOpen>>', self._update_tree)
     
     self.tree.bind("<Double-1>", self.OnDoubleClick)
Пример #3
0
    def initUI(self):

        data_frame = Frame(self.master, relief=RAISED, borderwidth=1)
        data_frame.pack(fill=BOTH, expand=True, padx=5, pady=2)

        data_frame.columnconfigure(0, weight=1, minsize=30)
        data_frame.columnconfigure(1, weight=1, minsize=30)

        # ---------------------- File Name Pattern --------------------------
        fname_lb = Label(data_frame, text='File Name Pattern:')
        fname_lb.grid(row=4, column=0, sticky=W, padx=10)

        self.fname_val = StringVar()
        self.fname_val.set(self.formData.fname_pat)

        fname = Entry(data_frame, width=50, bd=2, textvariable=self.fname_val)
        fname.grid(row=5,
                   column=0,
                   columnspan=2,
                   sticky=N + S + W + E,
                   padx=10)
        fname.bind('<Button-3>', rClicker, add='')

        # Close button
        self.closeButton = Button(self.master,
                                  text="Close",
                                  width=10,
                                  bd=2,
                                  command=self.closeWin)
        self.closeButton.bind('<Return>', lambda event: self.closeWin())

        self.closeButton.pack(side=RIGHT, padx=5, pady=5)

        # OK button
        self.okButton = Button(self.master,
                               text="OK",
                               width=10,
                               command=self.submitData)

        self.okButton.bind('<Return>', lambda event: self.submitData())

        self.okButton.pack(side=RIGHT)

        fname.focus()
Пример #4
0
    def __init__(self, master):
        self.master = master
        master.title("Convert SPC files")

        mf = Frame(master, padding="10")
        mf.grid(column=0, row=0, sticky=(N, W, E, S))
        mf.columnconfigure(0, weight=1)
        mf.rowconfigure(0, weight=1)
        self.message = "Enter folder containing *.SPC files"
        self.label_text = StringVar()
        self.folder = StringVar()
        self.output_fmt = StringVar()

        self.label_text.set(self.message)

        self.label = Label(mf, textvariable=self.label_text)
        self.folder_label = Label(mf, text="Folder")
        self.output_fmt_label = Label(mf, text="Output Format")

        self.fmt_txt = Radiobutton(mf, text="TXT", variable=self.output_fmt, value='txt')
        self.fmt_csv = Radiobutton(mf, text="CSV", variable=self.output_fmt, value='csv')
        self.folder_entry = Entry(mf, textvariable=self.folder)

        self.sel_foler = Button(mf, text="Browse", command=self.ask_dir)
        self.convert_btn = Button(mf, text="Convert", command=self.convert)

        # map on grid
        self.label.grid(row=0, column=0, columnspan=4, sticky=W + E)
        self.folder_label.grid(row=1, column=0, sticky=E)
        self.output_fmt_label.grid(row=2, column=0, sticky=E)
        self.folder_entry.grid(row=1, column=1, columnspan=2, sticky=W + E)
        self.fmt_txt.grid(row=2, column=1, sticky=W)
        self.fmt_csv.grid(row=2, column=2, sticky=W)
        self.sel_foler.grid(row=1, column=3, sticky=W)
        self.convert_btn.grid(row=3, column=1, columnspan=2, sticky=W + E)

        for child in mf.winfo_children():
            child.grid_configure(padx=5, pady=5)
Пример #5
0
class JobList(Frame):
    # NOTE: job_params contains information about a Job in the Joblist
    # NOTE: plot_args contains information about plotting information, which occurs after the jobs have been and the data files have been created

    def __init__(self, parent=None, **kwargs):
        Frame.__init__(self, parent)
        self.parent = parent
        self.job_list_yscroll = Scrollbar(self, orient=Tkinter.VERTICAL)
        self.job_list_xscroll = Scrollbar(self, orient=Tkinter.HORIZONTAL)
        self.job_list = Listbox(self, xscrollcommand=self.job_list_xscroll, yscrollcommand=self.job_list_yscroll)
        self.job_list_xscroll['command'] = self.job_list.xview
        self.job_list_yscroll['command'] = self.job_list.yview
        self.new_job_frame = Frame(self)
        add_icon_filename = kwargs['add_icon_filename'] if 'add_icon_filename' in kwargs else None
        if add_icon_filename == None:
            self.add_job_button = Button(self.new_job_frame, text='Add Job', command=self.on_add)
        else:
            add_icon = PhotoImage(file=add_icon_filename)
            self.add_job_button = Button(self.new_job_frame, text='Add Job', compound='bottom', image=add_icon, command=self.on_add)
        self.remove_job_button = Button(self.new_job_frame, text='Remove Job', command=self.on_remove)
        self.progress_frame = Frame(self)
        self.progress_value = Tkinter.IntVar()
        self.progress_bar = Progressbar(self.progress_frame, variable=self.progress_value)
        self.button_frame = Frame(self)
        self.process_button = ProcessButton(parent=self.button_frame, start_jobs=self.start_jobs)
        self.quit_button = QuitButton(parent=self.button_frame, close_other_windows=self.close_top_level_windows)

        self.run_job = kwargs['run_job'] if 'run_job' in kwargs else None

        self.create_plots = kwargs['create_plots'] if 'create_plots' in kwargs else None

        self.log_filename = kwargs['log_filename'] if 'log_filename' in kwargs else None

        self.bind('<<AskToClearJobs>>', self.ask_to_clear_jobs)
        self.bind('<<AskToPlotGraphs>>', self.ask_to_plot_graphs)
        self.bind('<<CreatePlotGUI>>', self.create_plot_gui)
        self.parent.bind('<ButtonPress>', self.on_press)
        self.parent.bind('<Configure>', self.on_resize)

        self.reinit_variables()

        self.top_level_windows = list()

        # NOTE: Because there seems to be an issue resizing child widgets when the top level (Tk) widget is being resized,
        # the resize option will be disabled for this window
        self.parent.resizable(width=False, height=False)

        self.lift()

    def reinit_variables(self):
        self.job_params = dict()

        self.last_job_id = -1

        self.job_outcomes = list()

        self.plot_args = list()

        self.on_button = False

    def add_job_params(self, input_args):
        self.job_params = input_args
        # Add each element to the job list
        for job in self.job_params:
            self.add_job(job)

    def add_job(self, job):
        try:
            index_end = job['input_directory'].rindex('/')
            index_start = job['input_directory'].rindex('/', 0, index_end)
            input_directory_text = job['input_directory']
            list_text = 'Job ' + str(job['job_id']) + ' \'' + input_directory_text + '\''
            if job['start'] != None:
                list_text += ' ' + str(job['start'])
                if job['end'] != None:
                    list_text += ' to'
            if job['end'] != None:
                list_text += ' ' + str(job['end'])

            if job['job_id'] > self.last_job_id:
                self.last_job_id = job['job_id']

            self.job_list.insert(Tkinter.END, list_text)

            # Add the list text to the job params as an optional parameter to read later to display in a future Graph GUI (or for any other useful purpose)
            job['list_text'] = list_text

            # The line number is used wrt the GUI to indicate which job in the job list is being currently executed.
            job['line_number'] = self.job_list.size() - 1
            #print str(job['line_number'])

            self.job_params[job['job_id']] = job
        except KeyError as ke:
            # Should show some error message indicating that there is a problem.
            pass

        #print str(self.job_params)
        #print 'Added Job ' + str(job['job_id'])

    def ask_to_clear_jobs(self, event):
        for job in self.job_params.itervalues():
            line_number = job['line_number']
            self.job_list.itemconfig(line_number, foreground='black')

        # Update parent to refresh widget appearance
        self.parent.update()

        # Reactivate process button
        self.process_button.config(state = Tkinter.NORMAL)

        # Note: Display a pop-up that tells the user that the job is done and asks if the job list should be cleared.

        clearList = msg.askyesno(title='Jobs Finished', message='All jobs have been completed.  Would you like to clear the job list?', master=self)
        if clearList:
            self.clear_list()

    def ask_to_plot_graphs(self, event):
        # TODO: Add a dialog that also asks to create a graph of the 'Other Type Of Plot'
        plotGraphs = msg.askyesno(title='Plot Graphs', message='Create plots of data?', master=self)

        if not plotGraphs:
            return

        # TODO: Iterate through the jobs to display to the user an interface that asks if they want to graphs of the outputs
        if self.create_plots != None:
            output_files_list = list()
            for job_outcome in self.job_outcomes:
                for output_outcomes in job_outcome[2]:
                    (station, output_directory, output_files) = output_outcomes
                    for output_files_tuple in output_files:
                        for output_file_tuple in output_files_tuple:
                            (output_file, output_file_success) = output_file_tuple
                            if output_file_success:
                                # If there is a list text variable (the 4th (or 3rd by 0 based index) variable), then add it to our output list
                                if len(job_outcome) == 4:
                                    output_files_list.append([output_file, job_outcome[3]])
                                else:
                                    output_files_list.append([output_file])

            plots_thread = PlotsThread(self.create_plots, output_files_list, self)
            plots_thread.start()

    def add_plot(self, args=dict()):
        self.plot_args.append(args)

    def finished_adding_plots(self):
        self.event_generate('<<CreatePlotGUI>>', when='tail')

    def create_plot_gui(self, event):
        # TODO: This should be replaced with a new window that allows the user to drag and drop the icons from one frame to another
        graph_names = list()
        for args in self.plot_args:
            graph_name = args['output_file']
            graph_names.append(graph_name)
        dnd_graphs_frame = Dnd.createFrame(self, 'Drag and Drop Output Plots', graph_names, self.finish_creating_plot_gui)

    # This is the entry point for the
    def finish_creating_plot_gui(self, plot_labels):
        graph_count = 1
        for plot_label in plot_labels:
            for args in self.plot_args:
                #print 'Looking in ' + args['plot_title'] + ' for ' + plot_label
                #print 'The plot label is: ' + plot_label
                #print 'The output file is: ' + args['output_file']
                if plot_label == args['output_file']:
                    #print 'Creating graph ' + str(graph_count)
                    graph_count += 1
                    graph_window = ModelRunnerGraphGUI.GraphWindow(parent=self, title=args['window_title'], df=args['df'], plot=args['plot'], plot_title=args['plot_title'], y_label=args['y_label'], log_filename=self.log_filename)
                    graph_window.set_grid()
                    self.top_level_windows.append(graph_window)
        #print 'Creating plot GUI

        # Have to clear out list here instead of clear_list because clear_list() removes plot_args before this method has a chance to read
        # them and create the appropriate plot graph windows
        self.reinit_variables()

    # Clear all the elements in the list
    def clear_list(self):

        # Save plot args because they are need later in this run
        plot_args = self.plot_args
        self.reinit_variables()
        # Restore the plot args
        self.plot_args = plot_args

        self.job_list.delete(0, self.job_list.size())
        self.progress_value.set(0)
        # Update parent to refresh widget appearance
        self.parent.update()

    def on_add(self):
        single_job = JobParameters(parent=self.parent, beginning_year=1950, ending_year=2100, job_id=self.last_job_id + 1, entry=self)
        single_job.set_grid()

    def on_remove(self):
        selection = self.job_list.curselection()
        for line_number in selection:
            line_text = self.job_list.get(line_number)
            job_id = int(line_text[4:line_text.index(' ', 4)])
            job = self.job_params.pop(job_id)
            self.job_list.delete(line_number)
            print 'Removed Job ' + str(job['job_id'])
        # Fix line number
        for line_number in range(self.job_list.size()):
            line_text = self.job_list.get(line_number)
            job_id = int(line_text[4:line_text.index(' ', 4)])
            #print 'Job ' + str(job_id) + ' is now on line ' + str(line_number)
            self.job_params[job_id]['line_number'] = line_number

    def set_grid(self):
        self.grid(sticky=Tkinter.N + Tkinter.S + Tkinter.W + Tkinter.E, padx=4, pady=4)
        self.columnconfigure(0, minsize=600)
        self.rowconfigure(0, minsize=300)
        self.job_list.grid(row=0, column=0, sticky=Tkinter.N + Tkinter.S + Tkinter.E + Tkinter.W)
        self.job_list_yscroll.grid(row=0, column=1, sticky=Tkinter.N + Tkinter.S + Tkinter.W)
        self.job_list_xscroll.grid(row=1, column=0, sticky=Tkinter.E + Tkinter.W + Tkinter.N)
        self.new_job_frame.grid(row=2, column=0, pady=3, sticky=Tkinter.W)
        self.remove_job_button.grid(row=0, column=0)
        self.add_job_button.grid(row=0, column=1)
        self.progress_frame.grid(row=3, column=0, pady=3)
        self.progress_frame.columnconfigure(0, minsize=600)
        self.progress_bar.grid(row=0, column=0, sticky=Tkinter.E + Tkinter.W + Tkinter.N + Tkinter.S)
        self.button_frame.grid(row=4, column=0, sticky=Tkinter.E + Tkinter.W + Tkinter.N + Tkinter.S)
        self.button_frame.columnconfigure(0, minsize=300)
        self.button_frame.columnconfigure(1, minsize=300)
        self.process_button.pack(side=Tkinter.RIGHT)
        self.quit_button.pack(side=Tkinter.RIGHT)

    def start_jobs(self):
        # If there are no queued jobs then simply return
        if len(self.job_params) == 0 or len(self.job_list.get(0)) == 0:
            return
        # Deactivate the process button
        self.process_button.config(state = Tkinter.DISABLED)
        # Initialize the progress bar
        self.progress_value.set(0)
        # Update parent to refresh widget appearance
        self.parent.update()
        # Start process thread
        jobs_thread = JobsThread(self.job_params, self.run_job, self.on_update, self.on_resume)
        jobs_thread.start()
        self['cursor'] = 'wait'

    def on_update(self, status, line_number, step):
        if status == 'init':
            self.job_list.itemconfig(line_number, foreground='green')
            self.job_list.activate(line_number)
        elif status == 'success':
            self.job_list.itemconfig(line_number, foreground='blue')
        elif status == 'fail':
            self.job_list.itemconfig(line_number, foreground='red')
        self.progress_value.set(step)
        # Update parent to refresh widget appearance
        self.parent.update()

    def on_resume(self, job_outcomes=list()):
        self.progress_value.set(100)
        self.job_outcomes = job_outcomes
        self.event_generate('<<AskToClearJobs>>', when='tail')
        self.event_generate('<<AskToPlotGraphs>>', when='tail')
        self['cursor'] = 'arrow'

    def close_top_level_windows(self):
        #print 'Closing other top level windows'
        for top_level_window in self.top_level_windows:
            if top_level_window:
                top_level_window.withdraw()
                top_level_window.destroy()

    def notify_of_close(self, top_level_window):
        if top_level_window in self.top_level_windows:
            #print 'Removing top level window'
            self.top_level_windows.remove(top_level_window)

    def on_press(self, event):
        self.on_button = True
        self.release_pattern = "<B%d-ButtonRelease-%d>" % (event.num, event.num)
        self.parent.bind(self.release_pattern, self.on_release)

    def on_release(self, event):
        self.on_button = False

    def on_resize(self, event):
        self.parent.lift()

        if self.on_button:

            self.set_grid()

    def on_close(self):
        self.plot_args = list()
        self.withdraw()
        self.destroy()
Пример #6
0
class MainWindow(object):
    def __init__(self, root, debugger):
        '''
        -----------------------------------------------------
        | main button toolbar                               |
        -----------------------------------------------------
        |       < ma | in content area >      |             |
        |            |                        |             |
        | File list  | File name              | Inspector   |
        | (stack/    | Code area              |             |
        | breakpnts) |                        |             |
        |            |                        |             |
        |            |                        |             |
        -----------------------------------------------------
        |     status bar area                               |
        -----------------------------------------------------

        '''

        # Obtain and expand the current working directory.
        base_path = os.path.abspath(os.getcwd())
        base_path = os.path.normcase(base_path) + '/'

        # Create a filename normalizer based on the CWD.
        self.filename_normalizer = filename_normalizer(base_path)

        self.debugger = debugger
        # Associate the debugger with this view.
        self.debugger.view = self

        # Root window
        self.root = root
        self.root.title('Bugjar')
        self.root.geometry('1024x768')

        # Prevent the menus from having the empty tearoff entry
        self.root.option_add('*tearOff', False)
        # Catch the close button
        self.root.protocol("WM_DELETE_WINDOW", self.cmd_quit)
        # Catch the "quit" event.
        self.root.createcommand('exit', self.cmd_quit)

        # Setup the menu
        self._setup_menubar()

        # Set up the main content for the window.
        self._setup_button_toolbar()
        self._setup_main_content()
        self._setup_status_bar()

        # Now configure the weights for the root frame
        self.root.columnconfigure(0, weight=1)
        self.root.rowconfigure(0, weight=0)
        self.root.rowconfigure(1, weight=1)
        self.root.rowconfigure(2, weight=0)

        debugger.start()

    ######################################################
    # Internal GUI layout methods.
    ######################################################

    def _setup_menubar(self):
        # Menubar
        self.menubar = Menu(self.root)

        # self.menu_Apple = Menu(self.menubar, name='Apple')
        # self.menubar.add_cascade(menu=self.menu_Apple)

        self.menu_file = Menu(self.menubar)
        self.menubar.add_cascade(menu=self.menu_file, label='File')

        self.menu_program = Menu(self.menubar)
        self.menubar.add_cascade(menu=self.menu_program, label='Program')

        self.menu_help = Menu(self.menubar)
        self.menubar.add_cascade(menu=self.menu_help, label='Help')

        # self.menu_Apple.add_command(label='Test', command=self.cmd_dummy)

        # self.menu_file.add_command(label='New', command=self.cmd_dummy, accelerator="Command-N")
        self.menu_file.add_command(label='Open...', command=self.cmd_open_file, accelerator="Command-O")
        self.root.bind('<Command-o>', self.cmd_open_file)
        # self.menu_file.add_command(label='Close', command=self.cmd_dummy)

        self.menu_program.add_command(label='Run', command=self.cmd_run, accelerator="R")
        self.root.bind('<r>', self.cmd_run)
        self.menu_program.add_command(label='Step', command=self.cmd_step, accelerator="S")
        self.root.bind('<s>', self.cmd_step)
        self.menu_program.add_command(label='Next', command=self.cmd_next, accelerator="N")
        self.root.bind('<n>', self.cmd_next)
        self.menu_program.add_command(label='Return', command=self.cmd_return, accelerator="BackSpace")
        self.root.bind('<BackSpace>', self.cmd_return)

        self.menu_help.add_command(label='Open Documentation', command=self.cmd_bugjar_docs)
        self.menu_help.add_command(label='Open Bugjar project page', command=self.cmd_bugjar_page)
        self.menu_help.add_command(label='Open Bugjar on GitHub', command=self.cmd_bugjar_github)
        self.menu_help.add_command(label='Open BeeWare project page', command=self.cmd_beeware_page)

        # last step - configure the menubar
        self.root['menu'] = self.menubar

    def _setup_button_toolbar(self):
        '''
        The button toolbar runs as a horizontal area at the top of the GUI.
        It is a persistent GUI component
        '''

        # Main toolbar
        self.toolbar = Frame(self.root)
        self.toolbar.grid(column=0, row=0, sticky=(W, E))

        # Buttons on the toolbar
        self.run_button = Button(self.toolbar, text='Run', command=self.cmd_run)
        self.run_button.grid(column=0, row=0)

        self.step_button = Button(self.toolbar, text='Step', command=self.cmd_step)
        self.step_button.grid(column=1, row=0)

        self.next_button = Button(self.toolbar, text='Next', command=self.cmd_next)
        self.next_button.grid(column=2, row=0)

        self.return_button = Button(self.toolbar, text='Return', command=self.cmd_return)
        self.return_button.grid(column=3, row=0)

        self.toolbar.columnconfigure(0, weight=0)
        self.toolbar.rowconfigure(0, weight=0)

    def _setup_main_content(self):
        '''
        Sets up the main content area. It is a persistent GUI component
        '''

        # Main content area
        self.content = PanedWindow(self.root, orient=HORIZONTAL)
        self.content.grid(column=0, row=1, sticky=(N, S, E, W))

        # Create subregions of the content
        self._setup_file_lists()
        self._setup_code_area()
        self._setup_inspector()

        # Set up weights for the left frame's content
        self.content.columnconfigure(0, weight=1)
        self.content.rowconfigure(0, weight=1)

        self.content.pane(0, weight=1)
        self.content.pane(1, weight=2)
        self.content.pane(2, weight=1)

    def _setup_file_lists(self):

        self.file_notebook = Notebook(self.content, padding=(0, 5, 0, 5))
        self.content.add(self.file_notebook)

        self._setup_stack_frame_list()
        self._setup_breakpoint_list()

    def _setup_stack_frame_list(self):
        self.stack_frame = Frame(self.content)
        self.stack_frame.grid(column=0, row=0, sticky=(N, S, E, W))
        self.file_notebook.add(self.stack_frame, text='Stack')

        self.stack = StackView(self.stack_frame, normalizer=self.filename_normalizer)
        self.stack.grid(column=0, row=0, sticky=(N, S, E, W))

        # # The tree's vertical scrollbar
        self.stack_scrollbar = Scrollbar(self.stack_frame, orient=VERTICAL)
        self.stack_scrollbar.grid(column=1, row=0, sticky=(N, S))

        # # Tie the scrollbar to the text views, and the text views
        # # to each other.
        self.stack.config(yscrollcommand=self.stack_scrollbar.set)
        self.stack_scrollbar.config(command=self.stack.yview)

        # Setup weights for the "stack" tree
        self.stack_frame.columnconfigure(0, weight=1)
        self.stack_frame.columnconfigure(1, weight=0)
        self.stack_frame.rowconfigure(0, weight=1)

        # Handlers for GUI events
        self.stack.bind('<<TreeviewSelect>>', self.on_stack_frame_selected)

    def _setup_breakpoint_list(self):
        self.breakpoints_frame = Frame(self.content)
        self.breakpoints_frame.grid(column=0, row=0, sticky=(N, S, E, W))
        self.file_notebook.add(self.breakpoints_frame, text='Breakpoints')

        self.breakpoints = BreakpointView(self.breakpoints_frame, normalizer=self.filename_normalizer)
        self.breakpoints.grid(column=0, row=0, sticky=(N, S, E, W))

        # The tree's vertical scrollbar
        self.breakpoints_scrollbar = Scrollbar(self.breakpoints_frame, orient=VERTICAL)
        self.breakpoints_scrollbar.grid(column=1, row=0, sticky=(N, S))

        # Tie the scrollbar to the text views, and the text views
        # to each other.
        self.breakpoints.config(yscrollcommand=self.breakpoints_scrollbar.set)
        self.breakpoints_scrollbar.config(command=self.breakpoints.yview)

        # Setup weights for the "breakpoint list" tree
        self.breakpoints_frame.columnconfigure(0, weight=1)
        self.breakpoints_frame.columnconfigure(1, weight=0)
        self.breakpoints_frame.rowconfigure(0, weight=1)

        # Handlers for GUI events
        self.breakpoints.tag_bind('breakpoint', '<Double-Button-1>', self.on_breakpoint_double_clicked)
        self.breakpoints.tag_bind('breakpoint', '<<TreeviewSelect>>', self.on_breakpoint_selected)
        self.breakpoints.tag_bind('file', '<<TreeviewSelect>>', self.on_breakpoint_file_selected)

    def _setup_code_area(self):
        self.code_frame = Frame(self.content)
        self.code_frame.grid(column=1, row=0, sticky=(N, S, E, W))

        # Label for current file
        self.current_file = StringVar()
        self.current_file_label = Label(self.code_frame, textvariable=self.current_file)
        self.current_file_label.grid(column=0, row=0, sticky=(W, E))

        # Code display area
        self.code = DebuggerCode(self.code_frame, debugger=self.debugger)
        self.code.grid(column=0, row=1, sticky=(N, S, E, W))

        # Set up weights for the code frame's content
        self.code_frame.columnconfigure(0, weight=1)
        self.code_frame.rowconfigure(0, weight=0)
        self.code_frame.rowconfigure(1, weight=1)

        self.content.add(self.code_frame)

    def _setup_inspector(self):
        self.inspector_frame = Frame(self.content)
        self.inspector_frame.grid(column=2, row=0, sticky=(N, S, E, W))

        self.inspector = InspectorView(self.inspector_frame)
        self.inspector.grid(column=0, row=0, sticky=(N, S, E, W))

        # The tree's vertical scrollbar
        self.inspector_scrollbar = Scrollbar(self.inspector_frame, orient=VERTICAL)
        self.inspector_scrollbar.grid(column=1, row=0, sticky=(N, S))

        # Tie the scrollbar to the text views, and the text views
        # to each other.
        self.inspector.config(yscrollcommand=self.inspector_scrollbar.set)
        self.inspector_scrollbar.config(command=self.inspector.yview)

        # Setup weights for the "breakpoint list" tree
        self.inspector_frame.columnconfigure(0, weight=1)
        self.inspector_frame.columnconfigure(1, weight=0)
        self.inspector_frame.rowconfigure(0, weight=1)

        self.content.add(self.inspector_frame)

    def _setup_status_bar(self):
        # Status bar
        self.statusbar = Frame(self.root)
        self.statusbar.grid(column=0, row=2, sticky=(W, E))

        # Current status
        self.run_status = StringVar()
        self.run_status_label = Label(self.statusbar, textvariable=self.run_status)
        self.run_status_label.grid(column=0, row=0, sticky=(W, E))
        self.run_status.set('Not running')

        # Main window resize handle
        self.grip = Sizegrip(self.statusbar)
        self.grip.grid(column=1, row=0, sticky=(S, E))

        # Set up weights for status bar frame
        self.statusbar.columnconfigure(0, weight=1)
        self.statusbar.columnconfigure(1, weight=0)
        self.statusbar.rowconfigure(0, weight=0)

    ######################################################
    # Utility methods for controlling content
    ######################################################

    def show_file(self, filename, line=None, breakpoints=None):
        """Show the content of the nominated file.

        If specified, line is the current line number to highlight. If the
        line isn't currently visible, the window will be scrolled until it is.

        breakpoints is a list of line numbers that have current breakpoints.

        If refresh is true, the file will be reloaded and redrawn.
        """
        # Set the filename label for the current file
        self.current_file.set(self.filename_normalizer(filename))

        # Update the code view; this means changing the displayed file
        # if necessary, and updating the current line.
        if filename != self.code.filename:
            self.code.filename = filename
            for bp in self.debugger.breakpoints(filename).values():
                if bp.enabled:
                    self.code.enable_breakpoint(bp.line)
                else:
                    self.code.disable_breakpoint(bp.line)

        self.code.line = line

    ######################################################
    # TK Main loop
    ######################################################

    def mainloop(self):
        self.root.mainloop()

    ######################################################
    # TK Command handlers
    ######################################################

    def cmd_quit(self):
        "Quit the debugger"
        self.debugger.stop()
        self.root.quit()

    def cmd_run(self, event=None):
        "Run until the next breakpoint, or end of execution"
        self.debugger.do_run()

    def cmd_step(self, event=None):
        "Step into the next line of code"
        self.debugger.do_step()

    def cmd_next(self, event=None):
        "Run the next line of code in the current frame"
        self.debugger.do_next()

    def cmd_return(self, event=None):
        "Return to the previous frame"
        self.debugger.do_return()

    def cmd_open_file(self, event=None):
        "Open a file in the breakpoint pane"
        filename = tkFileDialog.askopenfilename(initialdir=os.path.abspath(os.getcwd()))

        if filename:
            # Convert to canonical form
            filename = os.path.abspath(filename)
            filename = os.path.normcase(filename)

            # Show the file contents
            self.code.filename = filename

            # Ensure the file appears on the breakpoint list
            self.breakpoints.insert_filename(filename)

            # Show the breakpoint panel
            self.file_notebook.select(self.breakpoints_frame)

            # ... select the new filename
            self.breakpoints.selection_set(filename)

            # .. and clear any currently selected item on the stack tree
            self.stack.selection_remove(self.stack.selection())

    def cmd_bugjar_page(self):
        "Show the Bugjar project page"
        webbrowser.open_new('http://pybee.org/bugjar')

    def cmd_bugjar_github(self):
        "Show the Bugjar GitHub repo"
        webbrowser.open_new('http://github.com/pybee/bugjar')

    def cmd_bugjar_docs(self):
        "Show the Bugjar documentation"
        # If this is a formal release, show the docs for that
        # version. otherwise, just show the head docs.
        if len(NUM_VERSION) == 3:
            webbrowser.open_new('http://bugjar.readthedocs.org/en/v%s/' % VERSION)
        else:
            webbrowser.open_new('http://bugjar.readthedocs.org/')

    def cmd_beeware_page(self):
        "Show the BeeWare project page"
        webbrowser.open_new('http://pybee.org/')

    ######################################################
    # Handlers for GUI actions
    ######################################################

    def on_stack_frame_selected(self, event):
        "When a stack frame is selected, highlight the file and line"
        if event.widget.selection():
            _, index = event.widget.selection()[0].split(':')
            line, frame = self.debugger.stack[int(index)]

            # Display the file in the code view
            self.show_file(filename=frame['filename'], line=line)

            # Display the contents of the selected frame in the inspector
            self.inspector.show_frame(frame)

            # Clear any currently selected item on the breakpoint tree
            self.breakpoints.selection_remove(self.breakpoints.selection())

    def on_breakpoint_selected(self, event):
        "When a breakpoint on the tree has been selected, show the breakpoint"
        if event.widget.selection():
            parts = event.widget.focus().split(':')
            bp = self.debugger.breakpoint((parts[0], int(parts[1])))
            self.show_file(filename=bp.filename, line=bp.line)

            # Clear any currently selected item on the stack tree
            self.stack.selection_remove(self.stack.selection())

    def on_breakpoint_file_selected(self, event):
        "When a file is selected on the breakpoint tree, show the file"
        if event.widget.selection():
            filename = event.widget.focus()
            self.show_file(filename=filename)

            # Clear any currently selected item on the stack tree
            self.stack.selection_remove(self.stack.selection())

    def on_breakpoint_double_clicked(self, event):
        "When a breakpoint on the tree is double clicked, toggle it's status"
        if event.widget.selection():
            parts = event.widget.focus().split(':')
            bp = self.debugger.breakpoint((parts[0], int(parts[1])))
            if bp.enabled:
                self.debugger.disable_breakpoint(bp)
            else:
                self.debugger.enable_breakpoint(bp)

            # Clear any currently selected item on the stack tree
            self.stack.selection_remove(self.stack.selection())

    ######################################################
    # Handlers for debugger responses
    ######################################################

    def on_stack(self, stack):
        "A report of a new stack"
        # Make sure the stack frame list is displayed
        self.file_notebook.select(self.stack_frame)

        # Update the stack list
        self.stack.update_stack(stack)

        if len(stack) > 0:
            # Update the display of the current file
            line = stack[-1][0]
            filename = stack[-1][1]['filename']
            self.show_file(filename=filename, line=line)

            # Select the current stack frame in the frame list
            self.stack.selection_set('frame:%s' % (len(stack) - 1))
        else:
            # No current frame (probably end of execution),
            # so clear the current line marker
            self.code.line = None

    def on_line(self, filename, line):
        "A single line of code has been executed"
        self.run_status.set('Line (%s:%s)' % (filename, line))

    def on_call(self, args):
        "A callable has been invoked"
        self.run_status.set('Call: %s' % args)

    def on_return(self, retval):
        "A callable has returned"
        self.run_status.set('Return: %s' % retval)

    def on_exception(self, name, value):
        "An exception has been raised"
        self.run_status.set('Exception: %s - %s' % (name, value))
        tkMessageBox.showwarning(message='%s: %s' % (name, value))

    def on_postmortem(self):
        "An exception has been raised"
        self.run_status.set('Post mortem mode')
        tkMessageBox.showerror(message='Entering post mortem mode. Step/Next will restart')

    def on_restart(self):
        "The code has finished running, and will start again"
        self.run_status.set('Not running')
        tkMessageBox.showinfo(message='Program has finished, and will restart.')

    def on_info(self, message):
        "The debugger needs to inform the user of something"
        tkMessageBox.showinfo(message=message)

    def on_warning(self, message):
        "The debugger needs to warn the user of something"
        tkMessageBox.showwarning(message=message)

    def on_error(self, message):
        "The debugger needs to report an error"
        tkMessageBox.showerror(message=message)

    def on_breakpoint_enable(self, bp):
        "A breakpoint has been enabled in the debugger"
        # If the breakpoint is in the currently displayed file, updated
        # the display of the breakpoint.
        if bp.filename == self.code.filename:
            self.code.enable_breakpoint(bp.line, temporary=bp.temporary)

        # ... then update the display of the breakpoint on the tree
        self.breakpoints.update_breakpoint(bp)

    def on_breakpoint_disable(self, bp):
        "A breakpoint has been disabled in the debugger"
        # If the breakpoint is in the currently displayed file, updated
        # the display of the breakpoint.
        if bp.filename == self.code.filename:
            self.code.disable_breakpoint(bp.line)

        # ... then update the display of the breakpoint on the tree
        self.breakpoints.update_breakpoint(bp)

    def on_breakpoint_ignore(self, bp, count):
        "A breakpoint has been ignored by the debugger"
        # If the breakpoint is in the currently displayed file, updated
        # the display of the breakpoint.
        if bp.filename == self.code.filename:
            self.code.ignore_breakpoint(bp.line)

        # ... then update the display of the breakpoint on the tree
        self.breakpoints.update_breakpoint(bp)

    def on_breakpoint_clear(self, bp):
        "A breakpoint has been cleared in the debugger"
        # If the breakpoint is in the currently displayed file, updated
        # the display of the breakpoint.
        if bp.filename == self.code.filename:
            self.code.clear_breakpoint(bp.line)

        # ... then update the display of the breakpoint on the tree
        self.breakpoints.update_breakpoint(bp)
dictionary = relationship_dictionary.get_dictionary('frequency')
relationship_manager = RelationshipManager(dictionary, stop_list = ['authority', 'jurisdiction'])

#Term dictionary and managers

term_dictionary  = RelevantTermsDictionary(RELEVANT_TERMS_FILE)
term_manager = RelevantTermsManager(term_dictionary, stop_list = ['authority', 'jurisdiction'])
#term_manager.set_current_threshold(99.0)

print "num of terms", len(term_manager.get_current_dictionary())
print "num of relations", len(relationship_manager.get_usable_couples())

#main frame
supermainframe = Frame(root, padding="3 3 12 12")
supermainframe.grid(column=0, row=0, sticky=(N, W, E, S))
supermainframe.columnconfigure(0, weight=1) 
supermainframe.rowconfigure(0, weight=1)

mainframe = Frame(supermainframe, padding="3 3 12 12")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
mainframe.columnconfigure(0, weight=1) 
mainframe.rowconfigure(0, weight=1) 


suggested_term_a = StringVar()
suggested_term_b = StringVar()

suggested_term_single = StringVar()


couple = relationship_manager.get_random_couple()
Пример #8
0
    def StartGui(self):
        self.tkRoot = Tk(baseName="")
        self.tkRoot.geometry("350x300+0+0")
        self.tkRoot.title("Engine SAPI GUI")
        self.GUIVisible = True

        frame = Frame(self.tkRoot)
        frame.style = Style()
        frame.style.theme_use("alt")
        frame.pack(fill=BOTH, expand=1)

        frame.columnconfigure(1, weight=1)
        frame.columnconfigure(7, pad=7)
        frame.rowconfigure(13, weight=1)
        frame.rowconfigure(13, pad=7)
        
        Label(frame, text="Start:").grid(row = 0, column=0)
        self.labelStart = Label(frame, text="0")
        self.labelStart.grid(row = 1, column=0)

        Label(frame, text="Length:").grid(row = 0, column=1)
        self.labelLength = Label(frame, text="0")
        self.labelLength.grid(row = 1, column=1)

        Label(frame, text="Total:").grid(row = 0, column=2)
        self.labelTotal = Label(frame, text="0")
        self.labelTotal.grid(row = 1, column=2)
        
        self.labelSentenceLeft = Label(frame, text="...")
        self.labelSentenceLeft.grid(row = 2, column=0, sticky=E)
        self.labelSentenceSpoken = Label(frame, text="...", foreground="red")
        self.labelSentenceSpoken.grid(row = 2, column=1)
        self.labelSentenceRight = Label(frame, text="...")
        self.labelSentenceRight.grid(row = 2, column=2, sticky=W, columnspan=2)   

        scrollbar = Scrollbar(frame, orient=VERTICAL)
        self.labelQueueToSpeak = Label(frame, text="Queue to speak:").grid(row = 3, column=0, pady=4, padx=5, sticky=W)
        self.listboxQueueToSpeak = Listbox(frame, width=50, height=3, yscrollcommand=scrollbar.set)
        
        scrollbar.config(command=self.listboxQueueToSpeak.yview)
        self.listboxQueueToSpeak.grid( sticky=N+S+E+W, row = 4, column = 0, columnspan = 2 ,rowspan = 3, padx=3)
        scrollbar.grid(sticky=N+S+W, row = 4, column = 2, rowspan = 3)

        self.buttonPauze = Button(frame, text="Pauze", command=self.communicationProtocal.handlePauze)
        self.buttonPauze.grid(row = 4, column=3)

        self.buttonStop = Button(frame, text="Stop", command=self.communicationProtocal.restartProcess)
        self.buttonStop.grid(row = 5, column=3)

        self.buttonResume = Button(frame, text="Resume", command=self.communicationProtocal.handleResume)
        self.buttonResume.grid(row = 6, column=3)

        Label(frame, text="Text to say:").grid(row = 7, column=0, padx=3, sticky=W)

        self.stringVarTextToSay = StringVar()
        self.entryTextToSay = Entry(frame, textvariable=self.stringVarTextToSay, width=500)
        self.entryTextToSay.grid(row=8, column=0, columnspan=3, padx=3, sticky=W)
        self.stringVarTextToSay.set("Hello SAPI Speak Engine")
        self.entryTextToSay.bind('<Return>', self.CallBackReturnSay)

        self.buttonSay = Button(frame, text="Say", command=self.CallBackButtonSay)
        self.buttonSay.grid(row = 8, column=3)

        Label(frame, text="Recover action:").grid(row = 9, column=0, padx=3, sticky=W)
        self.recoverActionLabelText = "None"
        self.labelRecoverAction = Label(frame, text=self.recoverActionLabelText, foreground="blue")
        self.labelRecoverAction.grid(row = 10, column=0)   

        Label(frame, text="Voice speed:").grid(row = 9, column=1, sticky=W)
        self.buttonSpeedDown = Button(frame, text="Speed down", command=self.communicationProtocal.handleSpeedDown)
        self.buttonSpeedDown.grid(row = 10, column=1, padx=3, sticky=E)

        self.speedValue = 0
        self.intVarSpeed = IntVar()
        vcmd = (self.tkRoot.register(self.OnValidateEntrySpeakSpeed), '%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W')
        self.entrySpeakSpeed = Entry(frame, textvariable=self.intVarSpeed, validate="key", validatecommand=vcmd, width=5)
        self.entrySpeakSpeed.grid(row=10,column=2)
        self.entrySpeakSpeed.bind('<Return>', self.CallBackSetSpeed)

        self.buttonSpeedUp = Button(frame, text="Speed up", command=self.communicationProtocal.handleSpeedUp)
        self.buttonSpeedUp.grid(row = 10, column=3)

        Label(frame, text="voice:").grid(row = 11, column=0, padx=3, sticky=W)
        self.buttonPrevVoice = Button(frame, text="Prev voice", command=self.communicationProtocal.handlePrevVoice)
        self.buttonPrevVoice.grid(row = 12, column=0, padx=3, sticky=W)

        self.buttonNextVoice = Button(frame, text="Next voice", command=self.communicationProtocal.handleNextVoice)
        self.buttonNextVoice.grid(row = 12, column=3)

        self.currentVoice = StringVar(self.tkRoot)
        self.currentVoice.set(self.communicationProtocal.CurrentVoiceName)

        engine = pyttsx.init()
        voices = engine.getProperty("voices")
        voiceNames = list()
        for x in xrange(0, len(voices)):
            voiceNames.append(voices[x].name)
        self.optionMenuVoices = OptionMenu(frame, self.currentVoice, *tuple(voiceNames), command=self.CallBackOptionMenuVoices)
        self.optionMenuVoices.config(width=500)
        self.optionMenuVoices.grid(sticky=W, row = 12, column = 1)
     
        #hide if close button is clicked
        self.tkRoot.protocol("WM_DELETE_WINDOW", self.HideGui)
        self.tkRoot.after(1000/32, self.Update)
        self.tkRoot.mainloop()  
Пример #9
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
Пример #10
0
    def __init__(self, master):
        self.master = master
        self.screen1 = None
        master.title("RVD")
        #mf = Frame(master, padding="20")
        master.geometry('575x300')
        #self.menu=Menu(master)
        #file_item=Menu(self.menu)

        #self.menu.add_cascade(label='File', menu=file_item)
        #file_item.add_command(label='About', command=self.about)
        #file_item.add_separator()
        #file_item.add_command(label='Exit', command=self.master.quit)
        mf = Frame(master, padding="15")
        mf.grid(column=0, row=0, sticky=(N, W, E, S))
        mf.columnconfigure(0, weight=1)
        mf.rowconfigure(0, weight=1)
        self.infomessage = "Raman spectra based RNA Virus Detection (RVD) program\n"
        self.developer = "\nDeveloped by Sanket Desai, Dutt laboratory, TMC-ACTREC"
        self.infolabel_text = StringVar()
        self.developer_text = StringVar()
        self.proname = StringVar()
        self.message = "Enter folder containing *.SPC files"
        self.label_text = StringVar()
        self.folder = StringVar()
        #self.output_fmt = StringVar()
        self.outputdir = StringVar()
        self.prolabel = Label(mf, text="Project name")
        self.infolabel_text.set(self.infomessage)
        self.developer_text.set(self.developer)
        self.label_text.set(self.message)
        self.ilabel = Label(mf, textvariable=self.infolabel_text)
        self.developerlabel = Label(mf, textvariable=self.developer_text)
        self.label = Label(mf, textvariable=self.label_text)
        self.folder_label = Label(mf, text="Input Directory")
        self.output_folder_label = Label(mf, text="Output Directory")
        #self.output_fmt_label = Label(mf, text="Output Format")
        #self.fmt_txt = Radiobutton(mf, text="TXT", variable=self.output_fmt, value='txt')
        #self.fmt_csv = Radiobutton(mf, text="CSV", variable=self.output_fmt, value='csv')

        self.proname_entry = Entry(mf, textvariable=self.proname)
        self.folder_entry = Entry(mf, textvariable=self.folder)
        self.sel_foler = Button(mf, text="Browse", command=self.ask_dir)
        self.folder_entry2 = Entry(mf, textvariable=self.outputdir)
        self.sel_foler2 = Button(mf, text="Browse", command=self.ask_odir)
        self.convert_btn = Button(mf, text="Submit", command=self.convert)
        # map on grid
        #self.menu.grid(row=0,column=0, sticky=E)
        self.ilabel.grid(row=0, column=2, sticky=E)
        self.prolabel.grid(row=2, column=1, sticky=E)
        self.proname_entry.grid(row=2, column=2, columnspan=2, sticky=W + E)
        self.label.grid(row=3, column=2, columnspan=4, sticky=W + E)
        self.folder_label.grid(row=4, column=1, sticky=E)
        #self.output_fmt_label.grid(row=3, column=0, sticky=E)
        self.folder_entry.grid(row=4, column=2, columnspan=2, sticky=W + E)
        #self.fmt_txt.grid(row=2, column=1, sticky=W)
        #self.fmt_csv.grid(row=2, column=2, sticky=W)
        self.sel_foler.grid(row=4, column=4, sticky=W)
        self.output_folder_label.grid(row=5, column=1, sticky=E)
        self.folder_entry2.grid(row=5, column=2, columnspan=2, sticky=W + E)
        self.sel_foler2.grid(row=5, column=4, sticky=W)
        self.convert_btn.grid(row=6, column=2, columnspan=2, sticky=W + E)
        self.developerlabel.grid(row=7, column=2, sticky=E)
        for child in mf.winfo_children():
            child.grid_configure(padx=5, pady=5)
Пример #11
0
    def initUI(self):

        data_frame = Frame(self.master, relief=RAISED, borderwidth=1)
        data_frame.pack(fill=BOTH, expand=True, padx=5, pady=2)

        data_frame.columnconfigure(0, weight=1, minsize=30)
        data_frame.columnconfigure(1, weight=1, minsize=30)

        # ----------------- Search string entry --------------------------
        #
        srchStr_lb = Label(data_frame, text='Search for:')
        srchStr_lb.grid(row=0, column=0, sticky=S + W, padx=10)

        self.srchStr_val = StringVar()
        self.srchStr_val.set(self.formData.srchString)

        srchStr = Entry(data_frame,
                        width=50,
                        bd=2,
                        textvariable=self.srchStr_val)

        srchStr.grid(row=1,
                     column=0,
                     columnspan=2,
                     sticky=N + S + W + E,
                     padx=10)

        srchStr.select_range(0, END)
        srchStr.icursor(END)
        srchStr.focus_set()

        srchStr.bind('<Button-3>', rClicker, add='')

        # Regular expression checkbox
        self.regExp_val = IntVar()
        self.regExp_val.set(self.reg_exp_val)

        chkBox01 = Checkbutton(data_frame,
                               text='Perl Pattern',
                               variable=self.regExp_val)

        chkBox01.grid(row=2, column=0, padx=18, sticky=W)

        # Close on OK checkbox
        self.closeOnOk_val = IntVar()
        self.closeOnOk_val.set(1)

        chkBox02 = Checkbutton(data_frame,
                               text='Close on OK',
                               variable=self.closeOnOk_val)

        chkBox02.grid(row=2, column=1, padx=18, sticky=W)

        # ---------------------- Options -----------------------
        opt_frame = LabelFrame(data_frame, text='Options')
        opt_frame.columnconfigure(0, weight=3, minsize=150)
        opt_frame.columnconfigure(1, weight=2, minsize=50)

        # Number of occurences to show per file
        opt_m_lb = Label(opt_frame,
                         pady=5,
                         text='Number of matched lines per file:')
        opt_m_lb.grid(row=0, column=0, sticky=E)

        self.opt_m_val = StringVar()
        self.opt_m_val.set(self.formData.opt_m)

        self.opt_m = Entry(opt_frame,
                           width=5,
                           bd=2,
                           textvariable=self.opt_m_val)

        self.opt_m.grid(row=0, column=1, sticky=W)

        # Number of lines before matched line
        opt_B_lb = Label(opt_frame,
                         pady=5,
                         text='Number of lines before matched line:')
        opt_B_lb.grid(row=1, column=0, sticky=E)

        self.opt_B_val = StringVar()
        self.opt_B_val.set(self.formData.opt_B)

        opt_B = Entry(opt_frame, width=5, bd=2, textvariable=self.opt_B_val)

        opt_B.grid(row=1, column=1, sticky=W)

        # Number of lines After matched line
        opt_A_lb = Label(opt_frame,
                         pady=5,
                         text='Number of lines after matched line:')
        opt_A_lb.grid(row=2, column=0, sticky=E)

        self.opt_A_val = StringVar()
        self.opt_A_val.set(self.formData.opt_A)

        opt_A = Entry(opt_frame, width=5, bd=2, textvariable=self.opt_A_val)
        opt_A.grid(row=2, column=1, sticky=W)

        # Put on the form
        opt_frame.grid(row=3,
                       column=0,
                       columnspan=2,
                       padx=10,
                       pady=5,
                       sticky=N + W + E)

        # ---------------------- File Name Pattern --------------------------
        fname_lb = Label(data_frame, text='File Name Pattern:')
        fname_lb.grid(row=4, column=0, sticky=W, padx=10)

        self.fname_val = StringVar()
        self.fname_val.set(self.formData.fname_pat)

        fname = Entry(data_frame, width=50, bd=2, textvariable=self.fname_val)
        fname.grid(row=5,
                   column=0,
                   columnspan=2,
                   sticky=N + S + W + E,
                   padx=10)
        fname.bind('<Button-3>', rClicker, add='')
        # ---------------------- Location -----------------------------
        loc_frame = LabelFrame(data_frame, text='Location')
        loc_frame.columnconfigure(0, weight=1, minsize=50)
        loc_frame.columnconfigure(1, weight=1, minsize=50)
        loc_frame.columnconfigure(2, weight=1, minsize=50)
        loc_frame.columnconfigure(3, weight=1, minsize=50)

        self.location_val = IntVar()
        self.location_val.set(self.srch_dir_idx)

        # Search in Db Location
        RBox0 = Radiobutton(loc_frame,
                            text='db',
                            variable=self.location_val,
                            value=0)
        RBox0.grid(row=0, column=0, sticky=W, padx=10)

        # Search in cui localion
        RBox1 = Radiobutton(loc_frame,
                            text='cui',
                            variable=self.location_val,
                            value=1)
        RBox1.grid(row=0, column=1, sticky=W, padx=10)

        # Search in Dat localion
        RBox2 = Radiobutton(loc_frame,
                            text='dat',
                            variable=self.location_val,
                            value=2)
        RBox2.grid(row=0, column=2, sticky=W, padx=10)

        # Search in scripts localion
        RBox3 = Radiobutton(loc_frame,
                            text='scripts',
                            variable=self.location_val,
                            value=3)
        RBox3.grid(row=0, column=3, sticky=W, padx=10)

        # Search in sub-folders
        lb2 = Label(loc_frame, text='Sub-dirs:')
        lb2.grid(row=1, column=0, sticky=E)

        self.subDir_val = StringVar()
        self.subDir_val.set(self.formData.srch_subdir)

        subFolders = Entry(loc_frame,
                           width=30,
                           bd=2,
                           textvariable=self.subDir_val)

        subFolders.grid(row=1,
                        column=1,
                        columnspan=3,
                        pady=5,
                        padx=10,
                        sticky=W + E)

        subFolders.bind('<Button-3>', rClicker, add='')

        # Search maxdepth
        lb3 = Label(loc_frame, text='Dir Depth:')
        lb3.grid(row=2, column=0, sticky=E)

        self.maxDepth_val = StringVar()
        self.maxDepth_val.set(self.formData.maxDepth)

        maxDepth = Entry(loc_frame,
                         width=10,
                         bd=2,
                         textvariable=self.maxDepth_val)

        maxDepth.grid(row=2, column=1, columnspan=1, pady=5, padx=10, sticky=W)

        # Put on the form
        loc_frame.grid(row=6,
                       column=0,
                       columnspan=2,
                       padx=10,
                       pady=5,
                       sticky=N + S + W + E)

        # Close button
        self.closeButton = Button(self.master,
                                  text="Close",
                                  width=10,
                                  bd=2,
                                  command=self.closeWin)
        self.closeButton.bind('<Return>', lambda event: self.closeWin())

        self.closeButton.pack(side=RIGHT, padx=5, pady=5)

        # OK button
        self.okButton = Button(self.master,
                               text="OK",
                               width=10,
                               command=self.submitData)

        self.okButton.bind('<Return>', lambda event: self.submitData())

        self.okButton.pack(side=RIGHT)
Пример #12
0
class mainframe(Frame):

    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.filenm=None
        self.streamnm = None
        self.pack(fill=BOTH, expand=1)
        self.parent = parent
        self.initplayer()
        self.player_process = None
        self.seekthread = None
        self.fstate = False
        self.paused = True
        self.trackmouse = True
        self.stdout_thread = None
        self.stream = False
        self.inhibit_slider_trigger = False
        self.q = LifoQueue()
        self.currtime = 0
        self.endtime = -1

    def initplayer(self):
        self.parentframe = Frame(self)
        self.parentframe.pack(fill=BOTH, expand=True)
        self.videoFrame = Frame(self.parentframe, width=800, height=480)
        self.videoFrame.pack(side="top", fill="both", expand=True)
        self.buttonframe = Frame(self.parentframe, padding="2 2 1 1")
        self.buttonframe.pack(side="bottom", fill="x", expand=False)

        self.seekbar = Scale(self.buttonframe, from_= 0, to=100, orient=HORIZONTAL)
        self.seekbar.grid(column=0, columnspan=4, row=0, sticky=[N, E, S, W])
        self.seekbar.configure(command=self.seeked)

        self.selectbutton = Button(self.buttonframe, text="Select File")
        self.selectbutton.grid(column=0, row=1, sticky=[E,W])
        self.streambutton = Button(self.buttonframe, text="Open HTTP", command=self.streamopen)
        self.streambutton.grid(column=1, row=1, sticky=[E,W])
        self.playbutton = Button(self.buttonframe, text="Play")
        self.playbutton.config(command=self.playpause)
        self.playbutton.grid(column=2, row=1, sticky=[E,W])
        self.fullscreenbutton = Button(self.buttonframe, text="Fullscreen", command=self.togglefullscreen)
        self.fullscreenbutton.grid(column=3, row=1, sticky=[E,W])
        for child in self.buttonframe.winfo_children(): child.grid_configure(padx=5, pady=5)
        self.buttonframe.rowconfigure(0, weight=1)
        self.buttonframe.rowconfigure(1, weight=1)
        self.buttonframe.columnconfigure(0, weight=1)
        self.buttonframe.columnconfigure(1, weight=1)
        self.buttonframe.columnconfigure(2, weight=1)
        self.buttonframe.columnconfigure(3, weight=1)

        self.selectbutton.configure(command=self.fileopen)
        self.videoFrame.bind("<Button-1>",self.playpause)
        self.parent.bind("<F11>", self.togglefullscreen)
        self.parent.bind("<Motion>",self.mouseops)

    def mouseops(self,event=None):
        self.videoFrame.config(cursor="")
        self.videoFrame.after(5000,self.cursorhandler)
        if self.trackmouse:
            x, y = self.parent.winfo_pointerx(), self.parent.winfo_pointery()
            windowx, windowy = self.parent.winfo_width(), self.parent.winfo_height()
            if windowy - 30 <= y:
                if self.fstate:
                    self.buttonframe.pack(side="bottom", fill="x", expand=False)
                    self.trackmouse = False
                    self.parent.after(5000, self.mousetracker)
                self.inhibit_slider_trigger = False
            elif self.fstate:
                self.buttonframe.pack_forget()
                self.inhibit_slider_trigger = True
            else:
                self.inhibit_slider_trigger = True

    def mousetracker(self):
        print 'Mouse Tracker'
        self.trackmouse = True
        self.videoFrame.after(0,self.mouseops)

    def cursorhandler(self):
        self.videoFrame.config(cursor="none")

    def togglefullscreen(self, event=None):
        self.fstate = not self.fstate
        self.parent.attributes("-fullscreen",self.fstate)
        if self.fstate:
            self.fullscreenbutton.config(text="Exit Fullscreen")
            self.buttonframe.pack_forget()
            self.videoFrame.config(cursor="none")
        else:
            self.fullscreenbutton.config(text="Fullscreen")
            self.buttonframe.pack(side="bottom", fill="x", expand=False)
            self.videoFrame.after(5000, self.cursorhandler)

    def fileopen(self):
        self.filenm = askopenfilename(filetypes=[("Supported Files","*.mp4;*.mkv;*.mpg;*.avi;*.mov"),("All Files","*.*")])
        self.stream = False
        self.play()

    def streamopen(self):
        self.streamnm = Dlog(self.parent)
        if self.streamnm.result is not None:
            s = str(self.streamnm)
        else:
            return
        if s.startswith('http'):
            self.stream = True
            self.play()
        else:
            self.stream = False
            showerror("Error","Incorrect Entry")

    def play(self):
        global fifofilename
        if self.filenm is not None and self.filenm != "":
            winid = self.videoFrame.winfo_id()
            if self.mplayer_isrunning():
                self.stop()
            try:
                self.paused = False
                self.playbutton.configure(text="Pause")
                if not self.stream:
                    self.player_process = Popen(["mplayer","-fs","-slave","-quiet","-wid",str(winid),self.filenm],stdin=PIPE, stdout=PIPE)
                else:
                    self.player_process = Popen(["mplayer","-fs","-slave","-quiet","-wid",str(winid),self.streamnm], stdin=PIPE, stdout=PIPE)
                self.stdout_thread = Thread(target=self.enqueue_pipe, args=(self.player_process.stdout, self.q))
                self.stdout_thread.daemon = True
                self.stdout_thread.start()
                self.emptypipe()
                self.seekthread = Thread(target=self.seekbar_setup, args=())
                self.seekthread.daemon = True
                self.seekthread.start()
            except:
                showerror("Error","".join(["Couldn't play video:\n",str(sys.exc_info()[:])]))

    def getvidtime(self):
        if self.mplayer_isrunning():
            self.command_player("get_time_length")
            output = self.readpipe()
            while "ANS_LENGTH" not in output:
                output = self.readpipe()
            if "ANS_LENGTH" in output:
                return output.split('ANS_LENGTH=')[1]
            else:
                return 0

    def playpause(self, event=None):
        if self.player_process is None:
            return
        self.paused = not self.paused
        if self.paused:
            print "VIDEO IS PAUSED /B/RO"
            self.playbutton.configure(text="Play")
        else:
            self.playbutton.configure(text="Pause")
        self.command_player("pause")

    def setwh(self,w,h):
        self.videoFrame.configure(width=w, height=h)

    def quit(self):
        print "QUIT CALLED"
        self.destroy()

    def mplayer_isrunning(self):
        if self.player_process is not None:
            return (self.player_process.poll() is None)
        else:
            return False

    def command_player(self, comd):
        global fifofilename
        if self.mplayer_isrunning():
            try:
                self.player_process.stdin.flush()
                self.player_process.stdin.write("\r\n%s\r\n"%comd)
                # for _ in itertools.repeat(None,8192):
                #     self.player_process.stdin.write("\n")
                self.player_process.stdin.flush()
            except:
                showerror("Error","Error passing command to mplayer\n%s"%sys.exc_info()[1])

    def enqueue_pipe(self, out, q):
        print 'Working on reading mplayer pipe output...'
        for line in iter(out.readline, b''):
            q.put(line)
        out.close()

    def seekbar_setup(self):
        pos = '0'
        trial = 0
        while float(pos)<1:
            trial += 1
            pos = self.getvidtime()
        self.seekbar.config(to=int(float(pos)))
        self.endtime = int(float(pos))
        Timer(1, self.seekbar_updater).start()

    def seekbar_updater(self):
        if not self.paused and self.inhibit_slider_trigger:
            self.currtime += 1
            self.seekbar.set(self.currtime)
        else:
            self.currtime = self.seekbar.get()
        Timer(1, self.seekbar_updater).start()

    def seeked(self,e):
        pos = self.seekbar.get()
        print "We changed pos to :%d"% pos

        x, y = self.parent.winfo_pointerx(), self.parent.winfo_pointery()
        windowx, windowy = self.parent.winfo_width(), self.parent.winfo_height()
        if not self.inhibit_slider_trigger and windowy - 30 <= y:
            self.command_player("seek %d 2"%pos)
            if self.paused:
                self.command_player("pause")

    def startmousetrack(self):
        self.trackmouse = True

    def readpipe(self):
        line = ""
        try:
            line = self.q.get_nowait()
        except Empty:
            print "Empty PIPE"
        finally:
            return line

    def emptypipe(self):
        str = ''
        try:
            while not self.q.empty():
                str += self.q.get_nowait()
        except Empty:
            print "Empty Pipe"
        finally:
            return str

    def stop(self):
        if self.mplayer_isrunning():
            self.player_process.stdin.write("quit\n")
            self.player_process.stdin.flush()
            print self.emptypipe()
        self.player_process = None
Пример #13
0
    def initUI(self):

        data_frame = Frame(self.master, relief=RAISED, borderwidth=1)
        data_frame.pack(fill=BOTH, expand=True, padx=5, pady=2)

        data_frame.columnconfigure(0, weight=1, minsize=30)
        data_frame.columnconfigure(1, weight=1, minsize=30)

        # ---------------------- File Name Pattern --------------------------
        fname_lb = Label(data_frame, text='File Name Pattern:')
        fname_lb.grid(row=4, column=0, sticky=W, padx=10)

        self.fname_val = StringVar()
        self.fname_val.set(self.formData.fname_pat)

        fname = Entry(data_frame, width=50, bd=2, textvariable=self.fname_val)
        fname.grid(row=5,
                   column=0,
                   columnspan=2,
                   sticky=N + S + W + E,
                   padx=10)
        fname.bind('<Button-3>', rClicker, add='')
        # ---------------------- Location -----------------------------
        loc_frame = LabelFrame(data_frame, text='Location')
        loc_frame.columnconfigure(0, weight=1, minsize=50)
        loc_frame.columnconfigure(1, weight=1, minsize=50)
        loc_frame.columnconfigure(2, weight=1, minsize=50)
        loc_frame.columnconfigure(3, weight=1, minsize=50)

        self.location_val = IntVar()
        self.location_val.set(self.srch_dir_idx)

        # Search in Db Location
        RBox0 = Radiobutton(loc_frame,
                            text='db',
                            variable=self.location_val,
                            value=0)
        RBox0.grid(row=0, column=0, sticky=W, padx=10)

        # Search in cui localion
        RBox1 = Radiobutton(loc_frame,
                            text='cui',
                            variable=self.location_val,
                            value=1)
        RBox1.grid(row=0, column=1, sticky=W, padx=10)

        # Search in Dat localion
        RBox2 = Radiobutton(loc_frame,
                            text='dat',
                            variable=self.location_val,
                            value=2)
        RBox2.grid(row=0, column=2, sticky=W, padx=10)

        # Search in scripts localion
        RBox3 = Radiobutton(loc_frame,
                            text='scripts',
                            variable=self.location_val,
                            value=3)
        RBox3.grid(row=0, column=3, sticky=W, padx=10)

        # Search in sub-folders
        lb2 = Label(loc_frame, text='Sub-dirs:')
        lb2.grid(row=1, column=0, sticky=E)

        self.subDir_val = StringVar()
        self.subDir_val.set(self.formData.srch_subdir)

        subFolders = Entry(loc_frame,
                           width=30,
                           bd=2,
                           textvariable=self.subDir_val)

        subFolders.grid(row=1,
                        column=1,
                        columnspan=3,
                        pady=5,
                        padx=10,
                        sticky=W + E)

        subFolders.bind('<Button-3>', rClicker, add='')

        # Search maxdepth
        lb3 = Label(loc_frame, text='Dir Depth:')
        lb3.grid(row=2, column=0, sticky=E)

        self.maxDepth_val = StringVar()
        self.maxDepth_val.set(self.formData.maxDepth)

        maxDepth = Entry(loc_frame,
                         width=10,
                         bd=2,
                         textvariable=self.maxDepth_val)

        maxDepth.grid(row=2, column=1, columnspan=1, pady=5, padx=10, sticky=W)

        # Put on the form
        loc_frame.grid(row=6,
                       column=0,
                       columnspan=2,
                       padx=10,
                       pady=5,
                       sticky=N + S + W + E)

        # Close button
        self.closeButton = Button(self.master,
                                  text="Close",
                                  width=10,
                                  bd=2,
                                  command=self.closeWin)
        self.closeButton.bind('<Return>', lambda event: self.closeWin())

        self.closeButton.pack(side=RIGHT, padx=5, pady=5)

        # OK button
        self.okButton = Button(self.master,
                               text="OK",
                               width=10,
                               command=self.submitData)

        self.okButton.bind('<Return>', lambda event: self.submitData())

        self.okButton.pack(side=RIGHT)

        fname.focus()
Пример #14
0
class Search:
    bg_color = "#E9E9E9"

    def __init__(self, parent):
        self.curr_search = ""
        self.title = "Search"
        self.items = {}
        self.root = Frame(parent)
        #configure parent for grid
        self.root.columnconfigure(0, weight=3)
        # self.root.columnconfigure(1, weight=2)
        self.root.columnconfigure(2, weight=1)

        self.text = tk.Text(self.root, height=1, width=50)
        self.text.bind("<Key>", self.build_word)
        self.text.bind("<BackSpace>", self.delete)
        self.text.bind("<Return>", self.lookup)
        # self.text.pack()
        self.build_dict()
        #spacing
        tk.Label(self.root,
                 text="Search:",
                 font=("Helvetica", 16),
                 bg=Search.bg_color).grid(row=0, column=0)
        self.text.grid(row=0, column=1, columnspan=2)
        self.labels = []

    def build_dict(self):
        #search for brand
        self.items["dorito"] = [
            "Doritos Nacho Cheese $4.00 Aisle 5",
            "Doritos Cooler Ranch $4.00 Aisle 5",
            "Doritos Pizza Flavored $4.00 Aisle 5"
        ]
        self.items["oreos"] = ["Double Stuf Oreos $5.50 Aisle 9"]
        self.items["lays"] = ["Lays $3.00 Aisle 9"]
        self.items["kelloggs"] = [
            "Froot Loops $2.89 Aisle 3", "Frosted Flakes $3.00 Aisle 3",
            "Cocoa Krispies $2.70 Aisle 3", "Apple Jacks $4.00 Aisle 3",
            "Corn Pops $2.70 Aisle 3"
        ]

        #search for food type
        self.items["cereal"] = [
            "Lucky Charms $2.89 Aisle 3",
            "Cinnamon Toast Crunch $3.00 Aisle 3", "Cocoa Puffs $2.70 Aisle 3",
            "Raisin Bran $4.00 Aisle 3", "Froot Loops $2.89 Aisle 3",
            "Frosted Flakes $3.00 Aisle 3", "Cocoa Krispies $2.70 Aisle 3",
            "Apple Jacks $4.00 Aisle 3", "Corn Pops $2.70 Aisle 3"
        ]
        self.items["cookies"] = ["Double Stuf Oreos $5.50 Aisle 9"]
        self.items["chips"] = [
            "Cheez-its $4.50 Aisle 9", "Doritos Nacho Cheese $4.00 Aisle 5",
            "Doritos Cooler Ranch $4.00 Aisle 5",
            "Doritos Pizza Flavored $4.00 Aisle 5", "Lays $3.00 Aisle 9"
        ]

    def get_root(self):
        return self.root

    def get_title(self):
        return self.title

    def delete(self, event):
        if len(self.curr_search) > 0:
            self.curr_search = self.curr_search[:-1]

    def build_word(self, event):
        self.curr_search += event.char

    # @param: upc is an identifier number that matches a specific item in the database
    def lookup(self, event):
        for l in self.labels:
            l.grid_forget()
        self.labels = []
        for k in self.items.keys():
            if k.lower().startswith(self.curr_search):
                for i, t in enumerate(self.items[k]):
                    # split_t = t.split(",")
                    # for j in range(len(split_t)):
                    l = tk.Label(self.root,
                                 text=t,
                                 font=("Helvetica", 14),
                                 bg=Search.bg_color,
                                 pady=5)
                    l.grid(row=i + 1, column=1)
                    self.labels.append(l)
        self.curr_search = ""
Пример #15
0
class Search:
	bg_color = "#E9E9E9"

	def __init__(self, parent):
		self.curr_search = ""
		self.title = "Search"
		self.items = {}
		self.root = Frame(parent)
		#configure parent for grid
		self.root.columnconfigure(0, weight=3)
		# self.root.columnconfigure(1, weight=2)
		self.root.columnconfigure(2, weight=1)

		self.text = tk.Text(self.root, height=1, width=50)
		self.text.bind("<Key>", self.build_word)
		self.text.bind("<BackSpace>", self.delete)
		self.text.bind("<Return>", self.lookup)
		# self.text.pack()
		self.build_dict()
		#spacing
		tk.Label(self.root, text="Search:", font=("Helvetica", 16), bg=Search.bg_color).grid(row=0, column=0)
		self.text.grid(row=0, column=1, columnspan=2)
		self.labels = []

	def build_dict(self):
		#search for brand
		self.items["dorito"] = ["Doritos Nacho Cheese $4.00 Aisle 5", "Doritos Cooler Ranch $4.00 Aisle 5", "Doritos Pizza Flavored $4.00 Aisle 5"]
		self.items["oreos"] = ["Double Stuf Oreos $5.50 Aisle 9"]
		self.items["lays"] = ["Lays $3.00 Aisle 9"]
		self.items["kelloggs"] = ["Froot Loops $2.89 Aisle 3", "Frosted Flakes $3.00 Aisle 3", "Cocoa Krispies $2.70 Aisle 3", "Apple Jacks $4.00 Aisle 3", "Corn Pops $2.70 Aisle 3"]

		#search for food type
		self.items["cereal"] = ["Lucky Charms $2.89 Aisle 3", "Cinnamon Toast Crunch $3.00 Aisle 3", "Cocoa Puffs $2.70 Aisle 3", "Raisin Bran $4.00 Aisle 3", "Froot Loops $2.89 Aisle 3", "Frosted Flakes $3.00 Aisle 3", "Cocoa Krispies $2.70 Aisle 3", "Apple Jacks $4.00 Aisle 3", "Corn Pops $2.70 Aisle 3"]
		self.items["cookies"] = ["Double Stuf Oreos $5.50 Aisle 9"]
		self.items["chips"] = ["Cheez-its $4.50 Aisle 9", "Doritos Nacho Cheese $4.00 Aisle 5", "Doritos Cooler Ranch $4.00 Aisle 5", "Doritos Pizza Flavored $4.00 Aisle 5", "Lays $3.00 Aisle 9"]

	def get_root(self):
		return self.root

	def get_title(self):
		return self.title

	def delete(self, event):
		if len(self.curr_search) > 0:
			self.curr_search = self.curr_search[:-1]

	def build_word(self, event):
		self.curr_search += event.char

	# @param: upc is an identifier number that matches a specific item in the database
	def lookup(self, event):
		for l in self.labels:
			l.grid_forget()
		self.labels = []
		for k in self.items.keys():
			if k.lower().startswith(self.curr_search):
				for i, t in enumerate(self.items[k]):
					# split_t = t.split(",")
					# for j in range(len(split_t)):
					l = tk.Label(self.root, text=t, font=("Helvetica", 14), bg=Search.bg_color, pady=5)
					l.grid(row=i+1, column=1)
					self.labels.append(l)
		self.curr_search = ""
Пример #16
0
class MainWindow(object):
    def __init__(self, root, debugger):
        '''
        -----------------------------------------------------
        | main button toolbar                               |
        -----------------------------------------------------
        |       < ma | in content area >      |             |
        |            |                        |             |
        | File list  | File name              | Inspector   |
        | (stack/    | Code area              |             |
        | breakpnts) |                        |             |
        |            |                        |             |
        |            |                        |             |
        -----------------------------------------------------
        |     status bar area                               |
        -----------------------------------------------------

        '''

        # Obtain and expand the current working directory.
        base_path = os.path.abspath(os.getcwd())
        base_path = os.path.normcase(base_path) + '/'

        # Create a filename normalizer based on the CWD.
        self.filename_normalizer = filename_normalizer(base_path)

        self.debugger = debugger
        # Associate the debugger with this view.
        self.debugger.view = self

        # Root window
        self.root = root
        self.root.title('Bugjar')
        self.root.geometry('1024x768')

        # Prevent the menus from having the empty tearoff entry
        self.root.option_add('*tearOff', False)
        # Catch the close button
        self.root.protocol("WM_DELETE_WINDOW", self.cmd_quit)
        # Catch the "quit" event.
        self.root.createcommand('exit', self.cmd_quit)

        # Setup the menu
        self._setup_menubar()

        # Set up the main content for the window.
        self._setup_button_toolbar()
        self._setup_main_content()
        self._setup_status_bar()

        # Now configure the weights for the root frame
        self.root.columnconfigure(0, weight=1)
        self.root.rowconfigure(0, weight=0)
        self.root.rowconfigure(1, weight=1)
        self.root.rowconfigure(2, weight=0)

        debugger.start()

    ######################################################
    # Internal GUI layout methods.
    ######################################################

    def _setup_menubar(self):
        # Menubar
        self.menubar = Menu(self.root)

        # self.menu_Apple = Menu(self.menubar, name='Apple')
        # self.menubar.add_cascade(menu=self.menu_Apple)

        self.menu_file = Menu(self.menubar)
        self.menubar.add_cascade(menu=self.menu_file, label='File')

        self.menu_program = Menu(self.menubar)
        self.menubar.add_cascade(menu=self.menu_program, label='Program')

        self.menu_help = Menu(self.menubar)
        self.menubar.add_cascade(menu=self.menu_help, label='Help')

        # self.menu_Apple.add_command(label='Test', command=self.cmd_dummy)

        # self.menu_file.add_command(label='New', command=self.cmd_dummy, accelerator="Command-N")
        self.menu_file.add_command(label='Open...',
                                   command=self.cmd_open_file,
                                   accelerator="Command-O")
        self.root.bind('<Command-o>', self.cmd_open_file)
        # self.menu_file.add_command(label='Close', command=self.cmd_dummy)

        self.menu_program.add_command(label='Run',
                                      command=self.cmd_run,
                                      accelerator="R")
        self.root.bind('<r>', self.cmd_run)
        self.menu_program.add_command(label='Step',
                                      command=self.cmd_step,
                                      accelerator="S")
        self.root.bind('<s>', self.cmd_step)
        self.menu_program.add_command(label='Next',
                                      command=self.cmd_next,
                                      accelerator="N")
        self.root.bind('<n>', self.cmd_next)
        self.menu_program.add_command(label='Return',
                                      command=self.cmd_return,
                                      accelerator="BackSpace")
        self.root.bind('<BackSpace>', self.cmd_return)

        self.menu_help.add_command(label='Open Documentation',
                                   command=self.cmd_bugjar_docs)
        self.menu_help.add_command(label='Open Bugjar project page',
                                   command=self.cmd_bugjar_page)
        self.menu_help.add_command(label='Open Bugjar on GitHub',
                                   command=self.cmd_bugjar_github)
        self.menu_help.add_command(label='Open BeeWare project page',
                                   command=self.cmd_beeware_page)

        # last step - configure the menubar
        self.root['menu'] = self.menubar

    def _setup_button_toolbar(self):
        '''
        The button toolbar runs as a horizontal area at the top of the GUI.
        It is a persistent GUI component
        '''

        # Main toolbar
        self.toolbar = Frame(self.root)
        self.toolbar.grid(column=0, row=0, sticky=(W, E))

        # Buttons on the toolbar
        self.run_button = Button(self.toolbar,
                                 text='Run',
                                 command=self.cmd_run)
        self.run_button.grid(column=0, row=0)

        self.step_button = Button(self.toolbar,
                                  text='Step',
                                  command=self.cmd_step)
        self.step_button.grid(column=1, row=0)

        self.next_button = Button(self.toolbar,
                                  text='Next',
                                  command=self.cmd_next)
        self.next_button.grid(column=2, row=0)

        self.return_button = Button(self.toolbar,
                                    text='Return',
                                    command=self.cmd_return)
        self.return_button.grid(column=3, row=0)

        self.toolbar.columnconfigure(0, weight=0)
        self.toolbar.rowconfigure(0, weight=0)

    def _setup_main_content(self):
        '''
        Sets up the main content area. It is a persistent GUI component
        '''

        # Main content area
        self.content = PanedWindow(self.root, orient=HORIZONTAL)
        self.content.grid(column=0, row=1, sticky=(N, S, E, W))

        # Create subregions of the content
        self._setup_file_lists()
        self._setup_code_area()
        self._setup_inspector()

        # Set up weights for the left frame's content
        self.content.columnconfigure(0, weight=1)
        self.content.rowconfigure(0, weight=1)

        self.content.pane(0, weight=1)
        self.content.pane(1, weight=2)
        self.content.pane(2, weight=1)

    def _setup_file_lists(self):

        self.file_notebook = Notebook(self.content, padding=(0, 5, 0, 5))
        self.content.add(self.file_notebook)

        self._setup_stack_frame_list()
        self._setup_breakpoint_list()

    def _setup_stack_frame_list(self):
        self.stack_frame = Frame(self.content)
        self.stack_frame.grid(column=0, row=0, sticky=(N, S, E, W))
        self.file_notebook.add(self.stack_frame, text='Stack')

        self.stack = StackView(self.stack_frame,
                               normalizer=self.filename_normalizer)
        self.stack.grid(column=0, row=0, sticky=(N, S, E, W))

        # # The tree's vertical scrollbar
        self.stack_scrollbar = Scrollbar(self.stack_frame, orient=VERTICAL)
        self.stack_scrollbar.grid(column=1, row=0, sticky=(N, S))

        # # Tie the scrollbar to the text views, and the text views
        # # to each other.
        self.stack.config(yscrollcommand=self.stack_scrollbar.set)
        self.stack_scrollbar.config(command=self.stack.yview)

        # Setup weights for the "stack" tree
        self.stack_frame.columnconfigure(0, weight=1)
        self.stack_frame.columnconfigure(1, weight=0)
        self.stack_frame.rowconfigure(0, weight=1)

        # Handlers for GUI events
        self.stack.bind('<<TreeviewSelect>>', self.on_stack_frame_selected)

    def _setup_breakpoint_list(self):
        self.breakpoints_frame = Frame(self.content)
        self.breakpoints_frame.grid(column=0, row=0, sticky=(N, S, E, W))
        self.file_notebook.add(self.breakpoints_frame, text='Breakpoints')

        self.breakpoints = BreakpointView(self.breakpoints_frame,
                                          normalizer=self.filename_normalizer)
        self.breakpoints.grid(column=0, row=0, sticky=(N, S, E, W))

        # The tree's vertical scrollbar
        self.breakpoints_scrollbar = Scrollbar(self.breakpoints_frame,
                                               orient=VERTICAL)
        self.breakpoints_scrollbar.grid(column=1, row=0, sticky=(N, S))

        # Tie the scrollbar to the text views, and the text views
        # to each other.
        self.breakpoints.config(yscrollcommand=self.breakpoints_scrollbar.set)
        self.breakpoints_scrollbar.config(command=self.breakpoints.yview)

        # Setup weights for the "breakpoint list" tree
        self.breakpoints_frame.columnconfigure(0, weight=1)
        self.breakpoints_frame.columnconfigure(1, weight=0)
        self.breakpoints_frame.rowconfigure(0, weight=1)

        # Handlers for GUI events
        self.breakpoints.tag_bind('breakpoint', '<Double-Button-1>',
                                  self.on_breakpoint_double_clicked)
        self.breakpoints.tag_bind('breakpoint', '<<TreeviewSelect>>',
                                  self.on_breakpoint_selected)
        self.breakpoints.tag_bind('file', '<<TreeviewSelect>>',
                                  self.on_breakpoint_file_selected)

    def _setup_code_area(self):
        self.code_frame = Frame(self.content)
        self.code_frame.grid(column=1, row=0, sticky=(N, S, E, W))

        # Label for current file
        self.current_file = StringVar()
        self.current_file_label = Label(self.code_frame,
                                        textvariable=self.current_file)
        self.current_file_label.grid(column=0, row=0, sticky=(W, E))

        # Code display area
        self.code = DebuggerCode(self.code_frame, debugger=self.debugger)
        self.code.grid(column=0, row=1, sticky=(N, S, E, W))

        # Set up weights for the code frame's content
        self.code_frame.columnconfigure(0, weight=1)
        self.code_frame.rowconfigure(0, weight=0)
        self.code_frame.rowconfigure(1, weight=1)

        self.content.add(self.code_frame)

    def _setup_inspector(self):
        self.inspector_frame = Frame(self.content)
        self.inspector_frame.grid(column=2, row=0, sticky=(N, S, E, W))

        self.inspector = InspectorView(self.inspector_frame)
        self.inspector.grid(column=0, row=0, sticky=(N, S, E, W))

        # The tree's vertical scrollbar
        self.inspector_scrollbar = Scrollbar(self.inspector_frame,
                                             orient=VERTICAL)
        self.inspector_scrollbar.grid(column=1, row=0, sticky=(N, S))

        # Tie the scrollbar to the text views, and the text views
        # to each other.
        self.inspector.config(yscrollcommand=self.inspector_scrollbar.set)
        self.inspector_scrollbar.config(command=self.inspector.yview)

        # Setup weights for the "breakpoint list" tree
        self.inspector_frame.columnconfigure(0, weight=1)
        self.inspector_frame.columnconfigure(1, weight=0)
        self.inspector_frame.rowconfigure(0, weight=1)

        self.content.add(self.inspector_frame)

    def _setup_status_bar(self):
        # Status bar
        self.statusbar = Frame(self.root)
        self.statusbar.grid(column=0, row=2, sticky=(W, E))

        # Current status
        self.run_status = StringVar()
        self.run_status_label = Label(self.statusbar,
                                      textvariable=self.run_status)
        self.run_status_label.grid(column=0, row=0, sticky=(W, E))
        self.run_status.set('Not running')

        # Main window resize handle
        self.grip = Sizegrip(self.statusbar)
        self.grip.grid(column=1, row=0, sticky=(S, E))

        # Set up weights for status bar frame
        self.statusbar.columnconfigure(0, weight=1)
        self.statusbar.columnconfigure(1, weight=0)
        self.statusbar.rowconfigure(0, weight=0)

    ######################################################
    # Utility methods for controlling content
    ######################################################

    def show_file(self, filename, line=None, breakpoints=None):
        """Show the content of the nominated file.

        If specified, line is the current line number to highlight. If the
        line isn't currently visible, the window will be scrolled until it is.

        breakpoints is a list of line numbers that have current breakpoints.

        If refresh is true, the file will be reloaded and redrawn.
        """
        # Set the filename label for the current file
        self.current_file.set(self.filename_normalizer(filename))

        # Update the code view; this means changing the displayed file
        # if necessary, and updating the current line.
        if filename != self.code.filename:
            self.code.filename = filename
            for bp in self.debugger.breakpoints(filename).values():
                if bp.enabled:
                    self.code.enable_breakpoint(bp.line)
                else:
                    self.code.disable_breakpoint(bp.line)

        self.code.line = line

    ######################################################
    # TK Main loop
    ######################################################

    def mainloop(self):
        self.root.mainloop()

    ######################################################
    # TK Command handlers
    ######################################################

    def cmd_quit(self):
        "Quit the debugger"
        self.debugger.stop()
        self.root.quit()

    def cmd_run(self, event=None):
        "Run until the next breakpoint, or end of execution"
        self.debugger.do_run()

    def cmd_step(self, event=None):
        "Step into the next line of code"
        self.debugger.do_step()

    def cmd_next(self, event=None):
        "Run the next line of code in the current frame"
        self.debugger.do_next()

    def cmd_return(self, event=None):
        "Return to the previous frame"
        self.debugger.do_return()

    def cmd_open_file(self, event=None):
        "Open a file in the breakpoint pane"
        filename = tkFileDialog.askopenfilename(
            initialdir=os.path.abspath(os.getcwd()))

        if filename:
            # Convert to canonical form
            filename = os.path.abspath(filename)
            filename = os.path.normcase(filename)

            # Show the file contents
            self.code.filename = filename

            # Ensure the file appears on the breakpoint list
            self.breakpoints.insert_filename(filename)

            # Show the breakpoint panel
            self.file_notebook.select(self.breakpoints_frame)

            # ... select the new filename
            self.breakpoints.selection_set(filename)

            # .. and clear any currently selected item on the stack tree
            self.stack.selection_remove(self.stack.selection())

    def cmd_bugjar_page(self):
        "Show the Bugjar project page"
        webbrowser.open_new('http://pybee.org/bugjar')

    def cmd_bugjar_github(self):
        "Show the Bugjar GitHub repo"
        webbrowser.open_new('http://github.com/pybee/bugjar')

    def cmd_bugjar_docs(self):
        "Show the Bugjar documentation"
        # If this is a formal release, show the docs for that
        # version. otherwise, just show the head docs.
        if len(NUM_VERSION) == 3:
            webbrowser.open_new('http://bugjar.readthedocs.org/en/v%s/' %
                                VERSION)
        else:
            webbrowser.open_new('http://bugjar.readthedocs.org/')

    def cmd_beeware_page(self):
        "Show the BeeWare project page"
        webbrowser.open_new('http://pybee.org/')

    ######################################################
    # Handlers for GUI actions
    ######################################################

    def on_stack_frame_selected(self, event):
        "When a stack frame is selected, highlight the file and line"
        if event.widget.selection():
            _, index = event.widget.selection()[0].split(':')
            line, frame = self.debugger.stack[int(index)]

            # Display the file in the code view
            self.show_file(filename=frame['filename'], line=line)

            # Display the contents of the selected frame in the inspector
            self.inspector.show_frame(frame)

            # Clear any currently selected item on the breakpoint tree
            self.breakpoints.selection_remove(self.breakpoints.selection())

    def on_breakpoint_selected(self, event):
        "When a breakpoint on the tree has been selected, show the breakpoint"
        if event.widget.selection():
            parts = event.widget.focus().split(':')
            bp = self.debugger.breakpoint((parts[0], int(parts[1])))
            self.show_file(filename=bp.filename, line=bp.line)

            # Clear any currently selected item on the stack tree
            self.stack.selection_remove(self.stack.selection())

    def on_breakpoint_file_selected(self, event):
        "When a file is selected on the breakpoint tree, show the file"
        if event.widget.selection():
            filename = event.widget.focus()
            self.show_file(filename=filename)

            # Clear any currently selected item on the stack tree
            self.stack.selection_remove(self.stack.selection())

    def on_breakpoint_double_clicked(self, event):
        "When a breakpoint on the tree is double clicked, toggle it's status"
        if event.widget.selection():
            parts = event.widget.focus().split(':')
            bp = self.debugger.breakpoint((parts[0], int(parts[1])))
            if bp.enabled:
                self.debugger.disable_breakpoint(bp)
            else:
                self.debugger.enable_breakpoint(bp)

            # Clear any currently selected item on the stack tree
            self.stack.selection_remove(self.stack.selection())

    ######################################################
    # Handlers for debugger responses
    ######################################################

    def on_stack(self, stack):
        "A report of a new stack"
        # Make sure the stack frame list is displayed
        self.file_notebook.select(self.stack_frame)

        # Update the stack list
        self.stack.update_stack(stack)

        if len(stack) > 0:
            # Update the display of the current file
            line = stack[-1][0]
            filename = stack[-1][1]['filename']
            self.show_file(filename=filename, line=line)

            # Select the current stack frame in the frame list
            self.stack.selection_set('frame:%s' % (len(stack) - 1))
        else:
            # No current frame (probably end of execution),
            # so clear the current line marker
            self.code.line = None

    def on_line(self, filename, line):
        "A single line of code has been executed"
        self.run_status.set('Line (%s:%s)' % (filename, line))

    def on_call(self, args):
        "A callable has been invoked"
        self.run_status.set('Call: %s' % args)

    def on_return(self, retval):
        "A callable has returned"
        self.run_status.set('Return: %s' % retval)

    def on_exception(self, name, value):
        "An exception has been raised"
        self.run_status.set('Exception: %s - %s' % (name, value))
        tkMessageBox.showwarning(message='%s: %s' % (name, value))

    def on_postmortem(self):
        "An exception has been raised"
        self.run_status.set('Post mortem mode')
        tkMessageBox.showerror(
            message='Entering post mortem mode. Step/Next will restart')

    def on_restart(self):
        "The code has finished running, and will start again"
        self.run_status.set('Not running')
        tkMessageBox.showinfo(
            message='Program has finished, and will restart.')

    def on_info(self, message):
        "The debugger needs to inform the user of something"
        tkMessageBox.showinfo(message=message)

    def on_warning(self, message):
        "The debugger needs to warn the user of something"
        tkMessageBox.showwarning(message=message)

    def on_error(self, message):
        "The debugger needs to report an error"
        tkMessageBox.showerror(message=message)

    def on_breakpoint_enable(self, bp):
        "A breakpoint has been enabled in the debugger"
        # If the breakpoint is in the currently displayed file, updated
        # the display of the breakpoint.
        if bp.filename == self.code.filename:
            self.code.enable_breakpoint(bp.line, temporary=bp.temporary)

        # ... then update the display of the breakpoint on the tree
        self.breakpoints.update_breakpoint(bp)

    def on_breakpoint_disable(self, bp):
        "A breakpoint has been disabled in the debugger"
        # If the breakpoint is in the currently displayed file, updated
        # the display of the breakpoint.
        if bp.filename == self.code.filename:
            self.code.disable_breakpoint(bp.line)

        # ... then update the display of the breakpoint on the tree
        self.breakpoints.update_breakpoint(bp)

    def on_breakpoint_ignore(self, bp, count):
        "A breakpoint has been ignored by the debugger"
        # If the breakpoint is in the currently displayed file, updated
        # the display of the breakpoint.
        if bp.filename == self.code.filename:
            self.code.ignore_breakpoint(bp.line)

        # ... then update the display of the breakpoint on the tree
        self.breakpoints.update_breakpoint(bp)

    def on_breakpoint_clear(self, bp):
        "A breakpoint has been cleared in the debugger"
        # If the breakpoint is in the currently displayed file, updated
        # the display of the breakpoint.
        if bp.filename == self.code.filename:
            self.code.clear_breakpoint(bp.line)

        # ... then update the display of the breakpoint on the tree
        self.breakpoints.update_breakpoint(bp)
Пример #17
0
    TotalMask = np.sum(FlagsOnList)


#######################
# Tk part2   #
#######################
from Tkinter import Tk, W, E
from ttk import Frame, Button, Label, Style
from ttk import Entry

the_window = tk.Tk()
frame = Frame(the_window)

Style().configure("TButton", padding=(0, 5, 0, 5), font='serif 10')

frame.columnconfigure(0, pad=3)
frame.columnconfigure(1, pad=3)
frame.columnconfigure(2, pad=3)
frame.columnconfigure(3, pad=3)

frame.rowconfigure(0, pad=3)
frame.rowconfigure(1, pad=3)
##  ENTRY  ###
band1Label = Label(frame, text='Band 1')
band1Label.grid(row=0, column=0)
band1Entry = Entry(frame)
band1Entry.grid(row=0, column=1)
band2Label = Label(frame, text='Band 2')
band2Label.grid(row=0, column=2)
band2Entry = Entry(frame)
band2Entry.grid(row=0, column=3)
Пример #18
0
    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()