* src/plugins/GraphViz.py: launch image viewer in Windows.

* src/Mime/_WinMime.py: handle rundll32.exe applications.
* src/Utils.py: search path in Windows when looking for applications.

svn: r7055
This commit is contained in:
Brian Matherly 2006-07-22 05:52:16 +00:00
parent bf1d752f01
commit 75fe94b45a
4 changed files with 27 additions and 24 deletions

View File

@ -1,3 +1,8 @@
2006-07-21 Brian Matherly <brian@gramps-project.org>
* src/plugins/GraphViz.py: launch image viewer in Windows.
* src/Mime/_WinMime.py: handle rundll32.exe applications.
* src/Utils.py: search path in Windows when looking for applications.
2006-07-21 Don Allingham <don@gramps-project.org>
* src/DataViews/_RelationView.py: provide number for children/siblings
* src/GrampsWidgets.py: fix spacing on link box

View File

@ -70,6 +70,9 @@ def get_application(type):
# Find a friendly name for the application
if command.startswith('"'):
app = command.split('"')[1]
elif command.startswith('rundll32.exe'):
# Get the description of the DLL instead of the application
app = command.split()[1].split(',')[0]
else:
app = command.split()[0]

View File

@ -461,6 +461,12 @@ def search_for(name):
name = name.split('"')[1]
else:
name = name.split()[0]
if os.sys.platform == "win32":
for i in os.environ['PATH'].split(';'):
fname = os.path.join(i,name)
if os.access(fname,os.X_OK) and not os.path.isdir(fname):
return 1
else:
for i in os.environ['PATH'].split(':'):
fname = os.path.join(i,name)
if os.access(fname,os.X_OK) and not os.path.isdir(fname):

View File

@ -64,6 +64,8 @@ import const
from BaseDoc import PAPER_LANDSCAPE
from QuestionDialog import ErrorDialog
import Errors
import Utils
import Mime
#------------------------------------------------------------------------
#
@ -124,11 +126,11 @@ class _options:
)
if os.sys.platform == "win32":
_dot_found = os.system("dot -V 2>nul") == 0
_dot_found = Utils.search_for("dot.exe")
else:
_dot_found = os.system("dot -V 2>/dev/null") == 0
_dot_found = Utils.search_for("dot")
if os.system("which epstopdf >/dev/null 2>&1") == 0:
if Utils.search_for("epstopdf") == 1:
_options.formats += (("pdf", "PDF", _("PDF"), "application/pdf"),)
_pdf_pipe = 'epstopdf -f -o=%s'
@ -1025,11 +1027,7 @@ class FormatComboBox(gtk.ComboBox):
def get_printable(self):
_apptype = _options.formats[self.get_active()][3]
print_label = None
try:
import Utils
import Mime
mprog = Mime.get_application(_apptype)
if Utils.search_for(mprog[0]):
@ -1087,8 +1085,6 @@ class GraphicsFormatComboBox(gtk.ComboBox):
_apptype = _options.formats[self.get_active()][3]
print_label = None
try:
import Utils
import Mime
mprog = Mime.get_application(_apptype)
if Utils.search_for(mprog[0]):
print_label = _("Open in %(program_name)s") % { 'program_name':
@ -1174,12 +1170,8 @@ class GraphVizGraphics(Report):
break
if _apptype:
try:
import Utils
import Mime
app = Mime.get_application(_apptype)
os.environ["FILE"] = self.user_output
os.system ('%s "$FILE" &' % app[0])
Utils.launch(app[0],self.user_output)
except:
pass
@ -1191,11 +1183,8 @@ class GraphVizGraphics(Report):
break
if _apptype:
try:
import Utils
import Mime
app = Mime.get_application(_apptype)
os.environ["FILE"] = self.user_output
os.system ('%s "$FILE" &' % app[0])
Utils.launch(app[0],self.user_output)
except:
pass