Example #1
0
    def __init__(self):
        MeldDoc.__init__(self)
        Component.__init__(
            self, "vcview.ui", "vcview", ["VcviewActions", 'liststore_vcs'])
        bind_settings(self)

        self.ui_file = ui_file("vcview-ui.xml")
        self.actiongroup = self.VcviewActions
        self.actiongroup.set_translation_domain("meld")
        self.model = VcTreeStore()
        self.widget.connect("style-updated", self.model.on_style_updated)
        self.model.on_style_updated(self.widget)
        self.treeview.set_model(self.model)
        self.treeview.get_selection().connect(
            "changed", self.on_treeview_selection_changed)
        self.treeview.set_search_equal_func(tree.treeview_search_cb, None)
        self.current_path, self.prev_path, self.next_path = None, None, None

        self.name_column.set_attributes(
            self.emblem_renderer,
            icon_name=tree.COL_ICON,
            icon_tint=tree.COL_TINT)
        self.name_column.set_attributes(
            self.name_renderer,
            text=tree.COL_TEXT,
            foreground_rgba=tree.COL_FG,
            style=tree.COL_STYLE,
            weight=tree.COL_WEIGHT,
            strikethrough=tree.COL_STRIKE)
        self.location_column.set_attributes(
            self.location_renderer, markup=COL_LOCATION)
        self.status_column.set_attributes(
            self.status_renderer, markup=COL_STATUS)
        self.extra_column.set_attributes(
            self.extra_renderer, markup=COL_OPTIONS)
        self.location_column.bind_property(
            'visible', self.actiongroup.get_action("VcFlatten"), 'active')

        self.consolestream = ConsoleStream(self.consoleview)
        self.location = None
        self.vc = None

        settings.bind('vc-console-visible',
                      self.actiongroup.get_action('VcConsoleVisible'),
                      'active', Gio.SettingsBindFlags.DEFAULT)
        settings.bind('vc-console-visible', self.console_vbox, 'visible',
                      Gio.SettingsBindFlags.DEFAULT)
        settings.bind('vc-console-pane-position', self.vc_console_vpaned,
                      'position', Gio.SettingsBindFlags.DEFAULT)

        for s in self.props.status_filters:
            if s in self.state_actions:
                self.actiongroup.get_action(
                    self.state_actions[s][0]).set_active(True)
Example #2
0
    def __init__(self):
        MeldDoc.__init__(self)
        Component.__init__(self, "vcview.ui", "vcview",
                           ["VcviewActions", 'liststore_vcs'])
        bind_settings(self)

        self.ui_file = ui_file("vcview-ui.xml")
        self.actiongroup = self.VcviewActions
        self.actiongroup.set_translation_domain("meld")
        self.model = VcTreeStore()
        self.widget.connect("style-updated", self.model.on_style_updated)
        self.model.on_style_updated(self.widget)
        self.treeview.set_model(self.model)
        self.treeview.get_selection().connect(
            "changed", self.on_treeview_selection_changed)
        self.treeview.set_search_equal_func(tree.treeview_search_cb, None)
        self.current_path, self.prev_path, self.next_path = None, None, None

        self.name_column.set_attributes(self.emblem_renderer,
                                        icon_name=tree.COL_ICON,
                                        icon_tint=tree.COL_TINT)
        self.name_column.set_attributes(self.name_renderer,
                                        text=tree.COL_TEXT,
                                        foreground_rgba=tree.COL_FG,
                                        style=tree.COL_STYLE,
                                        weight=tree.COL_WEIGHT,
                                        strikethrough=tree.COL_STRIKE)
        self.location_column.set_attributes(self.location_renderer,
                                            markup=COL_LOCATION)
        self.status_column.set_attributes(self.status_renderer,
                                          markup=COL_STATUS)
        self.extra_column.set_attributes(self.extra_renderer,
                                         markup=COL_OPTIONS)
        self.location_column.bind_property(
            'visible', self.actiongroup.get_action("VcFlatten"), 'active')

        self.consolestream = ConsoleStream(self.consoleview)
        self.location = None
        self.vc = None

        settings.bind('vc-console-visible',
                      self.actiongroup.get_action('VcConsoleVisible'),
                      'active', Gio.SettingsBindFlags.DEFAULT)
        settings.bind('vc-console-visible', self.console_vbox, 'visible',
                      Gio.SettingsBindFlags.DEFAULT)
        settings.bind('vc-console-pane-position', self.vc_console_vpaned,
                      'position', Gio.SettingsBindFlags.DEFAULT)

        for s in self.props.status_filters:
            if s in self.state_actions:
                self.actiongroup.get_action(
                    self.state_actions[s][0]).set_active(True)
