Changeset 1002:5e741be6b47c
- Timestamp:
- 07/06/19 13:54:20 (5 years ago)
- Branch:
- python3
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/common.py
r999 r1002 34 34 pass 35 35 from gi.repository import Pango 36 from gi.repository import PangoCairo 36 37 37 38 import codecs -
src/mlx/gui/flight.py
r999 r1002 684 684 printOperation.set_use_full_page(False) 685 685 686 result = printOperation.run(Gtk.P RINT_OPERATION_ACTION_PRINT_DIALOG,686 result = printOperation.run(Gtk.PrintOperationAction.PRINT_DIALOG, 687 687 wizard.gui.mainWindow) 688 688 689 if result == Gtk.P RINT_OPERATION_RESULT_APPLY:689 if result == Gtk.PrintOperationResult.APPLY: 690 690 self._printSettings = printOperation.get_print_settings() 691 elif result == Gtk.P RINT_OPERATION_RESULT_ERROR:691 elif result == Gtk.PrintOperationResult.ERROR: 692 692 errorDialog(xstr("flightsel_print_failed", 693 693 wizard.gui.mainWindow, … … 705 705 706 706 cr = context.get_cairo_context() 707 707 708 cr.set_antialias(cairo.ANTIALIAS_GRAY) 708 709 … … 712 713 cr.stroke() 713 714 714 layout = cr.create_layout() 715 pcr = context.create_pango_context() 716 717 layout = Pango.Layout(pcr) # cr.create_layout() 715 718 layout.set_text("Malév VA official briefing") 716 719 font = Pango.FontDescription("sans") … … 719 722 layout.set_font_description(font) 720 723 721 (_ink, (x0, y0, x1, y1)) = layout.get_extents()722 width = float(x1 + 1 - x0)/ Pango.SCALE724 (_ink, logical) = layout.get_extents() 725 width = logical.width / Pango.SCALE 723 726 724 727 y = 25 * scale … … 726 729 cr.move_to((context.get_width() - width)/2.0, y) 727 730 cr.set_line_width(0.1 * scale) 728 cr.layout_path(layout)731 PangoCairo.layout_path(cr, layout) 729 732 cr.stroke_preserve() 730 733 cr.fill() 731 734 732 y += float(y1 + 1 - y0)/ Pango.SCALE735 y += logical.height / Pango.SCALE 733 736 y += 6 * scale 734 737 735 layout = cr.create_layout()738 layout = Pango.Layout(pcr) 736 739 layout.set_text("%s (%s) részére" % 737 740 (loginResult.pilotName, loginResult.pilotID)) 738 741 font = Pango.FontDescription("sans") 739 742 font.set_size(int(16 * scale * Pango.SCALE)) 740 font.set_weight( 450)743 font.set_weight(Pango.Weight.MEDIUM) 741 744 layout.set_font_description(font) 742 (_ink, (x0, y0, x1, y1)) = layout.get_extents()743 width = float(x1 + 1 - x0)/ Pango.SCALE745 (_ink, logical) = layout.get_extents() 746 width = logical.width / Pango.SCALE 744 747 745 748 cr.move_to((context.get_width() - width)/2.0, y) 746 749 cr.set_line_width(0.1 * scale) 747 cr.layout_path(layout)750 PangoCairo.layout_path(cr, layout) 748 751 cr.stroke_preserve() 749 752 cr.fill() 750 753 751 y += float(y1 + 1 - y0)/ Pango.SCALE754 y += logical.height / Pango.SCALE 752 755 y += 4 * scale 753 756 … … 761 764 font = Pango.FontDescription("sans") 762 765 font.set_size(int(7 * scale * Pango.SCALE)) 763 font.set_weight( 150)766 font.set_weight(Pango.Weight.ULTRALIGHT) 764 767 765 768 table = [] … … 793 796 totalHeight = 0 794 797 for (label, value) in table: 795 labelLayout = cr.create_layout()798 labelLayout = Pango.Layout(pcr) 796 799 labelLayout.set_text(label) 797 800 labelLayout.set_font_description(font) 798 801 799 (_ink, (x0, y0, x1, y1)) = labelLayout.get_extents()800 maxLabelWidth = max(maxLabelWidth, x1 + 1 - x0)801 labelHeight = y1 + 1 - y0802 803 valueLayout = cr.create_layout()802 (_ink, logical) = labelLayout.get_extents() 803 maxLabelWidth = max(maxLabelWidth, logical.width) 804 labelHeight = logical.height 805 806 valueLayout = Pango.Layout(pcr) 804 807 valueLayout.set_text(value) 805 808 valueLayout.set_font_description(font) … … 817 820 valueLayout.set_width(int(valueWidth * Pango.SCALE)) 818 821 819 (_ink, (x0, y0, x1, y1)) = valueLayout.get_extents()820 valueHeight = y1 + 1 - y0822 (_ink, logical) = valueLayout.get_extents() 823 valueHeight = logical.height 821 824 822 825 height = float(max(labelHeight, valueHeight))/Pango.SCALE … … 837 840 cr.move_to(labelX, y) 838 841 cr.set_line_width(0.1) 839 cr.layout_path(labelLayout)842 PangoCairo.layout_path(cr, labelLayout) 840 843 cr.stroke_preserve() 841 844 cr.fill() … … 843 846 cr.move_to(valueX, y) 844 847 cr.set_line_width(0.1) 845 cr.layout_path(valueLayout)848 PangoCairo.layout_path(cr, valueLayout) 846 849 cr.stroke_preserve() 847 850 cr.fill()
Note:
See TracChangeset
for help on using the changeset viewer.