Ejemplo n.º 1
0
    def __init__(self, master, studio, **cnf):
        super().__init__(master, studio, **cnf)
        self.body = ScrolledFrame(self, **self.style.dark)
        self.body.pack(side="top", fill="both", expand=True)

        self._toggle_btn = Button(self._header,
                                  image=get_icon_image("chevron_down", 15, 15),
                                  **self.style.dark_button,
                                  width=25,
                                  height=25)
        self._toggle_btn.pack(side="right")
        self._toggle_btn.on_click(self._toggle)

        self._search_btn = Button(self._header,
                                  image=get_icon_image("search", 15, 15),
                                  width=25,
                                  height=25,
                                  **self.style.dark_button)
        self._search_btn.pack(side="right")
        self._search_btn.on_click(self.start_search)

        self.groups = []

        self._identity_group = self.add_group(IdentityGroup)
        self._layout_group = self.add_group(LayoutGroup)
        self._attribute_group = self.add_group(AttributeGroup)

        self._empty_frame = Frame(self.body)
        self.show_empty()
        self._current = None
        self._expanded = False
Ejemplo n.º 2
0
    def setup_style_pane(self):
        self.body = ScrolledFrame(self, **self.style.surface)
        self.body.pack(side="top", fill="both", expand=True)

        self._toggle_btn = Button(self.get_header(),
                                  image=get_icon_image("chevron_down", 15, 15),
                                  **self.style.button,
                                  width=25,
                                  height=25)
        self._toggle_btn.pack(side="right")
        self._toggle_btn.on_click(self._toggle)

        self._search_btn = Button(self.get_header(),
                                  image=get_icon_image("search", 15, 15),
                                  width=25,
                                  height=25,
                                  **self.style.button)
        self._search_btn.pack(side="right")
        self._search_btn.on_click(self.start_search)

        self.groups = []

        self._empty_frame = Frame(self.body)
        self.show_empty()
        self._current = None
        self._expanded = False
        self._is_loading = False
        self._search_query = None
Ejemplo n.º 3
0
    def __init__(self, master, studio=None, **cnf):
        super().__init__(master, studio, **cnf)
        self._toggle_btn = Button(self._header,
                                  image=get_icon_image("chevron_down", 15, 15),
                                  **self.style.button,
                                  width=25,
                                  height=25)
        self._toggle_btn.pack(side="right")
        self._toggle_btn.on_click(self._toggle)

        self._search_btn = Button(
            self._header,
            **self.style.button,
            image=get_icon_image("search", 15, 15),
            width=25,
            height=25,
        )
        self._search_btn.pack(side="right")
        self._search_btn.on_click(self.start_search)
        self.body = Frame(self, **self.style.surface)
        self.body.pack(side="top", fill="both", expand=True)
        self._empty_label = Label(self.body, **self.style.text_passive)

        self._selected = None
        self._expanded = False
        self._tree = None
Ejemplo n.º 4
0
 def __init__(self, master):
     super().__init__(master)
     self.config(**self.style.surface)
     self._progress = ProgressBar(self)
     self._progress.pack(side="top", fill="x", padx=20, pady=20)
     self._progress_text = Label(self, **self.style.text_small, anchor="w")
     self._progress_text.pack(side="top", fill="x", padx=20, pady=10)
     self._message = Label(
         self,
         **self.style.text,
         anchor="w",
         compound="left",
         wrap=400,
         justify="left",
         pady=5,
         padx=5,
     )
     self._action_btn = Button(self,
                               text="Retry",
                               **self.style.button_highlight,
                               width=80,
                               height=25)
     self.extra_info = Text(self,
                            width=40,
                            height=6,
                            state='disabled',
                            font='consolas 10')
     self.pack(fill="both", expand=True)
     self.check_for_update()
Ejemplo n.º 5
0
 def __init__(self, master, style_def=None):
     super().__init__(master, style_def)
     self._picker = Button(self, **self.style.button, width=25, height=25, text="...")
     self._entry.pack_forget()
     self._picker.pack(side="right")
     self._entry.pack(side="left", fill="x")
     self._picker.on_click(self._pick)
