MCPcopy
hub / github.com/pdfarranger/pdfarranger / __init__

Method __init__

pdfarranger/pageutils.py:344–364  ·  view source on GitHub ↗
(self, model, selection, window)

Source from the content-addressed store, hash-verified

342 """ A dialog box to define page size or scale factor """
343
344 def __init__(self, model, selection, window):
345 super().__init__(title=_("Page size"), parent=window)
346 self.set_resizable(False)
347 page = model.get_value(model.get_iter(selection[-1]), 0)
348 paper_widget = PaperSizeWidget(page.size_in_mm(), margin=1)
349 paper_widget.attach(Gtk.Label(_("Fit mode"), halign=Gtk.Align.START), 1, 5, 1, 1)
350 self.combo = Gtk.ComboBoxText()
351 self.combo.append('SCALE', _("Scale"))
352 self.combo.append('SCALE-ADD-MARG', _("Scale & Add margins"))
353 self.combo.append('CROP-ADD-MARG', _("Crop & Add margins"))
354 self.combo.set_active(0)
355 paper_widget.attach(self.combo, 2, 5, 1, 1)
356 rel_widget = _RelativeScalingWidget(page.scale)
357 self.scale_stack = _RadioStackSwitcher(margin=15)
358 self.scale_stack.add_named(paper_widget, "Fit", _("Fit to paper"))
359 self.scale_stack.add_named(rel_widget, "Relative", _("Relative"))
360 pagesizeframe = Gtk.Frame(shadow_type=Gtk.ShadowType.NONE)
361 pagesizeframe.add(self.scale_stack)
362 self.vbox.pack_start(pagesizeframe, True, True, 0)
363 self.show_all()
364 self.selection = selection
365
366 def run_get(self):
367 """ Open the dialog and return the size value """

Callers

nothing calls this directly

Calls 7

PaperSizeWidgetClass · 0.85
_RadioStackSwitcherClass · 0.85
size_in_mmMethod · 0.80
add_namedMethod · 0.80
__init__Method · 0.45
get_valueMethod · 0.45

Tested by

no test coverage detected