示例#1
0
 def __init__(self, *args, **kwargs):
     self._app = Scripting.root_node
     self.__topwin = kwargs.pop('topwin')
     Group.__init__(self, *args, **kwargs)
     
     frm = Frame(self)
     self.__gui_images = []
     imageMatFileBtn = ImageTk.PhotoImage(
         file=get_gui_image_path('Pattern_SaveMat_Button.png')
     )
     self.__gui_images.append(imageMatFileBtn)
     Button(frm, image=imageMatFileBtn, command=self._on_save_mat_file).pack(side=TOP)
     Button(frm, text='mat', width=6).pack(side=TOP)
     frm.pack(side=LEFT)
     
     frm = Frame(self)
     imageExcelFileBtn = ImageTk.PhotoImage(
         file=get_gui_image_path('Pattern_SaveExcel_Button.png')
     )
     self.__gui_images.append(imageExcelFileBtn)
     Button(frm, image=imageExcelFileBtn).pack(side=TOP)
     Button(frm, text='xlsx', width=6).pack(side=TOP)
     frm.pack(side=LEFT)
     
     self.name = 'Corr Matrix'
示例#2
0
 def __init__(self, *args, **kwargs):
     self._app = Application.instance
     self.__topwin = kwargs.pop('topwin')
     Group.__init__(self, *args, **kwargs)
     
     frm = Frame(self)
     self.__uiImages = []
     imageMatFileBtn = ImageTk.PhotoImage(
         file=uiImagePath('Pattern_SaveMat_Button.png')
     )
     self.__uiImages.append(imageMatFileBtn)
     Button(frm, image=imageMatFileBtn, command=self.onSaveMat).pack(side=TOP)
     Button(frm, text='mat', width=6).pack(side=TOP)
     frm.pack(side=LEFT)
     
     frm = Frame(self)
     imageExcelFileBtn = ImageTk.PhotoImage(
         file=uiImagePath('Pattern_SaveExcel_Button.png')
     )
     self.__uiImages.append(imageExcelFileBtn)
     Button(frm, image=imageExcelFileBtn).pack(side=TOP)
     Button(frm, text='xlsx', width=6).pack(side=TOP)
     frm.pack(side=LEFT)
     
     self.name = 'Corr Matrix'
示例#3
0
 def __init__(self):
     TkToolWindow.__init__(self)
     
     disable_tab = tk.Frame(self._tool_tabs)
     self._tool_tabs.add(disable_tab, text='Disable')        
     
     # Start Common group {
     common_group = Group(disable_tab)
     common_group.pack(side='left', fill='y')
     common_group.name = 'Common'
     
     key_codes = [['LWIN', 'RWIN', 'MENU'], ['ALT+ESC', 'ALT+TAB', 'CTRL+ESC']] 
     
     grid_frame = tk.Frame(common_group)
     grid_frame.pack()
     
     def callback(code, var):
         enable = False if var.get() else True
         with code_printer:
             self.enable_key(enable, code)
     
     for n in range(2):
         for m in range(3):
             code = key_codes[n][m]
             var = tk.IntVar(0)
             ttk.Checkbutton(grid_frame, text=disablekeys.key_name[code], variable=var, width=10, command=lambda code=code, var=var: callback(code, var)).grid(row=m, column=n)
     # }        
     
     self._make_window_manager_tab()
示例#4
0
 def __init__(self):
     TkToolWindow.__init__(self)
     
     finder_tab = tk.Frame(self._tool_tabs)
     self._tool_tabs.add(finder_tab, text='Finder')
     
     # Start select group {
     select_group = Group(finder_tab)
     select_group.pack(side='left', fill='y')
     select_group.name = 'Find'
     ttk.Button(select_group, text='Select Directory', 
                command=self._on_select_click).pack(fill='x')
     self.__start_button = start_button = ttk.Button(select_group, 
                text='Start', 
                command=self._on_start_click)
     start_button.pack(fill='y')
     ttk.Button(select_group, text='Stop',
                command=self._on_stop_click).pack(fill='y')
     # } End
                
     self._make_window_manager_tab()
     
     with self.attribute_lock:
         self.replica_finder = ReplicaFinder()
     
     self.__treeview = treeview = ReplicaTreeview(self.tk_object)
     treeview.pack(expand='yes', fill='both')
     self.replica_finder.add_observer(treeview)
     self.replica_finder.add_observer(self)
                
     self.__dirpath = None
