def __init__(self, root='', files=[], list_clean=False, select=False, page=100): """ Initialize the Dialog """ if select: buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT) else: buttons = (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE) super(HistoryDialog, self).__init__(flags=gtk.DIALOG_MODAL, buttons=buttons) set_tortoise_icon(self, 'menulog.ico') # set dialog title title = "hg log " if root: title += " - %s" % root self.set_title(title) self.root = root self.files = files self.list_clean = list_clean self.page_size = page self.start_rev = 'tip' self.tip_rev = None self.selected = (None, None) # build dialog self._create() # display history self._generate_history()
def __init__(self, cwd='', repos=[]): """ Initialize the Dialog """ gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) shlib.set_tortoise_icon(self, 'menuclone.ico') if cwd: os.chdir(cwd) # set dialog title title = "hg clone " title += " - %s" % (os.getcwd()) self.set_title(title) self._src_path = '' self._dest_path = '' self._settings = shlib.Settings('clone') self._recent_src = self._settings.mrul('src_paths') self._recent_dest = self._settings.mrul('dest_paths') try: self._src_path = repos[0] self._dest_path = repos[1] except: pass # build dialog self._create()
def __init__(self, root=''): """ Initialize the Dialog. """ gtk.Dialog.__init__(self, title="TortoiseHg Revisions - %s" % root, parent=None, flags=0, buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)) set_tortoise_icon(self, 'menurepobrowse.ico') self.root = root self.connect('response', gtk.main_quit) self._button_refresh = gtk.Button(_("Refresh")) self._button_refresh.connect('clicked', self._button_refresh_clicked) self._button_refresh.set_flags(gtk.CAN_DEFAULT) self.action_area.pack_end(self._button_refresh) # Create a new notebook, place the position of the tabs self.notebook = notebook = gtk.Notebook() notebook.set_tab_pos(gtk.POS_TOP) self.vbox.pack_start(notebook) notebook.show() self.show_tabs = True self.show_border = True # create pages for each type of revision info self.pages = [] self.tip_tree = self.add_page(notebook, 'Tip') self.parents_tree = self.add_page(notebook, 'Parents') self.heads_tree = self.add_page(notebook, 'Heads') self.vbox.show_all() # populate revision data self._get_revisions()
def __init__(self): gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) set_tortoise_icon(self, 'menudiff.ico') self.set_border_width(0) self.set_title("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()
def __init__(self, root='', cwd='', rev=''): """ Initialize the Dialog """ gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) set_tortoise_icon(self, 'menumerge.ico') # set dialog title title = "hg merge" if root: title += " - %s" % root self.set_title(title) self.root = root self.cwd = cwd or root self.rev = rev self.repo = None self.notify_func = None self._create()
def _setup_gtk(self): self.set_title(self.get_title()) set_tortoise_icon(self, self.get_icon()) # Minimum size minx, miny = self.get_minsize() self.set_size_request(minx, miny) # Initial size defx, defy = self.get_defsize() self.set_default_size(defx, defy) vbox = gtk.VBox(False, 0) self.add(vbox) self.tooltips = gtk.Tooltips() toolbar = gtk.Toolbar() tbuttons = self.get_tbbuttons() for tbutton in tbuttons: toolbar.insert(tbutton, -1) sep = gtk.SeparatorToolItem() sep.set_expand(True) sep.set_draw(False) toolbar.insert(sep, -1) if self.main: name = "Quit" tip = "Close Application" else: name = "Close" tip = "Close Window" button = self.make_toolbutton(gtk.STOCK_CLOSE, name, self._quit_clicked, tip=tip) toolbar.insert(button, -1) self.toolbar = toolbar vbox.pack_start(toolbar, False, False, 0) # Subclass returns the main body body = self.get_body() vbox.pack_start(body, True, True, 0) # Subclass provides extra stuff in bottom hbox extras = self.get_extras() if extras: vbox.pack_end(extras, False, False, 0) self.connect("destroy", self._destroying) self.connect("delete_event", self.should_live)
def __init__(self, cwd='', rev=''): """ Initialize the Dialog """ gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) set_tortoise_icon(self, 'menucheckout.ico') self.cwd = cwd or os.getcwd() self.root = rootpath(self.cwd) self.rev = rev self.notify_func = None u = ui.ui() try: self.repo = hg.repository(u, path=self.root) except RepoError: return None # set dialog title title = "hg update - %s" % self.cwd self.set_title(title) self._create()
def __init__(self, cwd='', root=''): """ Initialize the Dialog """ gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) set_tortoise_icon(self, 'proxy.ico') self.connect('delete-event', self._delete) # Pipe stderr, stdout to self.write self._queue = Queue.Queue() sys.stdout = self sys.stderr = self # Override mercurial.commands.serve() with our own version # that supports being stopped commands.table.update(thg_serve_cmd) self._url = None self._root = root if cwd: os.chdir(cwd) self._get_config() self.set_default_size(500, 300) # toolbar self.tbar = gtk.Toolbar() self._button_start = self._toolbutton(gtk.STOCK_MEDIA_PLAY, 'Start', self._on_start_clicked, None) self._button_stop = self._toolbutton(gtk.STOCK_MEDIA_STOP, 'Stop', self._on_stop_clicked, None) self._button_browse = self._toolbutton(gtk.STOCK_HOME, 'Browse', self._on_browse_clicked, None) self._button_conf = self._toolbutton(gtk.STOCK_PREFERENCES, 'Configure', self._on_conf_clicked, None) sep = gtk.SeparatorToolItem() sep.set_expand(True) sep.set_draw(False) self._button_close = self._toolbutton(gtk.STOCK_CLOSE, 'Quit', self._close_clicked) tbuttons = [ self._button_start, self._button_stop, gtk.SeparatorToolItem(), self._button_browse, gtk.SeparatorToolItem(), self._button_conf, sep, self._button_close, ] for btn in tbuttons: self.tbar.insert(btn, -1) vbox = gtk.VBox() self.add(vbox) vbox.pack_start(self.tbar, False, False, 2) # revision input revbox = gtk.HBox() lbl = gtk.Label("HTTP Port:") lbl.set_property("width-chars", 16) lbl.set_alignment(0, 0.5) self._port_input = gtk.Entry() self._port_input.set_text(self.defport) revbox.pack_start(lbl, False, False) revbox.pack_start(self._port_input, False, False) vbox.pack_start(revbox, False, False, 2) scrolledwindow = gtk.ScrolledWindow() scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN) scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.textview = gtk.TextView(buffer=None) self.textview.set_editable(False) self.textview.modify_font(pango.FontDescription("Monospace")) scrolledwindow.add(self.textview) self.textview.set_editable(False) self.textbuffer = self.textview.get_buffer() vbox.pack_start(scrolledwindow, True, True) self._set_button_states()
def __init__(self, cwd='', root = '', repos=[]): """ Initialize the Dialog. """ gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) shlib.set_tortoise_icon(self, 'menusynch.ico') self.root = root self.cwd = cwd self.selected_path = None self.hgthread = None # persistent app data self._settings = shlib.Settings('synch') self._recent_src = self._settings.mrul('src_paths') self.set_default_size(610, 400) self.paths = self._get_paths() self.origchangecount = self.repo.changelog.count() # load the fetch extension explicitly extensions.load(self.ui, 'fetch', None) name = self.repo.ui.config('web', 'name') or os.path.basename(root) self.set_title("TortoiseHg Synchronize - " + name) self.connect('delete-event', self._delete) # toolbar self.tbar = gtk.Toolbar() self.tips = gtk.Tooltips() self._stop_button = self._toolbutton(gtk.STOCK_STOP, 'Stop', self._stop_clicked, tip='Stop the hg operation') self._stop_button.set_sensitive(False) tbuttons = [ self._toolbutton(gtk.STOCK_GO_DOWN, 'Incoming', self._incoming_clicked, tip='Display changes that can be pulled' ' from selected repository'), self._toolbutton(gtk.STOCK_GOTO_BOTTOM, ' Pull ', self._pull_clicked, self._pull_menu(), tip='Pull changes from selected' ' repository'), gtk.SeparatorToolItem(), self._toolbutton(gtk.STOCK_GO_UP, 'Outgoing', self._outgoing_clicked, tip='Display local changes that will be pushed' ' to selected repository'), self._toolbutton(gtk.STOCK_GOTO_TOP, 'Push', self._push_clicked, tip='Push local changes to selected' ' repository'), self._toolbutton(gtk.STOCK_GOTO_LAST, 'Email', self._email_clicked, tip='Email local outgoing changes to' ' one or more recipients'), gtk.SeparatorToolItem(), self._stop_button, gtk.SeparatorToolItem(), self._toolbutton(gtk.STOCK_PREFERENCES, 'Configure', self._conf_clicked, tip='Configure peer repository paths'), gtk.SeparatorToolItem(), ] for btn in tbuttons: self.tbar.insert(btn, -1) sep = gtk.SeparatorToolItem() sep.set_expand(True) sep.set_draw(False) self.tbar.insert(sep, -1) button = self._toolbutton(gtk.STOCK_CLOSE, 'Quit', self._close_clicked, tip='Quit Application') self.tbar.insert(button, -1) vbox = gtk.VBox() self.add(vbox) vbox.pack_start(self.tbar, False, False, 2) # revision input revbox = gtk.HBox() lbl = gtk.Button("Remote Path:") lbl.unset_flags(gtk.CAN_FOCUS) lbl.connect('clicked', self._btn_remotepath_clicked) # revisions combo box self.pathlist = gtk.ListStore(str) self._pathbox = gtk.ComboBoxEntry(self.pathlist, 0) self._pathtext = self._pathbox.get_child() defrow = None defpushrow = None for row, (name, path) in enumerate(self.paths): if name == 'default': defrow = row if defpushrow is None: defpushrow = row elif name == 'default-push': defpushrow = row self.pathlist.append([path]) if repos: self._pathtext.set_text(repos[0]) elif defrow is not None: self._pathbox.set_active(defrow) elif defpushrow is not None: self._pathbox.set_active(defpushrow) sympaths = [x[1] for x in self.paths] for p in self._recent_src: if p not in sympaths: self.pathlist.append([p]) # create checkbox to disable proxy self._use_proxy = gtk.CheckButton("use proxy server") if ui.ui().config('http_proxy', 'host', ''): self._use_proxy.set_active(True) else: self._use_proxy.set_sensitive(False) revbox.pack_start(lbl, False, False) revbox.pack_start(self._pathbox, True, True) revbox.pack_end(self._use_proxy, False, False) vbox.pack_start(revbox, False, False, 2) expander = gtk.Expander('Advanced Options') expander.set_expanded(False) hbox = gtk.HBox() expander.add(hbox) revvbox = gtk.VBox() revhbox = gtk.HBox() self._reventry = gtk.Entry() self._force = gtk.CheckButton('Force pull or push') self.tips.set_tip(self._force, 'Run even when remote repository' ' is unrelated.') revhbox.pack_start(gtk.Label('Target Revision:'), False, False, 2) revhbox.pack_start(self._reventry, True, True, 2) eventbox = gtk.EventBox() eventbox.add(revhbox) self.tips.set_tip(eventbox, 'A specific revision up to which you' ' would like to push or pull.') revvbox.pack_start(eventbox, True, True, 8) revvbox.pack_start(self._force, False, False, 2) hbox.pack_start(revvbox, True, True, 4) frame = gtk.Frame('Incoming/Outgoing') hbox.pack_start(frame, False, False, 2) self._showpatch = gtk.CheckButton('Show Patches') self._newestfirst = gtk.CheckButton('Show Newest First') self._nomerge = gtk.CheckButton('Show No Merges') hbox = gtk.HBox() hbox.pack_start(self._showpatch, False, False, 2) hbox.pack_start(self._newestfirst, False, False, 2) hbox.pack_start(self._nomerge, False, False, 2) frame.add(hbox) vbox.pack_start(expander, False, False, 2) # hg output window scrolledwindow = gtk.ScrolledWindow() scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN) scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.textview = gtk.TextView(buffer=None) self.textview.set_editable(False) self.textview.modify_font(pango.FontDescription("Monospace")) scrolledwindow.add(self.textview) self.textview.set_editable(False) self.textbuffer = self.textview.get_buffer() vbox.pack_start(scrolledwindow, True, True) self.buttonhbox = gtk.HBox() self.viewpulled = gtk.Button('View Pulled Revisions') self.viewpulled.connect('clicked', self._view_pulled_changes) self.updatetip = gtk.Button('Update to Tip') self.updatetip.connect('clicked', self._update_to_tip) self.buttonhbox.pack_start(self.viewpulled, False, False, 2) self.buttonhbox.pack_start(self.updatetip, False, False, 2) vbox.pack_start(self.buttonhbox, False, False, 2) self.stbar = gtklib.StatusBar() vbox.pack_start(self.stbar, False, False, 2) self.connect('map', self.update_buttons)
def __init__(self, root='', revargs=[]): """ Initialize the Dialog """ gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) shlib.set_tortoise_icon(self, 'hg.ico') self.root = root self.revargs = revargs self.tbar = gtk.Toolbar() self.tips = gtk.Tooltips() sep = gtk.SeparatorToolItem() sep.set_expand(True) sep.set_draw(False) self._btn_close = self._toolbutton(gtk.STOCK_CLOSE, 'Close', self._close_clicked, 'Close Window') tbuttons = [ self._toolbutton(gtk.STOCK_GOTO_LAST, 'Send', self._on_send_clicked, 'Send email(s)'), gtk.SeparatorToolItem(), self._toolbutton(gtk.STOCK_PREFERENCES, 'configure', self._on_conf_clicked, 'Configure email settings'), sep, self._btn_close ] for btn in tbuttons: self.tbar.insert(btn, -1) mainvbox = gtk.VBox() self.add(mainvbox) mainvbox.pack_start(self.tbar, False, False, 2) # set dialog title if revargs[0] in ('--outgoing', '-o'): self.set_title('Email outgoing changes') elif revargs[0] in ('--rev', '-r'): self.set_title('Email revision(s) ' + ' '.join(revargs[1:])) else: self.set_title('Email Mercurial Patches') self.set_default_size(630, 400) hbox = gtk.HBox() envframe = gtk.Frame('Envelope') flagframe = gtk.Frame('Options') hbox.pack_start(envframe, True, True, 4) hbox.pack_start(flagframe, False, False, 4) mainvbox.pack_start(hbox, False, True, 4) vbox = gtk.VBox() envframe.add(vbox) # To: combo box hbox = gtk.HBox() self._tolist = gtk.ListStore(str) self._tobox = gtk.ComboBoxEntry(self._tolist, 0) lbl = gtk.Label('To:') lbl.set_property("width-chars", 5) lbl.set_alignment(1.0, 0.5) hbox.pack_start(lbl, False, False, 4) hbox.pack_start(self._tobox, True, True, 4) vbox.pack_start(hbox, False, False, 4) # Cc: combo box hbox = gtk.HBox() self._cclist = gtk.ListStore(str) self._ccbox = gtk.ComboBoxEntry(self._cclist, 0) lbl = gtk.Label('Cc:') lbl.set_property("width-chars", 5) lbl.set_alignment(1.0, 0.5) hbox.pack_start(lbl, False, False, 4) hbox.pack_start(self._ccbox, True, True, 4) vbox.pack_start(hbox, False, False, 4) # From: combo box hbox = gtk.HBox() self._fromlist = gtk.ListStore(str) self._frombox = gtk.ComboBoxEntry(self._fromlist, 0) lbl = gtk.Label('From:') lbl.set_property("width-chars", 5) lbl.set_alignment(1.0, 0.5) hbox.pack_start(lbl, False, False, 4) hbox.pack_start(self._frombox, True, True, 4) vbox.pack_start(hbox, False, False, 4) vbox = gtk.VBox() flagframe.add(vbox) self.tooltips = gtk.Tooltips() self._normal = gtk.RadioButton(None, "Send changesets as HG patches") vbox.pack_start(self._normal, True, True, 4) self.tooltips.set_tip(self._normal, 'HG patches (as generated by export command) are compatible' ' with most patch programs. They include a header which' ' contains the most important changeset metadata.') self._git = gtk.RadioButton(self._normal, "Use extended (git) patch format") vbox.pack_start(self._git, True, True, 4) self.tooltips.set_tip(self._git, 'Git patches can describe binary files, copies, and' ' permission changes, but recipients may not be able to' ' use them if they are not using git or Mercurial.') self._plain = gtk.RadioButton(self._normal, "Plain, do not prepend HG header") vbox.pack_start(self._plain, True, True, 4) self.tooltips.set_tip(self._plain, 'Stripping Mercurial header removes username and parent' ' information. Only useful if recipient is not using' ' Mercurial (and does not like to see the headers).') self._bundle = gtk.RadioButton(self._normal, "Send single binary bundle, not patches") vbox.pack_start(self._bundle, True, True, 4) self.tooltips.set_tip(self._bundle, 'Bundles store complete changesets in binary form.' ' Upstream users can pull from them. This is the safest' ' way to send changes to recipient Mercurial users.') vbox = gtk.VBox() hbox = gtk.HBox() self._subjlist = gtk.ListStore(str) self._subjbox = gtk.ComboBoxEntry(self._subjlist, 0) hbox.pack_start(gtk.Label('Subject:'), False, False, 4) hbox.pack_start(self._subjbox, True, True, 4) vbox.pack_start(hbox, False, False, 4) self.descview = gtk.TextView(buffer=None) self.descview.set_editable(True) self.descview.modify_font(pango.FontDescription("Monospace")) self.descbuffer = self.descview.get_buffer() scrolledwindow = gtk.ScrolledWindow() scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN) scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scrolledwindow.add(self.descview) frame = gtk.Frame('Patch Series (Bundle) Description') frame.set_border_width(4) vbox.pack_start(scrolledwindow, True, True, 4) vbox.set_border_width(4) eventbox = gtk.EventBox() eventbox.add(vbox) frame.add(eventbox) self.tooltips.set_tip(eventbox, 'Patch series description is sent in initial summary' ' email with [PATCH 0 of N] subject. It should describe' ' the effects of the entire patch series. When emailing' ' a bundle, these fields make up the message subject and body.' ' The description field is unused when sending a single patch') mainvbox.pack_start(frame, True, True, 4) self.connect('map_event', self._on_window_map_event)
def __init__(self, root='', revs=[], files=[], filterfunc=None): """ Initialize the Dialog """ buttons = (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE) super(FilterDialog, self).__init__(flags=gtk.DIALOG_MODAL, buttons=buttons) set_tortoise_icon(self, 'menucheckout.ico') self.set_title("hg log filter - %s" % os.path.basename(root)) self.filterfunc = filterfunc try: self.repo = hg.repository(ui.ui(), path=root) except RepoError: return None self.set_default_size(350, 120) # add toolbar with tooltips self.tbar = gtk.Toolbar() self.tips = gtk.Tooltips() tbuttons = [ self._toolbutton( gtk.STOCK_FIND, 'Apply', self._btn_apply_clicked, tip='Apply filter to revision history'), ] for btn in tbuttons: self.tbar.insert(btn, -1) self.vbox.pack_start(self.tbar, False, False, 2) # branch: combo box hbox = gtk.HBox() self.branchradio = gtk.RadioButton(None, 'Branch') self.branchlist = gtk.ListStore(str) self.branchbox = gtk.ComboBoxEntry(self.branchlist, 0) hbox.pack_start(self.branchradio, False, False, 4) hbox.pack_start(self.branchbox, True, True, 4) eventbox = gtk.EventBox() eventbox.add(hbox) self.tips.set_tip(eventbox, 'View revision graph of named branch') self.vbox.pack_start(eventbox, False, False, 4) for name in self.repo.branchtags().keys(): self.branchlist.append([name]) # Revision range entries hbox = gtk.HBox() self.revradio = gtk.RadioButton(self.branchradio, 'Rev Range') self.rev0Entry = gtk.Entry() self.rev0Entry.connect('activate', self._btn_apply_clicked) self.rev1Entry = gtk.Entry() self.rev1Entry.connect('activate', self._btn_apply_clicked) hbox.pack_start(self.revradio, False, False, 4) hbox.pack_start(self.rev0Entry, True, False, 4) hbox.pack_start(self.rev1Entry, True, False, 4) eventbox = gtk.EventBox() eventbox.add(hbox) self.tips.set_tip(eventbox, 'View range of revisions') self.vbox.pack_start(eventbox, False, False, 4) if revs: self.rev0Entry.set_text(str(revs[0])) if len(revs) > 1: self.rev1Entry.set_text(str(revs[1])) hbox = gtk.HBox() self.searchradio = gtk.RadioButton(self.branchradio, 'Search Filter') hbox.pack_start(self.searchradio, False, False, 4) eventbox = gtk.EventBox() eventbox.add(hbox) self.tips.set_tip(eventbox, 'Search repository changelog with criteria') self.vbox.pack_start(eventbox, False, False, 4) self.searchframe = gtk.Frame() self.vbox.pack_start(self.searchframe, True, False, 4) vbox = gtk.VBox() self.searchframe.add(vbox) hbox = gtk.HBox() self.filesentry = gtk.Entry() self.filesentry.connect('activate', self._btn_apply_clicked) lbl = gtk.Label('File(s):') lbl.set_property("width-chars", 10) lbl.set_alignment(0, 0.5) hbox.pack_start(lbl, False, False, 4) hbox.pack_start(self.filesentry, True, True, 4) eventbox = gtk.EventBox() eventbox.add(hbox) self.tips.set_tip(eventbox, 'Display only changesets affecting these' ' comma separated file paths') vbox.pack_start(eventbox, False, False, 4) if files: self.filesentry.set_text(', '.join(files)) hbox = gtk.HBox() self.kwentry = gtk.Entry() self.kwentry.connect('activate', self._btn_apply_clicked) lbl = gtk.Label('Keyword(s):') lbl.set_property("width-chars", 10) lbl.set_alignment(0, 0.5) hbox.pack_start(lbl, False, False, 4) hbox.pack_start(self.kwentry, True, True, 4) eventbox = gtk.EventBox() eventbox.add(hbox) self.tips.set_tip(eventbox, 'Display only changesets matching these' ' comma separated case insensitive keywords') vbox.pack_start(eventbox, False, False, 4) hbox = gtk.HBox() self.dateentry = gtk.Entry() self.dateentry.connect('activate', self._btn_apply_clicked) self.helpbutton = gtk.Button("?") self.helpbutton.set_relief(gtk.RELIEF_NONE) self.tips.set_tip(self.helpbutton, 'Help on date formats') self.helpbutton.connect('clicked', self._date_help) lbl = gtk.Label('Date:') lbl.set_property("width-chars", 10) lbl.set_alignment(0, 0.5) hbox.pack_start(lbl, False, False, 4) hbox.pack_start(self.dateentry, True, True, 4) hbox.pack_start(self.helpbutton, False, False, 4) eventbox = gtk.EventBox() eventbox.add(hbox) self.tips.set_tip(eventbox, 'Display only changesets matching this' ' date specification') vbox.pack_start(eventbox, False, False, 4) self.searchradio.connect('toggled', self.searchtoggle) self.revradio.connect('toggled', self.revtoggle) self.branchradio.connect('toggled', self.branchtoggle) # toggle them all once self.searchradio.set_active(True) self.branchradio.set_active(True) self.revradio.set_active(True) self.rev0Entry.grab_focus() # show them all self.show_all()
def __init__(self, root='', configrepo=False, focusfield=None, newpath=None): """ Initialize the Dialog. """ gtk.Dialog.__init__(self, parent=None, flags=0, buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)) self.ui = ui.ui() try: repo = hg.repository(self.ui, path=root) except RepoError: repo = None if configrepo: error_dialog(self, 'No repository found', 'no repo at ' + root) self.response(gtk.RESPONSE_CANCEL) # Catch close events self.connect('delete-event', self._delete) self.connect('response', self._response) if configrepo: self.ui = repo.ui name = repo.ui.config('web', 'name') or os.path.basename(repo.root) self.rcpath = [os.sep.join([repo.root, '.hg', 'hgrc'])] self.set_title('TortoiseGit Configure Repository - ' + name) shlib.set_tortoise_icon(self, 'settings_repo.ico') self.root = repo.root else: self.rcpath = util.user_rcpath() self.set_title('TortoiseGit Configure User-Global Settings') shlib.set_tortoise_icon(self, 'settings_user.ico') self.root = None self.ini = self.load_config(self.rcpath) # Create a new notebook, place the position of the tabs self.notebook = notebook = gtk.Notebook() notebook.set_tab_pos(gtk.POS_TOP) self.vbox.pack_start(notebook) notebook.show() self.show_tabs = True self.show_border = True self._btn_apply = gtk.Button("Apply") self._btn_apply.connect('clicked', self._apply_clicked) self.action_area.pack_end(self._btn_apply) self.dirty = False self.pages = [] self.tooltips = gtk.Tooltips() self.history = shlib.Settings('config_history') # create pages for each section of configuration file self._tortoise_info = ( ('Commit Tool', 'tortoisehg.commit', ['qct', 'internal'], 'Select commit tool launched by TortoiseGit. Qct is' ' not included, must be installed separately'), ('Visual Diff Tool', 'tortoisehg.vdiff', [], 'Specify the visual diff tool; must be extdiff command'), ('Visual Editor', 'tortoisehg.editor', [], 'Specify the visual editor used to view files, etc'), ('Author Coloring', 'tortoisehg.authorcolor', ['False', 'True'], 'Color changesets by author name. If not enabled,' ' the changes are colored green for merge, red for' ' non-trivial parents, black for normal. Default: False'), ('Log Batch Size', 'tortoisehg.graphlimit', ['500'], 'The number of revisions to read and display in the' ' changelog viewer in a single batch. Default: 500'), ('Copy Hash', 'tortoisehg.copyhash', ['False', 'True'], 'Allow the changelog viewer to copy hash of currently' ' selected changeset into the clipboard. Default: False'), ('Overlay Icons', 'tortoisehg.overlayicons', ['False', 'True', 'localdisks'], 'Display overlay icons in Explorer windows.' ' Default: True')) self.tortoise_frame = self.add_page(notebook, 'TortoiseHG') self.fill_frame(self.tortoise_frame, self._tortoise_info) self._user_info = ( ('Username', 'ui.username', [], 'Name associated with commits'), ('3-way Merge Tool', 'ui.merge', [], 'Graphical merge program for resolving merge conflicts. If left' ' unspecified, Mercurial will use the first applicable tool it finds' ' on your system or use its internal merge tool that leaves conflict' ' markers in place.'), ('Editor', 'ui.editor', [], 'The editor to use during a commit and other' ' instances where Mercurial needs multiline input from' ' the user. Only required by CLI commands.'), ('Verbose', 'ui.verbose', ['False', 'True'], 'Increase the amount of output printed'), ('Debug', 'ui.debug', ['False', 'True'], 'Print debugging information')) self.user_frame = self.add_page(notebook, 'User') self.fill_frame(self.user_frame, self._user_info) self._paths_info = ( ('default', 'paths.default', [], 'Directory or URL to use when pulling if no source is specified.' ' Default is set to repository from which the current repository was cloned.'), ('default-push', 'paths.default-push', [], 'Optional. Directory or URL to use when pushing if no' ' destination is specified.''')) self.paths_frame = self.add_page(notebook, 'Paths') vbox = self.fill_frame(self.paths_frame, self._paths_info) self.pathtree = gtk.TreeView() self.pathsel = self.pathtree.get_selection() self.pathsel.connect("changed", self._pathlist_rowchanged) column = gtk.TreeViewColumn('Peer Repository Paths', gtk.CellRendererText(), text=2) self.pathtree.append_column(column) scrolledwindow = gtk.ScrolledWindow() scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scrolledwindow.add(self.pathtree) vbox.add(scrolledwindow) self.pathlist = [] if 'paths' in list(self.ini): for name in self.ini['paths']: if name in ('default', 'default-push'): continue self.pathlist.append((name, self.ini['paths'][name])) self.curpathrow = 0 buttonbox = gtk.HBox() self.addButton = gtk.Button("Add") self.addButton.connect('clicked', self._add_path) buttonbox.pack_start(self.addButton) self._delpathbutton = gtk.Button("Remove") self._delpathbutton.connect('clicked', self._remove_path) buttonbox.pack_start(self._delpathbutton) self._refreshpathbutton = gtk.Button("Refresh") self._refreshpathbutton.connect('clicked', self._refresh_path) buttonbox.pack_start(self._refreshpathbutton) self._testpathbutton = gtk.Button("Test") self._testpathbutton.connect('clicked', self._test_path) buttonbox.pack_start(self._testpathbutton) table = gtk.Table(2, 2, False) lbl = gtk.Label('Name:') lbl.set_alignment(1.0, 0.0) self._pathnameedit = gtk.Entry() self._pathnameedit.set_sensitive(False) table.attach(lbl, 0, 1, 0, 1, gtk.FILL, 0, 4, 3) table.attach(self._pathnameedit, 1, 2, 0, 1, gtk.FILL|gtk.EXPAND, 0, 4, 3) lbl = gtk.Label('Path:') lbl.set_alignment(1.0, 0.0) self._pathpathedit = gtk.Entry() self._pathpathedit.set_sensitive(False) table.attach(lbl, 0, 1, 1, 2, gtk.FILL, 0, 4, 3) table.attach(self._pathpathedit, 1, 2, 1, 2, gtk.FILL|gtk.EXPAND, 0, 4, 3) vbox.pack_start(table, False, False, 4) vbox.pack_start(buttonbox, False, False, 4) self.refresh_path_list() self._web_info = ( ('Name', 'web.name', ['unknown'], 'Repository name to use in the web interface. Default' ' is the working directory.'), ('Description', 'web.description', ['unknown'], 'Textual description of the repository''s purpose or' ' contents.'), ('Contact', 'web.contact', ['unknown'], 'Name or email address of the person in charge of the' ' repository.'), ('Style', 'web.style', ['default', 'gitweb', 'coal', 'old'], 'Which template map style to use'), ('Archive Formats', 'web.allow_archive', ['bz2', 'gz', 'zip'], 'Comma separated list of archive formats allowed for' ' downloading'), ('Port', 'web.port', ['8000'], 'Port to listen on'), ('Push Requires SSL', 'web.push_ssl', ['True', 'False'], 'Whether to require that inbound pushes be transported' ' over SSL to prevent password sniffing.'), ('Stripes', 'web.stripes', ['1', '0'], 'How many lines a "zebra stripe" should span in multiline' ' output. Default is 1; set to 0 to disable.'), ('Max Files', 'web.maxfiles', ['10'], 'Maximum number of files to list per changeset.'), ('Max Changes', 'web.maxfiles', ['10'], 'Maximum number of changes to list on the changelog.'), ('Allow Push', 'web.allow_push', ['*'], 'Whether to allow pushing to the repository. If empty or not' ' set, push is not allowed. If the special value "*", any remote' ' user can push, including unauthenticated users. Otherwise, the' ' remote user must have been authenticated, and the authenticated' ' user name must be present in this list (separated by whitespace' ' or ","). The contents of the allow_push list are examined after' ' the deny_push list.'), ('Deny Push', 'web.deny_push', ['*'], 'Whether to deny pushing to the repository. If empty or not set,' ' push is not denied. If the special value "*", all remote users' ' are denied push. Otherwise, unauthenticated users are all' ' denied, and any authenticated user name present in this list' ' (separated by whitespace or ",") is also denied. The contents' ' of the deny_push list are examined before the allow_push list.'), ('Encoding', 'web.encoding', ['UTF-8'], 'Character encoding name')) self.web_frame = self.add_page(notebook, 'Web') self.fill_frame(self.web_frame, self._web_info) self._proxy_info = ( ('host', 'http_proxy.host', [], 'Host name and (optional) port of proxy server, for' ' example "myproxy:8000"'), ('no', 'http_proxy.no', [], 'Optional. Comma-separated list of host names that' ' should bypass the proxy'), ('passwd', 'http_proxy.passwd', [], 'Optional. Password to authenticate with at the' ' proxy server'), ('user', 'http_proxy.user', [], 'Optional. User name to authenticate with at the' ' proxy server')) self.proxy_frame = self.add_page(notebook, 'Proxy') self.fill_frame(self.proxy_frame, self._proxy_info) self._email_info = ( ('From', 'email.from', [], 'Email address to use in "From" header and SMTP envelope'), ('To', 'email.to', [], 'Comma-separated list of recipient email addresses'), ('Cc', 'email.cc', [], 'Comma-separated list of carbon copy recipient email' ' addresses'), ('Bcc', 'email.bcc', [], 'Comma-separated list of blind carbon copy recipient' ' email addresses'), ('method', 'email.method', ['smtp'], 'Optional. Method to use to send email messages. If value is "smtp" (default),' ' use SMTP (configured below). Otherwise, use as name of program to run that' ' acts like sendmail (takes "-f" option for sender, list of recipients on' ' command line, message on stdin). Normally, setting this to "sendmail" or' ' "/usr/sbin/sendmail" is enough to use sendmail to send messages.'), ('SMTP Host', 'smtp.host', [], 'Host name of mail server'), ('SMTP Port', 'smtp.port', ['25'], 'Port to connect to on mail server. Default: 25'), ('SMTP TLS', 'smtp.tls', ['False', 'True'], 'Connect to mail server using TLS. Default: False'), ('SMTP Username', 'smtp.username', [], 'Username to authenticate to SMTP server with'), ('SMTP Password', 'smtp.password', [], 'Password to authenticate to SMTP server with'), ('Local Hostname', 'smtp.local_hostname', [], 'Hostname the sender can use to identify itself to MTA')) self.email_frame = self.add_page(notebook, 'Email') self.fill_frame(self.email_frame, self._email_info) self._diff_info = ( ('Git Format', 'diff.git', ['False', 'True'], 'Use git extended diff format.'), ('No Dates', 'diff.nodates', ['False', 'True'], 'Do no include dates in diff headers.'), ('Show Function', 'diff.showfunc', ['False', 'True'], 'Show which function each change is in.'), ('Ignore White Space', 'diff.ignorews', ['False', 'True'], 'Ignore white space when comparing lines.'), ('Ignore WS Amount', 'diff.ignorewsamount', ['False', 'True'], 'Ignore changes in the amount of white space.'), ('Ignore Blank Lines', 'diff.ignoreblanklines', ['False', 'True'], 'Ignore changes whose lines are all blank.'), ) self.diff_frame = self.add_page(notebook, 'Diff') self.fill_frame(self.diff_frame, self._diff_info) # Force dialog into clean state in the beginning self._refresh_vlist() self._btn_apply.set_sensitive(False) self.dirty = False
def __init__(self, cwd='', root=''): """ Initialize the Dialog. """ gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) set_tortoise_icon(self, 'general.ico') self.root = root self.cwd = cwd self.selected_path = None self.hgthread = None self.connect('delete-event', self._delete) self.set_default_size(600, 400) name = os.path.basename(os.path.abspath(root)) self.set_title("TortoiseHg Recovery - " + name) # toolbar self.tbar = gtk.Toolbar() self.tips = gtk.Tooltips() self._stop_button = self._toolbutton(gtk.STOCK_STOP, 'Stop', self._stop_clicked, tip='Stop the hg operation') self._stop_button.set_sensitive(False) tbuttons = [ self._toolbutton(gtk.STOCK_CLEAR, 'clean', self._clean_clicked, tip='Clean checkout, undo all changes'), gtk.SeparatorToolItem(), self._toolbutton(gtk.STOCK_UNDO, 'rollback', self._rollback_clicked, tip='Rollback (undo) last transaction to' ' repository (pull, commit, etc)'), gtk.SeparatorToolItem(), self._toolbutton(gtk.STOCK_CLEAR, 'recover', self._recover_clicked, tip='Recover from interrupted operation'), gtk.SeparatorToolItem(), self._toolbutton(gtk.STOCK_APPLY, 'verify', self._verify_clicked, tip='Validate repository consistency'), gtk.SeparatorToolItem(), self._stop_button, gtk.SeparatorToolItem(), ] for btn in tbuttons: self.tbar.insert(btn, -1) sep = gtk.SeparatorToolItem() sep.set_expand(True) sep.set_draw(False) self.tbar.insert(sep, -1) button = self._toolbutton(gtk.STOCK_CLOSE, 'Close', self._close_clicked, tip='Close Application') self.tbar.insert(button, -1) vbox = gtk.VBox() self.add(vbox) vbox.pack_start(self.tbar, False, False, 2) # hg output window scrolledwindow = gtk.ScrolledWindow() scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN) scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.textview = gtk.TextView(buffer=None) self.textview.set_editable(False) self.textview.modify_font(pango.FontDescription("Monospace")) scrolledwindow.add(self.textview) self.textview.set_editable(False) self.textbuffer = self.textview.get_buffer() vbox.pack_start(scrolledwindow, True, True) self.stbar = gtklib.StatusBar() vbox.pack_start(self.stbar, False, False, 2)
def __init__(self, cmdline, progressbar=True, width=520, height=400): title = 'hg ' + ' '.join(cmdline[1:]) gtk.Dialog.__init__(self, title=title, flags=gtk.DIALOG_MODAL, #buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT) ) set_tortoise_icon(self, 'hg.ico') self.cmdline = cmdline self.returncode = None # construct dialog self.set_default_size(width, height) self._button_stop = gtk.Button("Stop") self._button_stop.connect('clicked', self._on_stop_clicked) self.action_area.pack_start(self._button_stop) self._button_ok = gtk.Button("Close") self._button_ok.connect('clicked', self._on_ok_clicked) self.action_area.pack_start(self._button_ok) self.connect('delete-event', self._delete) self.connect('response', self._response) self.pbar = None if progressbar: self.last_pbar_update = 0 hbox = gtk.HBox() self.status_text = gtk.Label() self.status_text.set_text(toutf(" ".join(cmdline).replace("\n", " "))) self.status_text.set_alignment(0, 0.5) self.status_text.set_ellipsize(pango.ELLIPSIZE_END) hbox.pack_start(self.status_text, True, True, 3) # Create a centering alignment object align = gtk.Alignment(0.0, 0.0, 1, 0) hbox.pack_end(align, False, False, 3) align.show() # create the progress bar self.pbar = gtk.ProgressBar() align.add(self.pbar) self.pbar.pulse() self.pbar.show() self.vbox.pack_start(hbox, False, False, 3) scrolledwindow = gtk.ScrolledWindow() scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN) scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.textview = gtk.TextView(buffer=None) self.textview.set_editable(False) self.textview.modify_font(pango.FontDescription("Monospace")) scrolledwindow.add(self.textview) self.textbuffer = self.textview.get_buffer() self.vbox.pack_start(scrolledwindow, True, True) self.connect('map_event', self._on_window_map_event) self.show_all()