Ejemplo n.º 6
0
 def __init__(self, master, studio=None, **cnf):
     super().__init__(master, **cnf)
     self.update_defaults()
     self.__class__._instance = self
     if not self.__class__._view_mode:
         self.__class__._view_mode = StringVar(None, self.get_pref('mode'))
         self.__class__._transparency_flag = t = BooleanVar(None, self.get_pref('inactive_transparency'))
         self.__class__._side = side = StringVar(None, self.get_pref('side'))
         t.trace_add("write", lambda *_: self.set_pref('inactive_transparency', t.get()))
     self.studio = studio
     self._header = Frame(self, **self.style.dark, **self.style.dark_highlight_dim, height=30)
     self._header.pack(side="top", fill="x")
     self._header.pack_propagate(0)
     self._header.allow_drag = True
     Label(self._header, **self.style.dark_text_passive, text=self.name).pack(side="left")
     self._min = Button(self._header, image=get_icon_image("close", 15, 15), **self.style.dark_button, width=25,
                        height=25)
     self._min.pack(side="right")
     self._min.on_click(self.minimize)
     self._pref = MenuButton(self._header, **self.style.dark_button)
     self._pref.configure(image=get_icon_image("settings", 15, 15))
     self._pref.pack(side="right")
     self._pref.tooltip("Options")
     self._search_bar = SearchBar(self._header, height=20)
     self._search_bar.on_query_clear(self.on_search_clear)
     self._search_bar.on_query_change(self.on_search_query)
     menu = self.make_menu((
         ("cascade", "View Mode", None, None, {"menu": (
             ("radiobutton", "Docked", None, self.open_as_docked, {"variable": self._view_mode, "value": "docked"}),
             ("radiobutton", "Window", None, self.open_as_window, {"variable": self._view_mode, "value": "window"}),
         )}),
         ("cascade", "Position", None, None, {"menu": (
             ("radiobutton", "Left", None, lambda: self.reposition("left"),
              {"variable": self._side, "value": "left"}),
             ("radiobutton", "Right", None, lambda: self.reposition("right"),
              {"variable": self._side, "value": "right"}),
         )}),
         EnableIf(lambda: self._view_mode.get() == 'window',
                  ("cascade", "Window options", None, None, {"menu": (
                      (
                          "checkbutton", "Transparent when inactive", None, None,
                          {"variable": self._transparency_flag}),
                  )})),
         ("command", "Close", get_icon_image("close", 14, 14), self.minimize, {}),
         ("separator",),
         *self.create_menu()
     ), self._pref)
     self._pref.config(menu=menu)
     # self._pref.on_click(self.minimize)
     self.config(**self.style.dark)
     self.indicator = None
     self.window_handle = None
     self.on_focus(self._on_focus_get)
     self.on_focus_lost(self._on_focus_release)
     self.on_close(self.close_window)
     self._mode_map = {
         'window': self.open_as_window,
         'docked': self.open_as_docked
     }
Ejemplo n.º 7
0
    def __init__(self, master, studio=None, **cnf):
        super().__init__(master, studio, **cnf)
        f = Frame(self, **self.style.dark)
        f.pack(side="top", fill="both", expand=True, pady=4)
        f.pack_propagate(0)

        self._variable_pane = ScrolledFrame(f, width=150)
        self._variable_pane.place(x=0, y=0, relwidth=0.4, relheight=1)

        self._detail_pane = ScrolledFrame(f, width=150)
        self._detail_pane.place(relx=0.4,
                                y=0,
                                relwidth=0.6,
                                relheight=1,
                                x=15,
                                width=-20)

        self._search_btn = Button(self._header,
                                  image=get_icon_image("search", 15, 15),
                                  width=25,
                                  height=25,
                                  **self.style.dark_button)
        self._search_btn.pack(side="right")
        self._search_btn.on_click(self.start_search)
        self._add = MenuButton(self._header, **self.style.dark_button)
        self._add.configure(image=get_icon_image("add", 15, 15))
        self._add.pack(side="right")
        self._delete_btn = Button(self._header,
                                  image=get_icon_image("delete", 15, 15),
                                  width=25,
                                  height=25,
                                  **self.style.dark_button)
        self._delete_btn.pack(side="right")
        self._delete_btn.on_click(self._delete)
        self._var_types_menu = self.make_menu(self._get_add_menu(), self._add)
        self._add.config(menu=self._var_types_menu)
        self._selected = None
        self._links = {}
        self._overlay = Label(f,
                              **self.style.dark_text_passive,
                              text="Add variables",
                              compound="top")
        self._overlay.configure(image=get_icon_image("add", 25, 25))
        self._show_overlay(True)
        self._editors = []