示例#5
0
    def __init__(self):
        TkToolWindow.__init__(self)
        
        self._gui_images = []
        
        finder_tab = tk.Frame(self._tool_tabs)
        self._tool_tabs.add(finder_tab, text='Finder')
        
        # Start select group {
        select_group = Group(finder_tab)
        select_group.pack(side='left', fill='y')
        select_group.name = 'Finder'
        
        row = tk.Frame(select_group)
        row.pack()
        
        image_start = ImageTk.PhotoImage(file=os.path.join(_image_dir, 'start_button.png'))
        self._gui_images.append(image_start)
        self.__start_button = start_button = ttk.Button(row, 
                   image=image_start, 
                   command=self._on_start_click)
        start_button.pack(side='left', fill='y')
        
        image_stop = ImageTk.PhotoImage(file=os.path.join(_image_dir, 'stop_button.png'))
        self._gui_images.append(image_stop)
        ttk.Button(row, image=image_stop,
                   command=self._on_stop_click).pack(side='left', fill='y')                   
        # } End
                   
        self._make_window_manager_tab()
        
        with self.attribute_lock:
            self.replica_finder = ReplicaFinder()
            
        self.__dir_indicator = dir_indicator = DirIndicator(self.tk_object)
        dir_indicator.pack(fill='x')
        cwd = os.getcwd()
        if os.path.altsep is not None: # Windows OS
            cwd = cwd.replace(os.path.altsep, os.path.sep)
        dir_indicator.change_dir(cwd)        
        
        self.__treeview = treeview = ReplicaTreeview(self.tk_object)
        treeview.pack(expand='yes', fill='both')
        self.replica_finder.add_observer(treeview)
        self.replica_finder.add_observer(self)  

        # Start Status Bar {
        status_bar = tk.Frame(self.tk_object)
        status_bar.pack(fill='x')
        image_red = ImageTk.PhotoImage(file=os.path.join(_image_dir, 'red_light.png'))    
        self.__image_red_light = image_red
        image_green = ImageTk.PhotoImage(file=os.path.join(_image_dir, 'green_light.png'))
        self.__image_green_light = image_green
        self.__busy_light = ttk.Label(status_bar, image=image_green)
        self.__busy_light.pack(side='right')     
        self.__current_dir_label = ttk.Label(status_bar)
        self.__current_dir_label.pack(side='right')
示例#6
0
    def __init__(self, *args, **kwargs):
        self.__topwin = kwargs.pop('topwin')
        Group.__init__(self, *args, **kwargs)

        # Todo: 3D surface of CAF

        # see http://matplotlib.org/examples/color/colormaps_reference.html
        self.__cmaps = cmaps = {
            'Sequential': [
                'Blues', 'BuGn', 'BuPu', 'GnBu', 'Greens', 'Greys', 'Oranges',
                'OrRd', 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', 'Reds',
                'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd'
            ],
            'Sequential (2)': [
                'afmhot', 'autumn', 'bone', 'cool', 'copper', 'gist_heat',
                'gray', 'hot', 'pink', 'spring', 'summer', 'winter'
            ],
            'Diverging': [
                'BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr', 'RdBu',
                'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral', 'seismic'
            ],
            'Qualitative': [
                'Accent', 'Dark2', 'Paired', 'Pastel1', 'Pastel2', 'Set1',
                'Set2', 'Set3'
            ],
            'Miscellaneous': [
                'gist_earth', 'terrain', 'ocean', 'gist_stern', 'brg',
                'CMRmap', 'cubehelix', 'gnuplot', 'gnuplot2', 'gist_ncar',
                'nipy_spectral', 'jet', 'rainbow', 'gist_rainbow', 'hsv',
                'flag', 'prism'
            ]
        }

        self.__cmapCategoryList = cmapCategoryList = Combobox(
            self, values=cmaps.keys(), takefocus=1, stat='readonly', width=12)
        cmapCategoryList.current(0)
        cmapCategoryList.bind('<<ComboboxSelected>>', self.onCategorySelect)
        cmapCategoryList.pack()

        self.__cmapList = cmapList = Combobox(
            self,
            value=cmaps[cmapCategoryList.get()],
            takefocus=1,
            stat='readonly',
            width=12)
        cmapList.current(0)
        cmapList.pack()

        Button(self, text='Apply', command=self.onApplyClick).pack()

        self.name = 'Color Map'
