Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

commit: add paste filenames function to message popup

closes issue 110

Changeset 664b6f68b525

Parent 006ca8bb6aea

by Trey Roessig

Changes to one file · Browse files at 664b6f68b525 Showing diff from parent 006ca8bb6aea Diff from another changeset...

Change 1 of 3 Show Entire File hggtk/​commit.py Stacked
 
17
18
19
20
 
 
21
22
23
 
234
235
236
 
237
238
239
 
645
646
647
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
648
649
650
 
17
18
19
 
20
21
22
23
24
 
235
236
237
238
239
240
241
 
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
@@ -17,7 +17,8 @@
 from mercurial.node import hex, nullrev  from mercurial import ui, hg, util, patch  from gdialog import Prompt, Confirm -from status import GStatus, FM_STATUS, FM_CHECKED, DM_REJECTED, DM_CHUNK_ID +from status import GStatus, FM_STATUS, FM_CHECKED, FM_PATH_UTF8 +from status import DM_REJECTED, DM_CHUNK_ID  from hglib import fromutf  import shlib  from shlib import shell_notify @@ -234,6 +235,7 @@
  vbox.pack_start(frame)     self.text = gtk.TextView() + self.text.connect('populate-popup', self._msg_add_to_popup)   self.text.set_wrap_mode(gtk.WRAP_WORD)   self.text.modify_font(pango.FontDescription(self.fontcomment))   scroller.add(self.text) @@ -645,6 +647,30 @@
  self.mode = qnew and 'status' or 'commit'   self.reload_status()   self.qnew_name.grab_focus() # set focus back + + def _msg_add_to_popup(self, textview, menu): + menu_items = ((None, _('----'), None), + (None, _('Paste _Filenames'), self._msg_paste_fnames), + ) + for stock, label, handler in menu_items: + if label == '----': + menuitem = gtk.SeparatorMenuItem() + elif stock: + menuitem = gtk.ImageMenuItem(stock) + else: + menuitem = gtk.MenuItem(label) + if handler: + menuitem.connect('activate', handler) + menu.append(menuitem) + menu.show_all() + + def _msg_paste_fnames(self, sender): + buf = self.text.get_buffer() + fnames = [ file[FM_PATH_UTF8] for file in self.filemodel + if file[FM_CHECKED] ] + buf.delete_selection(True, True) + buf.insert_at_cursor('\n'.join([fname for fname in fnames])) +    def run(_ui, *pats, **opts):   cmdoptions = {