Exemplo n.º 1
0
    def __init__(self):
        super().__init__(get_workbench(), background=lookup_style_option("TFrame", "background"))
        ui_utils.set_zoomed(self, True)

        self.main_pw = ReplayerPanedWindow(self, orient=tk.HORIZONTAL, sashwidth=10)
        self.center_pw = ReplayerPanedWindow(self.main_pw, orient=tk.VERTICAL, sashwidth=10)
        self.right_frame = ttk.Frame(self.main_pw)
        self.right_pw = ReplayerPanedWindow(self.right_frame, orient=tk.VERTICAL, sashwidth=10)
        self.editor_notebook = ReplayerEditorNotebook(self.center_pw)
        shell_book = ttk.Notebook(self.main_pw)
        self.shell = ShellFrame(shell_book)
        self.details_frame = EventDetailsFrame(self.right_pw)
        self.log_frame = LogFrame(
            self.right_pw, self.editor_notebook, self.shell, self.details_frame
        )
        self.browser = ReplayerFileBrowser(self.main_pw, self.log_frame)
        self.control_frame = ControlFrame(self.right_frame)

        self.main_pw.grid(padx=10, pady=10, sticky=tk.NSEW)
        self.main_pw.add(self.browser, width=200)
        self.main_pw.add(self.center_pw, width=1000)
        self.main_pw.add(self.right_frame, width=200)
        self.center_pw.add(self.editor_notebook, height=700)
        self.center_pw.add(shell_book, height=300)
        shell_book.add(self.shell, text="Shell")
        self.right_pw.grid(sticky=tk.NSEW)
        self.control_frame.grid(sticky=tk.NSEW)
        self.right_pw.add(self.log_frame, height=600)
        self.right_pw.add(self.details_frame, height=200)
        self.right_frame.columnconfigure(0, weight=1)
        self.right_frame.rowconfigure(0, weight=1)

        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)
Exemplo n.º 2
0
    def _init_window(self):

        self.set_default("layout.zoomed", False)
        self.set_default("layout.top", 15)
        self.set_default("layout.left", 150)
        self.set_default("layout.width", 700)
        self.set_default("layout.height", 650)
        self.set_default("layout.w_width", 200)
        self.set_default("layout.e_width", 200)
        self.set_default("layout.s_height", 200)

        # I don't actually need saved options for Full screen/maximize view,
        # but it's easier to create menu items, if I use configuration manager's variables
        self.set_default("view.full_screen", False)
        self.set_default("view.maximize_view", False)

        # In order to avoid confusion set these settings to False
        # even if they were True when Thonny was last run
        self.set_option("view.full_screen", False)
        self.set_option("view.maximize_view", False)

        self.geometry("{0}x{1}+{2}+{3}".format(
            self.get_option("layout.width"), self.get_option("layout.height"),
            self.get_option("layout.left"), self.get_option("layout.top")))

        if self.get_option("layout.zoomed"):
            ui_utils.set_zoomed(self, True)

        self.protocol("WM_DELETE_WINDOW", self._on_close)

        # Window icons
        window_icons = self.get_option("theme.window_icons")
        if window_icons:
            imgs = [self.get_image(filename) for filename in window_icons]
            self.iconphoto(True, *imgs)
        elif running_on_linux() and ui_utils.get_tk_version_info() >= (8, 6):
            self.iconphoto(True, self.get_image("thonny.png"))
        else:
            icon_file = os.path.join(self.get_package_dir(), "res",
                                     "thonny.ico")
            try:
                self.iconbitmap(icon_file, default=icon_file)
            except:
                try:
                    # seems to work in mac
                    self.iconbitmap(icon_file)
                except:
                    pass  # TODO: try to get working in Ubuntu

        self.bind("<Configure>", self._on_configure, True)