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

thgconfig: read registry settings, fill shell extension page

Changeset cd4d3440bf05

Parent 678ba41d2e79

by Steve Borho

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

 
457
458
459
 
 
460
461
 
 
462
463
 
464
465
 
466
467
468
 
507
508
509
 
510
511
512
513
514
 
515
516
517
 
524
525
526
527
 
528
529
530
 
548
549
550
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
551
552
553
 
457
458
459
460
461
462
 
463
464
465
 
466
467
 
468
469
470
471
 
510
511
512
513
514
515
516
517
518
519
520
521
522
 
529
530
531
 
532
533
534
535
 
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
@@ -457,12 +457,15 @@
  vbox.pack_start(ovframe, False, False, 2)   ovcvbox = gtk.VBox()   ovframe.add(ovcvbox) + hbox = gtk.HBox() + ovcvbox.pack_start(hbox, False, False, 2)   self.ovenable = gtk.CheckButton(_('Enable overlays')) - ovcvbox.pack_start(self.ovenable, False, False, 2) + hbox.pack_start(self.ovenable, False, False, 2) + self.ovenable.connect('toggled', self.ovenable_toggled)   self.lclonly = gtk.CheckButton(_('Local disks only')) - ovcvbox.pack_start(self.lclonly, False, False, 2) + hbox.pack_start(self.lclonly, False, False, 2)   self.ovdebug = gtk.CheckButton(_('Enable debug logging')) - ovcvbox.pack_start(self.ovdebug, False, False, 2) + hbox.pack_start(self.ovdebug, False, False, 2)   table = gtk.Table(2, 2, False)   ovcvbox.pack_start(table, False, False, 2)   @@ -507,11 +510,13 @@
  rows = (len(shellcmds) + 2) / 3   table = gtk.Table(rows, 3, False)   cmcvbox.pack_start(table, False, False, 2) + self.cmptoggles = {}   for i, cmd in enumerate(shellcmds):   row, col = divmod(i, 3)   check = gtk.CheckButton(cmd)   table.attach(check, col, col+1,   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('focus-in-event', self.set_help,   desctext.get_buffer(), tooltip) @@ -524,7 +529,7 @@
  tooltip = _('Enable/Disable the overlay icons globally')   self.ovenable.connect('focus-in-event', self.set_help,   desctext.get_buffer(), tooltip) - tooltip = _('Only use overlays on local disks') + tooltip = _('Only enable overlays on local disks')   self.lclonly.connect('focus-in-event', self.set_help,   desctext.get_buffer(), tooltip)   tooltip = _('Enable the overlay code to emit debug messages' @@ -548,6 +553,56 @@
  ' that the TortoiseHg tracelog application can receive.')   self.cmdebug.connect('focus-in-event', self.set_help,   desctext.get_buffer(), tooltip) + self.load_shell_configs() + + def load_shell_configs(self): + shellapps = 'explorer.exe' + includepath = '' + excludepath = '' + overlayenable = True + overlaydebug = False + localdisks = False + cmenudebug = False + promoteditems = 'commit' + try: + from _winreg import HKEY_CURRENT_USER, OpenKey, QueryValueEx + hkey = OpenKey(HKEY_CURRENT_USER, r"Software\TortoiseHg") + t = ('1', 'True') + try: shellapps = QueryValueEx(hkey, 'ShellApps')[0] + except EnvironmentError: pass + try: overlayenable = QueryValueEx(hkey, 'EnableOverlays')[0] in t + except EnvironmentError: pass + try: localdisks = QueryValueEx(hkey, 'LocalDisksOnly')[0] in t + except EnvironmentError: pass + try: overlaydebug = QueryValueEx(hkey, 'OverlayDebug')[0] in t + except EnvironmentError: pass + try: includepath = QueryValueEx(hkey, 'IncludePath')[0] + except EnvironmentError: pass + try: excludepath = QueryValueEx(hkey, 'ExcludePath')[0] + except EnvironmentError: pass + try: cmenudebug = QueryValueEx(hkey, 'ContextMenuDebug')[0] in t + except EnvironmentError: pass + try: promoteditems = QueryValueEx(hkey, 'PromotedItems')[0] + except EnvironmentError: pass + except ImportError: + pass + + self.shellapps.set_text(shellapps) + self.ovenable.set_active(overlayenable) + self.lclonly.set_active(localdisks) + self.ovdebug.set_active(overlaydebug) + self.ovinclude.set_text(includepath) + self.ovexclude.set_text(excludepath) + self.cmdebug.set_active(cmenudebug) + promoted = [pi.strip() for pi in promoteditems.split(',')] + for cmd, check in self.cmptoggles.iteritems(): + check.set_active(cmd in promoted) + + 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())     def fill_frame(self, frame, info):   widgets = []