示例#7
0
 def _make_widgets(self):
     tool_tabs = self.window_node._tool_tabs        
     tab = Frame(tool_tabs)
     
     # Start Info Group {
     info_group = Group(tab)
     info_group.pack(side='left', fill='y')
     info_group.name = 'Info'
     Label(info_group, text=eval_format('ID: {id(self.window_node)}')).pack()
     Button(info_group, text='Copy ID', 
            command=self._on_copy_id_click).pack()
     Button(info_group, text='Copy Path',
            command=self._on_copy_path_click).pack()
     # } End Info Group 
            
     # Start Attributes Group {
     attr_group = Group(tab)
     attr_group.pack(side='left', fill='y')
     attr_group.name = 'Attributes'
     
     self.__topmost = topmost = IntVar(0)
     Checkbutton(attr_group, text='Topmost', 
                 variable=topmost, 
                 command=self._on_topmost_click).pack()
                 
     def on_scale(val):
         self.set_transparency(val)
         
     Scale(attr_group, from_=0.2, to=1.0, orient='horizontal', value=1.0, command=on_scale).pack()
     Label(attr_group, text='Transparency').pack()
         
     # } End Attributes Group
     
     tool_tabs.add(tab, text='Window Manager')
示例#8
0
    def __init__(self, *args, **kwargs):
        self._app = Application.instance
        self.__uiImages = []
        self.__topwin = kwargs.pop('topwin')
        Group.__init__(self, *args, **kwargs)
        frm = Frame(self)
        frm.pack(side=TOP)

        imageMLbl = ImageTk.PhotoImage(file=uiImagePath('Pattern_M_Label.png'))
        self.__uiImages.append(imageMLbl)
        Label(frm, image=imageMLbl).pack(side=LEFT)

        self.__M = ParamItem(frm)
        self.__M.label.config(text='M')
        self.__M.entryWidth = 6
        self.__M.entryText = 10
        self.__M.entry.bind('<Return>', lambda dumb: self.onSolve())
        self.__M.checkFunc = self._app.checkInt
        self.__M.pack(side=RIGHT)

        self._app.balloon.bind_widget(
            frm, balloonmsg='The number of the array elements.')

        imageSolveBtn = ImageTk.PhotoImage(
            file=uiImagePath('Pattern_Solve_Button.png'))
        self.__uiImages.append(imageSolveBtn)

        self.__btnSolve = Button(self,
                                 image=imageSolveBtn,
                                 command=self.onSolve)
        self.__btnSolve.pack(side=TOP)
        self._app.balloon.bind_widget(
            self.__btnSolve,
            balloonmsg='Launch the solver to synthesize the correlation matrix.'
        )

        frm = Frame(self)
        frm.pack(side=TOP)
        imageDisplayBtn = ImageTk.PhotoImage(
            file=uiImagePath('Pattern_Display_Button.png'))
        self.__uiImages.append(imageDisplayBtn)
        Label(frm, image=imageDisplayBtn).pack(side=LEFT)
        self.__bDisplay = IntVar(0)
        chkDisplay = Checkbutton(frm, text="Display", variable=self.__bDisplay)
        chkDisplay.pack(side=TOP)
        self._app.balloon.bind_widget(frm, balloonmsg='Display solver output.')

        self.name = 'Optimize'
