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

@ -48,6 +48,19 @@ class Gerber():
# Final geometry: MultiPolygon # 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): def fix_regions(self):
''' '''
Overwrites the region polygons with fixed Overwrites the region polygons with fixed

Binary file not shown.

View File

@ -33,11 +33,16 @@ class App:
Gtk.main() Gtk.main()
def mplpaint(self): def mplpaint(self):
f = Figure(figsize=(5,4), dpi=50) f = Figure(dpi=50)
a = f.add_subplot(111) 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) s = sin(2*pi*t)
a.plot(t,s) 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 = FigureCanvas(f) # a Gtk.DrawingArea
canvas.set_size_request(600,400) canvas.set_size_request(600,400)
@ -102,14 +107,18 @@ class App:
dialog.destroy() dialog.destroy()
def plot_gerber(self, gerber): def plot_gerber(self, gerber):
f = Figure(figsize=(5,4), dpi=200)
f = Figure(dpi=75)
a = f.add_subplot(111) a = f.add_subplot(111)
a.set_aspect(1)
for poly in gerber.solid_geometry: for poly in gerber.solid_geometry:
x, y = poly.exterior.xy x, y = poly.exterior.xy
a.plot(x, y) a.plot(x, y)
for ints in poly.interiors: for ints in poly.interiors:
x, y = ints.coords.xy x, y = ints.coords.xy
a.plot(x, y) a.plot(x, y)
a.grid()
f.tight_layout()
canvas = FigureCanvas(f) # a Gtk.DrawingArea canvas = FigureCanvas(f) # a Gtk.DrawingArea
canvas.set_size_request(600,400) canvas.set_size_request(600,400)
self.grid.attach(canvas,1,1,600,400) self.grid.attach(canvas,1,1,600,400)

View File

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