Esempio n. 1
0
    def __init__(self, *args, **kwargs):
        super(MainWindowView, self).__init__(*args, **kwargs)
        self.config(orient=tk.VERTICAL)
        self.config(**config.get_theme().ui["frame"])
        self.texts = tk.PanedWindow(self)

        self.left_nb = CloseableNotebook(self, side="left")
        self.right_nb = CloseableNotebook(self, side="right")
        self.bottom_nb = ttk.Notebook(self)

        self.texts.add(self.left_nb)
        self.texts.add(self.right_nb)
        self.add(self.texts)
        self.add(self.bottom_nb)

        self.console_ui = ConsoleView(self.bottom_nb)
        self.bottom_nb.add(self.console_ui, text=tr("Console"))
        self.variable_viewer_ui = VariableViewerView(self.bottom_nb)
        self.bottom_nb.add(self.variable_viewer_ui, text=tr("Variable Viewer"))
        self.debugger_ui = DebuggerView(master=self.bottom_nb)
        self.bottom_nb.add(self.debugger_ui, text=tr("Debugger"))
        self.notes_view = NotesView(master=self,
                                    project=self.master.controller.project)
        self.bottom_nb.add(self.notes_view, text=tr("Notes"))

        self.left_tabs = []
        self.right_tabs = []
Esempio n. 2
0
    def __init__(self, master=None, controller=None):
        super().__init__(master)
        if controller is None:
            raise Exception("Controller expected for OptionView Widget")
        else:
            self.controller = controller
        self.master.resizable(False, False)
        self.master.update()

        self.notebook = ttk.Notebook(self,
                                     width=self.master.winfo_width(),
                                     height=self.master.winfo_height() - 50)
        self.notebook.grid(row=0, column=0, columnspan=5, sticky="nswe")

        self.keybindings_view = KeybindingsView(self.notebook)
        self.general_view = GeneralView(self.notebook)

        self.notebook.add(self.general_view,
                          text=self.general_view.name,
                          sticky="nswe")
        self.notebook.add(self.keybindings_view,
                          text=self.keybindings_view.name,
                          sticky="nswe")

        self.button_ok = tk.Button(self,
                                   text=tr("OK"),
                                   command=self.on_button_ok)
        self.button_cancel = tk.Button(self,
                                       text=tr("Cancel"),
                                       command=self.on_button_cancel)
        self.button_ok.grid(row=1, column=3)
        self.button_cancel.grid(row=1, column=4)
Esempio n. 3
0
 def __init__(self, master=None):
     super().__init__(master)
     self.name = tr("Keybindings")
     self.entries = []
     for i, (key, value) in enumerate(keybindings._attrs.items()):
         if value:
             cur = value[1:-1].split("-")
             current = []
             for char in cur:
                 if char in string.ascii_letters:
                     c = char.upper()
                 else:
                     c = char
                 current.append(c)
         else:
             current = []
         if i > 20:
             j = 2
         else:
             j = 0
         ety = KeybindingEntry(self, current)
         lbl = tk.Label(self, text=tr(f"{key.capitalize()} :"))
         lbl.grid(row=i, column=j)
         ety.grid(row=i, column=j + 1)
         self.entries.append((ety, key))
     pass
Esempio n. 4
0
 def __set_path(self, fpath):
     if fpath is not None:
         self._path = fpath
         self.fullname = os.path.split(fpath)[-1]
         self.extension = self.fullname.split(".")[-1].lower()
         self.name = self.fullname.split(".")[0]
     else:
         self._path = None
         self.fullname =tr("New File")
         self.extension = ""
         self.name = tr("New File")
Esempio n. 5
0
    def __setup_ui(self):
        self.toolbar = Toolbar(self)

        self.main = MainWindowView(self)
        self.side_notebook = ttk.Notebook(self)
        self.project_manager = ProjectManagerView(self)
        self.snippets = SnippetsView(self)

        self.toolbar.grid(row=0, column=0, columnspan=2, sticky="ew")

        self.side_notebook.grid(row=1, column=0, sticky="ns")
        self.side_notebook.add(self.project_manager,
                               text=tr("Project Manager"))
        self.side_notebook.add(self.snippets, text=tr("Snippets"))

        self.main.grid(row=1, column=1, sticky="ns")
