Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

shlib: move browse_url() from about.py to shlib.py

Changeset 206918d2908f

Parent a8b2f0d46bde

by Steve Borho

Changes to 4 files · Browse files at 206918d2908f Showing diff from parent a8b2f0d46bde Diff from another changeset...

 
9
10
11
12
13
14
15
 
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 
43
44
45
 
9
10
11
 
12
13
 
14
15
16
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
20
21
22
@@ -9,37 +9,14 @@
 import os  import sys  import gtk -import threading    from tortoisehg.util.i18n import _ -from tortoisehg.util import version, paths, hglib +from tortoisehg.util import version, paths, hglib, shlib    from tortoisehg.hgtk import gtklib, hgtk   -def browse_url(url): - def start_browser(): - if os.name == 'nt': - import win32api, win32con - win32api.ShellExecute(0, "open", url, None, "", - win32con.SW_SHOW) - elif sys.platform == 'darwin': - # use Mac OS X internet config module (removed in Python 3.0) - import ic - ic.launchurl(url) - else: - try: - import gconf - client = gconf.client_get_default() - browser = client.get_string( - '/desktop/gnome/url-handlers/http/command') + '&' - os.system(browser % url) - except ImportError: - # If gconf is not found, fall back to old standard - os.system('firefox ' + url) - threading.Thread(target=start_browser).start() -  def url_handler(dialog, link, user_data): - browse_url(link) + shlib.browse_url(link)    gtk.about_dialog_set_url_hook(url_handler, None)  
 
17
18
19
20
 
21
22
23
 
776
777
778
779
 
780
781
782
 
17
18
19
 
20
21
22
23
 
776
777
778
 
779
780
781
782
@@ -17,7 +17,7 @@
 from tortoisehg.util.i18n import _  from tortoisehg.util import shlib, hglib   -from tortoisehg.hgtk import csinfo, gdialog, gtklib, hgcmd, statusbar, about +from tortoisehg.hgtk import csinfo, gdialog, gtklib, hgcmd, statusbar    class ChangeSet(gdialog.GDialog):   'GTK+ based dialog for displaying repository logs' @@ -776,7 +776,7 @@
  groups[int(m.group(1))], link)   if not num:   link += text - about.browse_url(link) + shlib.browse_url(link)     def csetlink_event(self, tag, widget, event, liter):   if event.type != gtk.gdk.BUTTON_RELEASE:
 
18
19
20
21
 
22
23
24
 
387
388
389
390
391
 
392
393
394
 
18
19
20
 
21
22
23
24
 
387
388
389
 
 
390
391
392
393
@@ -18,7 +18,7 @@
 from mercurial import cmdutil, util, ui, hg, commands    from tortoisehg.util.i18n import _ -from tortoisehg.util import settings, hglib, paths +from tortoisehg.util import settings, hglib, paths, shlib    from tortoisehg.hgtk import gtklib   @@ -387,8 +387,7 @@
  return   if not url.startswith('http'):   url = 'http://tortoisehg.bitbucket.org/manual/0.9/' + url - from tortoisehg.hgtk import about - about.browse_url(url) + shlib.browse_url(url)     def launch(self, item, app):   import sys
 
9
10
11
 
12
13
14
 
19
20
21
 
 
 
 
 
 
22
23
24
 
136
137
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
10
11
12
13
14
15
 
20
21
22
23
24
25
26
27
28
29
30
31
 
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
@@ -9,6 +9,7 @@
 import os  import sys  import time +import threading  from mercurial.i18n import _  from mercurial import hg   @@ -19,6 +20,12 @@
  return t    if os.name == 'nt': + def browse_url(url): + def start_browser(): + import win32api, win32con + win32api.ShellExecute(0, "open", url, None, "", win32con.SW_SHOW) + threading.Thread(target=start_browser).start() +   def shell_notify(paths):   try:   from win32com.shell import shell, shellcon @@ -136,3 +143,22 @@
    def update_thgstatus(*args, **kws):   pass + + def browse_url(url): + def start_browser(): + if sys.platform == 'darwin': + # use Mac OS X internet config module (removed in Python 3.0) + import ic + ic.launchurl(url) + else: + try: + import gconf + client = gconf.client_get_default() + browser = client.get_string( + '/desktop/gnome/url-handlers/http/command') + '&' + os.system(browser % url) + except ImportError: + # If gconf is not found, fall back to old standard + os.system('firefox ' + url) + threading.Thread(target=start_browser).start() +