def __init__(self, *args, **kwargs): super(MeldSourceView, self).__init__(*args, **kwargs) bind_settings(self) binding_set = Gtk.binding_set_find('GtkSourceView') for key, modifiers in self.replaced_entries: Gtk.binding_entry_remove(binding_set, key, modifiers)
def __init__(self): GtkSource.Buffer.__init__(self) bind_settings(self) self.data = MeldBufferData() self.undo_sequence = None meldsettings.connect('changed', self.on_setting_changed) self.set_style_scheme(meldsettings.style_scheme)
def __init__(self): super().__init__() bind_settings(self) self.data = MeldBufferData() self.undo_sequence = None meldsettings.connect('changed', self.on_setting_changed) self.set_style_scheme(meldsettings.style_scheme)
def __init__(self, filename=None): GtkSource.Buffer.__init__(self) bind_settings(self) self.data = MeldBufferData(filename) self.user_action_count = 0 meldsettings.connect('changed', self.on_setting_changed) self.set_style_scheme(meldsettings.style_scheme)
def do_realize(self): bind_settings(self) self.bind_property( 'enable-space-drawer', self.props.space_drawer, 'enable-matrix', GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE, ) return GtkSource.View.do_realize(self)
def __init__(self): melddoc.MeldDoc.__init__(self) gnomeglade.Component.__init__(self, "vcview.ui", "vcview", ["VcviewActions", 'liststore_vcs']) bind_settings(self) self.ui_file = gnomeglade.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( self.model.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)
def do_realize(self): bind_settings(self) def wrap_mode_from_bool(binding, from_value): if from_value: settings_mode = settings.get_enum('wrap-mode') if settings_mode == Gtk.WrapMode.NONE: mode = Gtk.WrapMode.WORD else: mode = settings_mode else: mode = Gtk.WrapMode.NONE return mode def wrap_mode_to_bool(binding, from_value): return bool(from_value) self.bind_property( 'wrap-mode-bool', self, 'wrap-mode', GObject.BindingFlags.BIDIRECTIONAL, wrap_mode_from_bool, wrap_mode_to_bool, ) self.wrap_mode_bool = wrap_mode_to_bool(None, self.props.wrap_mode) def draw_spaces_from_bool(binding, from_value): return GtkSource.DrawSpacesFlags.ALL if from_value else 0 def draw_spaces_to_bool(binding, from_value): return bool(from_value) self.bind_property( 'draw-spaces-bool', self, 'draw-spaces', GObject.BindingFlags.BIDIRECTIONAL, draw_spaces_from_bool, draw_spaces_to_bool, ) self.draw_spaces_bool = draw_spaces_to_bool(None, self.props.draw_spaces) meld_settings = get_meld_settings() self.on_setting_changed(meld_settings, 'font') self.on_setting_changed(meld_settings, 'style-scheme') self.get_buffer().set_style_scheme(meld_settings.style_scheme) meld_settings.connect('changed', self.on_setting_changed) return GtkSource.View.do_realize(self)
def __init__(self): melddoc.MeldDoc.__init__(self) gnomeglade.Component.__init__(self, "vcview.ui", "vcview", ["VcviewActions", 'liststore_vcs']) bind_settings(self) self.ui_file = gnomeglade.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(self.model.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)
def do_realize(self): bind_settings(self) def wrap_mode_from_bool(binding, from_value): if from_value: settings_mode = settings.get_enum('wrap-mode') if settings_mode == Gtk.WrapMode.NONE: mode = Gtk.WrapMode.WORD else: mode = settings_mode else: mode = Gtk.WrapMode.NONE return mode def wrap_mode_to_bool(binding, from_value): return bool(from_value) self.bind_property( 'wrap-mode-bool', self, 'wrap-mode', GObject.BindingFlags.BIDIRECTIONAL, wrap_mode_from_bool, wrap_mode_to_bool, ) self.wrap_mode_bool = wrap_mode_to_bool(None, self.props.wrap_mode) def draw_spaces_from_bool(binding, from_value): return GtkSource.DrawSpacesFlags.ALL if from_value else 0 def draw_spaces_to_bool(binding, from_value): return bool(from_value) self.bind_property( 'draw-spaces-bool', self, 'draw-spaces', GObject.BindingFlags.BIDIRECTIONAL, draw_spaces_from_bool, draw_spaces_to_bool, ) self.draw_spaces_bool = draw_spaces_to_bool( None, self.props.draw_spaces) self.on_setting_changed(meldsettings, 'font') self.on_setting_changed(meldsettings, 'style-scheme') return GtkSource.View.do_realize(self)
def __init__(self): melddoc.MeldDoc.__init__(self) gnomeglade.Component.__init__(self, "vcview.ui", "vcview", ["VcviewActions", 'liststore_vcs']) bind_settings(self) self.ui_file = gnomeglade.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) selection = self.treeview.get_selection() selection.set_mode(Gtk.SelectionMode.MULTIPLE) selection.connect("changed", self.on_treeview_selection_changed) self.treeview.set_headers_visible(1) self.treeview.set_search_equal_func( self.model.treeview_search_cb, None) self.current_path, self.prev_path, self.next_path = None, None, None self.column_name_map = {} col_index = self.model.column_index column = Gtk.TreeViewColumn(_("Name")) column.set_resizable(True) renicon = emblemcellrenderer.EmblemCellRenderer() column.pack_start(renicon, False) column.set_attributes(renicon, icon_name=col_index(tree.COL_ICON, 0), icon_tint=col_index(tree.COL_TINT, 0)) rentext = Gtk.CellRendererText() column.pack_start(rentext, True) column.set_attributes(rentext, text=col_index(tree.COL_TEXT, 0), foreground=col_index(tree.COL_FG, 0), style=col_index(tree.COL_STYLE, 0), weight=col_index(tree.COL_WEIGHT, 0), strikethrough=col_index(tree.COL_STRIKE, 0)) column_index = self.treeview.append_column(column) - 1 self.column_name_map[vc.DATA_NAME] = column_index def addCol(name, num, data_name=None): column = Gtk.TreeViewColumn(name) column.set_resizable(True) rentext = Gtk.CellRendererText() column.pack_start(rentext, True) column.set_attributes(rentext, markup=self.model.column_index(num, 0)) column_index = self.treeview.append_column(column) - 1 if data_name: self.column_name_map[data_name] = column_index return column self.treeview_column_location = addCol(_("Location"), COL_LOCATION) addCol(_("Status"), COL_STATUS, vc.DATA_STATE) addCol(_("Revision"), COL_REVISION, vc.DATA_REVISION) addCol(_("Options"), COL_OPTIONS, vc.DATA_OPTIONS) self.consolestream = ConsoleStream(self.consoleview) self.location = None self.treeview_column_location.set_visible(self.actiongroup.get_action("VcFlatten").get_active()) self.vc = None self.valid_vc_actions = tuple() cell = Gtk.CellRendererText() self.combobox_vcs.pack_start(cell, False) self.combobox_vcs.add_attribute(cell, 'text', 0) self.combobox_vcs.add_attribute(cell, 'sensitive', 2) self.combobox_vcs.lock = False 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) self.state_filters = [] for s in self.state_actions: if s in self.props.status_filters: action_name = self.state_actions[s][0] self.state_filters.append(s) self.actiongroup.get_action(action_name).set_active(True)
def __init__(self, filename=None): GtkSource.Buffer.__init__(self) bind_settings(self) self.data = MeldBufferData(filename) self.user_action_count = 0
def do_realize(self): bind_settings(self) return GtkSource.View.do_realize(self)
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)
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)
def do_realize(self): bind_settings(self) self.on_setting_changed(meldsettings, 'font') self.on_setting_changed(meldsettings, 'style-scheme') return GtkSource.View.do_realize(self)
def __init__(self): super().__init__() bind_settings(self) self.data = MeldBufferData() self.undo_sequence = None
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)