Esempio n. 6
0
    def __init__(self, *args, **kwargs):
        super(MainWindowView, self).__init__(*args, **kwargs)
        self.config(orient=tk.VERTICAL)
        self.texts = tk.PanedWindow(self)

        self.left_nb = CloseableNotebook(self, side="left")
        self.right_nb = CloseableNotebook(self, side="right")
        self.bottom_nb = ttk.Notebook(self)

        self.texts.add(self.left_nb)
        self.texts.add(self.right_nb)
        self.add(self.texts)
        self.add(self.bottom_nb)

        self.console_ui = ConsoleView(self)
        self.bottom_nb.add(self.console_ui, text=tr("Console"))
        self.variable_viewer_ui = VariableViewerView(self)
        self.bottom_nb.add(self.variable_viewer_ui, text=tr("Variable Viewer"))

        self.left_tabs = []
        self.right_tabs = []
Esempio n. 7
0
    def __init_tabs_spaces_frame(self):
        self.formatting_frame = FormattingView(master=self,
                                               text=tr("Formatting"))
        self.formatting_frame.grid(row=0, column=0, columnspan=2)

        self.locale_combo = ttk.Combobox(self,
                                         values=Translator.get_all_locales(),
                                         textvariable=self.locale_code,
                                         state="readonly",
                                         justify="left",
                                         height=10)
        self.locale_combo.grid(row=1, column=1)
        tk.Label(self, text=tr("Language :")).grid(row=1, column=0)
        tk.Label(self, text=tr("Path to  git :")).grid(row=2, column=0)
        if config.path_to_git:
            path = config.path_to_git
        else:
            path = None
        self.git_path_ety = EntrySelectFolder(
            master=self, title="Select path to git install", path=path)
        self.git_path_ety.grid(row=2, column=1)
Esempio n. 8
0
    def __setup_ui(self):
        tk.Label(self,
                 text=tr("Insert spaces instead of tabs? ")).grid(row=0,
                                                                  column=0)
        tk.Label(self, text=tr("Show Whitespace Characters? ")).grid(row=1,
                                                                     column=0)
        tk.Label(self, text=tr("Tabs Length :")).grid(row=2, column=0)
        tk.Label(self, text=tr("Start maximized? ")).grid(row=3, column=0)

        spaces_cb = tk.Checkbutton(self, variable=self.insert_spaces_over_tabs)
        whitespace_cb = tk.Checkbutton(self, variable=self.show_whitespace)
        start_maximized_cb = tk.Checkbutton(self,
                                            variable=self.start_maximized)
        tabs_length_sb = tk.Spinbox(self,
                                    from_=2,
                                    to=12,
                                    increment=1,
                                    textvariable=self.tabs_length)
        spaces_cb.grid(row=0, column=1)
        whitespace_cb.grid(row=1, column=1)
        tabs_length_sb.grid(row=2, column=1)
        start_maximized_cb.grid(row=3, column=1)
Esempio n. 9
0
    def __init__(self, master=None, controller=None):
        super().__init__(master)
        self.master.protocol("WM_DELETE_WINDOW", self.on_cancel_btn)
        self.controller = controller

        self.sname = tk.StringVar()
        self.sname.trace_add("write", self.on_sname_change)
        self.sid = tk.StringVar()
        self.replace_select = tk.IntVar()

        self.sname_ety = EntryWithPlaceholder(self,
                                              placeholder=tr("Snippet Name"),
                                              textvariable=self.sname)
        self.sid_ety = EntryWithPlaceholder(self,
                                            placeholder="",
                                            textvariable=self.sid)
        self.replace_select_cb = tk.Checkbutton(self,
                                                variable=self.replace_select)
        self.before_cursor_txt = tk.Text(self, width=30, height=10)
        self.after_cursor_txt = tk.Text(self, width=30, height=10)
        self.ok_btn = tk.Button(self, text=tr("Ok"), command=self.on_ok_btn)
        self.cancel_btn = tk.Button(self,
                                    text=tr("Cancel"),
                                    command=self.on_cancel_btn)

        self.sname_ety.grid(row=0, column=1)
        self.sid_ety.grid(row=1, column=1)
        self.replace_select_cb.grid(row=2, column=1)
        self.before_cursor_txt.grid(row=3, column=1)
        self.after_cursor_txt.grid(row=4, column=1)
        self.ok_btn.grid(row=5, column=0, sticky="we")
        self.cancel_btn.grid(row=5, column=1)

        tk.Label(self, text=tr("Snippet Name :")).grid(row=0, column=0)
        tk.Label(self, text=tr("Snippet Id :")).grid(row=1, column=0)
        tk.Label(self, text=tr("Replace Selection ?")).grid(row=2, column=0)
        tk.Label(self, text=tr("Before Cursor :")).grid(row=3, column=0)
        tk.Label(self, text=tr("After Cursor :")).grid(row=4, column=0)
