summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Pellegrin <fede@evolware.org>2021-03-14 08:09:51 +0100
committerJohn Kacur <jkacur@redhat.com>2021-03-14 11:11:03 -0400
commit5d183d48244866bb05649b44f7b0d49c9334dd3e (patch)
tree6e6a294cb1f85ea6952c5eb5850ca7a1c3da64ba
parentcd9e707b23980ed568aeddac6eaa2125b651c6cc (diff)
downloadtuna-5d183d48244866bb05649b44f7b0d49c9334dd3e.tar.gz
tuna: multiple fixes for Gtk-3.0 UI interface
Multiple fixes to make tuna compatible with Gtk-3.0 library. The UI should be now mostly working, some warnings are still present and may be still addressed in the future. Signed-off-by: Federico Pellegrin <fede@evolware.org> Signed-off-by: John Kacur <jkacur@redhat.com>
-rw-r--r--tuna/gui/commonview.py13
-rwxr-xr-xtuna/gui/cpuview.py15
-rwxr-xr-xtuna/gui/irqview.py5
-rwxr-xr-xtuna/gui/procview.py6
-rw-r--r--tuna/gui/profileview.py8
-rwxr-xr-xtuna/tuna.py2
-rw-r--r--tuna/tuna_gui.glade6
-rwxr-xr-xtuna/tuna_gui.py2
8 files changed, 28 insertions, 29 deletions
diff --git a/tuna/gui/commonview.py b/tuna/gui/commonview.py
index 59ca244..cc8f913 100644
--- a/tuna/gui/commonview.py
+++ b/tuna/gui/commonview.py
@@ -13,9 +13,9 @@ class commonview:
def cleanUp(self):
for value in self.contentTable.get_children():
- if value.get_name() == "controls":
+ if Gtk.Buildable.get_name(value) == "controls":
self.ctrl = value
- if value.get_name() == "profileSelectorBox":
+ if Gtk.Buildable.get_name(value) == "profileSelectorBox":
self.selector = value
self.contentTable.remove(value)
@@ -79,12 +79,13 @@ class commonview:
# scale control
frameContent[catCntr]['texts'][contentCntr] = Gtk.HScale()
frameContent[catCntr]['texts'][contentCntr].set_range(self.config.ctlGuiParams[catCntr][val][0], self.config.ctlGuiParams[catCntr][val][1])
- frameContent[catCntr]['texts'][contentCntr].set_update_policy(Gtk.UPDATE_CONTINUOUS)
+ #frameContent[catCntr]['texts'][contentCntr].set_update_policy(Gtk.UPDATE_CONTINUOUS)
frameContent[catCntr]['texts'][contentCntr].set_value(int(self.config.ctlParams[catCntr][val]))
frameContent[catCntr]['texts'][contentCntr].set_digits(0)
else:
# input field
- frameContent[catCntr]['texts'][contentCntr] = Gtk.Entry(256)
+ frameContent[catCntr]['texts'][contentCntr] = Gtk.Entry()
+ frameContent[catCntr]['texts'][contentCntr].set_max_length(256)
frameContent[catCntr]['texts'][contentCntr].set_alignment(0)
frameContent[catCntr]['texts'][contentCntr].set_text(self.config.ctlParams[catCntr][val])
frameContent[catCntr]['texts'][contentCntr].connect("button-release-event", self.checkStar, catCntr, contentCntr, val, frameContent[catCntr]['labels'][contentCntr])
@@ -105,7 +106,7 @@ class commonview:
self.ret = {}
self.property_cntr = 0
for value in self.contentTable.get_children():
- if value.get_name() == "controls" or value.get_name() == "profileSelectorBox":
+ if Gtk.Buildable.get_name(value) == "controls" or Gtk.Buildable.get_name(value) == "profileSelectorBox":
continue
self.ret[value.get_label()] = {}
for content in value:
@@ -128,7 +129,7 @@ class commonview:
self.ret = {}
self.property_cntr = 0
for value in self.contentTable.get_children():
- if value.get_name() == "controls" or value.get_name() == "profileSelectorBox":
+ if Gtk.Buildable.get_name(value) == "controls" or Gtk.Buildable.get_name(value) == "profileSelectorBox":
continue
self.ret[value.get_label()] = {}
for content in value:
diff --git a/tuna/gui/cpuview.py b/tuna/gui/cpuview.py
index ec19149..7f00bf5 100755
--- a/tuna/gui/cpuview.py
+++ b/tuna/gui/cpuview.py
@@ -47,10 +47,9 @@ class cpu_socket_frame(Gtk.Frame):
def __init__(self, socket, cpus, creator):
+ GObject.GObject.__init__(self)
if creator.nr_sockets > 1:
- GObject.GObject.__init__(self, _("Socket %s") % socket)
- else:
- GObject.GObject.__init__(self)
+ self.set_label(_("Socket %s") % socket)
self.socket = socket
self.cpus = cpus
@@ -268,7 +267,7 @@ class cpuview:
columns = math.ceil(math.sqrt(self.nr_sockets))
rows = math.ceil(self.nr_sockets / columns)
box = Gtk.HBox()
- vbox.pack_start(box, True, True)
+ vbox.pack_start(box, True, True, 0)
else:
box = vbox
@@ -281,7 +280,7 @@ class cpuview:
if self.nr_sockets > 1:
if column == columns:
box = Gtk.HBox()
- vbox.pack_start(box, True, True)
+ vbox.pack_start(box, True, True, 0)
column = 1
else:
column += 1
@@ -298,10 +297,8 @@ class cpuview:
req = frame.get_preferred_size()
# FIXME: what is the slack we have
# to add to every row and column?
- #width = req[0] + 16
- width = 16
- #height = req[1] + 20
- height = 20
+ width = req.minimum_size.width + 16
+ height = req.minimum_size.height + 40
if self.nr_sockets > 1:
width *= columns
height *= rows
diff --git a/tuna/gui/irqview.py b/tuna/gui/irqview.py
index ea5c2f5..fddb977 100755
--- a/tuna/gui/irqview.py
+++ b/tuna/gui/irqview.py
@@ -20,7 +20,8 @@ class irq_druid:
self.irqs = irqs
self.ps = ps
self.irq = irq
- self.window = Gtk.Builder(gladefile)
+ self.window = Gtk.Builder()
+ self.window.add_objects_from_file(gladefile, ("set_irq_attributes", "tuna"))
#self.window = Gtk.glade.XML(gladefile, "set_irq_attributes", "tuna")
self.dialog = self.window.get_object("set_irq_attributes")
pixbuf = self.dialog.render_icon(Gtk.STOCK_PREFERENCES,
@@ -322,7 +323,7 @@ class irqview:
setattr.show()
refresh.show()
- menu.popup(None, None, None, event.button, event.time)
+ menu.popup(None, None, None, event, event.button, event.time)
def toggle_mask_cpu(self, cpu, enabled):
if not enabled:
diff --git a/tuna/gui/procview.py b/tuna/gui/procview.py
index f897fdd..d2abc13 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
@@ -1,4 +1,5 @@
import re
+import os
import tuna.tuna_sched as tuna_sched
import gi
@@ -29,7 +30,7 @@ class process_druid:
self.pid_info = pid_info
self.nr_cpus = nr_cpus
self.window = Gtk.Builder()
- self.window.add_from_file(gladefile)
+ self.window.add_objects_from_file(gladefile, ("set_process_attributes", "tuna"))
# self.window = Gtk.glade.XML(gladefile, "set_process_attributes", "tuna")
self.dialog = self.window.get_object("set_process_attributes")
pixbuf = self.dialog.render_icon(Gtk.STOCK_PREFERENCES,
@@ -410,7 +411,6 @@ class procview:
pass
new_value[self.COL_CMDLINE] = procfs.process_cmdline(thread_info)
-
gui.set_store_columns(self.tree_store, iter, new_value)
def show(self, force_refresh=False):
@@ -671,7 +671,7 @@ class procview:
uthreads.show()
help.show()
- menu.popup(None, None, None, event.button, event.time)
+ menu.popup(None, None, None, event, event.button, event.time)
def toggle_mask_cpu(self, cpu, enabled):
if not enabled:
diff --git a/tuna/gui/profileview.py b/tuna/gui/profileview.py
index 4f68bf4..c65f92e 100644
--- a/tuna/gui/profileview.py
+++ b/tuna/gui/profileview.py
@@ -87,7 +87,7 @@ class profileview:
temp = f.read()
f.close()
self.profileContentBuffer = self.profileContent.get_buffer()
- buff = self.profileContentBuffer.get_text(self.profileContentBuffer.get_start_iter(), self.profileContentBuffer.get_end_iter())
+ buff = self.profileContentBuffer.get_text(self.profileContentBuffer.get_start_iter(), self.profileContentBuffer.get_end_iter(), False)
if temp != buff:
dialog = Gtk.MessageDialog(None, \
Gtk.DialogFlags.MODAL \
@@ -114,14 +114,14 @@ class profileview:
def on_SaveButton_clicked(self, widget):
try:
self.profileContentBuffer = self.profileContent.get_buffer()
- self.config.cache = self.profileContentBuffer.get_text(self.profileContentBuffer.get_start_iter(), self.profileContentBuffer.get_end_iter())
+ self.config.cache = self.profileContentBuffer.get_text(self.profileContentBuffer.get_start_iter(), self.profileContentBuffer.get_end_iter(), False)
self.config.cacheToFile(self.config.cacheFileName)
except IOError as e:
self.show_mbox_warning(_("Cannot write to config file: %s") % (self.config.cacheFileName))
def on_UpdateButton_clicked(self, widget):
self.profileContentBuffer = self.profileContent.get_buffer()
- self.temp = self.profileContentBuffer.get_text(self.profileContentBuffer.get_start_iter(), self.profileContentBuffer.get_end_iter())
+ self.temp = self.profileContentBuffer.get_text(self.profileContentBuffer.get_start_iter(), self.profileContentBuffer.get_end_iter(), False)
try:
if not self.config.loadDirect(self.temp):
self.commonview.updateCommonView()
@@ -215,7 +215,7 @@ class profileview:
context.append(item)
context.show_all()
- context.popup(None, None, None, event.button, time)
+ context.popup(None, None, None, event, event.button, time)
return True
def get_current_tree_selection(self):
diff --git a/tuna/tuna.py b/tuna/tuna.py
index 614a825..1e39222 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
@@ -530,7 +530,7 @@ def thread_filtered(tid, cpus_filtered, show_kthreads, show_uthreads):
return False
raise err
- if set(cpus_filtered + affinity) == set(cpus_filtered):
+ if set(cpus_filtered + list(affinity)) == set(cpus_filtered):
return True
if not (show_kthreads and show_uthreads):
diff --git a/tuna/tuna_gui.glade b/tuna/tuna_gui.glade
index 2b572ca..65b38b1 100644
--- a/tuna/tuna_gui.glade
+++ b/tuna/tuna_gui.glade
@@ -129,7 +129,7 @@
</child>
</object>
</child>
- <child>
+ <child type="tab">
<object class="GtkLabel" id="monitor_tab_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -455,7 +455,7 @@
<property name="position">1</property>
</packing>
</child>
- <child>
+ <child type="tab">
<object class="GtkLabel" id="common_tab_l">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -757,7 +757,7 @@
<property name="position">2</property>
</packing>
</child>
- <child>
+ <child type="tab">
<object class="GtkLabel" id="profile_tab_l">
<property name="visible">True</property>
<property name="can_focus">False</property>
diff --git a/tuna/tuna_gui.py b/tuna/tuna_gui.py
index 2360f53..6c2e05d 100755
--- a/tuna/tuna_gui.py
+++ b/tuna/tuna_gui.py
@@ -37,7 +37,7 @@ class main_gui:
if os.access(tuna_glade, os.F_OK):
break
self.wtree = Gtk.Builder()
- self.wtree.add_from_file(tuna_glade)
+ self.wtree.add_objects_from_file(tuna_glade, ("mainbig_window", "tuna"))
#self.wtree = Gtk.glade.XML(tuna_glade, "mainbig_window", "tuna")
self.ps = procfs.pidstats()
self.irqs = procfs.interrupts()