Exemple #1
0
    def __init__(self, master, appWidth, appHeight):
        self.master = master
        geo = "%dx%d" % (appWidth, appHeight)
        master.geometry(geo)
        master.title("Smacket")
        self.videoPath = ""

        bcg = "#0A8049"
        topLeft = PanedWindow(master, orient=tk.VERTICAL)
        topLeft.config(bg = bcg)
        topLeft.grid(row = 0, column = 0)
        topLeftTitle = tk.Message(master, text = "Timestamps")
        topLeftTitle.config(anchor = "center", aspect = 500, font = ("consolas", 20, "bold"), bg = bcg, relief = "sunken")
        timeStamps = TextScrollCombo(master)
        timeStamps.config(width=appWidth // 10, height= appHeight // 2)
        timeStamps.txt.config(font=("consolas", 12), undo=True, wrap='word', borderwidth=3, relief="sunken")
        topLeft.add(topLeftTitle)
        topLeft.add(timeStamps)

        bottomLeft = PanedWindow(master, orient=tk.VERTICAL)
        bottomLeft.config(bg = bcg)
        bottomLeft.grid(row = 1, column = 0)
        bottomLeftTitle = tk.Message(master, text = "Matches")
        bottomLeftTitle.config(anchor = "center", aspect = 500, font = ("consolas", 20, "bold"), bg = bcg, relief = "sunken")
        matches = TextScrollCombo(master)
        matches.config(width= appWidth// 10 , height=appHeight // 2)
        matches.txt.config(font=("consolas", 12), undo=True, wrap='word', borderwidth=3, relief="sunken")
        bottomLeft.add(bottomLeftTitle)
        bottomLeft.add(matches)

        videoPlayer = Label(master, 
                            height = 20,
                            width = appWidth - (appWidth // 10),
                            bg = 'red',
                            text = "VideoPlayer",)
        videoPlayer.grid(row=0, column=1)

        videoSkimmer = Label(master, 
                            height = 20,
                            width = appWidth - (appWidth // 10),
                            bg = 'yellow',
                            text = "VideoSkimmer",)
        videoSkimmer.grid(row=1, column=1)
    def __init__(self, *args, **kwargs):
        '''
node_name:   The name of this node. Usually set by ModelNode.__setattr__ automatically.
figure_meta: Meta information of figure.
The rest parameters are passed to PanedWindow.__init__.
'''
        node_name = kwargs.pop('node_name', '')
        super().__init__(node_name=node_name)

        self.__selected_curve = (None, None)

        figure_meta = None if 'figure_meta' not in kwargs \
            else kwargs.pop('figure_meta')
        kwargs['orient'] = 'horizontal'

        paned_window = PanedWindow(*args, **kwargs)

        paned_window.config(sashwidth=4, sashrelief='groove', bg='forestgreen')

        #        figureTabsStyle = Style()
        #        figureTabsStyle.configure('Figure.TNotebook', tabposition='sw')
        #        figureTabs    = Notebook(paned_window, style='Figure.TNotebook')
        figureTabs = Notebook(paned_window)

        self.figureTabs = figureTabs
        figureTabs.bind('<<NotebookTabChanged>>', self._on_tab_change)
        self.lock_attribute('figureTabs')

        if figure_meta:
            self.make_figures(figure_meta)

        self.lock_elements()

        paned_window.add(figureTabs, stretch='always')

        listPan = PanedWindow(paned_window, orient='vertical')
        listPan.config(sashwidth=4, sashrelief='groove', bg='forestgreen')
        paned_window.add(listPan, stretch='never')

        listFrm = Frame(listPan)
        listPan.add(listFrm, stretch='always')
        Label(listFrm, text='Curves', bg='#b5d6b0').pack(side='top', fill='x')
        self.__list = ScrolledList(listFrm, relief='groove')
        self.__list.list_config(width=20)
        self.__list.list_click_callback = self._on_list_click
        self.__list.pack(fill='both', expand='yes')

        listFrm = Frame(listPan)
        listPan.add(listFrm, stretch='never')
        Label(listFrm, text='Indicators', bg='#b5d6b0').pack(side='top',
                                                             fill='x')
        self.__indicator_listbox = ScrolledList(listFrm, relief='groove')
        self.__indicator_listbox.list_config(width=20)
        self.__indicator_listbox.pack(fill='both', expand='yes')

        with self.attribute_lock:
            set_attributes(
                self,
                paned_window=paned_window,
                grid_group_observer=self.GridGroupObserver(self),
                axis_group_observer=self.AxisGroupObserver(self),
                clear_group_observer=self.ClearGroupObserver(self),
                label_group_observer=self.LabelGroupObserver(self),
                indicator_group_observer=self.IndicatorGroupObserver(self),
                data_figure_observer=self.DataFigureObserver(self),
                data_pool=[])
Exemple #3
0
    def __init__(self, controller):
        ttk.Frame.__init__(self)
        self.controller = controller
        self.window = self._nametowidget(self.winfo_parent())
        self.window.bind("<Escape>", self.exit)
        self.window.title("LyfePixel")
        self.window.protocol("WM_DELETE_WINDOW", self.exit)

        self.controller.configure_toplevel(self.window)
        self.window.overrideredirect(0)
        self.place(relwidth=1, relheight=1)
        self.state = TOOLCONST.DRAW
        self.window.resizable(True, True)
        self.project = PixelProject(8, 8)
        self.pallet = self.project.selected_frame.selected_layer
        self.pallet.selection = [
            f"{self.pallet.width - 1}x{self.pallet.height - 1}"
        ]
        self.alpha = 255

        menubar = Menu(self.window)
        menubar.add_command(label="New", command=self.open_start_window)
        menubar.add_separator()
        menubar.add_command(label="Help",
                            command=lambda: HelpWindow(self.controller))
        menubar.add_separator()
        # display the menu
        self.window.config(menu=menubar)

        panes = PanedWindow(self,
                            orient="vertical",
                            sashpad=3,
                            sashrelief="sunken")
        panes.pack(fill="both", expand=True)
        panes.config(borderwidth=0)

        canvas_frame = Frame(panes)
        canvas_frame.pack(fill="both", expand=True, side="top", anchor="n")
        panes.add(canvas_frame)
        panes.paneconfigure(canvas_frame, height=150)
        self.pallet_box = LyfeCanvas(self.project, canvas_frame)
        force_aspect(self.pallet_box, canvas_frame, 1.0)
        colors = get_gradient(8)
        colors.extend(get_rainbow(56))
        for id in self.pallet_box.itterate_canvas():
            self.pallet.set_pixel_color(id, hex_to_rgba(colors.pop()))
        self.pallet_box.bind_left(self.select_color)
        self.pallet_box.bind_double_left(self.change_color)
        self.pallet_box.bind("<Configure>", self.on_configure)
        self.pallet_box.configure()

        outer_frame = Frame(panes)
        outer_frame.pack(fill="both", expand=True, padx=4)
        panes.add(outer_frame)
        panes.paneconfigure(outer_frame, height=250)

        color_label_frame = Frame(outer_frame)
        self.color_label_text_var = StringVar()
        self.color_label_text_var.set(ToolController.get_color())
        color_label = Label(color_label_frame,
                            textvariable=self.color_label_text_var)
        color_label.pack(side="bottom", fill="x", expand=True)
        color_label_frame.pack(fill="x", expand=True)

        self.alpha_scale = Scale(outer_frame,
                                 orient="horizontal",
                                 from_=0,
                                 to=255,
                                 command=self.set_alpha)
        self.alpha_scale.set(self.alpha)
        self.alpha_scale.pack(fill="x", expand=True, pady=2)

        div_1 = ttk.Separator(outer_frame)
        div_1.pack(fill="x", expand=True, pady=2)

        self.toolbox = ToolBox(outer_frame)
        self.toolbox.pack(fill="both", expand=True, pady=2)

        self.grip = ttk.Sizegrip(self)
        self.grip.place(relx=1.0, rely=1.0, anchor="se")
        self.grip.bind("<ButtonPress-1>", self.on_press)
        self.grip.bind("<B1-Motion>", self.on_resize)
        self.grip.bind("<ButtonRelease-1>", self.on_release)

        self.clipboard_box = ClipBoardBox(self.controller, panes)
        self.clipboard_box.pack(fill="both", expand=True)
        panes.add(self.clipboard_box)

        self.window.minsize(250, 400)
        self.window.geometry(f"250x720")
        self.pallet_box.after_idle(self.refresh)

        color = self.pallet.array[self.pallet.width - 1][self.pallet.height -
                                                         1]
        ToolController.set_color(color)
        self.alpha = color[3]
        self.alpha_scale.set(self.alpha)
        self.pallet.start_selection = id
        self.pallet.end_selection = id
        self.update()
	def __init__(self, controller, width, height, *args, **kwargs):
		BaseWindow.__init__(self, controller, *args, **kwargs)
		self.controller = controller
		self.controller.configure_toplevel(self)
		self.resizable(True, True)
		self.attributes('-topmost', False) #Remove the toplevel priority
		self.set_exit_function(self.exit)
		self.set_title("Canvas")
		self.file = None
		self.width = int(width)
		self.height = int(height)
		self.geometry(f"{WIDTH}x{HEIGHT}")
		self.bind("<Escape>", self.exit)
		self.top_bar.pack(side = "top", fill = "x", pady = (2,0))
		self.magnifying_glass_image = load_tk_image_from_bytes_array(magnifying_glass_bytes)
		self.floppy_image = load_tk_image_from_bytes_array(floppy_bytes)
		self.bytes_image=  load_tk_image_from_bytes_array(export_to_bytes_bytes)
		self.horizontal_flip_image =  load_tk_image_from_bytes_array(flip_horizontal_bytes)
		self.vertical_flip_image = load_tk_image_from_bytes_array(flip_vertical_bytes)
		self.rotate_left_image = load_tk_image_from_bytes_array(rotate_left_bytes)
		self.rotate_right_image = load_tk_image_from_bytes_array(rotate_right_bytes)
		self.to_grayscale_image = load_tk_image_from_bytes_array(to_grayscale_bytes)
		self.selection_options_image = load_tk_image_from_bytes_array(selection_options_bytes)
		self.layers_symbol_image = load_tk_image_from_bytes_array(layers_symbol_bytes)
		self.folder_options_symbol = load_tk_image_from_bytes_array(folder_options_symbol_bytes)
		self.effects_wand_symbol = load_tk_image_from_bytes_array(effects_wand_symbol_bytes)
		self.copy_options_symbol = load_tk_image_from_bytes_array(copy_options_symbol_bytes)
		self.undo_symbol = load_tk_image_from_bytes_array(undo_symbol_bytes)
		self.redo_symbol = load_tk_image_from_bytes_array(redo_symbol_bytes)

		self.drawtips_references = []
		self.project = PixelProject(self.width, self.height)

		panes = PanedWindow(self, orient = "horizontal", sashpad=3, sashrelief ="sunken")
		panes.pack(fill = "both", expand = True)
		panes.config(borderwidth = 0)

		self.left_side_frame = Frame(panes)
		self.left_side_frame.pack(fill = "both", expand = False, side = "left")
		panes.add(self.left_side_frame)

		tool_buttons = []
		self.gif_tool_bar = ToolBar(tool_buttons, self.left_side_frame)
		self.gif_tool_bar.pack(side = "top", fill = "x", pady = (0,2))

		save_options_button = Label(self.gif_tool_bar, image = self.floppy_image, font = "bold")
		save_options_button.pack(side = "left")
		save_menu = Menu(self, tearoff=0)
		save_menu.add_command(label="Export Gif", command=self.export_gif)
		save_menu.add_command(label="Export Selected Frame", command=self.export_selected_layer)
		save_menu.add_command(label="Export Selected Layer", command=self.export_selected_frame)
		# gif_menu.add_command(label="Export Project as Zip", command=self.export_zip)
		# gif_menu.add_command(label="Export Project as .lpixel", command=self.flip_selection_horizontal)
		# gif_menu.add_command(label="Load Folder as Layers in Current Frame", command=self.load_folder_as_layers)
		bind_popup("<Button-1>", save_options_button, save_menu)

		load_options_button = Label(self.gif_tool_bar, image = self.folder_options_symbol, font = "bold")
		load_options_button.pack(side = "left")
		load_options_menu = Menu(self, tearoff=0)
		load_options_menu.add_command(label="Import Gif as Frames", command=self.import_gif)
		load_options_menu.add_command(label="Load Folder as Frames", command=self.load_folder_as_frames)
		load_options_menu.add_command(label="Load Folder as Layers in Selected Frame", command=self.load_folder_as_layers)
		bind_popup("<Button-1>", load_options_button, load_options_menu)

		preview_options_button = Label(self.gif_tool_bar, image = self.magnifying_glass_image, font = "bold")
		preview_options_button.pack(side = "left")
		preview_options_menu = Menu(self, tearoff=0)
		preview_options_menu.add_command(label="Inspect Selected Frame", command=self.inspect_frame)
		preview_options_menu.add_command(label="Inspect Selected Layer", command=self.inspect_layer)
		bind_popup("<Button-1>", preview_options_button, preview_options_menu)

		panes2 = PanedWindow(self.left_side_frame, orient = "vertical", sashpad=3, sashrelief ="sunken")
		panes2.pack(fill = "both", expand = True, padx = 4, pady = (0,4))
		panes2.config(borderwidth = 0)

		self.gif_view = LayerViewer(self.project, self.width, self.height, panes2)
		self.gif_view.pack(fill = "both", expand = True)
		panes2.add(self.gif_view)
		
		self.frame_manager = LayerManager(self, self.project, panes2)
		self.frame_manager.pack(side = "left", fill = "both", expand = True, pady = 0)
		panes2.add(self.frame_manager)

		self.right_side_frame = Frame(panes)
		self.right_side_frame.pack(fill = "both", expand = True, side = "right")
		panes.add(self.right_side_frame)

		tool_buttons = [
			(self.vertical_flip_image, self.flip_vertical),
			(self.horizontal_flip_image, self.flip_horizontal),
			(self.rotate_left_image, self.rotate_left),
			(self.rotate_right_image, self.rotate_right),
		]
		self.tool_bar = ToolBar(tool_buttons, self.right_side_frame)
		self.tool_bar.pack(side = "top", fill = "x")


		layer_menu = Menu(self, tearoff = 0)
		layer_menu.add_command(label = "Rename Current Layer", command = self.rename_selected_layer)
		layer_menu.add_command(label = "Export Current Layer", command = self.save)
		layer_menu.add_command(label = "Export Current Layer as Bytes (Console)", command = self.export_selected_layer_as_bytes)
		layer_menu.add_command(label = "Delete Current Layer", command = self.delete_selected_layer)
		layer_menu.add_command(label = "Duplicate Current Layer", command = self.copy_selected_layer)
		layer_menu.add_command(label = "Promote Current Layer", command = self.promote_selected_layer)
		layer_menu.add_command(label = "Demote Current Layer", command = self.demote_selected_layer)
		layer_menu.add_command(label = "Merge Layer Down", command = self.merge_selected_layer_down)
		layer_menu.add_separator()
		layer_menu.add_command(label = "Rename Current Frame", command = self.rename_selected_frame)
		layer_menu.add_command(label = "Export Current Frame", command = self.save_selected_frame)
		layer_menu.add_command(label = "Export Current Frame as Bytes (Console)", command = self.export_selected_frame_as_bytes)
		layer_menu.add_command(label = "Delete Current Frame", command = self.delete_selected_frame)
		layer_menu.add_command(label = "Duplicate Current Frame", command = self.copy_selected_frame)
		layer_menu.add_command(label = "Promote Current Frame", command = self.promote_selected_frame)
		layer_menu.add_command(label = "Demote Current Frame", command = self.demote_selected_frame)
		layer_menu.add_command(label = "New Layer in Current Frame", command = self.new_layer_in_selected_frame)
		layer_menu.add_command(label = "New Layer from Image in Current Frame", command = self.new_layer_from_image_in_selected_frame)
		self.layer_options_menu_button = Label(self.tool_bar, image = self.layers_symbol_image, font = "bold")
		self.layer_options_menu_button.pack(side = "left")
		bind_popup("<Button-1>", self.layer_options_menu_button, layer_menu)

		selection_menu = Menu(self, tearoff=0)
		selection_menu.add_command(label = "Flood Fill Selection", command = self.fill_selection)
		selection_menu.add_command(label = "Flip Selection Vertical", command = self.flip_selection_vertical)
		selection_menu.add_command(label = "Flip Selection Horizontal", command = self.flip_selection_horizontal)
		selection_menu.add_command(label = "Rotate Selection Right", command = self.rotate_selection_right)
		selection_menu.add_command(label = "Rotate Selection Left", command = self.rotate_seletion_left)
		selection_menu.add_command(label = "Export Selection", command = self.export_selection)
		selection_menu.add_command(label = "Export Selection as Bytes (Console)", command = self.export_selection_as_bytes)
		selection_menu.add_separator()
		selection_menu.add_command(label = "Copy Selection to Clipboard", command = self.copy_selection_to_clipboard)
		selection_menu.add_command(label = "New Layer from Selection", command = self.new_layer_image_from_selection)
		selection_menu.add_separator()
		selection_menu.add_command(label = "Apply Blur Filter to Selection", command = self.effect_blur_selection)
		selection_menu.add_command(label = "Apply Contour Filter to Selection", command = self.effect_contour_selection)
		selection_menu.add_command(label = "Apply Detail Filter to Selection", command = self.effect_detail_selection)
		selection_menu.add_command(label = "Apply Edge Enhance Filter to Selection", command = self.effect_edge_enhance_selection)
		selection_menu.add_command(label = "Apply Edge Enhance More Filter to Selection", command = self.effect_edge_enhance_more_selection)
		selection_menu.add_command(label = "Apply Emboss Filter to Selection", command = self.effect_emboss_selection)
		selection_menu.add_command(label = "Apply Find Edges Filter to Selection", command = self.effect_find_edges_selection)
		selection_menu.add_command(label = "Apply Sharpen Filter to Selection", command = self.effect_sharpen_selection)
		selection_menu.add_command(label = "Apply Smooth Filter to Selection", command = self.effect_smooth_selection)
		selection_menu.add_command(label = "Apply Smooth More Filter to Selection", command = self.effect_smooth_more_selection)
		selection_menu.add_command(label = "Apply Gaussian Filter to Selection", command = self.effect_gaussian_selection)
		selection_menu.add_command(label = "Apply Box Blur Filter to Selection", command = self.effect_box_blur_selection)
		selection_menu.add_command(label = "Apply Median Filter to Selection", command = self.effect_median_filter_selection)
		selection_menu.add_command(label = "Apply Min Filter to Selection", command = self.effect_min_filter_selection)
		selection_menu.add_command(label = "Apply Max Filter to Selection", command = self.effect_max_filter_selection)
		selection_menu.add_command(label = "Apply Mode Filter to Selection", command = self.effect_mode_filter_selection)
		self.selections_options_menu_button = Label(self.tool_bar, image = self.selection_options_image, font = "bold")
		self.selections_options_menu_button.pack(side = "left")
		bind_popup("<Button-1>", self.selections_options_menu_button, selection_menu)

		effects_menu = Menu(self, tearoff=0)
		effects_menu.add_command(label = "Apply Blur Filter", command = self.effect_blur_layer)
		effects_menu.add_command(label = "Apply Contour Filter", command = self.effect_contour_layer)
		effects_menu.add_command(label = "Apply Detail Filter", command = self.effect_detail_layer)
		effects_menu.add_command(label = "Apply Edge Enhance Filter", command = self.effect_edge_enhance_layer)
		effects_menu.add_command(label = "Apply Edge Enhance More Filter", command = self.effect_edge_enhance_more_layer)
		effects_menu.add_command(label = "Apply Emboss Filter", command = self.effect_emboss_layer)
		effects_menu.add_command(label = "Apply Find Edges Filter", command = self.effect_find_edges_layer)
		effects_menu.add_command(label = "Apply Sharpen Filter", command = self.effect_sharpen_layer)
		effects_menu.add_command(label = "Apply Smooth Filter", command = self.effect_smooth_layer)
		effects_menu.add_command(label = "Apply Smooth More Filter", command = self.effect_smooth_more_layer)
		effects_menu.add_command(label = "Apply Gaussian Filter", command = self.effect_gaussian_layer)
		effects_menu.add_command(label = "Apply Box Blur Filter", command = self.effect_box_blur_layer)
		effects_menu.add_command(label = "Apply Median Filter", command = self.effect_median_filter_layer)
		effects_menu.add_command(label = "Apply Min Filter", command = self.effect_min_filter_layer)
		effects_menu.add_command(label = "Apply Max Filter", command = self.effect_max_filter_layer)
		effects_menu.add_command(label = "Apply Mode Filter", command = self.effect_mode_filter_layer)
		self.effects_options_menu_button = Label(self.tool_bar, image = self.effects_wand_symbol, font = "bold")
		self.effects_options_menu_button.pack(side = "left")
		bind_popup("<Button-1>", self.effects_options_menu_button, effects_menu)

		copy_options_menu = Menu(self, tearoff=0)
		copy_options_menu.add_command(label = "Copy Current Layer to Clipboard", command = self.copy_selected_layer_to_clipboard)
		copy_options_menu.add_command(label = "Copy Current Frame to Clipboard", command = self.copy_selected_frame_to_clipboard)
		copy_options_menu.add_command(label = "Copy Selection to Clipboard", command = self.copy_selection_to_clipboard)
		copy_options_menu.add_separator()
		copy_options_menu.add_command(label = "Paste As New Layer in Current Frame", command = self.paste_as_new_layer_in_current_frame)
		copy_options_menu.add_command(label = "Paste As New Layer in New Frame", command = self.paste_as_new_layer_in_new_frame)
		copy_options_button = Label(self.tool_bar, image = self.copy_options_symbol, font = "bold")
		copy_options_button.pack(side = "left")
		bind_popup("<Button-1>", copy_options_button, copy_options_menu)

		undo_button =  Label(self.tool_bar, image = self.undo_symbol)
		undo_button.pack(side = "left")
		undo_button.bind("<Button-1>", self.undo)

		redo_button =  Label(self.tool_bar, image = self.redo_symbol)
		redo_button.pack(side = "left")
		redo_button.bind("<Button-1>", self.redo)

		self.canvas_frame = ttk.LabelFrame(self.right_side_frame, text = "")
		self.canvas_frame.pack(fill = "both", expand = True, anchor = "n", padx = 3)
		inner_frame = Frame(self.canvas_frame)
		inner_frame.pack(fill = "both", expand = True, side = "top", anchor = "n", padx = 4, pady = 4)
		self.canvas = LyfeCanvas(self.project, inner_frame)
		force_aspect(self.canvas, inner_frame, float(self.width)/float(self.height))

		self.footer = Frame(self.right_side_frame)
		self.footer.pack(side = "bottom", fill = "x", expand = False, padx = 3)
		self.footer_var = StringVar()
		self.footer_label = Label(self.footer, textvariable = self.footer_var)
		self.footer_label.pack(side = "left", expand = False, fill = "x")

		self.grip = ttk.Sizegrip(self)
		self.grip.place(relx=1.0, rely=1.0, anchor="se")
		self.grip.bind("<ButtonPress-1>", self.on_press)
		self.grip.bind("<B1-Motion>", self.on_resize)
		self.grip.bind("<ButtonRelease-1>", self.on_release)

		self.canvas.bind_middle(self.eyedrop)
		self.canvas.bind_movement(self.on_mouse_move)
		self.canvas.canvas.bind("<ButtonPress-1>", self.on_canvas_click)
		self.canvas.canvas.bind("<B1-Motion>", self.on_canvas_drag)
		self.canvas.canvas.bind("<ButtonRelease-1>", self.on_canvas_release)
		self.canvas.canvas.bind("<ButtonPress-3>", self.on_erase_start)
		self.canvas.bind_right_drag(self.on_erase)
		self.canvas.canvas.bind("<ButtonRelease-3>", self.on_erase_end)

		self.canvas.after_idle(self.refresh)
Exemple #5
0
    def __init__(self, *args, **kwargs):
        '''
node_name:   The name of this node. Usually set by ModelNode.__setattr__ automatically.
figure_meta: Meta information of figure.
The rest parameters are passed to PanedWindow.__init__.
'''
        node_name    = kwargs.pop('node_name', '')
        super().__init__(node_name=node_name)

        figure_meta = None if 'figure_meta' not in kwargs \
            else kwargs.pop('figure_meta')
        kwargs['orient'] = 'horizontal'
        
        paned_window = PanedWindow(*args, **kwargs)

        paned_window.config(sashwidth=4, sashrelief='groove', bg='forestgreen')        
       
#        figureTabsStyle = Style()
#        figureTabsStyle.configure('Figure.TNotebook', tabposition='sw')       
#        figureTabs    = Notebook(paned_window, style='Figure.TNotebook')
        figureTabs  = Notebook(paned_window)
        
        self.figureTabs   = figureTabs
        figureTabs.bind('<<NotebookTabChanged>>', self._on_tab_change)
        self.lock_attribute('figureTabs')
        
        if figure_meta:
            self.make_figures(figure_meta)
            
        self.lock_elements()    
        
        paned_window.add(figureTabs, stretch='always')
        

        listPan     = PanedWindow(paned_window, orient='vertical')
        listPan.config(sashwidth=4, sashrelief='groove', bg='forestgreen')        
        paned_window.add(listPan, stretch='never')

        
        listFrm     = Frame(listPan)
        listPan.add(listFrm, stretch='always')        
        Label(listFrm, text='Curves', bg='#b5d6b0').pack(side='top', fill='x')
        self.__list = ScrolledList(listFrm, relief='groove')
        self.__list.list_config(width=20)
        self.__list.list_click_callback = self._on_list_click
        self.__list.pack(fill='both', expand='yes')

        listFrm     = Frame(listPan)        
        listPan.add(listFrm, stretch='never')
        Label(listFrm, text='Indicators', bg='#b5d6b0').pack(side='top', fill='x')
        self.__indicator_listbox = ScrolledList(listFrm, relief='groove')
        self.__indicator_listbox.list_config(width=20)
        self.__indicator_listbox.pack(fill='both', expand='yes')
                      
        with self.attribute_lock:
            set_attributes(self,
                paned_window = paned_window,
                grid_group_observer = self.GridGroupObserver(self), 
                axis_group_observer = self.AxisGroupObserver(self),
                clear_group_observer = self.ClearGroupObserver(self),
                label_group_observer = self.LabelGroupObserver(self),
                indicator_group_observer = self.IndicatorGroupObserver(self),
                data_figure_observer = self.DataFigureObserver(self),
                data_pool    = []
            )
Exemple #6
0
class PicasaView():
    """ Interface to the view class """
    def __init__(self, controller):
        self.controller = controller  # function to call

        self.root = Tk()  # create main window called root
        self.root.state('zoomed')  # have root be full screen
        self.root.title('Picasa')  # name the display
        self.root.protocol(
            'WM_DELETE_WINDOW',
            lambda: self.controller('stop'))  # Trap close window

        self.menu = PicasaMenu(self.root, controller)  # create main menu
        self.root.config(menu=self.menu)  # add menu to window

        self.TAB = PanedWindow(self.root, orient=VERTICAL)  # Top And Bottom
        self.TAB.grid(sticky='nsew')
        self.LAR = PanedWindow(self.root, orient=HORIZONTAL)  # Left And Right
        self.LAR.grid(sticky='nsew')
        self.TAB.add(self.LAR)

        self.tree = Tree(self.root, controller)  # create tree
        self.LAR.add(self.tree)

        self.gallery = Gallery(self.root, controller)  # create all pics
        self.LAR.add(self.gallery)

        self.status = Status(self.TAB, controller)  # create status text
        self.TAB.add(self.status)

        self.TAB.config(sashrelief='raised')  # make sash visible
        self.LAR.config(sashrelief='raised')

        self.root.grid_columnconfigure(0, weight=1)  # make all resizeable
        self.root.grid_rowconfigure(0, weight=1)

        self.TAB.sash_place(0, 1, 1000)
        #self.TAB.sash('dragto', 0, 1, 1000)

    def start(self):
        """ start the main window """
        self.root.mainloop()  # display root

    def stop(self):
        """ quit Picasa and close down cleanly """
        self.root.destroy()  # Quit the application
        #self.root.quit()

    def addstatus(self, text):
        """ add a comment to the status log """
        txt = ""
        for msg in text:
            txt += msg
        self.status.text.insert((1.0), txt + '\n')

    def clearstatus(self):
        """ clear the contents of the status area """
        self.status.text.delete((1.0), 'end')

    def getdir(self):
        """ Get the user to choose a folder to watch """
        return filedialog.askdirectory()

    def build(self, album):
        """ build tree structure and gallery from list of folders """
        self.tree.build(album)
        self.gallery.build(album)