Esempio n. 10
0
    def __setup_menu(self):
        theme = config.get_theme()
        self.menubar = tk.Menu(self, **theme.ui["menu"])
        self.master.config(menu=self.menubar)
        menufile = tk.Menu(self.menubar, **theme.ui["menu"])
        self.menuthemes = tk.Menu(self.menubar, **theme.ui["menu"])
        menutools = tk.Menu(self.menubar, **theme.ui["menu"])
        menuedit = tk.Menu(self.menubar, **theme.ui["menu"])
        menuedit_formatting = tk.Menu(menuedit, **theme.ui["menu"])
        menuview = tk.Menu(self.menubar, **theme.ui["menu"])

        self.menubar.add_cascade(label=tr("File"), menu=menufile)
        self.menubar.add_cascade(label=tr("Edit"), menu=menuedit)
        self.menubar.add_cascade(label=tr("Themes"), menu=self.menuthemes)
        self.menubar.add_cascade(label=tr("Tools"), menu=menutools)

        menufile.add_command(label=tr("New"),
                             command=self.controller.menus.file_new)
        menufile.add_command(label=tr("Open"),
                             command=self.controller.menus.file_open)
        menufile.add_command(label=tr("Save"),
                             command=self.controller.menus.file_save)
        menufile.add_command(label=tr("Save As"),
                             command=self.controller.menus.file_save_as)
        menufile.add_command(label=tr("Quit"), command=self.quit)

        menuedit.add_command(label=tr("Undo"),
                             command=self.controller.menus.edit_undo)
        menuedit.add_command(label=tr("Redo"),
                             command=self.controller.menus.edit_redo)
        menuedit.add_command(label=tr("Duplicate line/selection"),
                             command=self.controller.menus.edit_duplicate)
        menuedit.add_command(label=tr("Comment/Uncomment"),
                             command=self.controller.menus.edit_comment)
        menuedit.add_cascade(label=tr("Formatting"), menu=menuedit_formatting)

        menuedit_formatting.add_command(
            label=tr("To UPPERCASE"),
            command=self.controller.menus.edit_formatting_upper)
        menuedit_formatting.add_command(
            label=tr("To lowercase"),
            command=self.controller.menus.edit_formatting_lower)
        menuedit_formatting.add_command(
            label=tr("To Capitalized"),
            command=self.controller.menus.edit_formatting_capitalized)
        menuedit_formatting.add_command(
            label=tr("To iNVERT cASING"),
            command=self.controller.menus.edit_formatting_invert)
        menuedit_formatting.add_command(
            label=tr("To RAnDom CASinG"),
            command=self.controller.menus.edit_formatting_random)
        menuedit_formatting.add_command(
            label=tr("To SpOnGeBoB cAsInG"),
            command=self.controller.menus.edit_formatting_spongebob)

        for theme in self.controller.get_all_themes:
            self.menuthemes.add_radiobutton(label=theme,
                                            variable=self.current_theme)

        menutools.add_command(
            label=tr("Layeredimage Builder"),
            command=self.controller.menus.tools_open_layeredimage_builder)
        menutools.add_command(
            label=tr("Variable Viewer"),
            command=self.controller.menus.tools_open_variable_viewer)
        menutools.add_command(
            label=tr("Screen Builder"),
            command=self.controller.menus.tools_open_screen_builder)
        menutools.add_command(
            label=tr("Add Snippet"),
            command=self.controller.menus.tools_open_add_snippet)
        menutools.add_command(label=tr("Options"),
                              command=self.controller.menus.tools_open_options)
Esempio n. 11
0
 def on_btn_click(self, *args):
     self.path = filedialog.askdirectory(title=tr(self.title))
     self.ety.delete(0, tk.END)
     self.ety.insert(tk.END, self.path)
Esempio n. 12
0
 def __init__(self, master=None):
     super().__init__(master)
     self.name = tr("General")
     self.__init_variables()
     self.__init_tabs_spaces_frame()