Ejemplo n.º 8
0
 def init_toolbar(self):
     for action in self.actions:
         if len(action) == 1:
             Frame(self._toolbar, width=1, bg=self.style.colors.get("primarydarkaccent")).pack(
                 side='left', fill='y', pady=3, padx=5)
             continue
         btn = Button(self._toolbar, image=action[1], **self.style.button, width=25, height=25)
         btn.pack(side="left", padx=3)
         btn.tooltip(action[3])
         ActionNotifier.bind_event("<Button-1>", btn, action[2], text=action[3])
Ejemplo n.º 9
0
    def __init__(self, master, studio, **cnf):
        super().__init__(master, studio, **cnf)
        self.header = Frame(self, **self.style.surface)
        self.header.pack(side="top", fill="x")
        for i, title in enumerate(("Sequence", "Handler", "Add", " " * 3)):
            Label(
                self.header,
                **self.style.text_passive,
                text=title,
                anchor="w",
            ).grid(row=0, column=i, sticky='ew')

        # set the first two columns to expand evenly
        for column in range(2):
            self.header.grid_columnconfigure(column, weight=1, uniform=1)

        self.bindings = BindingsTable(self)
        self.bindings.on_value_change(self.modify_item)
        self.bindings.on_item_delete(self.delete_item)
        self.bindings.pack(fill="both", expand=True)

        self._add = Button(self._header,
                           **self.style.button,
                           width=25,
                           height=25,
                           image=get_icon_image("add", 15, 15))
        self._add.pack(side="right")
        self._add.tooltip("Add event binding")
        self._add.on_click(self.add_new)

        self._search_btn = Button(
            self._header,
            **self.style.button,
            image=get_icon_image("search", 15, 15),
            width=25,
            height=25,
        )
        self._search_btn.pack(side="right")
        self._search_btn.on_click(self.start_search)

        self._empty_frame = Label(self.bindings, **self.style.text_passive)
        self._show_empty(self.NO_SELECTION_MSG)
Ejemplo n.º 10
0
 def _add_button(self, **kw):
     text = kw.get("text")
     focus = kw.get("focus", False)
     # If a button bar does not already exist we need to create one
     if self.bar is None:
         self._make_button_bar()
     btn = Button(self.bar, **self.style.button, text=text, height=25)
     btn.configure(**self.style.highlight_active)
     btn.pack(side="right", padx=5, pady=5)
     # ensure the buttons have a minimum width of _MIN_BUTTON_WIDTH
     btn.configure(width=max(self._MIN_BUTTON_WIDTH, btn.measure_text(text)))
     btn.on_click(kw.get("command", lambda _: self._terminate_with_val(kw.get("value"))))
     if focus:
         btn.focus_set()
         btn.config_all(**self.style.button_highlight)
     return btn
Ejemplo n.º 11
0
    def __init__(self, master, studio=None,  **cnf):
        super().__init__(master, studio, **cnf)
        self._tree = ComponentTreeView(self)
        self._tree.pack(side="top", fill="both", expand=True, pady=4)
        # self._tree.sample()
        self._tree.on_select(self._trigger_select)
        self._toggle_btn = Button(self._header, image=get_icon_image("chevron_down", 15, 15), **self.style.dark_button,
                                  width=25,
                                  height=25)
        self._toggle_btn.pack(side="right")
        self._toggle_btn.on_click(self._toggle)

        self._selected = None
        self._expanded = False

        self.studio.designer.node = self._tree
Ejemplo n.º 12
0
 def __init__(self, master=None, **cnf):
     super().__init__(master, **cnf)
     self.config(**self.style.no_highlight, **self.style.dark)
     self._entry = Entry(self, **self.style.dark_input)
     self._clear_btn = Button(self,
                              image=get_icon_image("close", 15, 15),
                              **self.style.dark_button,
                              width=25,
                              height=25)
     self._clear_btn.pack(side="right", fill="y")
     self._clear_btn.on_click(self._clear)
     Label(self,
           **self.style.dark_text,
           image=get_icon_image("search", 15, 15)).pack(side="left")
     self._entry.pack(side="left", fill="both", expand=True, padx=2)
     self._entry.on_entry(self._change)
     self._on_change = None
     self._on_clear = None