示例#9
0
 def __init__(self, *args, **kwargs):
     #self._app = app = Application.instance
     self.__topwin = kwargs.pop('topwin')
     Group.__init__(self, *args, **kwargs)
     Button(self, text='Load *.mat', command=self.onLoadClick).pack()
     paramX = LabeledEntry(self)
     paramX.label_text = 'x = '
     paramX.entry_width = 6
     paramX.pack()
     self.__paramX = paramX
     paramY = LabeledEntry(self)
     paramY.label_text = 'y = '
     paramY.entry_width = 6
     paramY.pack()
     self.__paramY = paramY
     self.name = 'Load'
示例#10
0
 def __init__(self, *args, **kwargs):
     #self._app = app = Application.instance
     self.__topwin = kwargs.pop('topwin')
     Group.__init__(self, *args, **kwargs)
     Button(self, text='Load *.mat', command=self.onLoadClick).pack()
     paramX = ParamItem(self)
     paramX.labelText = 'x = '
     paramX.entryWidth = 6
     paramX.pack()
     self.__paramX = paramX
     paramY = ParamItem(self)
     paramY.labelText = 'y = '
     paramY.entryWidth = 6
     paramY.pack()
     self.__paramY = paramY
     self.name = 'Load'
示例#11
0
    def __init__(self, *args, **kwargs):
        self._app = Application.instance
        self.__uiImages = []
        self.__topwin = kwargs.pop('topwin')
        Group.__init__(self, *args, **kwargs)
        frm = Frame(self)
        frm.pack(side=TOP)
        
        imageMLbl = ImageTk.PhotoImage(
            file=uiImagePath('Pattern_M_Label.png')
        )
        self.__uiImages.append(imageMLbl)
        Label(frm, image=imageMLbl).pack(side=LEFT)
        
        self.__M = ParamItem(frm)
        self.__M.label.config(text='M')
        self.__M.entryWidth = 6
        self.__M.entryText = 10
        self.__M.entry.bind('<Return>', lambda dumb: self.onSolve())
        self.__M.checkFunc = self._app.checkInt
        self.__M.pack(side=RIGHT)
        
        self._app.balloon.bind_widget(frm, balloonmsg='The number of the array elements.')

        imageSolveBtn = ImageTk.PhotoImage(
            file=uiImagePath('Pattern_Solve_Button.png')
        )
        self.__uiImages.append(imageSolveBtn)

        self.__btnSolve = Button(self, image=imageSolveBtn, command=self.onSolve)
        self.__btnSolve.pack(side=TOP)
        self._app.balloon.bind_widget(self.__btnSolve, balloonmsg='Launch the solver to synthesize the correlation matrix.')
        
        frm = Frame(self)
        frm.pack(side=TOP)
        imageDisplayBtn = ImageTk.PhotoImage(
            file=uiImagePath('Pattern_Display_Button.png')
        )
        self.__uiImages.append(imageDisplayBtn)
        Label(frm, image=imageDisplayBtn).pack(side=LEFT)
        self.__bDisplay = IntVar(0)
        chkDisplay = Checkbutton(frm, text="Display", variable=self.__bDisplay)
        chkDisplay.pack(side=TOP)
        self._app.balloon.bind_widget(frm, balloonmsg='Display solver output.')
        
        self.name = 'Optimize'
示例#12
0
    def __init__(self, *args, **kwargs):
        self._app = Scripting.root_node
        self.__gui_images = []
        self.__topwin = kwargs.pop('topwin')
        Group.__init__(self, *args, **kwargs)
        frm = Frame(self)
        frm.pack(side=TOP)
        
        imageMLbl = ImageTk.PhotoImage(
            file=get_gui_image_path('Pattern_M_Label.png')
        )
        self.__gui_images.append(imageMLbl)
        Label(frm, image=imageMLbl).pack(side=LEFT)
        
        self.__M = LabeledEntry(frm)
        self.__M.label.config(text='M')
        self.__M.entry_width = 6
        self.__M.entry_text = 10
        self.__M.entry.bind('<Return>', lambda dumb: self._on_solve_button_click())
        self.__M.checker_function = self._app.check_int
        self.__M.pack(side=RIGHT)
        
        self._app.balloon.bind_widget(frm, balloonmsg='The number of the array elements.')

        imageSolveBtn = ImageTk.PhotoImage(
            file=get_gui_image_path('Pattern_Solve_Button.png')
        )
        self.__gui_images.append(imageSolveBtn)

        self.__btnSolve = Button(self, image=imageSolveBtn, command=self._on_solve_button_click)
        self.__btnSolve.pack(side=TOP)
        self._app.balloon.bind_widget(self.__btnSolve, balloonmsg='Launch the solver to synthesize the correlation matrix.')
        
        frm = Frame(self)
        frm.pack(side=TOP)
        imageDisplayBtn = ImageTk.PhotoImage(
            file=get_gui_image_path('Pattern_Display_Button.png')
        )
        self.__gui_images.append(imageDisplayBtn)
        Label(frm, image=imageDisplayBtn).pack(side=LEFT)
        self.__bDisplay = IntVar(0)
        chkDisplay = Checkbutton(frm, text="Display", variable=self.__bDisplay)
        chkDisplay.pack(side=TOP)
        self._app.balloon.bind_widget(frm, balloonmsg='Display solver output.')
        
        self.name = 'Optimize'