Example #3
0
    def __init__(self):
        super().__init__()
        # FIXME:
        # This unimaginable hack exists because GObject (or GTK+?)
        # doesn't actually correctly chain init calls, even if they're
        # not to GObjects. As a workaround, we *should* just be able to
        # put our class first, but because of Gtk.Template we can't do
        # that if it's a GObject, because GObject doesn't support
        # multiple inheritance and we need to inherit from our Widget
        # parent to make Template work.
        MeldDoc.__init__(self)
        self.init_template()
        bind_settings(self)

        # Set up per-view action group for top-level menu insertion
        self.view_action_group = Gio.SimpleActionGroup()

        property_actions = (('vc-console-visible', self.console_vbox,
                             'visible'), )
        for action_name, obj, prop_name in property_actions:
            action = Gio.PropertyAction.new(action_name, obj, prop_name)
            self.view_action_group.add_action(action)

        # Manually handle GAction additions
        actions = (
            ('compare', self.action_diff),
            ('find', self.action_find),
            ('next-change', self.action_next_change),
            ('open-external', self.action_open_external),
            ('previous-change', self.action_previous_change),
            ('refresh', self.action_refresh),
            ('vc-add', self.action_add),
            ('vc-commit', self.action_commit),
            ('vc-delete-locally', self.action_delete),
            ('vc-push', self.action_push),
            ('vc-remove', self.action_remove),
            ('vc-resolve', self.action_resolved),
            ('vc-revert', self.action_revert),
            ('vc-update', self.action_update),
        )
        for name, callback in actions:
            action = Gio.SimpleAction.new(name, None)
            action.connect('activate', callback)
            self.view_action_group.add_action(action)

        new_boolean = GLib.Variant.new_boolean
        stateful_actions = (
            ('vc-flatten', self.action_filter_state_change,
             new_boolean('flatten' in self.props.status_filters)),
            ('vc-status-modified', self.action_filter_state_change,
             new_boolean('modified' in self.props.status_filters)),
            ('vc-status-normal', self.action_filter_state_change,
             new_boolean('normal' in self.props.status_filters)),
            ('vc-status-unknown', self.action_filter_state_change,
             new_boolean('unknown' in self.props.status_filters)),
            ('vc-status-ignored', self.action_filter_state_change,
             new_boolean('ignored' in self.props.status_filters)),
        )
        for (name, callback, state) in stateful_actions:
            action = Gio.SimpleAction.new_stateful(name, None, state)
            action.connect('change-state', callback)
            self.view_action_group.add_action(action)

        builder = Gtk.Builder.new_from_resource(
            '/org/gnome/meld/ui/vcview-menus.ui')
        context_menu = builder.get_object('vcview-context-menu')
        self.popup_menu = Gtk.Menu.new_from_model(context_menu)
        self.popup_menu.attach_to_widget(self)

        self.model = VcTreeStore()
        self.connect("style-updated", self.model.on_style_updated)
        self.model.on_style_updated(self)
        self.treeview.set_model(self.model)
        self.treeview.get_selection().connect(
            "changed", self.on_treeview_selection_changed)
        self.treeview.set_search_equal_func(tree.treeview_search_cb, None)
        self.current_path, self.prev_path, self.next_path = None, None, None

        self.name_column.set_attributes(self.emblem_renderer,
                                        icon_name=tree.COL_ICON,
                                        icon_tint=tree.COL_TINT)
        self.name_column.set_attributes(self.name_renderer,
                                        text=tree.COL_TEXT,
                                        foreground_rgba=tree.COL_FG,
                                        style=tree.COL_STYLE,
                                        weight=tree.COL_WEIGHT,
                                        strikethrough=tree.COL_STRIKE)
        self.location_column.set_attributes(self.location_renderer,
                                            markup=COL_LOCATION)
        self.status_column.set_attributes(self.status_renderer,
                                          markup=COL_STATUS)
        self.extra_column.set_attributes(self.extra_renderer,
                                         markup=COL_OPTIONS)

        self.consolestream = ConsoleStream(self.consoleview)
        self.location = None
        self.vc = None

        settings.bind('vc-console-visible', self.console_vbox, 'visible',
                      Gio.SettingsBindFlags.DEFAULT)
        settings.bind('vc-console-pane-position', self.vc_console_vpaned,
                      'position', Gio.SettingsBindFlags.DEFAULT)
