Some adjustments to look and feel of plots

This commit is contained in:
Juan Pablo Caram 2014-01-03 01:13:42 -05:00
parent fd61658366
commit b611624229
4 changed files with 63 additions and 29 deletions

View File

@ -46,7 +46,20 @@ class Gerber():
self.flashes = []
# Final geometry: MultiPolygon
self.solid_geometry = None
self.solid_geometry = None
def bounds(self):
if self.solid_geometry == None:
print "Warning: solid_geometry not computed yet."
return (0,0,0,0)
return self.solid_geometry.bounds
def size(self):
if self.solid_geometry == None:
print "Warning: solid_geometry not computed yet."
return 0
bounds = self.bounds()
return (bounds[2]-bounds[0], bounds[3]-bounds[1])
def fix_regions(self):
'''

Binary file not shown.

View File

@ -33,11 +33,16 @@ class App:
Gtk.main()
def mplpaint(self):
f = Figure(figsize=(5,4), dpi=50)
f = Figure(dpi=50)
a = f.add_subplot(111)
t = arange(0.0,3.0,0.01)
a.set_aspect(1)
t = arange(0.0,5.0,0.01)
s = sin(2*pi*t)
a.plot(t,s)
a.grid()
#a.patch.set_visible(False) Background of the axes
f.patch.set_visible(False)
f.tight_layout()
canvas = FigureCanvas(f) # a Gtk.DrawingArea
canvas.set_size_request(600,400)
@ -102,14 +107,18 @@ class App:
dialog.destroy()
def plot_gerber(self, gerber):
f = Figure(figsize=(5,4), dpi=200)
f = Figure(dpi=75)
a = f.add_subplot(111)
a.set_aspect(1)
for poly in gerber.solid_geometry:
x, y = poly.exterior.xy
a.plot(x, y)
for ints in poly.interiors:
x, y = ints.coords.xy
a.plot(x, y)
a.grid()
f.tight_layout()
canvas = FigureCanvas(f) # a Gtk.DrawingArea
canvas.set_size_request(600,400)
self.grid.attach(canvas,1,1,600,400)

View File

@ -195,6 +195,36 @@
<property name="margin_right">3</property>
<property name="margin_top">3</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="checkbutton1">
<property name="label" translatable="yes">Merge Geometry</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton2">
<property name="label" translatable="yes">Different Colors</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box4">
<property name="visible">True</property>
@ -203,7 +233,7 @@
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Tool dia.:</property>
<property name="label" translatable="yes">Scale (pix./unit): </property>
</object>
<packing>
<property name="expand">False</property>
@ -212,10 +242,13 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="entry2">
<object class="GtkSpinButton" id="spinbutton1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="invisible_char">●</property>
<property name="climb_rate">10</property>
<property name="snap_to_ticks">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -227,22 +260,16 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="position">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Isolation Routing</property>
<property name="label" translatable="yes">Gerber</property>
</object>
<packing>
<property name="tab_fill">False</property>
@ -293,21 +320,6 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>