示例#13
0
 def __init__(self):
     TkToolWindow.__init__(self)
     
     driver_tab = tk.Frame(self._tool_tabs)
     self._tool_tabs.add(driver_tab, text='Driver')
     
     # Load Group {
     load_group = Group(driver_tab)
     load_group.pack(side='left', fill='y')
     load_group.name = 'Load'
     
     load_att_button = ttk.Button(load_group, text='Load Att Driver')
     load_att_button.pack(fill='x')
     load_ps_button = ttk.Button(load_group, text='Load PS Driver')
     load_ps_button.pack(fill='x')
     # } End
     
     self._make_window_manager_tab()
     
     iq_slider = IQSlider(self.tk_object, i_range=128, q_range=128, relief='raised')
     iq_slider.pack(expand='yes', fill='both')
示例#14
0
    def __init__(self, *args, **kwargs):
        self.__topwin = kwargs.pop('topwin')
        Group.__init__(self, *args, **kwargs)
        
        # Todo: 3D surface of CAF
        
        # see http://matplotlib.org/examples/color/colormaps_reference.html
        self.__cmaps    = cmaps = {'Sequential':     ['Blues', 'BuGn', 'BuPu',
                                     'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd',
                                     'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu',
                                     'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd'],
                 'Sequential (2)': ['afmhot', 'autumn', 'bone', 'cool', 'copper',
                                     'gist_heat', 'gray', 'hot', 'pink',
                                     'spring', 'summer', 'winter'],
                 'Diverging':      ['BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr',
                                     'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral',
                                     'seismic'],
                 'Qualitative':    ['Accent', 'Dark2', 'Paired', 'Pastel1',
                                     'Pastel2', 'Set1', 'Set2', 'Set3'],
                 'Miscellaneous':  ['gist_earth', 'terrain', 'ocean', 'gist_stern',
                                     'brg', 'CMRmap', 'cubehelix',
                                     'gnuplot', 'gnuplot2', 'gist_ncar',
                                     'nipy_spectral', 'jet', 'rainbow',
                                     'gist_rainbow', 'hsv', 'flag', 'prism']}                

        self.__cmapCategoryList     = cmapCategoryList  = Combobox(self, values=cmaps.keys(), takefocus=1, stat='readonly', width=12)
        cmapCategoryList.current(0)
        cmapCategoryList.bind('<<ComboboxSelected>>', self.onCategorySelect)
        cmapCategoryList.pack()
        
        self.__cmapList             = cmapList          = Combobox(self, value=cmaps[cmapCategoryList.get()], takefocus=1, stat='readonly', width=12)
        cmapList.current(0)
        cmapList.pack()
        
        Button(self, text='Apply', command=self.onApplyClick).pack()

        self.name = 'Color Map'