Ejemplo n.º 13
0
    def __init__(self, master, studio=None, **cnf):
        if not self._var_init:
            self._init_var(studio)
        super().__init__(master, studio, **cnf)

        f = Frame(self, **self.style.surface)
        f.pack(side="top", fill="both", expand=True, pady=4)
        f.pack_propagate(0)

        self._widget_set = Spinner(self._header, width=150)
        self._widget_set.config(**self.style.no_highlight)
        self._widget_set.set_values(list(self.CLASSES.keys()))
        self._widget_set.pack(side="left")
        self._widget_set.on_change(self.collect_groups)
        self._select_pane = ScrolledFrame(f, width=150)
        self._select_pane.place(x=0, y=0, relwidth=0.4, relheight=1)

        self._search_btn = Button(self._header, image=get_icon_image("search", 15, 15), width=25, height=25,
                                  **self.style.button)
        self._search_btn.pack(side="right")
        self._search_btn.on_click(self.start_search)
        self._search_selector = Label(self._select_pane.body, **self.style.text, text="search", anchor="w")
        self._search_selector.configure(**self.style.hover)

        self._widget_pane = ScrolledFrame(f, width=150)
        self._select_pane.body.config(**self.style.surface)
        self._widget_pane.place(relx=0.4, y=0, relwidth=0.6, relheight=1)

        self._pool = {}
        self._selectors = []
        self._selected = None
        self._component_cache = None
        self._extern_groups = []
        self._widget = None
        self.collect_groups(self.get_pref("widget_set"))
        # add custom widgets config to settings
        templates.update(_widget_pref_template)
        self._custom_group = None
        self._custom_widgets = []
        Preferences.acquire().add_listener(self._custom_pref_path, self._init_custom)
        self._reload_custom()
Ejemplo n.º 14
0
 def __init__(self, master, **cnf):
     super().__init__(master, **cnf)
     self.config(**self.style.dark)
     self._label_frame = Frame(self, **self.style.bright, height=20)
     self._label_frame.pack(side="top", fill="x", padx=2)
     self._label_frame.pack_propagate(0)
     self._label = Label(self._label_frame, **self.style.bright,
                         **self.style.text_bright)
     self._label.pack(side="left")
     self._collapse_btn = Button(self._label_frame,
                                 width=20,
                                 **self.style.bright,
                                 **self.style.text_bright)
     self._collapse_btn.config(text=get_icon("triangle_up"))
     self._collapse_btn.pack(side="right", fill="y")
     self._collapse_btn.on_click(self.toggle)
     self.body = Frame(self, **self.style.dark)
     self.body.pack(side="top", fill="both", pady=2)
     self.__ref = Frame(self.body, height=0, width=0, **self.style.dark)
     self.__ref.pack(side="top")
     self._collapsed = False
Ejemplo n.º 15
0
    def __init__(self, master, studio=None, **cnf):
        if not self._var_init:
            self._init_var(studio)
        super().__init__(master, studio, **cnf)

        f = Frame(self, **self.style.dark)
        f.pack(side="top", fill="both", expand=True, pady=4)
        f.pack_propagate(0)

        self._widget_set = Spinner(self._header, width=150)
        self._widget_set.config(**self.style.no_highlight)
        self._widget_set.set_values(list(self.CLASSES.keys()))
        self._widget_set.pack(side="left")
        self._widget_set.on_change(self.collect_groups)
        self._select_pane = ScrolledFrame(f, width=150)
        self._select_pane.place(x=0, y=0, relwidth=0.4, relheight=1)

        self._search_btn = Button(self._header,
                                  image=get_icon_image("search", 15, 15),
                                  width=25,
                                  height=25,
                                  **self.style.dark_button)
        self._search_btn.pack(side="right")
        self._search_btn.on_click(self.start_search)
        self._search_selector = Label(self._select_pane.body,
                                      **self.style.dark_text,
                                      text="search",
                                      anchor="w")
        self._search_selector.configure(**self.style.dark_on_hover)

        self._widget_pane = ScrolledFrame(f, width=150, bg="orange")
        self._select_pane.body.config(**self.style.dark)
        self._widget_pane.place(relx=0.4, y=0, relwidth=0.6, relheight=1)

        self._pool = {}
        self._selectors = []
        self._selected = None
        self._component_cache = None
        self.collect_groups(self.get_pref("widget_set"))
