2007-08-29 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* src/glade/printpreview.glade: Renamed and moved to src/docgen/ * src/glade/Makefile.am: printpreview.glade removed. * src/docgen/gtkprintpreview.glade: Added. * src/docgen/Makefile.am: gtkprintpreview.glade added. * po/POTFILES.in: /src/docgen/gtkprintpreview.glade added. * src/docgen/GtkPrint.py: Preview is getting close to be complete. svn: r8885
This commit is contained in:
parent
5e42a8ba9d
commit
9bc24a3cad
@ -1,3 +1,11 @@
|
|||||||
|
2007-08-29 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
|
||||||
|
* src/glade/printpreview.glade: Renamed and moved to src/docgen/
|
||||||
|
* src/glade/Makefile.am: printpreview.glade removed.
|
||||||
|
* src/docgen/gtkprintpreview.glade: Added.
|
||||||
|
* src/docgen/Makefile.am: gtkprintpreview.glade added.
|
||||||
|
* po/POTFILES.in: /src/docgen/gtkprintpreview.glade added.
|
||||||
|
* src/docgen/GtkPrint.py: Preview is getting close to be complete.
|
||||||
|
|
||||||
2007-08-26 Brian Matherly <brian@gramps-project.org>
|
2007-08-26 Brian Matherly <brian@gramps-project.org>
|
||||||
* src/plugins/AncestorChart.py: Rename AncestorChart2 to AncestorChart
|
* src/plugins/AncestorChart.py: Rename AncestorChart2 to AncestorChart
|
||||||
|
|
||||||
|
@ -651,6 +651,7 @@ src/FilterEditor/_ShowResults.py
|
|||||||
#
|
#
|
||||||
# Glade files
|
# Glade files
|
||||||
#
|
#
|
||||||
|
src/docgen/gtkprintpreview.glade
|
||||||
src/GrampsDbUtils/gedcomimport.glade
|
src/GrampsDbUtils/gedcomimport.glade
|
||||||
src/glade/edit_person.glade
|
src/glade/edit_person.glade
|
||||||
src/glade/gramps.glade
|
src/glade/gramps.glade
|
||||||
|
@ -77,6 +77,12 @@ if gtk.pygtk_version < (2,10,0):
|
|||||||
PRINTER_DPI = 72.0
|
PRINTER_DPI = 72.0
|
||||||
PRINTER_SCALE = 1.0
|
PRINTER_SCALE = 1.0
|
||||||
|
|
||||||
|
MARGIN = 6
|
||||||
|
|
||||||
|
(ZOOM_BEST_FIT,
|
||||||
|
ZOOM_FIT_WIDTH,
|
||||||
|
ZOOM_FREE,) = range(3)
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# PrintPreview class
|
# PrintPreview class
|
||||||
@ -85,22 +91,37 @@ PRINTER_SCALE = 1.0
|
|||||||
class PrintPreview:
|
class PrintPreview:
|
||||||
"""Implement a dialog to show print preview.
|
"""Implement a dialog to show print preview.
|
||||||
"""
|
"""
|
||||||
|
zoom_factors = {
|
||||||
|
0.50: '50%',
|
||||||
|
0.75: '75%',
|
||||||
|
1.00: '100%',
|
||||||
|
1.25: '125%',
|
||||||
|
1.50: '150%',
|
||||||
|
1.75: '175%',
|
||||||
|
2.00: '200%',
|
||||||
|
3.00: '300%',
|
||||||
|
4.00: '400%',
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self, operation, preview, context, parent):
|
def __init__(self, operation, preview, context, parent):
|
||||||
self._operation = operation
|
self._operation = operation
|
||||||
self._preview = preview
|
self._preview = preview
|
||||||
self._context = context
|
self._context = context
|
||||||
|
|
||||||
|
self.__build_window()
|
||||||
|
self._current_page = None
|
||||||
|
|
||||||
# Private
|
# Private
|
||||||
|
|
||||||
def __build_window(self):
|
def __build_window(self):
|
||||||
"""Build the window from Glade.
|
"""Build the window from Glade.
|
||||||
"""
|
"""
|
||||||
glade_file = os.path.join(const.glade_dir, 'printpreview.glade')
|
glade_file = os.path.join(os.path.dirname(__file__),
|
||||||
|
'gtkprintpreview.glade')
|
||||||
|
|
||||||
window_xml = gtk.glade.XML(glade_file, 'window2', 'gramps')
|
window_xml = gtk.glade.XML(glade_file, 'window2', 'gramps')
|
||||||
self._window = window_xml.get_widget('window2')
|
self._window = window_xml.get_widget('window2')
|
||||||
#self._window.set_transient_for(parent)
|
#self._window.set_transient_for(parent)
|
||||||
self._window.set_modal(True)
|
|
||||||
|
|
||||||
# add the page number entry box into the toolbar
|
# add the page number entry box into the toolbar
|
||||||
entry_xml = gtk.glade.XML(glade_file, 'entry_hbox', 'gramps')
|
entry_xml = gtk.glade.XML(glade_file, 'entry_hbox', 'gramps')
|
||||||
@ -108,11 +129,17 @@ class PrintPreview:
|
|||||||
entry_item = window_xml.get_widget('entry_item')
|
entry_item = window_xml.get_widget('entry_item')
|
||||||
entry_item.add(entry_box)
|
entry_item.add(entry_box)
|
||||||
|
|
||||||
|
# remember active widgets for future use
|
||||||
|
self._swin = window_xml.get_widget('swin')
|
||||||
self._drawing_area = window_xml.get_widget('drawingarea')
|
self._drawing_area = window_xml.get_widget('drawingarea')
|
||||||
self._first_button = window_xml.get_widget('first')
|
self._first_button = window_xml.get_widget('first')
|
||||||
self._prev_button = window_xml.get_widget('prev')
|
self._prev_button = window_xml.get_widget('prev')
|
||||||
self._next_button = window_xml.get_widget('next')
|
self._next_button = window_xml.get_widget('next')
|
||||||
self._last_button = window_xml.get_widget('last')
|
self._last_button = window_xml.get_widget('last')
|
||||||
|
self._zoom_fit_width_button = window_xml.get_widget('zoom_fit_width')
|
||||||
|
self._zoom_best_fit_button = window_xml.get_widget('zoom_best_fit')
|
||||||
|
self._zoom_in_button = window_xml.get_widget('zoom_in')
|
||||||
|
self._zoom_out_button = window_xml.get_widget('zoom_out')
|
||||||
|
|
||||||
self._pages_entry = entry_xml.get_widget('entry')
|
self._pages_entry = entry_xml.get_widget('entry')
|
||||||
self._pages_label = entry_xml.get_widget('label')
|
self._pages_label = entry_xml.get_widget('label')
|
||||||
@ -120,15 +147,15 @@ class PrintPreview:
|
|||||||
# connect the signals
|
# connect the signals
|
||||||
window_xml.signal_autoconnect({
|
window_xml.signal_autoconnect({
|
||||||
'on_drawingarea_expose_event': self.on_drawingarea_expose_event,
|
'on_drawingarea_expose_event': self.on_drawingarea_expose_event,
|
||||||
'on_drawingarea_size_allocate': self.on_drawingarea_size_allocate,
|
'on_swin_size_allocate': self.on_swin_size_allocate,
|
||||||
'on_quit_clicked': self.on_quit_clicked,
|
'on_quit_clicked': self.on_quit_clicked,
|
||||||
'on_print_clicked': self.on_print_clicked,
|
'on_print_clicked': self.on_print_clicked,
|
||||||
'on_first_clicked': self.on_first_clicked,
|
'on_first_clicked': self.on_first_clicked,
|
||||||
'on_prev_clicked': self.on_prev_clicked,
|
'on_prev_clicked': self.on_prev_clicked,
|
||||||
'on_next_clicked': self.on_next_clicked,
|
'on_next_clicked': self.on_next_clicked,
|
||||||
'on_last_clicked': self.on_last_clicked,
|
'on_last_clicked': self.on_last_clicked,
|
||||||
'on_zoom_100_clicked': self.on_zoom_100_clicked,
|
'on_zoom_fit_width_toggled': self.on_zoom_fit_width_toggled,
|
||||||
'on_zoom_to_fit_clicked': self.on_zoom_to_fit_clicked,
|
'on_zoom_best_fit_toggled': self.on_zoom_best_fit_toggled,
|
||||||
'on_zoom_in_clicked': self.on_zoom_in_clicked,
|
'on_zoom_in_clicked': self.on_zoom_in_clicked,
|
||||||
'on_zoom_out_clicked': self.on_zoom_out_clicked,
|
'on_zoom_out_clicked': self.on_zoom_out_clicked,
|
||||||
'on_window_delete_event': self.on_window_delete_event,
|
'on_window_delete_event': self.on_window_delete_event,
|
||||||
@ -167,7 +194,15 @@ class PrintPreview:
|
|||||||
|
|
||||||
##return self._page_surfaces[page_no]
|
##return self._page_surfaces[page_no]
|
||||||
|
|
||||||
def __update_navigation(self):
|
def __set_page(self, page_no):
|
||||||
|
if page_no < 0 or page_no >= self._page_no:
|
||||||
|
return
|
||||||
|
|
||||||
|
if self._current_page != page_no:
|
||||||
|
self._drawing_area.queue_draw()
|
||||||
|
|
||||||
|
self._current_page = page_no
|
||||||
|
|
||||||
self._first_button.set_sensitive(self._current_page)
|
self._first_button.set_sensitive(self._current_page)
|
||||||
self._prev_button.set_sensitive(self._current_page)
|
self._prev_button.set_sensitive(self._current_page)
|
||||||
self._next_button.set_sensitive(self._current_page < self._page_no - 1)
|
self._next_button.set_sensitive(self._current_page < self._page_no - 1)
|
||||||
@ -175,6 +210,71 @@ class PrintPreview:
|
|||||||
|
|
||||||
self._pages_entry.set_text('%d' % (self._current_page + 1))
|
self._pages_entry.set_text('%d' % (self._current_page + 1))
|
||||||
|
|
||||||
|
def __set_zoom(self, zoom):
|
||||||
|
self._zoom = zoom
|
||||||
|
|
||||||
|
screen_width = int(self._paper_width * self._zoom + 2 * MARGIN)
|
||||||
|
screen_height = int(self._paper_height * self._zoom + 2 * MARGIN)
|
||||||
|
self._drawing_area.set_size_request(screen_width, screen_height)
|
||||||
|
self._drawing_area.queue_draw()
|
||||||
|
|
||||||
|
self._zoom_in_button.set_sensitive(self._zoom !=
|
||||||
|
max(self.zoom_factors.keys()))
|
||||||
|
self._zoom_out_button.set_sensitive(self._zoom !=
|
||||||
|
min(self.zoom_factors.keys()))
|
||||||
|
|
||||||
|
def __zoom_in(self):
|
||||||
|
zoom = [z for z in self.zoom_factors.keys() if z > self._zoom]
|
||||||
|
|
||||||
|
if zoom:
|
||||||
|
return min(zoom)
|
||||||
|
else:
|
||||||
|
return self._zoom
|
||||||
|
|
||||||
|
def __zoom_out(self):
|
||||||
|
zoom = [z for z in self.zoom_factors.keys() if z < self._zoom]
|
||||||
|
|
||||||
|
if zoom:
|
||||||
|
return max(zoom)
|
||||||
|
else:
|
||||||
|
return self._zoom
|
||||||
|
|
||||||
|
def __zoom_fit_width(self):
|
||||||
|
width, height, vsb_w, hsb_h = self.__get_view_size()
|
||||||
|
|
||||||
|
zoom = width / self._paper_width
|
||||||
|
if self._paper_height * zoom > height:
|
||||||
|
zoom = (width - vsb_w) / self._paper_width
|
||||||
|
|
||||||
|
return zoom
|
||||||
|
|
||||||
|
def __zoom_best_fit(self):
|
||||||
|
width, height, vsb_w, hsb_h = self.__get_view_size()
|
||||||
|
|
||||||
|
zoom = min(width / self._paper_width, height / self._paper_height)
|
||||||
|
|
||||||
|
return zoom
|
||||||
|
|
||||||
|
def __get_view_size(self):
|
||||||
|
"""Get the dimensions of the scrolled window.
|
||||||
|
"""
|
||||||
|
width = self._swin.allocation.width - 2 * MARGIN
|
||||||
|
height = self._swin.allocation.height - 2 * MARGIN
|
||||||
|
|
||||||
|
if self._swin.get_shadow_type() != gtk.SHADOW_NONE:
|
||||||
|
width -= 2 * self._swin.style.xthickness
|
||||||
|
height -= 2 * self._swin.style.ythickness
|
||||||
|
|
||||||
|
spacing = self._swin.style_get_property('scrollbar-spacing')
|
||||||
|
|
||||||
|
vsb_w, vsb_h = self._swin.get_vscrollbar().size_request()
|
||||||
|
vsb_w += spacing
|
||||||
|
|
||||||
|
hsb_w, hsb_h = self._swin.get_hscrollbar().size_request()
|
||||||
|
hsb_h += spacing
|
||||||
|
|
||||||
|
return width, height, vsb_w, hsb_h
|
||||||
|
|
||||||
def __end_preview(self):
|
def __end_preview(self):
|
||||||
self._operation.end_preview()
|
self._operation.end_preview()
|
||||||
|
|
||||||
@ -185,15 +285,14 @@ class PrintPreview:
|
|||||||
cr.rectangle(event.area)
|
cr.rectangle(event.area)
|
||||||
cr.clip()
|
cr.clip()
|
||||||
|
|
||||||
cr.translate(6, 6)
|
# TODO put the paper on the middle of the window
|
||||||
|
cr.translate(MARGIN, MARGIN)
|
||||||
# TODO correct scale
|
|
||||||
#cr.scale(self._scale, self._scale)
|
|
||||||
|
|
||||||
|
# draw an empty white page
|
||||||
cr.set_source_rgb(1.0, 1.0, 1.0)
|
cr.set_source_rgb(1.0, 1.0, 1.0)
|
||||||
cr.rectangle(0, 0,
|
cr.rectangle(0, 0,
|
||||||
self._paper_width * self._scale,
|
self._paper_width * self._zoom,
|
||||||
self._paper_height * self._scale)
|
self._paper_height * self._zoom)
|
||||||
cr.fill_preserve()
|
cr.fill_preserve()
|
||||||
cr.set_source_rgb(0, 0, 0)
|
cr.set_source_rgb(0, 0, 0)
|
||||||
cr.set_line_width(1)
|
cr.set_line_width(1)
|
||||||
@ -206,37 +305,32 @@ class PrintPreview:
|
|||||||
##cr.set_source_surface(self.get_page(0))
|
##cr.set_source_surface(self.get_page(0))
|
||||||
##cr.paint()
|
##cr.paint()
|
||||||
|
|
||||||
self._context.set_cairo_context(cr,
|
# draw the content of the currently selected page
|
||||||
PRINTER_DPI * self._scale,
|
dpi = PRINTER_DPI * self._zoom
|
||||||
PRINTER_DPI * self._scale)
|
self._context.set_cairo_context(cr, dpi, dpi)
|
||||||
self._preview.render_page(self._current_page)
|
self._preview.render_page(self._current_page)
|
||||||
|
|
||||||
|
def on_swin_size_allocate(self, scrolledwindow, allocation):
|
||||||
|
if self._zoom_mode == ZOOM_FIT_WIDTH:
|
||||||
|
self.__set_zoom(self.__zoom_fit_width())
|
||||||
|
|
||||||
def on_drawingarea_size_allocate(self, drawingarea, allocation):
|
if self._zoom_mode == ZOOM_BEST_FIT:
|
||||||
pass
|
self.__set_zoom(self.__zoom_best_fit())
|
||||||
|
|
||||||
def on_print_clicked(self, toolbutton):
|
def on_print_clicked(self, toolbutton):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def on_first_clicked(self, toolbutton):
|
def on_first_clicked(self, toolbutton):
|
||||||
self._current_page = 0
|
self.__set_page(0)
|
||||||
self.__update_navigation()
|
|
||||||
self._drawing_area.queue_draw()
|
|
||||||
|
|
||||||
def on_prev_clicked(self, toolbutton):
|
def on_prev_clicked(self, toolbutton):
|
||||||
self._current_page -= 1
|
self.__set_page(self._current_page - 1)
|
||||||
self.__update_navigation()
|
|
||||||
self._drawing_area.queue_draw()
|
|
||||||
|
|
||||||
def on_next_clicked(self, toolbutton):
|
def on_next_clicked(self, toolbutton):
|
||||||
self._current_page += 1
|
self.__set_page(self._current_page + 1)
|
||||||
self.__update_navigation()
|
|
||||||
self._drawing_area.queue_draw()
|
|
||||||
|
|
||||||
def on_last_clicked(self, toolbutton):
|
def on_last_clicked(self, toolbutton):
|
||||||
self._current_page = self._page_no - 1
|
self.__set_page(self._page_no - 1)
|
||||||
self.__update_navigation()
|
|
||||||
self._drawing_area.queue_draw()
|
|
||||||
|
|
||||||
def on_entry_activate(self, entry):
|
def on_entry_activate(self, entry):
|
||||||
try:
|
try:
|
||||||
@ -247,25 +341,35 @@ class PrintPreview:
|
|||||||
if new_page < 0 or new_page >= self._page_no:
|
if new_page < 0 or new_page >= self._page_no:
|
||||||
new_page = self._current_page
|
new_page = self._current_page
|
||||||
|
|
||||||
self._current_page = new_page
|
self.__set_page(new_page)
|
||||||
self.__update_navigation()
|
|
||||||
self._drawing_area.queue_draw()
|
|
||||||
|
|
||||||
def on_zoom_100_clicked(self, toolbutton):
|
def on_zoom_fit_width_toggled(self, toggletoolbutton):
|
||||||
self._scale = 1.0
|
if toggletoolbutton.get_active():
|
||||||
self._drawing_area.queue_draw()
|
self._zoom_best_fit_button.set_active(False)
|
||||||
|
self._zoom_mode = ZOOM_FIT_WIDTH
|
||||||
|
self.__set_zoom(self.__zoom_fit_width())
|
||||||
|
else:
|
||||||
|
self._zoom_mode = ZOOM_FREE
|
||||||
|
|
||||||
def on_zoom_to_fit_clicked(self, toolbutton):
|
def on_zoom_best_fit_toggled(self, toggletoolbutton):
|
||||||
pass
|
if toggletoolbutton.get_active():
|
||||||
|
self._zoom_fit_width_button.set_active(False)
|
||||||
|
self._zoom_mode = ZOOM_BEST_FIT
|
||||||
|
self.__set_zoom(self.__zoom_best_fit())
|
||||||
|
else:
|
||||||
|
self._zoom_mode = ZOOM_FREE
|
||||||
|
|
||||||
def on_zoom_in_clicked(self, toolbutton):
|
def on_zoom_in_clicked(self, toolbutton):
|
||||||
self._scale += 0.5
|
self._zoom_fit_width_button.set_active(False)
|
||||||
self._drawing_area.queue_draw()
|
self._zoom_best_fit_button.set_active(False)
|
||||||
|
self._zoom_mode = ZOOM_FREE
|
||||||
|
self.__set_zoom(self.__zoom_in())
|
||||||
|
|
||||||
def on_zoom_out_clicked(self, toolbutton):
|
def on_zoom_out_clicked(self, toolbutton):
|
||||||
if self._scale > 1.0:
|
self._zoom_fit_width_button.set_active(False)
|
||||||
self._scale -= 0.5
|
self._zoom_best_fit_button.set_active(False)
|
||||||
self._drawing_area.queue_draw()
|
self._zoom_mode = ZOOM_FREE
|
||||||
|
self.__set_zoom(self.__zoom_out())
|
||||||
|
|
||||||
def on_window_delete_event(self, widget, event):
|
def on_window_delete_event(self, widget, event):
|
||||||
self.__end_preview()
|
self.__end_preview()
|
||||||
@ -278,23 +382,25 @@ class PrintPreview:
|
|||||||
# Public
|
# Public
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.__build_window()
|
# get paper/page dimensions
|
||||||
|
|
||||||
self._scale = 1.0
|
|
||||||
|
|
||||||
##self._page_numbers = [0,]
|
|
||||||
##self._page_surfaces = {}
|
|
||||||
self._page_no = self._operation.get_property('n_pages')
|
|
||||||
self._pages_label.set_text('of %d' % self._page_no)
|
|
||||||
self._current_page = 0
|
|
||||||
self.__update_navigation()
|
|
||||||
|
|
||||||
page_setup = self._context.get_page_setup()
|
page_setup = self._context.get_page_setup()
|
||||||
self._paper_width = page_setup.get_paper_width(gtk.UNIT_POINTS)
|
self._paper_width = page_setup.get_paper_width(gtk.UNIT_POINTS)
|
||||||
self._paper_height = page_setup.get_paper_height(gtk.UNIT_POINTS)
|
self._paper_height = page_setup.get_paper_height(gtk.UNIT_POINTS)
|
||||||
self._page_width = page_setup.get_page_width(gtk.UNIT_POINTS)
|
self._page_width = page_setup.get_page_width(gtk.UNIT_POINTS)
|
||||||
self._page_height = page_setup.get_page_height(gtk.UNIT_POINTS)
|
self._page_height = page_setup.get_page_height(gtk.UNIT_POINTS)
|
||||||
|
|
||||||
|
# get the total number of pages
|
||||||
|
##self._page_numbers = [0,]
|
||||||
|
##self._page_surfaces = {}
|
||||||
|
self._page_no = self._operation.get_property('n_pages')
|
||||||
|
self._pages_label.set_text('of %d' % self._page_no)
|
||||||
|
|
||||||
|
# set zoom level and initial page number
|
||||||
|
self._zoom_mode = ZOOM_FREE
|
||||||
|
self.__set_zoom(1.0)
|
||||||
|
self.__set_page(0)
|
||||||
|
|
||||||
|
# let's the show begin...
|
||||||
self._window.show()
|
self._window.show()
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
@ -465,67 +571,67 @@ def tabstops_to_tabarray(tab_stops, dpi):
|
|||||||
|
|
||||||
return tab_array
|
return tab_array
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
###------------------------------------------------------------------------
|
||||||
#
|
###
|
||||||
# Table row style
|
### Table row style
|
||||||
#
|
###
|
||||||
#------------------------------------------------------------------------
|
###------------------------------------------------------------------------
|
||||||
|
|
||||||
class RowStyle(list):
|
##class RowStyle(list):
|
||||||
"""Specifies the format of a table row.
|
##"""Specifies the format of a table row.
|
||||||
|
|
||||||
RowStyle extents the available styles in BaseDoc.
|
##RowStyle extents the available styles in BaseDoc.
|
||||||
|
|
||||||
The RowStyle contains the width of each column as a percentage of the
|
##The RowStyle contains the width of each column as a percentage of the
|
||||||
width of the full row. Note! The width of the row is not know until
|
##width of the full row. Note! The width of the row is not know until
|
||||||
divide() or draw() method is called.
|
##divide() or draw() method is called.
|
||||||
|
|
||||||
"""
|
##"""
|
||||||
def __init__(self):
|
##def __init__(self):
|
||||||
self.columns = []
|
##self.columns = []
|
||||||
|
|
||||||
def set_columns(self, columns):
|
##def set_columns(self, columns):
|
||||||
"""Set the number of columns.
|
##"""Set the number of columns.
|
||||||
|
|
||||||
@param columns: number of columns that should be used.
|
##@param columns: number of columns that should be used.
|
||||||
@param type: int
|
##@param type: int
|
||||||
|
|
||||||
"""
|
##"""
|
||||||
self.columns = columns
|
##self.columns = columns
|
||||||
|
|
||||||
def get_columns(self):
|
##def get_columns(self):
|
||||||
"""Return the number of columns.
|
##"""Return the number of columns.
|
||||||
"""
|
##"""
|
||||||
return self.columns
|
##return self.columns
|
||||||
|
|
||||||
def set_column_widths(self, clist):
|
##def set_column_widths(self, clist):
|
||||||
"""Set the width of all the columns at once.
|
##"""Set the width of all the columns at once.
|
||||||
|
|
||||||
@param clist: list of width of columns in % of the full row.
|
##@param clist: list of width of columns in % of the full row.
|
||||||
@param tyle: list
|
##@param tyle: list
|
||||||
|
|
||||||
"""
|
##"""
|
||||||
self.columns = len(clist)
|
##self.columns = len(clist)
|
||||||
for i in range(self.columns):
|
##for i in range(self.columns):
|
||||||
self.colwid[i] = clist[i]
|
##self.colwid[i] = clist[i]
|
||||||
|
|
||||||
def set_column_width(self, index, width):
|
##def set_column_width(self, index, width):
|
||||||
"""
|
##"""
|
||||||
Sets the width of a specified column to the specified width.
|
##Sets the width of a specified column to the specified width.
|
||||||
|
|
||||||
@param index: column being set (index starts at 0)
|
##@param index: column being set (index starts at 0)
|
||||||
@param width: percentage of the table width assigned to the column
|
##@param width: percentage of the table width assigned to the column
|
||||||
"""
|
##"""
|
||||||
self.colwid[index] = width
|
##self.colwid[index] = width
|
||||||
|
|
||||||
def get_column_width(self, index):
|
##def get_column_width(self, index):
|
||||||
"""
|
##"""
|
||||||
Returns the column width of the specified column as a percentage of
|
##Returns the column width of the specified column as a percentage of
|
||||||
the entire table width.
|
##the entire table width.
|
||||||
|
|
||||||
@param index: column to return (index starts at 0)
|
##@param index: column to return (index starts at 0)
|
||||||
"""
|
##"""
|
||||||
return self.colwid[index]
|
##return self.colwid[index]
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -1124,7 +1230,7 @@ class CairoDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
|
|||||||
|
|
||||||
It must be implemented in the subclasses. The idea is that with
|
It must be implemented in the subclasses. The idea is that with
|
||||||
different subclass different output could be generated:
|
different subclass different output could be generated:
|
||||||
e.g. Print, PDF, PS, PNG (which are currently supported by Cairo.
|
e.g. Print, PDF, PS, PNG (which are currently supported by Cairo).
|
||||||
|
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
@ -1359,6 +1465,8 @@ class GtkPrint(CairoDoc):
|
|||||||
|
|
||||||
self.preview = PrintPreview(operation, preview, context, parent)
|
self.preview = PrintPreview(operation, preview, context, parent)
|
||||||
|
|
||||||
|
# give a dummy cairo context to gtk.PrintContext,
|
||||||
|
# PrintPreview will update it with the real one
|
||||||
width = int(context.get_width())
|
width = int(context.get_width())
|
||||||
height = int(context.get_height())
|
height = int(context.get_height())
|
||||||
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
|
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
|
||||||
|
@ -20,6 +20,9 @@ docgen_PYTHON = \
|
|||||||
SvgDrawDoc.py\
|
SvgDrawDoc.py\
|
||||||
GtkPrint.py
|
GtkPrint.py
|
||||||
|
|
||||||
|
GLADEFILES = \
|
||||||
|
gtkprintpreview.glade
|
||||||
|
|
||||||
# Clean up all the byte-compiled files
|
# Clean up all the byte-compiled files
|
||||||
MOSTLYCLEANFILES = *pyc *pyo
|
MOSTLYCLEANFILES = *pyc *pyo
|
||||||
|
|
||||||
|
@ -76,8 +76,8 @@
|
|||||||
<widget class="GtkWindow" id="window2">
|
<widget class="GtkWindow" id="window2">
|
||||||
<property name="title" translatable="yes">Print Preview</property>
|
<property name="title" translatable="yes">Print Preview</property>
|
||||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||||
<property name="modal">False</property>
|
<property name="modal">True</property>
|
||||||
<property name="default_width">800</property>
|
<property name="default_width">800</property>
|
||||||
<property name="default_height">600</property>
|
<property name="default_height">600</property>
|
||||||
<property name="resizable">True</property>
|
<property name="resizable">True</property>
|
||||||
@ -258,14 +258,16 @@
|
|||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkToolButton" id="zoom_100">
|
<widget class="GtkToggleToolButton" id="zoom_fit_width">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="tooltip" translatable="yes">Zooms 1:1</property>
|
<property name="label" translatable="yes"></property>
|
||||||
<property name="stock_id">gtk-zoom-100</property>
|
<property name="use_underline">True</property>
|
||||||
|
<property name="stock_id">gtk-missing-image</property>
|
||||||
<property name="visible_horizontal">True</property>
|
<property name="visible_horizontal">True</property>
|
||||||
<property name="visible_vertical">True</property>
|
<property name="visible_vertical">True</property>
|
||||||
<property name="is_important">False</property>
|
<property name="is_important">False</property>
|
||||||
<signal name="clicked" handler="on_zoom_100_clicked" last_modification_time="Thu, 23 Aug 2007 17:55:06 GMT"/>
|
<property name="active">False</property>
|
||||||
|
<signal name="toggled" handler="on_zoom_fit_width_toggled" last_modification_time="Tue, 28 Aug 2007 18:53:35 GMT"/>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -274,14 +276,14 @@
|
|||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkToolButton" id="zoom_to_fit">
|
<widget class="GtkToggleToolButton" id="zoom_best_fit">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="tooltip" translatable="yes">Zooms to fit the whole page</property>
|
|
||||||
<property name="stock_id">gtk-zoom-fit</property>
|
<property name="stock_id">gtk-zoom-fit</property>
|
||||||
<property name="visible_horizontal">True</property>
|
<property name="visible_horizontal">True</property>
|
||||||
<property name="visible_vertical">True</property>
|
<property name="visible_vertical">True</property>
|
||||||
<property name="is_important">False</property>
|
<property name="is_important">False</property>
|
||||||
<signal name="clicked" handler="on_zoom_to_fit_clicked" last_modification_time="Wed, 22 Aug 2007 09:52:41 GMT"/>
|
<property name="active">False</property>
|
||||||
|
<signal name="toggled" handler="on_zoom_best_fit_toggled" last_modification_time="Tue, 28 Aug 2007 18:53:55 GMT"/>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -333,19 +335,19 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||||
|
<signal name="size_allocate" handler="on_swin_size_allocate" last_modification_time="Tue, 28 Aug 2007 21:17:25 GMT"/>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkViewport" id="viewport1">
|
<widget class="GtkViewport" id="viewport1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkDrawingArea" id="drawingarea">
|
<widget class="GtkDrawingArea" id="drawingarea">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<signal name="expose_event" handler="on_drawingarea_expose_event" last_modification_time="Wed, 22 Aug 2007 13:46:23 GMT"/>
|
<signal name="expose_event" handler="on_drawingarea_expose_event" last_modification_time="Wed, 22 Aug 2007 13:46:23 GMT"/>
|
||||||
<signal name="size_allocate" handler="on_drawingarea_size_allocate" last_modification_time="Wed, 22 Aug 2007 13:47:26 GMT"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
@ -9,6 +9,5 @@ dist_pkgdata_DATA = \
|
|||||||
mergedata.glade\
|
mergedata.glade\
|
||||||
plugins.glade\
|
plugins.glade\
|
||||||
rule.glade\
|
rule.glade\
|
||||||
scratchpad.glade\
|
scratchpad.glade
|
||||||
printpreview.glade
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user