示例#15
0
    def __init__(self, *args, **kwargs):
        self._app = Application.instance
        self.__topwin = kwargs.pop('topwin')
        Group.__init__(self, *args, **kwargs)

        frm = Frame(self)
        self.__uiImages = []
        imageMatFileBtn = ImageTk.PhotoImage(
            file=uiImagePath('Pattern_SaveMat_Button.png'))
        self.__uiImages.append(imageMatFileBtn)
        Button(frm, image=imageMatFileBtn,
               command=self.onSaveMat).pack(side=TOP)
        Button(frm, text='mat', width=6).pack(side=TOP)
        frm.pack(side=LEFT)

        frm = Frame(self)
        imageExcelFileBtn = ImageTk.PhotoImage(
            file=uiImagePath('Pattern_SaveExcel_Button.png'))
        self.__uiImages.append(imageExcelFileBtn)
        Button(frm, image=imageExcelFileBtn).pack(side=TOP)
        Button(frm, text='xlsx', width=6).pack(side=TOP)
        frm.pack(side=LEFT)

        self.name = 'Corr Matrix'
示例#16
0
    def __init__(self, *args, **kwargs):
        self._app = Application.instance
        self.__topwin = kwargs.pop('topwin')
        Group.__init__(self, *args, **kwargs)
        frm = Frame(self)

        self.__center = ParamItem(frm)
        setMultiAttr(self.__center,
                     labelText='center(deg)',
                     entryText=0,
                     checkFunc=self._app.checkInt,
                     entryWidth=5,
                     labelWidth=10)
        self.__center.pack(side=TOP)
        self._app.balloon.bind_widget(
            self.__center, balloonmsg='Specify the beam center here.')

        self.__width = ParamItem(frm)
        setMultiAttr(self.__width,
                     labelText='width(deg)',
                     entryText=20,
                     checkFunc=self._app.checkInt,
                     entryWidth=5,
                     labelWidth=10)
        self.__width.pack(side=TOP)
        self._app.balloon.bind_widget(
            self.__width, balloonmsg='Specify the beam width here.')

        self.__uiImages = []

        imageAddBtn = ImageTk.PhotoImage(
            file=uiImagePath('Pattern_Add_Button.png'))
        self.__uiImages.append(imageAddBtn)
        btn = Button(frm, image=imageAddBtn, command=self.onAdd)
        btn.pack(side=LEFT)
        self._app.balloon.bind_widget(
            btn, balloonmsg='Add new beam to the ideal pattern.')

        imageDelBtn = ImageTk.PhotoImage(
            file=uiImagePath('Pattern_Del_Button.png'))
        self.__uiImages.append(imageDelBtn)
        btn = Button(frm, image=imageDelBtn, command=self.onDel)
        btn.pack(side=LEFT)
        self._app.balloon.bind_widget(
            btn, balloonmsg='Remove the selected beam in the listbox.')

        imageClrBtn = ImageTk.PhotoImage(
            file=uiImagePath('Pattern_Clear_Button.png'))
        self.__uiImages.append(imageClrBtn)
        btn = Button(frm, image=imageClrBtn, command=self.onClear)
        btn.pack(side=LEFT)
        self._app.balloon.bind_widget(
            btn, balloonmsg='Clear the listbox of the beam parameters.')

        imagePlotBtn = ImageTk.PhotoImage(
            file=uiImagePath('Pattern_Plot_Button.png'))
        self.__uiImages.append(imagePlotBtn)
        btn = Button(frm, image=imagePlotBtn, command=self.onPlotIdealPattern)
        btn.pack(side=LEFT)
        self._app.balloon.bind_widget(btn,
                                      balloonmsg='Plot the ideal pattern.')

        frm.pack(side=LEFT, fill=Y)

        self.__paramlist = ScrolledList(self)
        self.__paramlist.list.config(height=4, width=10)
        self.__paramlist.pack(side=LEFT)
        self.name = 'Edit Ideal Pattern'

        self.optgrp = None
