mirror of https://github.com/GNOME/gimp.git
tools: in performance-log-viewer.py, fix deprecation warnings
This commit is contained in:
parent
14d9606c04
commit
b1077a903e
|
@ -511,9 +511,9 @@ class SelectionOp (enum.Enum):
|
||||||
|
|
||||||
class Selection (GObject.GObject):
|
class Selection (GObject.GObject):
|
||||||
__gsignals__ = {
|
__gsignals__ = {
|
||||||
"changed": (GObject.SIGNAL_RUN_FIRST, None, ()),
|
"changed": (GObject.SignalFlags.RUN_FIRST, None, ()),
|
||||||
"change-complete": (GObject.SIGNAL_RUN_FIRST, None, ()),
|
"change-complete": (GObject.SignalFlags.RUN_FIRST, None, ()),
|
||||||
"highlight-changed": (GObject.SIGNAL_RUN_FIRST, None, ())
|
"highlight-changed": (GObject.SignalFlags.RUN_FIRST, None, ())
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__ (self, iter = ()):
|
def __init__ (self, iter = ()):
|
||||||
|
@ -776,9 +776,9 @@ class CellRendererColorToggle (Gtk.CellRendererToggle):
|
||||||
color = GObject.Property (type = Gdk.RGBA, default = Gdk.RGBA (0, 0, 0))
|
color = GObject.Property (type = Gdk.RGBA, default = Gdk.RGBA (0, 0, 0))
|
||||||
|
|
||||||
def do_render (self, cr, widget, background_area, cell_area, flags):
|
def do_render (self, cr, widget, background_area, cell_area, flags):
|
||||||
state = widget.get_state ()
|
state = widget.get_state_flags ()
|
||||||
style = widget.get_style_context ()
|
style = widget.get_style_context ()
|
||||||
bg_color = style.get_background_color (state)
|
fg_color = style.get_color (state)
|
||||||
active = self.get_property ("active")
|
active = self.get_property ("active")
|
||||||
size = max (min (cell_area.width, cell_area.height) -
|
size = max (min (cell_area.width, cell_area.height) -
|
||||||
2 * self.padding,
|
2 * self.padding,
|
||||||
|
@ -786,24 +786,30 @@ class CellRendererColorToggle (Gtk.CellRendererToggle):
|
||||||
|
|
||||||
(r, g, b, a) = self.color
|
(r, g, b, a) = self.color
|
||||||
|
|
||||||
if is_bright_color (bg_color):
|
if is_bright_color (fg_color):
|
||||||
bg = (r, g, b)
|
|
||||||
fg = (0.75 * r, 0.75 * g, 0.75 * b)
|
|
||||||
else:
|
|
||||||
bg = (0.75 * r, 0.75 * g, 0.75 * b)
|
bg = (0.75 * r, 0.75 * g, 0.75 * b)
|
||||||
fg = (r, g, b)
|
fg = (r, g, b)
|
||||||
|
else:
|
||||||
|
bg = (r, g, b)
|
||||||
|
fg = (0.75 * r, 0.75 * g, 0.75 * b)
|
||||||
|
|
||||||
x = cell_area.x + (cell_area.width - size) // 2
|
x = cell_area.x + (cell_area.width - size) // 2
|
||||||
y = cell_area.y + (cell_area.height - size) // 2
|
y = cell_area.y + (cell_area.height - size) // 2
|
||||||
|
|
||||||
cr.rectangle (x, y, size, size)
|
|
||||||
|
|
||||||
if active:
|
if active:
|
||||||
cr.set_source_rgba (*bg)
|
cr.rectangle (x, y, size, size)
|
||||||
else:
|
|
||||||
Gdk.cairo_set_source_rgba (cr, bg_color)
|
|
||||||
|
|
||||||
cr.fill_preserve ()
|
cr.set_source_rgba (*bg)
|
||||||
|
cr.fill ()
|
||||||
|
else:
|
||||||
|
style.save ()
|
||||||
|
|
||||||
|
style.set_state (Gtk.StateFlags (state & ~Gtk.StateFlags.SELECTED))
|
||||||
|
Gtk.render_background (style, cr, x, y, size, size)
|
||||||
|
|
||||||
|
style.restore ()
|
||||||
|
|
||||||
|
cr.rectangle (x, y, size, size)
|
||||||
|
|
||||||
cr.set_source_rgb (*fg)
|
cr.set_source_rgb (*fg)
|
||||||
cr.set_line_width (2)
|
cr.set_line_width (2)
|
||||||
|
@ -1126,7 +1132,7 @@ class SampleGraph (Gtk.DrawingArea):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def do_draw (self, cr):
|
def do_draw (self, cr):
|
||||||
state = self.get_state ()
|
state = self.get_state_flags ()
|
||||||
style = (self.style_widget if self.model else
|
style = (self.style_widget if self.model else
|
||||||
self).get_style_context ()
|
self).get_style_context ()
|
||||||
(width, height) = (self.get_allocated_width (),
|
(width, height) = (self.get_allocated_width (),
|
||||||
|
@ -1529,7 +1535,7 @@ class SampleGraphList (Gtk.Box):
|
||||||
text = var_types[var_defs[var].type].format (value) \
|
text = var_types[var_defs[var].type].format (value) \
|
||||||
if value is not None else "N/A"
|
if value is not None else "N/A"
|
||||||
|
|
||||||
label = Gtk.Label (text, halign = Gtk.Align.END)
|
label = Gtk.Label (label = text, halign = Gtk.Align.END)
|
||||||
grid.attach (label, 1, row, 1, 1)
|
grid.attach (label, 1, row, 1, 1)
|
||||||
label.show ()
|
label.show ()
|
||||||
|
|
||||||
|
@ -2349,7 +2355,7 @@ class CellRendererPercentage (Gtk.CellRendererText):
|
||||||
|
|
||||||
self.value = 0
|
self.value = 0
|
||||||
|
|
||||||
@GObject.property (type = float)
|
@GObject.Property (type = float)
|
||||||
def value (self):
|
def value (self):
|
||||||
return self.value_property
|
return self.value_property
|
||||||
|
|
||||||
|
@ -2366,7 +2372,7 @@ class CellRendererPercentage (Gtk.CellRendererText):
|
||||||
if full_width <= 0 or full_height <= 0:
|
if full_width <= 0 or full_height <= 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
state = widget.get_state ()
|
state = widget.get_state_flags()
|
||||||
style = widget.get_style_context ()
|
style = widget.get_style_context ()
|
||||||
fg_color = style.get_color (state)
|
fg_color = style.get_color (state)
|
||||||
|
|
||||||
|
@ -2400,9 +2406,6 @@ class CellRendererPercentage (Gtk.CellRendererText):
|
||||||
style.save ()
|
style.save ()
|
||||||
style.set_state (state)
|
style.set_state (state)
|
||||||
|
|
||||||
fg_color = style.get_color (state)
|
|
||||||
bg_color = style.get_background_color (state)
|
|
||||||
|
|
||||||
x = round ((full_width - width) * self.get_property ("xalign"))
|
x = round ((full_width - width) * self.get_property ("xalign"))
|
||||||
|
|
||||||
cr.rectangle (cell_area.x + self.padding + x,
|
cr.rectangle (cell_area.x + self.padding + x,
|
||||||
|
@ -2412,7 +2415,11 @@ class CellRendererPercentage (Gtk.CellRendererText):
|
||||||
|
|
||||||
cr.clip ()
|
cr.clip ()
|
||||||
|
|
||||||
cr.set_source_rgba (*blend_colors (bg_color, fg_color, -0.3))
|
Gtk.render_background (style, cr,
|
||||||
|
cell_area.x, cell_area.y,
|
||||||
|
cell_area.width, cell_area.height)
|
||||||
|
|
||||||
|
cr.set_source_rgba (0, 0, 0, 0.25)
|
||||||
cr.paint ()
|
cr.paint ()
|
||||||
|
|
||||||
Gtk.CellRendererText.do_render (self,
|
Gtk.CellRendererText.do_render (self,
|
||||||
|
@ -2587,13 +2594,13 @@ class ProfileViewer (Gtk.ScrolledWindow):
|
||||||
GObject.TYPE_UINT64, str, float, float)
|
GObject.TYPE_UINT64, str, float, float)
|
||||||
|
|
||||||
__gsignals__ = {
|
__gsignals__ = {
|
||||||
"needs-update": (GObject.SIGNAL_RUN_FIRST,
|
"needs-update": (GObject.SignalFlags.RUN_FIRST,
|
||||||
None, (bool,)),
|
None, (bool,)),
|
||||||
"subprofile-added": (GObject.SIGNAL_RUN_FIRST,
|
"subprofile-added": (GObject.SignalFlags.RUN_FIRST,
|
||||||
None, (Gtk.Widget,)),
|
None, (Gtk.Widget,)),
|
||||||
"subprofile-removed": (GObject.SIGNAL_RUN_FIRST,
|
"subprofile-removed": (GObject.SignalFlags.RUN_FIRST,
|
||||||
None, (Gtk.Widget,)),
|
None, (Gtk.Widget,)),
|
||||||
"path-changed": (GObject.SIGNAL_RUN_FIRST,
|
"path-changed": (GObject.SignalFlags.RUN_FIRST,
|
||||||
None, ())
|
None, ())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2649,7 +2656,7 @@ class ProfileViewer (Gtk.ScrolledWindow):
|
||||||
button.add (hbox)
|
button.add (hbox)
|
||||||
hbox.show ()
|
hbox.show ()
|
||||||
|
|
||||||
label = Gtk.Label ("Threads")
|
label = Gtk.Label (label = "Threads")
|
||||||
hbox.pack_start (label, False, False, 0)
|
hbox.pack_start (label, False, False, 0)
|
||||||
label.show ()
|
label.show ()
|
||||||
|
|
||||||
|
@ -3051,11 +3058,11 @@ class ProfileViewer (Gtk.ScrolledWindow):
|
||||||
Gtk.ListStore.__init__ (self, int, bool, float, float, str)
|
Gtk.ListStore.__init__ (self, int, bool, float, float, str)
|
||||||
|
|
||||||
__gsignals__ = {
|
__gsignals__ = {
|
||||||
"subprofile-added": (GObject.SIGNAL_RUN_FIRST,
|
"subprofile-added": (GObject.SignalFlags.RUN_FIRST,
|
||||||
None, (Gtk.Widget,)),
|
None, (Gtk.Widget,)),
|
||||||
"subprofile-removed": (GObject.SIGNAL_RUN_FIRST,
|
"subprofile-removed": (GObject.SignalFlags.RUN_FIRST,
|
||||||
None, (Gtk.Widget,)),
|
None, (Gtk.Widget,)),
|
||||||
"path-changed": (GObject.SIGNAL_RUN_FIRST,
|
"path-changed": (GObject.SignalFlags.RUN_FIRST,
|
||||||
None, ())
|
None, ())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3165,7 +3172,7 @@ class ProfileViewer (Gtk.ScrolledWindow):
|
||||||
xpad = 8,
|
xpad = 8,
|
||||||
family = "Monospace",
|
family = "Monospace",
|
||||||
weight = Pango.Weight.BOLD,
|
weight = Pango.Weight.BOLD,
|
||||||
scale =scale)
|
scale = scale)
|
||||||
col.pack_start (cell, False)
|
col.pack_start (cell, False)
|
||||||
col.add_attribute (cell, "text", store.LINE)
|
col.add_attribute (cell, "text", store.LINE)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue