Ignore:
Timestamp:
07/04/19 18:08:19 (5 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

Using 'GdkPixbuf' instead of 'gdkPixbuf', 'AppIndicator3' instead of 'appindicator' and 'Pango' instead of 'pango' (re #347)

Location:
src/mlx/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/common.py

    r997 r998  
    2424gi.require_version("Gdk", "3.0")
    2525from gi.repository import Gdk
    26 from gi.repository import GdkPixbuf as gdkPixbuf
     26from gi.repository import GdkPixbuf
    2727gi.require_version("Gtk", "3.0")
    2828from gi.repository import Gtk
    2929try:
    3030    gi.require_version("AppIndicator3", "0.1")
    31     from gi.repository import AppIndicator3 as appindicator
     31    from gi.repository import AppIndicator3
    3232    appIndicator = True
    3333except:
    3434    pass
    35 from gi.repository import Pango as pango
     35from gi.repository import Pango
    3636
    3737
     
    7575POLICY_ALWAYS = Gtk.PolicyType.ALWAYS
    7676
    77 WEIGHT_NORMAL = pango.Weight.NORMAL
    78 WEIGHT_BOLD = pango.Weight.BOLD
     77WEIGHT_NORMAL = Pango.Weight.NORMAL
     78WEIGHT_BOLD = Pango.Weight.BOLD
    7979
    8080WINDOW_STATE_ICONIFIED = Gdk.WindowState.ICONIFIED
     
    9595SELECTION_MULTIPLE = Gtk.SelectionMode.MULTIPLE
    9696
    97 pixbuf_new_from_file = gdkPixbuf.Pixbuf.new_from_file
     97pixbuf_new_from_file = GdkPixbuf.Pixbuf.new_from_file
    9898
    9999import codecs
  • src/mlx/gui/flight.py

    r996 r998  
    8484
    8585        titleLabel = Gtk.Label(title)
    86         titleLabel.modify_font(pango.FontDescription("bold 24"))
     86        titleLabel.modify_font(Pango.FontDescription("bold 24"))
    8787        alignment.set_padding(padding_top = 4, padding_bottom = 4,
    8888                              padding_left = 6, padding_right = 0)
     
    714714        layout = cr.create_layout()
    715715        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)
    719719        layout.set_font_description(font)
    720720
    721721        (_ink, (x0, y0, x1, y1)) = layout.get_extents()
    722         width = float(x1 + 1 - x0) / pango.SCALE
     722        width = float(x1 + 1 - x0) / Pango.SCALE
    723723
    724724        y = 25 * scale
     
    730730        cr.fill()
    731731
    732         y += float(y1 + 1 - y0) / pango.SCALE
     732        y += float(y1 + 1 - y0) / Pango.SCALE
    733733        y += 6 * scale
    734734
     
    736736        layout.set_text("%s (%s) részére" %
    737737                        (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))
    740740        font.set_weight(450)
    741741        layout.set_font_description(font)
    742742        (_ink, (x0, y0, x1, y1)) = layout.get_extents()
    743         width = float(x1 + 1 - x0) / pango.SCALE
     743        width = float(x1 + 1 - x0) / Pango.SCALE
    744744
    745745        cr.move_to((context.get_width() - width)/2.0, y)
     
    749749        cr.fill()
    750750
    751         y += float(y1 + 1 - y0) / pango.SCALE
     751        y += float(y1 + 1 - y0) / Pango.SCALE
    752752        y += 4 * scale
    753753
     
    759759        y += 20 * scale
    760760
    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))
    763763        font.set_weight(150)
    764764
     
    807807            labelLayouts.append((labelLayout, valueLayout, labelHeight))
    808808
    809         maxLabelWidth = maxLabelWidth / pango.SCALE
     809        maxLabelWidth = maxLabelWidth / Pango.SCALE
    810810
    811811        valueX = labelX + labelValueFill + maxLabelWidth
     
    815815            (labelFill + maxLabelWidth + labelValueFill + valueFill)
    816816        for (labelLayout, valueLayout, labelHeight) in labelLayouts:
    817             valueLayout.set_width(int(valueWidth * pango.SCALE))
     817            valueLayout.set_width(int(valueWidth * Pango.SCALE))
    818818
    819819            (_ink, (x0, y0, x1, y1)) = valueLayout.get_extents()
    820820            valueHeight = y1 + 1 - y0
    821821
    822             height = float(max(labelHeight, valueHeight))/pango.SCALE
     822            height = float(max(labelHeight, valueHeight))/Pango.SCALE
    823823            layouts.append((labelLayout, valueLayout, height))
    824824
  • src/mlx/gui/statusicon.py

    r996 r998  
    7474
    7575        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)
    7979
    8080            indicator.set_menu(menu)
     
    122122        """Hide and destroy the status icon."""
    123123        if appIndicator:
    124             self._indicator.set_status(appindicator.IndicatorStatus.PASSIVE)
     124            self._indicator.set_status(AppIndicator3.IndicatorStatus.PASSIVE)
    125125        else:
    126126            self._statusIcon.set_visible(False)
Note: See TracChangeset for help on using the changeset viewer.