示例#17
0
 def __init__(self, *args, **kwargs):
     self._app = Application.instance
     self.__topwin = kwargs.pop('topwin')
     Group.__init__(self, *args, **kwargs)
     frm = Frame(self)
     
     self.__center = ParamItem(frm)
     setMultiAttr(self.__center,        
         labelText   = 'center(deg)',        
         entryText   = 0,    
         checkFunc   = self._app.checkInt,
         entryWidth  = 5,    
         labelWidth  = 10
     )                       
     self.__center.pack(side=TOP)        
     self._app.balloon.bind_widget(self.__center, balloonmsg='Specify the beam center here.')
     
     self.__width = ParamItem(frm)
     setMultiAttr(self.__width,
         labelText   = 'width(deg)',
         entryText   = 20,
         checkFunc   = self._app.checkInt,
         entryWidth  = 5,
         labelWidth  = 10
     )
     self.__width.pack(side=TOP)
     self._app.balloon.bind_widget(self.__width, balloonmsg='Specify the beam width here.')
     
     self.__uiImages = []
             
             
     imageAddBtn = ImageTk.PhotoImage(
         file=uiImagePath('Pattern_Add_Button.png')
     )
     self.__uiImages.append(imageAddBtn)
     btn = Button(frm, image=imageAddBtn, command=self.onAdd)
     btn.pack(side=LEFT)
     self._app.balloon.bind_widget(btn, balloonmsg='Add new beam to the ideal pattern.')
     
     imageDelBtn = ImageTk.PhotoImage(
         file=uiImagePath('Pattern_Del_Button.png')
     )
     self.__uiImages.append(imageDelBtn)
     btn = Button(frm, image=imageDelBtn, command=self.onDel)
     btn.pack(side=LEFT)
     self._app.balloon.bind_widget(btn, balloonmsg='Remove the selected beam in the listbox.')
     
     imageClrBtn = ImageTk.PhotoImage(
         file=uiImagePath('Pattern_Clear_Button.png')
     )
     self.__uiImages.append(imageClrBtn)
     btn = Button(frm, image=imageClrBtn, command=self.onClear)
     btn.pack(side=LEFT)
     self._app.balloon.bind_widget(btn, balloonmsg='Clear the listbox of the beam parameters.')
     
     imagePlotBtn = ImageTk.PhotoImage(
         file=uiImagePath('Pattern_Plot_Button.png')
     )
     self.__uiImages.append(imagePlotBtn)
     btn = Button(frm, image=imagePlotBtn, command=self.onPlotIdealPattern)
     btn.pack(side=LEFT)
     self._app.balloon.bind_widget(btn, balloonmsg='Plot the ideal pattern.')
     
     frm.pack(side=LEFT, fill=Y)
     
     self.__paramlist = ScrolledList(self)
     self.__paramlist.list.config(height=4, width=10)
     self.__paramlist.pack(side=LEFT)
     self.name = 'Edit Ideal Pattern'
     
     self.optgrp = None
示例#18
0
 def __init__(self, *args, **kwargs):
     self._app = Scripting.root_node
     self.__topwin = kwargs.pop('topwin')
     Group.__init__(self, *args, **kwargs)
     frm = Frame(self)
     
     self.__center = LabeledEntry(frm)
     set_attributes(self.__center,        
         label_text   = 'center(deg)',        
         entry_text   = 0,    
         checker_function   = self._app.check_int,
         entry_width  = 5,    
         label_width  = 10
     )                       
     self.__center.pack(side=TOP)        
     self._app.balloon.bind_widget(self.__center, balloonmsg='Specify the beam center here.')
     
     self.__width = LabeledEntry(frm)
     set_attributes(self.__width,
         label_text   = 'width(deg)',
         entry_text   = 20,
         checker_function   = self._app.check_int,
         entry_width  = 5,
         label_width  = 10
     )
     self.__width.pack(side=TOP)
     self._app.balloon.bind_widget(self.__width, balloonmsg='Specify the beam width here.')
     
     self.__gui_images = []
             
             
     imageAddBtn = ImageTk.PhotoImage(
         file=get_gui_image_path('Pattern_Add_Button.png')
     )
     self.__gui_images.append(imageAddBtn)
     btn = Button(frm, image=imageAddBtn, command=self._on_add_button_click)
     btn.pack(side=LEFT)
     self._app.balloon.bind_widget(btn, balloonmsg='Add new beam to the ideal pattern.')
     
     imageDelBtn = ImageTk.PhotoImage(
         file=get_gui_image_path('Pattern_Del_Button.png')
     )
     self.__gui_images.append(imageDelBtn)
     btn = Button(frm, image=imageDelBtn, command=self._on_delete_button_click)
     btn.pack(side=LEFT)
     self._app.balloon.bind_widget(btn, balloonmsg='Remove the selected beam in the listbox.')
     
     imageClrBtn = ImageTk.PhotoImage(
         file=get_gui_image_path('Pattern_Clear_Button.png')
     )
     self.__gui_images.append(imageClrBtn)
     btn = Button(frm, image=imageClrBtn, command=self._on_clear_button_click)
     btn.pack(side=LEFT)
     self._app.balloon.bind_widget(btn, balloonmsg='Clear the listbox of the beam parameters.')
     
     imagePlotBtn = ImageTk.PhotoImage(
         file=get_gui_image_path('Pattern_Plot_Button.png')
     )
     self.__gui_images.append(imagePlotBtn)
     btn = Button(frm, image=imagePlotBtn, command=self._on_plot_ideal_pattern)
     btn.pack(side=LEFT)
     self._app.balloon.bind_widget(btn, balloonmsg='Plot the ideal pattern.')
     
     frm.pack(side=LEFT, fill=Y)
     
     self.__paramlist = ScrolledList(self)
     self.__paramlist.list.config(height=4, width=10)
     self.__paramlist.pack(side=LEFT)
     self.name = 'Edit Ideal Pattern'
     
     self.optgrp = None
