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

thgconfig: dirty events and save routine for shell ext

Changeset dd3702788cde

Parent cd4d3440bf05

by Steve Borho

Changes to one file · Browse files at dd3702788cde Showing diff from parent cd4d3440bf05 Diff from another changeset...

 
272
273
274
275
 
276
277
278
 
518
519
520
 
521
522
523
524
525
526
 
527
528
529
530
531
532
 
533
534
535
536
 
537
538
539
540
541
542
 
543
544
545
 
547
548
549
 
550
551
552
553
 
554
555
556
 
598
599
600
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
601
602
603
604
605
 
606
607
608
 
792
793
794
 
795
796
797
 
272
273
274
 
275
276
277
278
 
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
 
552
553
554
555
556
557
558
559
560
561
562
563
 
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
 
826
827
828
829
830
831
832
@@ -272,7 +272,7 @@
  self.diff_frame = self.add_page(notebook, _('Diff'))   self.fill_frame(self.diff_frame, _diff_info)   - if not configrepo and os.name == 'nt': + if not configrepo: # and os.name == 'nt':   self.shellframe = self.add_page(notebook, _('Shell Ext'))   self.fill_shell_frame(self.shellframe)   @@ -518,28 +518,33 @@
  row, row+1, gtk.FILL|gtk.EXPAND, 0, 4, 3)   self.cmptoggles[cmd] = check   tooltip = _('Promote menu item "%s" to top menu') % cmd + check.connect('toggled', self.dirty_event)   check.connect('focus-in-event', self.set_help,   desctext.get_buffer(), tooltip)     tooltip = _('A comma (,) separated list of applications that'   ' the shell extensions will support. If unspecified,'   ' the default is explorer.exe') + self.shellapps.connect('changed', self.dirty_event)   self.shellapps.connect('focus-in-event', self.set_help,   desctext.get_buffer(), tooltip)   tooltip = _('Enable/Disable the overlay icons globally')   self.ovenable.connect('focus-in-event', self.set_help,   desctext.get_buffer(), tooltip)   tooltip = _('Only enable overlays on local disks') + self.lclonly.connect('toggled', self.dirty_event)   self.lclonly.connect('focus-in-event', self.set_help,   desctext.get_buffer(), tooltip)   tooltip = _('Enable the overlay code to emit debug messages'   ' that the TortoiseHg tracelog application can receive.') + self.ovdebug.connect('toggled', self.dirty_event)   self.ovdebug.connect('focus-in-event', self.set_help,   desctext.get_buffer(), tooltip)   tooltip = _('A list of semicolon (;) separated paths that the'   ' overlays will respect. This include filter is applied'   ' after the local disk check. If unspecified, the default'   ' is to display in all repositories.') + self.ovinclude.connect('changed', self.dirty_event)   self.ovinclude.connect('focus-in-event', self.set_help,   desctext.get_buffer(), tooltip)   tooltip = _('A list of semicolon (;) separated paths that are' @@ -547,10 +552,12 @@
  ' applied after the local disk check and include filters.'   ' So there is no need to exclude paths outside of your'   ' include filter. Default is no exclusion.') + self.ovexclude.connect('changed', self.dirty_event)   self.ovexclude.connect('focus-in-event', self.set_help,   desctext.get_buffer(), tooltip)   tooltip = _('Enable the context menu code to emit debug messages'   ' that the TortoiseHg tracelog application can receive.') + self.cmdebug.connect('toggled', self.dirty_event)   self.cmdebug.connect('focus-in-event', self.set_help,   desctext.get_buffer(), tooltip)   self.load_shell_configs() @@ -598,11 +605,38 @@
  for cmd, check in self.cmptoggles.iteritems():   check.set_active(cmd in promoted)   + def save_shell_configs(self): + shellapps = self.shellapps.get_text() + overlayenable = self.ovenable.get_active() and '1' or '0' + localdisks = self.lclonly.get_active() and '1' or '0' + overlaydebug = self.ovdebug.get_active() and '1' or '0' + includepath = self.ovinclude.get_text() + excludepath = self.ovexclude.get_text() + cmenudebug = self.cmdebug.get_active() and '1' or '0' + promoted = [] + for cmd, check in self.cmptoggles.iteritems(): + if check.get_active(): + promoted.append(cmd) + try: + from _winreg import HKEY_CURRENT_USER, OpenKey, SetValue + hkey = CreateKey(HKEY_CURRENT_USER, r"Software\TortoiseHg") + SetValue(hkey, 'ShellApps', shellapps) + SetValue(hkey, 'EnableOverlays', overlayenable) + SetValue(hkey, 'LocalDisksOnly', localdisks) + SetValue(hkey, 'OverlayDebug', overlaydebug) + SetValue(hkey, 'IncludePath', includepath) + SetValue(hkey, 'ExcludePath', excludepath) + SetValue(hkey, 'ContextMenuDebug', cmenudebug) + SetValue(hkey, 'PromotedItems', ','.join(promoted)) + except ImportError: + pass +   def ovenable_toggled(self, check):   self.lclonly.set_sensitive(check.get_active())   self.ovdebug.set_sensitive(check.get_active())   self.ovinclude.set_sensitive(check.get_active())   self.ovexclude.set_sensitive(check.get_active()) + self.dirty_event()     def fill_frame(self, frame, info):   widgets = [] @@ -792,6 +826,7 @@
  except IOError, e:   error_dialog(self, _('Unable to write configuration file'), str(e))   + self.save_shell_configs()   self._btn_apply.set_sensitive(False)   self.dirty = False   return 0