def __init__(self, parent=None, operations=None): Window.__init__(self, parent) self.set_border_width(0) self.set_title("bzrk diff") # Use two thirds of the screen by default screen = self.get_screen() monitor = screen.get_monitor_geometry(0) width = int(monitor.width * 0.66) height = int(monitor.height * 0.66) self.set_default_size(width, height) self.construct(operations)
def __init__(self, all=False, plain=False, parent=None, branch=None): self.all = all self.plain = plain self._branch = branch Window.__init__(self, parent) self.set_icon(self.render_icon(gtk.STOCK_FIND, gtk.ICON_SIZE_BUTTON)) self.annotate_colormap = AnnotateColorSaturation() self._create() self.revisions = {} self.history = [] self._no_back = set()
def __init__(self, branch, start_revs, maxnum, parent=None): """Create a new BranchWindow. :param branch: Branch object for branch to show. :param start_revs: Revision ids of top revisions. :param maxnum: Maximum number of revisions to display, None for no limit. """ Window.__init__(self, parent=parent) self.set_border_width(0) self.branch = branch self.start_revs = start_revs self.maxnum = maxnum self.config = GlobalConfig() if self.config.get_user_option('viz-compact-view') == 'yes': self.compact_view = True else: self.compact_view = False self.set_title(branch._get_nick(local=True) + " - revision history") # user-configured window size size = self._load_size('viz-window-size') if size: width, height = size else: # Use three-quarters of the screen by default screen = self.get_screen() monitor = screen.get_monitor_geometry(0) width = int(monitor.width * 0.75) height = int(monitor.height * 0.75) self.set_default_size(width, height) self.set_size_request(width/3, height/3) self._save_size_on_destroy(self, 'viz-window-size') # FIXME AndyFitz! icon = self.render_icon(gtk.STOCK_INDEX, gtk.ICON_SIZE_BUTTON) self.set_icon(icon) gtk.accel_map_add_entry("<viz>/Go/Next Revision", gtk.keysyms.Up, gtk.gdk.MOD1_MASK) gtk.accel_map_add_entry("<viz>/Go/Previous Revision", gtk.keysyms.Down, gtk.gdk.MOD1_MASK) gtk.accel_map_add_entry("<viz>/View/Refresh", gtk.keysyms.F5, 0) self.accel_group = gtk.AccelGroup() self.add_accel_group(self.accel_group) if getattr(gtk.Action, 'set_tool_item_type', None) is not None: # Not available before PyGtk-2.10 gtk.Action.set_tool_item_type(gtk.MenuToolButton) self.prev_rev_action = gtk.Action("prev-rev", "_Previous Revision", "Go to the previous revision", gtk.STOCK_GO_DOWN) self.prev_rev_action.set_accel_path("<viz>/Go/Previous Revision") self.prev_rev_action.set_accel_group(self.accel_group) self.prev_rev_action.connect("activate", self._back_clicked_cb) self.prev_rev_action.connect_accelerator() self.next_rev_action = gtk.Action("next-rev", "_Next Revision", "Go to the next revision", gtk.STOCK_GO_UP) self.next_rev_action.set_accel_path("<viz>/Go/Next Revision") self.next_rev_action.set_accel_group(self.accel_group) self.next_rev_action.connect("activate", self._fwd_clicked_cb) self.next_rev_action.connect_accelerator() self.refresh_action = gtk.Action("refresh", "_Refresh", "Refresh view", gtk.STOCK_REFRESH) self.refresh_action.set_accel_path("<viz>/View/Refresh") self.refresh_action.set_accel_group(self.accel_group) self.refresh_action.connect("activate", self._refresh_clicked) self.refresh_action.connect_accelerator() self.construct()
def __init__(self, branch, parent=None): """ Initialize the Tags window. """ Window.__init__(self, parent) # Get arguments self.branch = branch # Create the widgets self._button_add = gtk.Button(stock=gtk.STOCK_ADD) self._button_remove = gtk.Button(stock=gtk.STOCK_REMOVE) self._button_refresh = gtk.Button(stock=gtk.STOCK_REFRESH) self._button_close = gtk.Button(stock=gtk.STOCK_CLOSE) self._model = gtk.ListStore(str, str) self._treeview_tags = gtk.TreeView(self._model) self._scrolledwindow_tags = gtk.ScrolledWindow() self._revisionview = RevisionView() self._hbox = gtk.HBox() self._vbox_buttons = gtk.VBox() self._vbox_buttons_top = gtk.VBox() self._vbox_buttons_bottom = gtk.VBox() self._vpaned = gtk.VPaned() # Set callbacks self._button_add.connect('clicked', self._on_add_clicked) self._button_close.connect('clicked', self._on_close_clicked) self._button_refresh.connect('clicked', self._on_refresh_clicked) self._button_remove.connect('clicked', self._on_remove_clicked) self._treeview_tags.connect('cursor-changed', self._on_treeview_changed) # Set properties self.set_title(_i18n("Tags")) self.set_default_size(600, 400) self._scrolledwindow_tags.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self._hbox.set_border_width(5) self._hbox.set_spacing(5) self._vbox_buttons.set_size_request(100, -1) self._vbox_buttons_top.set_spacing(3) self._vpaned.set_position(200) # Construct the dialog self._scrolledwindow_tags.add(self._treeview_tags) self._vbox_buttons_top.pack_start(self._button_add, False, False) self._vbox_buttons_top.pack_start(self._button_remove, False, False) self._vbox_buttons_top.pack_start(self._button_refresh, False, False) self._vbox_buttons_bottom.pack_start(self._button_close, False, False) self._vbox_buttons.pack_start(self._vbox_buttons_top, True, True) self._vbox_buttons.pack_start(self._vbox_buttons_bottom, False, False) self._vpaned.add1(self._scrolledwindow_tags) self._vpaned.add2(self._revisionview) self._hbox.pack_start(self._vpaned, True, True) self._hbox.pack_start(self._vbox_buttons, False, True) self.add(self._hbox) # Default to no tags self._no_tags = True # Load the tags self._load_tags() # Display everything self._hbox.show_all()