Example #4
0
    def __init__(self):
        super().__init__()
        # FIXME:
        # This unimaginable hack exists because GObject (or GTK+?)
        # doesn't actually correctly chain init calls, even if they're
        # not to GObjects. As a workaround, we *should* just be able to
        # put our class first, but because of Gtk.Template we can't do
        # that if it's a GObject, because GObject doesn't support
        # multiple inheritance and we need to inherit from our Widget
        # parent to make Template work.
        MeldDoc.__init__(self)
        self.init_template()
        bind_settings(self)

        self.ui_file = ui_file("vcview-ui.xml")
        self.actiongroup = self.VcviewActions
        self.actiongroup.set_translation_domain("meld")
        self.model = VcTreeStore()
        self.connect("style-updated", self.model.on_style_updated)
        self.model.on_style_updated(self)
        self.treeview.set_model(self.model)
        self.treeview.get_selection().connect(
            "changed", self.on_treeview_selection_changed)
        self.treeview.set_search_equal_func(tree.treeview_search_cb, None)
        self.current_path, self.prev_path, self.next_path = None, None, None

        self.name_column.set_attributes(
            self.emblem_renderer,
            icon_name=tree.COL_ICON,
            icon_tint=tree.COL_TINT)
        self.name_column.set_attributes(
            self.name_renderer,
            text=tree.COL_TEXT,
            foreground_rgba=tree.COL_FG,
            style=tree.COL_STYLE,
            weight=tree.COL_WEIGHT,
            strikethrough=tree.COL_STRIKE)
        self.location_column.set_attributes(
            self.location_renderer, markup=COL_LOCATION)
        self.status_column.set_attributes(
            self.status_renderer, markup=COL_STATUS)
        self.extra_column.set_attributes(
            self.extra_renderer, markup=COL_OPTIONS)
        self.location_column.bind_property(
            'visible', self.actiongroup.get_action("VcFlatten"), 'active')

        self.consolestream = ConsoleStream(self.consoleview)
        self.location = None
        self.vc = None

        settings.bind('vc-console-visible',
                      self.actiongroup.get_action('VcConsoleVisible'),
                      'active', Gio.SettingsBindFlags.DEFAULT)
        settings.bind('vc-console-visible', self.console_vbox, 'visible',
                      Gio.SettingsBindFlags.DEFAULT)
        settings.bind('vc-console-pane-position', self.vc_console_vpaned,
                      'position', Gio.SettingsBindFlags.DEFAULT)

        for s in self.props.status_filters:
            if s in self.state_actions:
                self.actiongroup.get_action(
                    self.state_actions[s][0]).set_active(True)
