Remove the "print_label" construct from the reports. The only label is "Open with default viewer". No need to check the mime type or to look for the default application because Gramps uses the host OS to figure it out for the user.
svn: r12351
This commit is contained in:
@@ -66,7 +66,7 @@ class BookFormatComboBox(gtk.ComboBox):
|
||||
self.data.append(item)
|
||||
name = item[0]
|
||||
self.store.append(row=[name])
|
||||
if item[6] == active:
|
||||
if item[5] == active:
|
||||
active_index = index
|
||||
elif not active and name == out_pref:
|
||||
active_index = index
|
||||
@@ -85,8 +85,8 @@ class BookFormatComboBox(gtk.ComboBox):
|
||||
def get_ext(self):
|
||||
return self.data[self.get_active()][4]
|
||||
|
||||
def get_printable(self):
|
||||
return self.data[self.get_active()][5]
|
||||
def is_file_output(self):
|
||||
return len(self.get_ext()) > 0
|
||||
|
||||
def get_clname(self):
|
||||
return self.data[self.get_active()][6]
|
||||
return self.data[self.get_active()][5]
|
||||
|
||||
@@ -94,7 +94,7 @@ class DocReportDialog(ReportDialog):
|
||||
|
||||
self.options.set_document(self.doc)
|
||||
|
||||
if self.print_report.get_active():
|
||||
if self.open_with_app.get_active():
|
||||
self.doc.open_requested()
|
||||
|
||||
def doc_type_changed(self, obj):
|
||||
@@ -104,14 +104,10 @@ class DocReportDialog(ReportDialog):
|
||||
file format. For example, a HTML document doesn't need any
|
||||
paper size/orientation options, but it does need a template
|
||||
file. Those chances are made here."""
|
||||
|
||||
label = obj.get_printable()
|
||||
if label:
|
||||
self.print_report.set_label (label)
|
||||
self.print_report.set_sensitive (True)
|
||||
if obj.is_file_output():
|
||||
self.open_with_app.set_sensitive (True)
|
||||
else:
|
||||
self.print_report.set_label (_("Open with default viewer"))
|
||||
self.print_report.set_sensitive (False)
|
||||
self.open_with_app.set_sensitive (False)
|
||||
|
||||
# Is this to be a printed report or an electronic report
|
||||
# (i.e. a set of web pages)
|
||||
@@ -129,15 +125,20 @@ class DocReportDialog(ReportDialog):
|
||||
self.notebook.insert_page(self.html_table,self.html_label,0)
|
||||
self.html_table.show_all()
|
||||
|
||||
fname = self.target_fileentry.get_full_path(0)
|
||||
(spath,ext) = os.path.splitext(fname)
|
||||
|
||||
ext_val = obj.get_ext()
|
||||
if ext_val:
|
||||
fname = spath + ext_val
|
||||
if obj.is_file_output():
|
||||
fname = self.target_fileentry.get_full_path(0)
|
||||
(spath, ext) = os.path.splitext(fname)
|
||||
|
||||
ext_val = obj.get_ext()
|
||||
if ext_val:
|
||||
fname = spath + ext_val
|
||||
else:
|
||||
fname = spath
|
||||
self.target_fileentry.set_filename(fname)
|
||||
self.target_fileentry.set_sensitive(True)
|
||||
else:
|
||||
fname = spath
|
||||
self.target_fileentry.set_filename(fname)
|
||||
self.target_fileentry.set_filename("")
|
||||
self.target_fileentry.set_sensitive(False)
|
||||
|
||||
# Does this report format use styles?
|
||||
if self.style_button:
|
||||
@@ -159,8 +160,8 @@ class DocReportDialog(ReportDialog):
|
||||
yoptions=gtk.SHRINK)
|
||||
self.row += 1
|
||||
|
||||
self.print_report = gtk.CheckButton (_("Print a copy"))
|
||||
self.tbl.attach(self.print_report,2,4,self.row,self.row+1,
|
||||
self.open_with_app = gtk.CheckButton(_("Open with default viewer"))
|
||||
self.tbl.attach(self.open_with_app, 2, 4, self.row, self.row+1,
|
||||
yoptions=gtk.SHRINK)
|
||||
self.row += 1
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class DrawFormatComboBox(gtk.ComboBox):
|
||||
self.store.append(row=[name])
|
||||
#if callback:
|
||||
# menuitem.connect("activate",callback)
|
||||
if item[6] == active:
|
||||
if item[5] == active:
|
||||
active_index = index
|
||||
elif not active and name == out_pref:
|
||||
active_index = index
|
||||
@@ -78,8 +78,8 @@ class DrawFormatComboBox(gtk.ComboBox):
|
||||
def get_ext(self):
|
||||
return self.__drawdoc_list[self.get_active()][4]
|
||||
|
||||
def get_printable(self):
|
||||
return self.__drawdoc_list[self.get_active()][5]
|
||||
def is_file_output(self):
|
||||
return len(self.get_ext()) > 0
|
||||
|
||||
def get_clname(self):
|
||||
return self.__drawdoc_list[self.get_active()][6]
|
||||
return self.__drawdoc_list[self.get_active()][5]
|
||||
|
||||
@@ -46,7 +46,6 @@ import gobject
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
import Mime
|
||||
import Utils
|
||||
import BaseDoc
|
||||
import Config
|
||||
@@ -892,19 +891,8 @@ class GraphvizFormatComboBox(gtk.ComboBox):
|
||||
def get_format_str(self):
|
||||
return _FORMATS[self.get_active()]["type"]
|
||||
|
||||
def get_printable(self):
|
||||
_apptype = _FORMATS[self.get_active()]["mime"]
|
||||
print_label = None
|
||||
try:
|
||||
mprog = Mime.get_application(_apptype)
|
||||
if Utils.search_for(mprog[0]):
|
||||
print_label = _("Open in %(program_name)s") % { 'program_name':
|
||||
mprog[1] }
|
||||
else:
|
||||
print_label = None
|
||||
except:
|
||||
print_label = None
|
||||
return print_label
|
||||
def is_file_output(self):
|
||||
return True
|
||||
|
||||
def get_clname(self):
|
||||
return _FORMATS[self.get_active()]["type"]
|
||||
@@ -1083,8 +1071,8 @@ class GraphvizReportDialog(ReportDialog):
|
||||
yoptions=gtk.SHRINK)
|
||||
self.row += 1
|
||||
|
||||
self.print_report = gtk.CheckButton(_("Open with application"))
|
||||
self.tbl.attach(self.print_report, 2, 4, self.row, self.row+1,
|
||||
self.open_with_app = gtk.CheckButton(_("Open with default viewer"))
|
||||
self.tbl.attach(self.open_with_app, 2, 4, self.row, self.row+1,
|
||||
yoptions=gtk.SHRINK)
|
||||
self.row += 1
|
||||
|
||||
@@ -1122,8 +1110,7 @@ class GraphvizReportDialog(ReportDialog):
|
||||
paper size/orientation options, but it does need a template
|
||||
file. Those chances are made here.
|
||||
"""
|
||||
self.print_report.set_label (_("Open with default application"))
|
||||
self.print_report.set_sensitive(True)
|
||||
self.open_with_app.set_sensitive(True)
|
||||
|
||||
fname = self.target_fileentry.get_full_path(0)
|
||||
(spath, ext) = os.path.splitext(fname)
|
||||
@@ -1144,7 +1131,7 @@ class GraphvizReportDialog(ReportDialog):
|
||||
|
||||
self.options.set_document(self.doc)
|
||||
|
||||
if self.print_report.get_active():
|
||||
if self.open_with_app.get_active():
|
||||
self.doc.open_requested()
|
||||
|
||||
def on_ok_clicked(self, obj):
|
||||
|
||||
@@ -52,7 +52,7 @@ class TextFormatComboBox(gtk.ComboBox):
|
||||
for item in self.__text_doc_list:
|
||||
name = item[0]
|
||||
self.store.append(row=[name])
|
||||
if item[6] == active:
|
||||
if item[5] == active:
|
||||
active_index = index
|
||||
elif not active and name == out_pref:
|
||||
active_index = index
|
||||
@@ -74,8 +74,8 @@ class TextFormatComboBox(gtk.ComboBox):
|
||||
def get_ext(self):
|
||||
return self.__text_doc_list[self.get_active()][4]
|
||||
|
||||
def get_printable(self):
|
||||
return self.__text_doc_list[self.get_active()][5]
|
||||
def is_file_output(self):
|
||||
return len(self.get_ext()) > 0
|
||||
|
||||
def get_clname(self):
|
||||
return self.__text_doc_list[self.get_active()][6]
|
||||
return self.__text_doc_list[self.get_active()][5]
|
||||
|
||||
Reference in New Issue
Block a user