def __init__(self): super(BugsTab, self).__init__(False, 6) table = gtk.Table(rows=2, columns=2) table.set_row_spacings(6) table.set_col_spacing(0, 16) image = gtk.Image() image.set_from_file(icon_path("bug.png")) table.attach(image, 0, 1, 0, 1, gtk.FILL) align = gtk.Alignment(0.0, 0.1) self.label = gtk.Label() align.add(self.label) table.attach(align, 1, 2, 0, 1, gtk.FILL) treeview = self.construct_treeview() table.attach(treeview, 1, 2, 1, 2, gtk.FILL | gtk.EXPAND) self.set_border_width(6) self.pack_start(table, expand=False) self.clear() self.show_all()
def __init__(self): super(BugsTab, self).__init__(homogeneous=False, spacing=6) table = Gtk.Table(rows=2, columns=2) table.set_row_spacings(6) table.set_col_spacing(0, 16) image = Gtk.Image() image.set_from_file(icon_path("bug.png")) table.attach(image, 0, 1, 0, 1, Gtk.AttachOptions.FILL) align = Gtk.Alignment.new(0.0, 0.1, 0, 0) self.label = Gtk.Label() align.add(self.label) table.attach(align, 1, 2, 0, 1, Gtk.AttachOptions.FILL) treeview = self.construct_treeview() table.attach(treeview, 1, 2, 1, 2, Gtk.AttachOptions.FILL | Gtk.AttachOptions.EXPAND) self.set_border_width(6) self.pack_start(table, False, True, 0) self.clear() self.show_all()
def show_no_signature(self): self.signature_key_id_label.hide() self.signature_key_id.set_text("") self.signature_fingerprint_label.hide() self.signature_fingerprint.set_text("") self.signature_trust_label.hide() self.signature_trust.set_text("") self.signature_image.set_from_file(icon_path("sign-unknown.png")) self.signature_label.set_markup("<b>Authenticity unknown</b>\n" + "This revision has not been signed.")
def __init__(self): super(AboutDialog, self).__init__() self.set_name("Bazaar GTK") self.set_version(bzrlib.plugins.gtk.version_string) self.set_website("http://bazaar-vcs.org/BzrGtk") self.set_license(read_license()) self.set_logo(gtk.gdk.pixbuf_new_from_file(icon_path("bzr-icon-64.png"))) credits = load_credits() if credits is not None: (authors, documenters, artists, translators) = credits self.set_authors(authors) self.set_documenters(documenters) self.set_artists(artists) self.set_translator_credits("\n".join(translators)) self.connect("response", lambda d, r: d.destroy())
def __init__(self, wt, wtpath, default_branch_path=None, parent=None): """ Initialize the Merge dialog. """ gtk.Dialog.__init__(self, title="Merge changes", parent=parent, flags=0, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) self.set_icon_from_file(icon_path("bzr-icon-64.png")) # Get arguments self.wt = wt self.wtpath = wtpath self.default_branch_path = default_branch_path self.parent_window = parent # Create widgets self._hbox = gtk.HBox() self._source = gtk.HBox() self._label_merge_from = gtk.Label(_i18n("Merge from")) self._combo_source = gtk.combo_box_new_text() for entry in [_i18n("Folder"),_i18n("Custom Location")]: self._combo_source.append_text(entry) self._combo_source.connect("changed", self._on_combo_changed) self._button_merge = gtk.Button(_i18n("_Merge")) self._button_merge_icon = gtk.Image() self._button_merge_icon.set_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_BUTTON) self._button_merge.set_image(self._button_merge_icon) self._button_merge.connect('clicked', self._on_merge_clicked) # Add widgets to dialog self.vbox.pack_start(self._hbox, False, False, 0) self._hbox.add(self._label_merge_from) self._hbox.add(self._combo_source) self._hbox.set_spacing(5) self.action_area.pack_end(self._button_merge) if self.default_branch_path and os.path.isdir( self.default_branch_path.partition('file://')[2]): self.directory = self.default_branch_path.partition('file://')[2] self._combo_source.set_active(0) elif self.default_branch_path: self._combo_source.set_active(1) else: # If no default_branch_path give, default to folder source with current folder self._combo_source.set_active(0) self.vbox.show_all()
def __init__(self, wt, wtpath, default_branch_path=None, parent=None): """ Initialize the Merge dialog. """ super(MergeDialog, self).__init__( title="Merge changes", parent=parent, flags=0, buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)) self.set_icon_from_file(icon_path("bzr-icon-64.png")) # Get arguments self.wt = wt self.wtpath = wtpath self.default_branch_path = default_branch_path self.parent_window = parent # Create widgets self._hbox = Gtk.HBox() self._source = Gtk.HBox() self._label_merge_from = Gtk.Label(label=_i18n("Merge from")) self._combo_source = Gtk.ComboBoxText() for entry in [_i18n("Folder"),_i18n("Custom Location")]: self._combo_source.append_text(entry) self._combo_source.connect("changed", self._on_combo_changed) self._button_merge = Gtk.Button(_i18n("_Merge"), use_underline=True) self._button_merge_icon = Gtk.Image() self._button_merge_icon.set_from_stock(Gtk.STOCK_APPLY, Gtk.IconSize.BUTTON) self._button_merge.set_image(self._button_merge_icon) self._button_merge.connect('clicked', self._on_merge_clicked) # Add widgets to dialog self.get_content_area().pack_start(self._hbox, False, False, 0) self._hbox.add(self._label_merge_from) self._hbox.add(self._combo_source) self._hbox.set_spacing(5) self.action_area.pack_end(self._button_merge, False, False, 0) if self.default_branch_path and os.path.isdir( self.default_branch_path.partition('file://')[2]): self.directory = self.default_branch_path.partition('file://')[2] self._combo_source.set_active(0) elif self.default_branch_path: self._combo_source.set_active(1) else: # If no default_branch_path give, default to folder source with current folder self._combo_source.set_active(0) self.get_content_area().show_all()
def _update_tags(self): menu = gtk.Menu() if self.branch.supports_tags(): tags = self.branch.tags.get_tag_dict().items() tags.sort(reverse=True) for tag, revid in tags: tag_image = gtk.Image() tag_image.set_from_file(icon_path('tag-16.png')) tag_item = gtk.ImageMenuItem(tag.replace('_', '__')) tag_item.set_image(tag_image) tag_item.connect('activate', self._tag_selected_cb, revid) tag_item.set_sensitive(self.treeview.has_revision_id(revid)) menu.add(tag_item) self.go_menu_tags.set_submenu(menu) self.go_menu_tags.set_sensitive(len(tags) != 0) else: self.go_menu_tags.set_sensitive(False) self.go_menu_tags.show_all()
def construct_menubar(self): menubar = Gtk.MenuBar() file_menu = Gtk.Menu() file_menuitem = Gtk.MenuItem.new_with_mnemonic("_File") file_menuitem.set_submenu(file_menu) file_menu_close = Gtk.ImageMenuItem.new_from_stock( Gtk.STOCK_CLOSE, self.accel_group) file_menu_close.connect('activate', lambda x: self.destroy()) file_menu_quit = Gtk.ImageMenuItem.new_from_stock( Gtk.STOCK_QUIT, self.accel_group) file_menu_quit.connect('activate', lambda x: Gtk.main_quit()) if self._parent is not None: file_menu.add(file_menu_close) file_menu.add(file_menu_quit) edit_menu = Gtk.Menu() edit_menuitem = Gtk.MenuItem.new_with_mnemonic("_Edit") edit_menuitem.set_submenu(edit_menu) edit_menu_branchopts = Gtk.MenuItem(label="Branch Settings") edit_menu_branchopts.connect('activate', lambda x: PreferencesWindow(self.branch.get_config()).show()) edit_menu_globopts = Gtk.MenuItem(label="Global Settings") edit_menu_globopts.connect('activate', lambda x: PreferencesWindow().show()) edit_menu.add(edit_menu_branchopts) edit_menu.add(edit_menu_globopts) view_menu = Gtk.Menu() view_menuitem = Gtk.MenuItem.new_with_mnemonic("_View") view_menuitem.set_submenu(view_menu) view_menu_refresh = self.refresh_action.create_menu_item() view_menu_refresh.connect('activate', self._refresh_clicked) view_menu.add(view_menu_refresh) view_menu.add(Gtk.SeparatorMenuItem()) view_menu_toolbar = Gtk.CheckMenuItem(label="Show Toolbar") view_menu_toolbar.set_active(True) if self.config.get_user_option('viz-toolbar-visible') == 'False': view_menu_toolbar.set_active(False) self.toolbar.hide() view_menu_toolbar.connect('toggled', self._toolbar_visibility_changed) view_menu_compact = Gtk.CheckMenuItem(label="Show Compact Graph") view_menu_compact.set_active(self.compact_view) view_menu_compact.connect('activate', self._brokenlines_toggled_cb) view_menu_vertical = Gtk.CheckMenuItem(label="Side-by-side Layout") view_menu_vertical.set_active(False) if self.config.get_user_option('viz-vertical') == 'True': view_menu_vertical.set_active(True) view_menu_vertical.connect('toggled', self._vertical_layout) view_menu_diffs = Gtk.CheckMenuItem(label="Show Diffs") view_menu_diffs.set_active(False) if self.config.get_user_option('viz-show-diffs') == 'True': view_menu_diffs.set_active(True) view_menu_diffs.connect('toggled', self._diff_visibility_changed) view_menu_wide_diffs = Gtk.CheckMenuItem(label="Wide Diffs") view_menu_wide_diffs.set_active(False) if self.config.get_user_option('viz-wide-diffs') == 'True': view_menu_wide_diffs.set_active(True) view_menu_wide_diffs.connect('toggled', self._diff_placement_changed) view_menu_wrap_diffs = Gtk.CheckMenuItem.new_with_mnemonic( "Wrap _Long Lines in Diffs") view_menu_wrap_diffs.set_active(False) if self.config.get_user_option('viz-wrap-diffs') == 'True': view_menu_wrap_diffs.set_active(True) view_menu_wrap_diffs.connect('toggled', self._diff_wrap_changed) view_menu.add(view_menu_toolbar) view_menu.add(view_menu_compact) view_menu.add(view_menu_vertical) view_menu.add(Gtk.SeparatorMenuItem()) view_menu.add(view_menu_diffs) view_menu.add(view_menu_wide_diffs) view_menu.add(view_menu_wrap_diffs) view_menu.add(Gtk.SeparatorMenuItem()) self.mnu_show_revno_column = Gtk.CheckMenuItem.new_with_mnemonic( "Show Revision _Number Column") self.mnu_show_date_column = Gtk.CheckMenuItem.new_with_mnemonic( "Show _Date Column") # Revision numbers are pointless if there are multiple branches if len(self.start_revs) > 1: self.mnu_show_revno_column.set_sensitive(False) self.treeview.set_property('revno-column-visible', False) for (col, name) in [(self.mnu_show_revno_column, "revno"), (self.mnu_show_date_column, "date")]: col.set_active(self.treeview.get_property(name + "-column-visible")) col.connect('toggled', self._col_visibility_changed, name) view_menu.add(col) go_menu = Gtk.Menu() go_menu.set_accel_group(self.accel_group) go_menuitem = Gtk.MenuItem.new_with_mnemonic("_Go") go_menuitem.set_submenu(go_menu) go_menu_next = self.next_rev_action.create_menu_item() go_menu_prev = self.prev_rev_action.create_menu_item() tag_image = Gtk.Image() tag_image.set_from_file(icon_path("tag-16.png")) self.go_menu_tags = Gtk.ImageMenuItem.new_with_mnemonic("_Tags") self.go_menu_tags.set_image(tag_image) self.treeview.connect('refreshed', lambda w: self._update_tags()) go_menu.add(go_menu_next) go_menu.add(go_menu_prev) go_menu.add(Gtk.SeparatorMenuItem()) go_menu.add(self.go_menu_tags) self.revision_menu = RevisionMenu(self.branch.repository, [], self.branch, parent=self) revision_menuitem = Gtk.MenuItem.new_with_mnemonic("_Revision") revision_menuitem.set_submenu(self.revision_menu) branch_menu = Gtk.Menu() branch_menuitem = Gtk.MenuItem.new_with_mnemonic("_Branch") branch_menuitem.set_submenu(branch_menu) branch_menu.add(Gtk.MenuItem.new_with_mnemonic("Pu_ll Revisions")) branch_menu.add(Gtk.MenuItem.new_with_mnemonic("Pu_sh Revisions")) try: from bzrlib.plugins import search except ImportError: mutter("Didn't find search plugin") else: branch_menu.add(Gtk.SeparatorMenuItem()) branch_index_menuitem = Gtk.MenuItem.new_with_mnemonic("_Index") branch_index_menuitem.connect('activate', self._branch_index_cb) branch_menu.add(branch_index_menuitem) branch_search_menuitem = Gtk.MenuItem.new_with_mnemonic("_Search") branch_search_menuitem.connect('activate', self._branch_search_cb) branch_menu.add(branch_search_menuitem) help_menu = Gtk.Menu() help_menuitem = Gtk.MenuItem.new_with_mnemonic("_Help") help_menuitem.set_submenu(help_menu) help_about_menuitem = Gtk.ImageMenuItem.new_from_stock( Gtk.STOCK_ABOUT, self.accel_group) help_about_menuitem.connect('activate', self._about_dialog_cb) help_menu.add(help_about_menuitem) menubar.add(file_menuitem) menubar.add(edit_menuitem) menubar.add(view_menuitem) menubar.add(go_menuitem) menubar.add(revision_menuitem) menubar.add(branch_menuitem) menubar.add(help_menuitem) menubar.show_all() return menubar
def show_signature(self, crypttext): (cleartext, key) = seahorse.verify(crypttext) assert cleartext is not None inv = self.repository.get_inventory(self.revision.revision_id) expected_testament = Testament(self.revision, inv).as_short_text() if expected_testament != cleartext: self.signature_image.set_from_file(icon_path("sign-bad.png")) self.signature_label.set_markup( "<b>Signature does not match repository data</b>\n" + "The signature plaintext is different from the expected testament plaintext." ) return if key and key.is_available(): if key.is_trusted(): if key.get_display_name() == self.revision.committer: self.signature_image.set_from_file(icon_path("sign-ok.png")) self.signature_label.set_markup( "<b>Authenticity confirmed</b>\n" + "This revision has been signed with " + "a trusted key." ) else: self.signature_image.set_from_file(icon_path("sign-bad.png")) self.signature_label.set_markup( "<b>Authenticity cannot be confirmed</b>\n" + "Revision committer is not the same as signer." ) else: self.signature_image.set_from_file(icon_path("sign-bad.png")) self.signature_label.set_markup( "<b>Authenticity cannot be confirmed</b>\n" + "This revision has been signed, but the " + "key is not trusted." ) else: self.show_no_signature() self.signature_image.set_from_file(icon_path("sign-bad.png")) self.signature_label.set_markup( "<b>Authenticity cannot be confirmed</b>\n" + "Signature key not available." ) return trust = key.get_trust() if trust <= seahorse.TRUST_NEVER: trust_text = "never trusted" elif trust == seahorse.TRUST_UNKNOWN: trust_text = "not trusted" elif trust == seahorse.TRUST_MARGINAL: trust_text = "marginally trusted" elif trust == seahorse.TRUST_FULL: trust_text = "fully trusted" elif trust == seahorse.TRUST_ULTIMATE: trust_text = "ultimately trusted" self.signature_key_id_label.show() self.signature_key_id.set_text(key.get_id()) fingerprint = key.get_fingerprint() if fingerprint == "": fingerprint = '<span foreground="dim grey">N/A</span>' self.signature_fingerprint_label.show() self.signature_fingerprint.set_markup(fingerprint) self.signature_trust_label.show() self.signature_trust.set_text("This key is " + trust_text)