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')
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()
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
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')
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')
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)