template nodeset
This commit is contained in:
parent
fa00c5bcfc
commit
1cf23ce4cf
|
@ -143,6 +143,8 @@ class Configuration(RawConfigParser):
|
|||
set_option(section, "prompt-border-width", "3", False)
|
||||
set_option(section, "prompt-character-limit", "21", False)
|
||||
set_option(section, "prompt-text-size", "42", False)
|
||||
set_option(section, "template-nodeset", "L 0 0, 1000 1", False)
|
||||
set_option(section, "template-nodeset-name", "template", False)
|
||||
|
||||
def add_section(self, name):
|
||||
if name not in self.order:
|
||||
|
|
|
@ -224,6 +224,8 @@ class GUI(Animation):
|
|||
self.marker_size = config["marker-size"]
|
||||
self.marker_color = config["marker-color"]
|
||||
self.label_precision = config["label-precision"]
|
||||
self.template_nodeset = config["template-nodeset"]
|
||||
self.template_nodeset_name = config["template-nodeset-name"]
|
||||
|
||||
def set_temporary_file(self):
|
||||
self.temporary_file = open(join(gettempdir(), "pgfw-config"), "w")
|
||||
|
@ -286,6 +288,13 @@ class GUI(Animation):
|
|||
rect.bottomright = self.display_surface.get_rect().bottomright
|
||||
self.nodeset_label, self.nodeset_label_rect = surface, rect
|
||||
|
||||
def get_nodeset(self):
|
||||
if not len(self.parent):
|
||||
self.parent.add_nodeset(self.template_nodeset_name,
|
||||
self.template_nodeset)
|
||||
self.set_nodeset_index(0)
|
||||
return self.parent[self.nodeset_index]
|
||||
|
||||
def set_yrange(self):
|
||||
width = self.plot_rect.w
|
||||
nodeset = self.get_nodeset()
|
||||
|
@ -323,9 +332,6 @@ class GUI(Animation):
|
|||
ysr.top = rect.top
|
||||
labels.append(((xs, xsr), (ys, ysr)))
|
||||
|
||||
def get_nodeset(self):
|
||||
return self.parent[self.nodeset_index]
|
||||
|
||||
def get_formatted_measure(self, measure):
|
||||
return "%s" % float(("%." + str(self.label_precision) + "g") % measure)
|
||||
|
||||
|
@ -453,6 +459,8 @@ class GUI(Animation):
|
|||
code += ","
|
||||
code += " {0} {1}".format(*map(self.get_formatted_measure,
|
||||
node))
|
||||
if not config.has_section("interpolate"):
|
||||
config.add_section("interpolate")
|
||||
config.set("interpolate", nodeset.name, code)
|
||||
|
||||
def add_nodeset(self, name):
|
||||
|
|
Loading…
Reference in New Issue