Exemple #1
0
    def __init__(self, context, editor):
        PanelView.__init__(self, context)
        self._log.debug("init")

        self._editor = editor
        self._handlers = {}
        self._preferences = Preferences()

        self._preferences.connect("preferences-changed", self._on_preferences_changed)
        self._show_tasks = self._preferences.get("issues-show-tasks")
        self._show_warnings = self._preferences.get("issues-show-warnings")

        self._icons = { Issue.SEVERITY_WARNING : GdkPixbuf.Pixbuf.new_from_file(Resources().get_icon("warning.png")),
                        Issue.SEVERITY_ERROR : GdkPixbuf.Pixbuf.new_from_file(Resources().get_icon("error.png")),
                        Issue.SEVERITY_INFO : None,
                        Issue.SEVERITY_TASK : GdkPixbuf.Pixbuf.new_from_file(Resources().get_icon("task.png")) }

        grid = Gtk.Grid()
        self.add(grid)

        self._store = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str, object)

        self._view = Gtk.TreeView(model=self._store)

        column = Gtk.TreeViewColumn()
        column.set_title(_("Message"))

        pixbuf_renderer = Gtk.CellRendererPixbuf()
        column.pack_start(pixbuf_renderer, False)
        column.add_attribute(pixbuf_renderer, "pixbuf", 0)

        text_renderer = Gtk.CellRendererText()
        column.pack_start(text_renderer, True)
        column.add_attribute(text_renderer, "markup", 1)

        self._view.append_column(column)

        column = Gtk.TreeViewColumn()
        column.set_title(_("File"))
        text_renderer2 = Gtk.CellRendererText()
        column.pack_start(text_renderer2, True)
        column.add_attribute(text_renderer2, "markup", 2)
        self._view.insert_column(column, -1)
        self._handlers[self._view] = self._view.connect("row-activated", self._on_row_activated)

        self._scr = Gtk.ScrolledWindow()

        self._scr.add(self._view)
        self._scr.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        self._scr.set_shadow_type(Gtk.ShadowType.IN)
        self._scr.set_hexpand(True)
        self._scr.set_vexpand(True)

        grid.add(self._scr)

        # toolbar
        self._button_warnings = Gtk.ToggleToolButton()
        self._button_warnings.set_tooltip_text(_("Show/Hide Warnings"))
        image = Gtk.Image()
        image.set_from_file(Resources().get_icon("warning.png"))
        self._button_warnings.set_icon_widget(image)
        self._button_warnings.set_active(self._show_warnings)
        self._handlers[self._button_warnings] = self._button_warnings.connect("toggled", self.__on_warnings_toggled)

        self._button_tasks = Gtk.ToggleToolButton()
        self._button_tasks.set_tooltip_text(_("Show/Hide Tasks"))
        imageTask = Gtk.Image()
        imageTask.set_from_file(Resources().get_icon("task.png"))
        self._button_tasks.set_icon_widget(imageTask)
        self._button_tasks.set_active(self._show_tasks)
        self._handlers[self._button_tasks] = self._button_tasks.connect("toggled", self.__on_tasks_toggled)

        toolbar = Gtk.Toolbar()
        toolbar.set_orientation(Gtk.Orientation.VERTICAL)
        toolbar.set_style(Gtk.ToolbarStyle.ICONS)
        toolbar.set_icon_size(Gtk.IconSize.MENU)
        toolbar.insert(self._button_warnings, -1)
        toolbar.insert(self._button_tasks, -1)
        toolbar.set_vexpand(True)

        grid.add(toolbar)

        # theme like gtk3
        ctx = self._scr.get_style_context()
        ctx.set_junction_sides(Gtk.JunctionSides.RIGHT)

        ctx = toolbar.get_style_context()
        ctx.set_junction_sides(Gtk.JunctionSides.LEFT | Gtk.JunctionSides.RIGHT)
        ctx.add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)

        self._issues = []

        self.show_all()

        self._log.debug("init finished")
Exemple #2
0
 def get_label(self):
     return _("Issues")