Ejemplo n.º 16
0
    def __init__(self, master, studio=None, **cnf):
        super().__init__(master, studio, **cnf)
        f = Frame(self, **self.style.surface)
        f.pack(side="top", fill="both", expand=True, pady=4)
        f.pack_propagate(0)

        self._variable_pane = ScrolledFrame(f, width=150)
        self._variable_pane.place(x=0, y=0, relwidth=0.4, relheight=1)

        self._detail_pane = ScrolledFrame(f, width=150)
        self._detail_pane.place(relx=0.4,
                                y=0,
                                relwidth=0.6,
                                relheight=1,
                                x=15,
                                width=-20)

        Label(self._detail_pane.body,
              **self.style.text_passive,
              text="Type",
              anchor="w").pack(side="top", fill="x")
        self.var_type_lbl = Label(self._detail_pane.body,
                                  **self.style.text,
                                  anchor="w")
        self.var_type_lbl.pack(side="top", fill="x")
        Label(self._detail_pane.body,
              **self.style.text_passive,
              text="Name",
              anchor="w").pack(side="top", fill="x")
        self.var_name = editors.get_editor(self._detail_pane.body,
                                           self._definitions["name"])
        self.var_name.pack(side="top", fill="x")
        Label(self._detail_pane.body,
              **self.style.text_passive,
              text="Value",
              anchor="w").pack(fill="x", side="top")
        self._editors = {}
        self._editor = None

        self._search_btn = Button(self._header,
                                  image=get_icon_image("search", 15, 15),
                                  width=25,
                                  height=25,
                                  **self.style.button)
        self._search_btn.pack(side="right")
        self._search_btn.on_click(self.start_search)
        self._search_query = None

        self._add = MenuButton(self._header, **self.style.button)
        self._add.configure(image=get_icon_image("add", 15, 15))
        self._add.pack(side="right")
        self._delete_btn = Button(self._header,
                                  image=get_icon_image("delete", 15, 15),
                                  width=25,
                                  height=25,
                                  **self.style.button)
        self._delete_btn.pack(side="right")
        self._delete_btn.on_click(self._delete)
        self._var_types_menu = self.make_menu(self._get_add_menu(),
                                              self._add,
                                              title="Add variable")
        self._var_types_menu.configure(tearoff=True)
        self._add.config(menu=self._var_types_menu)
        self._selected = None
        self._links = {}
        self._overlay = Label(f,
                              **self.style.text_passive,
                              text=self._empty_message,
                              compound="top")
        self._overlay.configure(image=get_icon_image("add", 25, 25))
        self._show_overlay(True)
Ejemplo n.º 17
0
    def __init__(self, master, debugger):
        super(ElementPane, self).__init__(master)
        Label(self._header, **self.style.text_accent,
              text=self.name).pack(side="left")

        ElementTreeView.Node.debugger = debugger
        self._tree = ElementTreeView(self)
        self._tree.pack(side="top", fill="both", expand=True, pady=4)
        self._tree.allow_multi_select(True)
        self._tree.on_select(self.on_select)

        self._search_btn = Button(
            self._header,
            **self.style.button,
            image=get_icon_image("search", 15, 15),
            width=25,
            height=25,
        )
        self._search_btn.pack(side="right", padx=2)
        self._search_btn.on_click(self.start_search)

        self._reload_btn = Button(
            self._header,
            **self.style.button,
            image=get_icon_image("rotate_clockwise", 15, 15),
            width=25,
            height=25,
        )
        self._reload_btn.pack(side="right", padx=2)
        self._reload_btn.tooltip("reload tree")

        self._toggle_btn = Button(self._header,
                                  image=get_icon_image("chevron_down", 15, 15),
                                  **self.style.button,
                                  width=25,
                                  height=25)
        self._toggle_btn.pack(side="right", padx=2)

        self._select_btn = ToggleButton(
            self._header,
            **self.style.button,
            image=get_icon_image("cursor", 15, 15),
            width=25,
            height=25,
        )
        self._select_btn.pack(side="right", padx=2)
        self._select_btn.tooltip("select element to inspect")

        self.debugger = debugger
        self._tree.add_as_node(
            widget=debugger.root).update_preload_status(False)

        self.debugger.bind("<<WidgetCreated>>", self.on_widget_created)
        self.debugger.bind("<<WidgetDeleted>>", self.on_widget_deleted)
        self.debugger.bind("<<WidgetModified>>", self.on_widget_modified)

        tkinter.Misc.bind_all(self.debugger.root, "<Motion>", self.on_motion)
        tkinter.Misc.bind_all(self.debugger.root, "<Button-1>",
                              self.on_widget_tap)
        tkinter.Misc.bind_all(self.debugger.root, "<Button-3>",
                              self.on_widget_tap)
        tkinter.Misc.bind_all(self.debugger.root, "<Map>", self.on_widget_map)
        tkinter.Misc.bind_all(self.debugger.root, "<Unmap>",
                              self.on_widget_unmap)
        self.highlighted = None