Example #5
0
File: vcview.py Project: GNOME/meld
    def __init__(self):
        super().__init__()
        # FIXME:
        # This unimaginable hack exists because GObject (or GTK+?)
        # doesn't actually correctly chain init calls, even if they're
        # not to GObjects. As a workaround, we *should* just be able to
        # put our class first, but because of Gtk.Template we can't do
        # that if it's a GObject, because GObject doesn't support
        # multiple inheritance and we need to inherit from our Widget
        # parent to make Template work.
        MeldDoc.__init__(self)
        self.init_template()
        bind_settings(self)

        # Set up per-view action group for top-level menu insertion
        self.view_action_group = Gio.SimpleActionGroup()

        property_actions = (
            ('vc-console-visible', self.console_vbox, 'visible'),
        )
        for action_name, obj, prop_name in property_actions:
            action = Gio.PropertyAction.new(action_name, obj, prop_name)
            self.view_action_group.add_action(action)

        # Manually handle GAction additions
        actions = (
            ('compare', self.action_diff),
            ('find', self.action_find),
            ('next-change', self.action_next_change),
            ('open-external', self.action_open_external),
            ('previous-change', self.action_previous_change),
            ('refresh', self.action_refresh),
            ('vc-add', self.action_add),
            ('vc-commit', self.action_commit),
            ('vc-delete-locally', self.action_delete),
            ('vc-push', self.action_push),
            ('vc-remove', self.action_remove),
            ('vc-resolve', self.action_resolved),
            ('vc-revert', self.action_revert),
            ('vc-update', self.action_update),
        )
        for name, callback in actions:
            action = Gio.SimpleAction.new(name, None)
            action.connect('activate', callback)
            self.view_action_group.add_action(action)

        new_boolean = GLib.Variant.new_boolean
        stateful_actions = (
            ('vc-flatten', self.action_filter_state_change,
                new_boolean('flatten' in self.props.status_filters)),
            ('vc-status-modified', self.action_filter_state_change,
                new_boolean('modified' in self.props.status_filters)),
            ('vc-status-normal', self.action_filter_state_change,
                new_boolean('normal' in self.props.status_filters)),
            ('vc-status-unknown', self.action_filter_state_change,
                new_boolean('unknown' in self.props.status_filters)),
            ('vc-status-ignored', self.action_filter_state_change,
                new_boolean('ignored' in self.props.status_filters)),
        )
        for (name, callback, state) in stateful_actions:
            action = Gio.SimpleAction.new_stateful(name, None, state)
            action.connect('change-state', callback)
            self.view_action_group.add_action(action)

        builder = Gtk.Builder.new_from_resource(
            '/org/gnome/meld/ui/vcview-menus.ui')
        context_menu = builder.get_object('vcview-context-menu')
        self.popup_menu = Gtk.Menu.new_from_model(context_menu)
        self.popup_menu.attach_to_widget(self)

        self.model = VcTreeStore()
        self.connect("style-updated", self.model.on_style_updated)
        self.model.on_style_updated(self)
        self.treeview.set_model(self.model)
        self.treeview.get_selection().connect(
            "changed", self.on_treeview_selection_changed)
        self.treeview.set_search_equal_func(tree.treeview_search_cb, None)
        self.current_path, self.prev_path, self.next_path = None, None, None

        self.name_column.set_attributes(
            self.emblem_renderer,
            icon_name=tree.COL_ICON,
            icon_tint=tree.COL_TINT)
        self.name_column.set_attributes(
            self.name_renderer,
            text=tree.COL_TEXT,
            foreground_rgba=tree.COL_FG,
            style=tree.COL_STYLE,
            weight=tree.COL_WEIGHT,
            strikethrough=tree.COL_STRIKE)
        self.location_column.set_attributes(
            self.location_renderer, markup=COL_LOCATION)
        self.status_column.set_attributes(
            self.status_renderer, markup=COL_STATUS)
        self.extra_column.set_attributes(
            self.extra_renderer, markup=COL_OPTIONS)

        self.consolestream = ConsoleStream(self.consoleview)
        self.location = None
        self.vc = None

        settings.bind('vc-console-visible', self.console_vbox, 'visible',
                      Gio.SettingsBindFlags.DEFAULT)
        settings.bind('vc-console-pane-position', self.vc_console_vpaned,
                      'position', Gio.SettingsBindFlags.DEFAULT)