Changeset 998:6fda08fc895b for src
- Timestamp:
- 07/04/19 18:08:19 (5 years ago)
- Branch:
- python3
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/common.py
r997 r998 24 24 gi.require_version("Gdk", "3.0") 25 25 from gi.repository import Gdk 26 from gi.repository import GdkPixbuf as gdkPixbuf26 from gi.repository import GdkPixbuf 27 27 gi.require_version("Gtk", "3.0") 28 28 from gi.repository import Gtk 29 29 try: 30 30 gi.require_version("AppIndicator3", "0.1") 31 from gi.repository import AppIndicator3 as appindicator31 from gi.repository import AppIndicator3 32 32 appIndicator = True 33 33 except: 34 34 pass 35 from gi.repository import Pango as pango35 from gi.repository import Pango 36 36 37 37 … … 75 75 POLICY_ALWAYS = Gtk.PolicyType.ALWAYS 76 76 77 WEIGHT_NORMAL = pango.Weight.NORMAL78 WEIGHT_BOLD = pango.Weight.BOLD77 WEIGHT_NORMAL = Pango.Weight.NORMAL 78 WEIGHT_BOLD = Pango.Weight.BOLD 79 79 80 80 WINDOW_STATE_ICONIFIED = Gdk.WindowState.ICONIFIED … … 95 95 SELECTION_MULTIPLE = Gtk.SelectionMode.MULTIPLE 96 96 97 pixbuf_new_from_file = gdkPixbuf.Pixbuf.new_from_file97 pixbuf_new_from_file = GdkPixbuf.Pixbuf.new_from_file 98 98 99 99 import codecs -
src/mlx/gui/flight.py
r996 r998 84 84 85 85 titleLabel = Gtk.Label(title) 86 titleLabel.modify_font( pango.FontDescription("bold 24"))86 titleLabel.modify_font(Pango.FontDescription("bold 24")) 87 87 alignment.set_padding(padding_top = 4, padding_bottom = 4, 88 88 padding_left = 6, padding_right = 0) … … 714 714 layout = cr.create_layout() 715 715 layout.set_text("Malév VA official briefing") 716 font = pango.FontDescription("sans")717 font.set_size(int(32 * scale * pango.SCALE))718 font.set_weight( pango.WEIGHT_NORMAL)716 font = Pango.FontDescription("sans") 717 font.set_size(int(32 * scale * Pango.SCALE)) 718 font.set_weight(Pango.WEIGHT_NORMAL) 719 719 layout.set_font_description(font) 720 720 721 721 (_ink, (x0, y0, x1, y1)) = layout.get_extents() 722 width = float(x1 + 1 - x0) / pango.SCALE722 width = float(x1 + 1 - x0) / Pango.SCALE 723 723 724 724 y = 25 * scale … … 730 730 cr.fill() 731 731 732 y += float(y1 + 1 - y0) / pango.SCALE732 y += float(y1 + 1 - y0) / Pango.SCALE 733 733 y += 6 * scale 734 734 … … 736 736 layout.set_text("%s (%s) részére" % 737 737 (loginResult.pilotName, loginResult.pilotID)) 738 font = pango.FontDescription("sans")739 font.set_size(int(16 * scale * pango.SCALE))738 font = Pango.FontDescription("sans") 739 font.set_size(int(16 * scale * Pango.SCALE)) 740 740 font.set_weight(450) 741 741 layout.set_font_description(font) 742 742 (_ink, (x0, y0, x1, y1)) = layout.get_extents() 743 width = float(x1 + 1 - x0) / pango.SCALE743 width = float(x1 + 1 - x0) / Pango.SCALE 744 744 745 745 cr.move_to((context.get_width() - width)/2.0, y) … … 749 749 cr.fill() 750 750 751 y += float(y1 + 1 - y0) / pango.SCALE751 y += float(y1 + 1 - y0) / Pango.SCALE 752 752 y += 4 * scale 753 753 … … 759 759 y += 20 * scale 760 760 761 font = pango.FontDescription("sans")762 font.set_size(int(7 * scale * pango.SCALE))761 font = Pango.FontDescription("sans") 762 font.set_size(int(7 * scale * Pango.SCALE)) 763 763 font.set_weight(150) 764 764 … … 807 807 labelLayouts.append((labelLayout, valueLayout, labelHeight)) 808 808 809 maxLabelWidth = maxLabelWidth / pango.SCALE809 maxLabelWidth = maxLabelWidth / Pango.SCALE 810 810 811 811 valueX = labelX + labelValueFill + maxLabelWidth … … 815 815 (labelFill + maxLabelWidth + labelValueFill + valueFill) 816 816 for (labelLayout, valueLayout, labelHeight) in labelLayouts: 817 valueLayout.set_width(int(valueWidth * pango.SCALE))817 valueLayout.set_width(int(valueWidth * Pango.SCALE)) 818 818 819 819 (_ink, (x0, y0, x1, y1)) = valueLayout.get_extents() 820 820 valueHeight = y1 + 1 - y0 821 821 822 height = float(max(labelHeight, valueHeight))/ pango.SCALE822 height = float(max(labelHeight, valueHeight))/Pango.SCALE 823 823 layouts.append((labelLayout, valueLayout, height)) 824 824 -
src/mlx/gui/statusicon.py
r996 r998 74 74 75 75 if appIndicator: 76 indicator = appindicator.Indicator.new ("mava-logger-x", iconFile,77 appindicator.IndicatorCategory.APPLICATION_STATUS)78 indicator.set_status ( appindicator.IndicatorStatus.ACTIVE)76 indicator = AppIndicator3.Indicator.new ("mava-logger-x", iconFile, 77 AppIndicator3.IndicatorCategory.APPLICATION_STATUS) 78 indicator.set_status (AppIndicator3.IndicatorStatus.ACTIVE) 79 79 80 80 indicator.set_menu(menu) … … 122 122 """Hide and destroy the status icon.""" 123 123 if appIndicator: 124 self._indicator.set_status( appindicator.IndicatorStatus.PASSIVE)124 self._indicator.set_status(AppIndicator3.IndicatorStatus.PASSIVE) 125 125 else: 126 126 self._statusIcon.set_visible(False)
Note:
See TracChangeset
for help on using the changeset viewer.