def setGuidesRow(n, gap):
    print "setGuidesRow should be a scribus API function"
    (margin_top, margin_left, margin_right, margin_bottom) = scribus.getPageNMargins(scribus.currentPage())
    (width, height) = scribus.getPageNSize(scribus.currentPage())
    cell_height = (height - (margin_top + margin_bottom) - (gap * (n - 1))) / n
    guide = []
    previous_guide = margin_top
    for i in range(0, n - 1):
        guide.append(previous_guide + cell_height)
        guide.append(previous_guide + cell_height + gap)
        previous_guide = previous_guide + cell_height + gap
    scribus.setHGuides(guide)
Beispiel #2
0
def setGuidesRow(n, gap):
    print "setGuidesRow should be a scribus API function"
    (margin_top, margin_left, margin_right,
     margin_bottom) = scribus.getPageNMargins(scribus.currentPage())
    (width, height) = scribus.getPageNSize(scribus.currentPage())
    cell_height = (height - (margin_top + margin_bottom) - (gap * (n - 1))) / n
    guide = []
    previous_guide = margin_top
    for i in range(0, n - 1):
        guide.append(previous_guide + cell_height)
        guide.append(previous_guide + cell_height + gap)
        previous_guide = previous_guide + cell_height + gap
    scribus.setHGuides(guide)
def setGuidesColumn(n, gap):
    print "setGuidesColumn should be a scribus API function"

    (margin_top, margin_left, margin_right, margin_bottom) = scribus.getPageNMargins(scribus.currentPage())
    (width, height) = scribus.getPageNSize(scribus.currentPage())
    cell_width = (width - (margin_left + margin_right) - (gap * (n - 1))) / n

    guide = []
    previous_guide = margin_left
    for i in range(0, n - 1):
        guide.append(previous_guide + cell_width)
        guide.append(previous_guide + cell_width + gap)
        previous_guide = previous_guide + cell_width + gap
    scribus.setVGuides(guide)
Beispiel #4
0
def setGuidesColumn(n, gap):
    print "setGuidesColumn should be a scribus API function"

    (margin_top, margin_left, margin_right,
     margin_bottom) = scribus.getPageNMargins(scribus.currentPage())
    (width, height) = scribus.getPageNSize(scribus.currentPage())
    cell_width = (width - (margin_left + margin_right) - (gap * (n - 1))) / n

    guide = []
    previous_guide = margin_left
    for i in range(0, n - 1):
        guide.append(previous_guide + cell_width)
        guide.append(previous_guide + cell_width + gap)
        previous_guide = previous_guide + cell_width + gap
    scribus.setVGuides(guide)
def setGuidesRow(n, gap):
    print "setGuidesRow should be a scribus API function"
    (margin_top, margin_left, margin_right, margin_bottom) = scribus.getPageNMargins(scribus.currentPage())
    print "left " + str(margin_left)
    print "right " + str(margin_right)
    (width, height) = scribus.getPageNSize(scribus.currentPage())
    print "width " + str(width)
    print "height " + str(height)
    cell_width = (width - (margin_left + margin_right) - (gap * (n - 1))) / n
    print cell_width
    guide = []
    previous_guide = margin_left
    for i in range(0, n - 1):
        guide.append(previous_guide + cell_width)
        guide.append(previous_guide + cell_width + gap)
        previous_guide = previous_guide + cell_width + gap
    scribus.setHGuides(guide)
Beispiel #6
0
horizontal_cells = scribus.messageBox(
    'Cells orientation',
    'Should the cells be wider than higer?',
    scribus.ICON_NONE,
    scribus.BUTTON_YES,
    scribus.BUTTON_NO,
)
if horizontal_cells == scribus.BUTTON_YES:  # doc of return value of messageBox is wrong: it returns the value of the button
    horizontal_cells = True
else:
    horizontal_cells = False

# get the measurements from the current page
(page_width, page_height) = scribus.getPageNSize(scribus.currentPage())
(margin_top, margin_left, margin_right,
 margin_bottom) = scribus.getPageNMargins(scribus.currentPage())

page_inner_width = page_width - margin_left - margin_right
page_inner_height = page_height - margin_top - margin_bottom

# calculate the basic values
line_height = font_size_main_text * 1.5  # real ratio 1.618
line_height_mm = line_height * pt_to_mm_ratio

debug("line_height", line_height)
debug("line_height_mm", line_height_mm)

gap = line_height_mm

# calculate number of lines fitting the page and the number of rows
page_line_count = get_page_line_count(page_inner_height, line_height_mm)
def page_size_margin(page_num):
    size = scribus.getPageNSize(page_num)
    margin = scribus.getPageNMargins(page_num)
    return size + margin
# input values
column_count = scribus.valueDialog('Number of columns', 'Please set the number of columns\n(sane values are 6, 9, 12, 24)', '6')
column_count = get_int_from_dialog_value(column_count)

font_size_main_text = scribus.valueDialog('Text size', 'Please set the font size for the main text\n(this value will be used)', '12')
font_size_main_text = get_int_from_dialog_value(font_size_main_text)

horizontal_cells = scribus.messageBox('Cells orientation', 'Should the cells be wider than higer?', scribus.ICON_NONE, scribus.BUTTON_YES, scribus.BUTTON_NO,)
if horizontal_cells == scribus.BUTTON_YES : # doc of return value of messageBox is wrong: it returns the value of the button
    horizontal_cells = True
else :
    horizontal_cells = False

# get the measurements from the current page
(page_width, page_height) = scribus.getPageNSize(scribus.currentPage())
(margin_top, margin_left, margin_right, margin_bottom) = scribus.getPageNMargins(scribus.currentPage())

page_inner_width = page_width - margin_left - margin_right
page_inner_height = page_height - margin_top - margin_bottom

# calculate the basic values
line_height = font_size_main_text * 1.5 # real ratio 1.618
line_height_mm = line_height * pt_to_mm_ratio

debug("line_height", line_height)
debug("line_height_mm", line_height_mm)

gap = line_height_mm

# calculate number of lines fitting the page and the number of rows
page_line_count = get_page_line_count(page_inner_height, line_height_mm)
def page_size_margin(page_num):
    size = scribus.getPageNSize(page_num)
    margin = scribus.getPageNMargins(page_num)
    return size + margin