Exemple #3
0
    def __init__(self, context, editor):
        PanelView.__init__(self, context)
        self._editor = editor
        self._base_handlers = {}

        self.set_orientation(Gtk.Orientation.VERTICAL)

        self._preferences = Preferences()

        grid = Gtk.Grid()
        grid.set_orientation(Gtk.Orientation.VERTICAL)
        self.add(grid)

        # toolbar

        btn_follow = Gtk.ToggleToolButton.new_from_stock(Gtk.STOCK_CONNECT)
        btn_follow.set_tooltip_text(_("Follow Editor"))
        btn_follow.set_active(
            self._preferences.get("outline-connect-to-editor"))
        self._base_handlers[btn_follow] = btn_follow.connect(
            "toggled", self._on_follow_toggled)

        btn_expand = Gtk.ToolButton.new_from_stock(Gtk.STOCK_ZOOM_IN)
        btn_expand.set_tooltip_text(_("Expand All"))
        self._base_handlers[btn_expand] = btn_expand.connect(
            "clicked", self._on_expand_clicked)

        btn_collapse = Gtk.ToolButton.new_from_stock(Gtk.STOCK_ZOOM_OUT)
        btn_collapse.set_tooltip_text(_("Collapse All"))
        self._base_handlers[btn_collapse] = btn_collapse.connect(
            "clicked", self._on_collapse_clicked)

        self._toolbar = Gtk.Toolbar()
        self._toolbar.set_style(Gtk.ToolbarStyle.ICONS)
        self._toolbar.set_icon_size(Gtk.IconSize.MENU)
        self._toolbar.insert(btn_follow, -1)
        self._toolbar.insert(Gtk.SeparatorToolItem(), -1)
        self._toolbar.insert(btn_expand, -1)
        self._toolbar.insert(btn_collapse, -1)
        self._toolbar.insert(Gtk.SeparatorToolItem(), -1)
        self._toolbar.set_hexpand(True)

        grid.add(self._toolbar)

        # tree view

        column = Gtk.TreeViewColumn()

        pixbuf_renderer = Gtk.CellRendererPixbuf()
        column.pack_start(pixbuf_renderer, False)
        column.add_attribute(pixbuf_renderer, "pixbuf", 1)

        text_renderer = Gtk.CellRendererText()
        column.pack_start(text_renderer, True)
        column.add_attribute(text_renderer, "markup", 0)

        self._offset_map = OutlineOffsetMap()

        self._store = Gtk.TreeStore(str, GdkPixbuf.Pixbuf,
                                    object)  # label, icon, node object

        self._view = Gtk.TreeView(model=self._store)
        self._view.append_column(column)
        self._view.set_headers_visible(False)
        self._cursor_changed_id = self._view.connect("cursor-changed",
                                                     self._on_cursor_changed)
        self._base_handlers[self._view] = self._view.connect(
            "row-activated", self._on_row_activated)

        scrolled = Gtk.ScrolledWindow()
        scrolled.add(self._view)
        scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        scrolled.set_vexpand(True)

        grid.add(scrolled)

        # this holds a list of the currently expanded paths
        self._expandedPaths = None
Exemple #4
0
 def get_label(self):
     return _("Outline")
Exemple #5
0
    def __init__(self, context, editor):
        PanelView.__init__(self, context)
        self._editor = editor
        self._base_handlers = {}

        self.set_orientation(Gtk.Orientation.VERTICAL)

        self._preferences = Preferences()

        grid = Gtk.Grid()
        grid.set_orientation(Gtk.Orientation.VERTICAL)
        self.add(grid)

        # toolbar

        btn_follow = Gtk.ToggleToolButton.new_from_stock(Gtk.STOCK_CONNECT)
        btn_follow.set_tooltip_text(_("Follow Editor"))
        btn_follow.set_active(self._preferences.get("outline-connect-to-editor"))
        self._base_handlers[btn_follow] = btn_follow.connect("toggled", self._on_follow_toggled)

        btn_expand = Gtk.ToolButton.new_from_stock(Gtk.STOCK_ZOOM_IN)
        btn_expand.set_tooltip_text(_("Expand All"))
        self._base_handlers[btn_expand] = btn_expand.connect("clicked", self._on_expand_clicked)

        btn_collapse = Gtk.ToolButton.new_from_stock(Gtk.STOCK_ZOOM_OUT)
        btn_collapse.set_tooltip_text(_("Collapse All"))
        self._base_handlers[btn_collapse] = btn_collapse.connect("clicked", self._on_collapse_clicked)

        self._toolbar = Gtk.Toolbar()
        self._toolbar.set_style(Gtk.ToolbarStyle.ICONS)
        self._toolbar.set_icon_size(Gtk.IconSize.MENU)
        self._toolbar.insert(btn_follow, -1)
        self._toolbar.insert(Gtk.SeparatorToolItem(), -1)
        self._toolbar.insert(btn_expand, -1)
        self._toolbar.insert(btn_collapse, -1)
        self._toolbar.insert(Gtk.SeparatorToolItem(), -1)
        self._toolbar.set_hexpand(True)

        grid.add(self._toolbar)

        # tree view

        column = Gtk.TreeViewColumn()

        pixbuf_renderer = Gtk.CellRendererPixbuf()
        column.pack_start(pixbuf_renderer, False)
        column.add_attribute(pixbuf_renderer, "pixbuf", 1)

        text_renderer = Gtk.CellRendererText()
        column.pack_start(text_renderer, True)
        column.add_attribute(text_renderer, "markup", 0)

        self._offset_map = OutlineOffsetMap()

        self._store = Gtk.TreeStore(str, GdkPixbuf.Pixbuf, object)    # label, icon, node object

        self._view = Gtk.TreeView(model=self._store)
        self._view.append_column(column)
        self._view.set_headers_visible(False)
        self._cursor_changed_id = self._view.connect("cursor-changed", self._on_cursor_changed)
        self._base_handlers[self._view] = self._view.connect("row-activated", self._on_row_activated)

        scrolled = Gtk.ScrolledWindow()
        scrolled.add(self._view)
        scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        scrolled.set_vexpand(True)

        grid.add(scrolled)

        # this holds a list of the currently expanded paths
        self._expandedPaths = None
Exemple #6
0
 def get_label(self):
     return _("Outline")