示例#19
0
 def __init__(self, *args, **kwargs):
     TkToolWindow.__init__(self, *args, **kwargs)
     Observable.__init__(self)
     
     self.__serialmap = None
     
     # Temporarily
     self.inst = Inst()
     # End Temporarily
     
     #window = self.tk_object
     tooltab = Frame(self._tool_tabs)
     self._tool_tabs.add(tooltab, text='SPI')
     #tooltab.pack(expand='yes', fill='x')        
     
 # Group OPEN 
     open_group = Group(tooltab)
     open_group.name = 'Open Device'
     open_group.pack(side='left', fill='y', expand='yes')
     
     self.__dev_combo = dev_combo = Combobox(open_group, value=[], takefocus=1, stat='readonly', width=12)
     dev_combo.bind('<<ComboboxSelected>>', self._on_dev_change)
     self.__current_serialno = None
     dev_combo.pack(side='top')
     
     self.__is_opened = IntVar(0)
     self.__open_check = open_check = Checkbutton(open_group, text='Open', 
         variable=self.__is_opened,
         command=self._on_open_click)
     open_check.pack(expand='yes', fill='y', side='top')
 # End Group Open
     
 # Group Parameters
     param_group = Group(tooltab)
     param_group.name = 'Parameters'
     param_group.pack(side='left')
     Button(param_group, text='Configure', command=self._on_param_change).pack(side='bottom')        
     
     param_frame = Frame(param_group)
     param_frame.pack()
     
     self.__CPOL = CPOL = IntVar(0)
     self.__CPHA = CPHA = IntVar(0)
     Checkbutton(param_frame, text='CPOL', variable=CPOL).grid(row=0, column=0)
     Checkbutton(param_frame, text='CPHA', variable=CPHA).grid(row=1, column=0)
     
     self.__baud_combo = baud_combo = Combobox(param_frame, value=[], takefocus=1, stat='readonly', width=8)
     baud_combo.grid(row=0, column=1, columnspan=2)
     
     self.__read_timeout_str = r_timeout = StringVar()
     self.__write_timeout_str = w_timeout = StringVar()
     Entry(param_frame, textvariable=r_timeout, width=5).grid(row=1, column=1)
     Entry(param_frame, textvariable=w_timeout, width=5).grid(row=1, column=2)
 # End Group Parameters
     
 # Write Group
     write_group = Group(tooltab)
     write_group.name = 'Write'
     write_group.pack(side='left', fill='y', expand='yes')
     
     self.__writebuf = writebuf = StringVar()
     Entry(write_group, textvariable=writebuf).pack()
     Button(write_group, text='Write', command=self._on_write_click).pack()
 # End Write Group
     
     self._make_window_manager_tab()
     
     # To Do: a driver group for loading specified spi bus driver
     converter = USBSPIConverter()
     converter.add_observer(self)
     self.add_observer(converter)