Okay. Trying to show a legend within the pychart gtk control isn't going to be very good.
This commit is contained in:
parent
7942621856
commit
ed2ee1b3dd
2
GUI_TODO
2
GUI_TODO
|
@ -1,3 +1,5 @@
|
||||||
|
Undo the shit i changed with pychart gtk
|
||||||
|
|
||||||
Make sure we're all good to use the images:
|
Make sure we're all good to use the images:
|
||||||
images/synchronize.png
|
images/synchronize.png
|
||||||
Downloaded at: https://www.iconfinder.com/iconsets/UltimateGnome
|
Downloaded at: https://www.iconfinder.com/iconsets/UltimateGnome
|
||||||
|
|
|
@ -472,7 +472,7 @@ class oxcSERVER(oxcSERVERvm, oxcSERVERhost, oxcSERVERproperties,
|
||||||
# Default three hours of period
|
# Default three hours of period
|
||||||
self.halt_performance = False
|
self.halt_performance = False
|
||||||
|
|
||||||
# TODO: James - Commented this out
|
# TODO: James - Commented this out GUI Has changed
|
||||||
#for widget in ["scrwin_cpuusage", "scrwin_memusage", "scrwin_netusage", "scrwin_diskusage"]:
|
#for widget in ["scrwin_cpuusage", "scrwin_memusage", "scrwin_netusage", "scrwin_diskusage"]:
|
||||||
# widget = self.wine.builder.get_object(widget).get_children()[0]
|
# widget = self.wine.builder.get_object(widget).get_children()[0]
|
||||||
# if widget.get_children():
|
# if widget.get_children():
|
||||||
|
@ -544,8 +544,8 @@ class oxcSERVER(oxcSERVERvm, oxcSERVERhost, oxcSERVERproperties,
|
||||||
chart[name].xaxis.set_tic_format_function(show_tic)
|
chart[name].xaxis.set_tic_format_function(show_tic)
|
||||||
chart[name].yaxis.set_position(7)
|
chart[name].yaxis.set_position(7)
|
||||||
chart[name].connect("datapoint-hovered", hovered)
|
chart[name].connect("datapoint-hovered", hovered)
|
||||||
chart[name].legend.set_visible(True)
|
chart[name].legend.set_visible(False)
|
||||||
chart[name].legend.set_position(line_chart.POSITION_RIGHT)
|
chart[name].legend.set_position(line_chart.POSITION_BOTTOM_LEFT)
|
||||||
chart[name].set_padding(100)
|
chart[name].set_padding(100)
|
||||||
chart[name].yaxis.set_label("kBps")
|
chart[name].yaxis.set_label("kBps")
|
||||||
chart["cpu"].yaxis.set_label("%")
|
chart["cpu"].yaxis.set_label("%")
|
||||||
|
@ -563,10 +563,11 @@ class oxcSERVER(oxcSERVERvm, oxcSERVERhost, oxcSERVERproperties,
|
||||||
chart["cpu"].add_graph(graph[key])
|
chart["cpu"].add_graph(graph[key])
|
||||||
|
|
||||||
chart["cpu"].set_size_request(len(data)*20, 250)
|
chart["cpu"].set_size_request(len(data)*20, 250)
|
||||||
# gobject.idle_add(lambda: self.wine.builder.get_object("scrwin_cpuusage").add(chart["cpu"]) and False)
|
gobject.idle_add(lambda: self.wine.builder.get_object("scrwin_cpuusage").add(chart["cpu"]) and False)
|
||||||
# gobject.idle_add(lambda: self.wine.builder.get_object("scrwin_cpuusage").show_all() and False)
|
gobject.idle_add(lambda: self.wine.builder.get_object("scrwin_cpuusage").show_all() and False)
|
||||||
self.wine.builder.get_object("scrwin_cpuusage").add(chart["cpu"])
|
|
||||||
self.wine.builder.get_object("scrwin_cpuusage").show_all()
|
# self.wine.builder.get_object("scrwin_cpuusage").add(chart["cpu"])
|
||||||
|
# self.wine.builder.get_object("scrwin_cpuusage").show_all()
|
||||||
|
|
||||||
# Memory
|
# Memory
|
||||||
if "memory_internal_free" in rrdinfo and "memory" in rrdinfo:
|
if "memory_internal_free" in rrdinfo and "memory" in rrdinfo:
|
||||||
|
|
|
@ -403,8 +403,7 @@ class LineChart(chart.Chart):
|
||||||
|
|
||||||
graph_rect = rect
|
graph_rect = rect
|
||||||
if (self.legend.get_property("visible") == True) and (self.legend.get_position() == POSITION_RIGHT):
|
if (self.legend.get_property("visible") == True) and (self.legend.get_position() == POSITION_RIGHT):
|
||||||
new_width = 400
|
graph_rect.width -= self.legend.last_width
|
||||||
graph_rect.width -= 300
|
|
||||||
|
|
||||||
if self.graphs and data_available:
|
if self.graphs and data_available:
|
||||||
self.grid.draw(context, graph_rect, self.xaxis, self.yaxis)
|
self.grid.draw(context, graph_rect, self.xaxis, self.yaxis)
|
||||||
|
@ -2023,6 +2022,7 @@ class Legend(ChartObject):
|
||||||
ChartObject.__init__(self)
|
ChartObject.__init__(self)
|
||||||
self._show = False
|
self._show = False
|
||||||
self._position = POSITION_TOP_RIGHT
|
self._position = POSITION_TOP_RIGHT
|
||||||
|
self.last_width = 0
|
||||||
|
|
||||||
def do_get_property(self, property):
|
def do_get_property(self, property):
|
||||||
if property.name == "visible":
|
if property.name == "visible":
|
||||||
|
@ -2063,7 +2063,8 @@ class Legend(ChartObject):
|
||||||
|
|
||||||
total_height += rheight + 6
|
total_height += rheight + 6
|
||||||
total_width = max(total_width, rwidth)
|
total_width = max(total_width, rwidth)
|
||||||
|
|
||||||
|
self.last_width = total_width
|
||||||
total_width += 18 + 20
|
total_width += 18 + 20
|
||||||
if self._position == POSITION_TOP_RIGHT:
|
if self._position == POSITION_TOP_RIGHT:
|
||||||
x = rect.width - total_width - 16
|
x = rect.width - total_width - 16
|
||||||
|
@ -2082,8 +2083,9 @@ class Legend(ChartObject):
|
||||||
y = 16
|
y = 16
|
||||||
|
|
||||||
elif self._position == POSITION_RIGHT:
|
elif self._position == POSITION_RIGHT:
|
||||||
x = rect.width - total_width - 16
|
# Bah. This is so broken and horrible and just wont work for small graphs
|
||||||
y = (rect.height - 16 - total_height) / 2
|
x = rect.width - (total_width/2) - 16
|
||||||
|
y = (rect.height - total_height) / 2
|
||||||
|
|
||||||
context.set_antialias(cairo.ANTIALIAS_NONE)
|
context.set_antialias(cairo.ANTIALIAS_NONE)
|
||||||
context.set_source_rgb(1, 1, 1)
|
context.set_source_rgb(1, 1, 1)
|
||||||
|
|
Loading…
Reference in New Issue