Ejemplo n.º 18
0
    def __init__(self, master, widget, menu=None):
        super().__init__(master, widget)
        self.title(f'Edit menu for {widget.id}')
        if not isinstance(menu, tk.Menu):
            menu = tk.Menu(widget, tearoff=False)
            widget.configure(menu=menu)
        self._base_menu = menu
        self._tool_bar = Frame(self, **self.style.dark, **self.style.dark_highlight_dim, height=30)
        self._tool_bar.pack(side="top", fill="x")
        self._tool_bar.pack_propagate(False)
        self._pane = PanedWindow(self, **self.style.dark_pane_horizontal)
        self._tree = MenuTree(self._pane, widget, menu)
        self._tree.allow_multi_select(True)
        self._tree.on_select(self._refresh_styles)
        self._tree.on_structure_change(self._refresh_styles)

        self._editor_pane = ScrolledFrame(self._pane)
        self._editor_pane_cover = Label(self._editor_pane, **self.style.dark_text_passive)
        self._editor_pane.pack(side="top", fill="both", expand=True)
        self._menu_item_styles = CollapseFrame(self._editor_pane.body)
        self._menu_item_styles.pack(side="top", fill="x", pady=4)
        self._menu_item_styles.label = "Menu Item attributes"
        self._menu_styles = CollapseFrame(self._editor_pane.body)
        self._menu_styles.pack(side="top", fill="x", pady=4)
        self._menu_styles.label = "Menu attributes"
        self._style_item_ref = {}
        self._menu_style_ref = {}
        self._prev_selection = None

        self._add = MenuButton(self._tool_bar, **self.style.dark_button)
        self._add.pack(side="left")
        self._add.configure(image=get_icon_image("add", 15, 15))
        _types = MenuTree.Node._type_def
        menu_types = self._tool_bar.make_menu(
            [(
                tk.COMMAND,
                i.title(),
                get_icon_image(_types[i][0], 14, 14),
                functools.partial(self.add_item, i), {}
            ) for i in _types],
            self._add)
        menu_types.configure(tearoff=True)
        self._add.config(menu=menu_types)
        self._delete_btn = Button(self._tool_bar, image=get_icon_image("delete", 15, 15), **self.style.dark_button,
                                  width=25,
                                  height=25)
        self._delete_btn.pack(side="left")
        self._delete_btn.on_click(self._delete)

        self._preview_btn = Button(self._tool_bar, image=get_icon_image("play", 15, 15), **self.style.dark_button,
                                   width=25, height=25)
        self._preview_btn.pack(side="left")
        self._preview_btn.on_click(self._preview)

        self._pane.pack(side="top", fill="both", expand=True)
        self._pane.add(self._tree, minsize=350, sticky='nswe', width=350, height=500)
        self._pane.add(self._editor_pane, minsize=320, sticky='nswe', width=320, height=500)
        self.load_menu(menu, self._tree)
        self._show_editor_message(self._MESSAGE_EDITOR_EMPTY)
        self.enable_centering()
        self.focus_set()
        self._load_all_properties()