Skip to content

Commit

Permalink
basic function for generic setting changing
Browse files Browse the repository at this point in the history
  • Loading branch information
swhalemwo committed Nov 2, 2020
1 parent 05d1296 commit d1b1576
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions obvz.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python3
#!/usr/bin/python3.8

import time
import time

import json

Expand Down Expand Up @@ -266,6 +266,22 @@ def reset(self):
self.g = nx.DiGraph()
self.update()


def change_settings(self, setting_dict):
"""changes setting"""

logging.info(setting_dict)

setting_to_change = list(setting_dict.keys())[0]
new_value = setting_dict[setting_to_change]

logging.info(["setting_to_change: ", setting_to_change])
logging.info(["new_value: ", new_value])


setattr(self, setting_to_change, new_value)



def signal_received(self, new_graph_str):
"""deal received signal"""
Expand All @@ -282,7 +298,6 @@ def signal_received(self, new_graph_str):
self.draw_arrow_toggle = new_graph_dict['draw_arrow_toggle']

# change layout type



if list(new_graph_dict.keys())[0] == "layout_type":
Expand All @@ -291,14 +306,18 @@ def signal_received(self, new_graph_str):
update_me = 1

if list(new_graph_dict.keys())[0] == "font_size":
self.font_size = new_graph_dict['font_size']
# self.font_size = new_graph_dict['font_size']
self.change_settings(new_graph_dict)
font_title = QFont("Arial", self.font_size)
fm = QFontMetrics(font_title)
self.title_vflush = fm.boundingRect("node title").height()
self.set_node_wd_ht(list(self.g.nodes()))
update_me = 1
# update_texts = 1





# only command is to redraw
if list(new_graph_dict.keys())[0] == 'redraw':
Expand Down

0 comments on commit d1b1576

Please sign in to comment.