Commit 6b485381 authored by sumpfralle's avatar sumpfralle

reordered tabs of GTK interface

tool id written by the gcode exporter is configurable (not used for now)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@172 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 801a9cfc
......@@ -5,13 +5,13 @@ from gcode import gcode
class SimpleGCodeExporter:
def __init__(self, filename, unit, startx, starty, startz, feedrate, speed, safety_height=None):
def __init__(self, filename, unit, startx, starty, startz, feedrate, speed, safety_height=None, tool_id=1):
self.file = file(filename,"w")
if unit == "mm":
self.file.write("G21\n")
else:
self.file.write("G20\n")
self.gcode = gcode(startx, starty, startz, safetyheight=safety_height)
self.gcode = gcode(startx, starty, startz, safetyheight=safety_height, tool_id=tool_id)
gc = self.gcode
self.file.write(gc.begin() + "\n")
self.file.write("F" + str(feedrate) + "\n")
......
......@@ -16,10 +16,11 @@ class gcode:
lastx = lasty = lastz = lasta = lastgcode = None
lastfeed = None
def __init__(self, startx, starty, startz, homeheight=1.5, safetyheight=None):
def __init__(self, startx, starty, startz, homeheight=1.5, safetyheight=None, tool_id=1):
self.startx = startx
self.starty = starty
self.startz = startz
self.tool_id = tool_id
if safetyheight is None:
safetyheight = max(max(startz, homeheight), 0.04)
self.homeheight = max(startz, homeheight)
......@@ -28,7 +29,7 @@ class gcode:
def begin(self):
return "G40 G49 G54 G80 G90\n" + \
"G04 P3 T1 M6\n" + \
"G04 P3 T%d M6\n" % self.tool_id + \
"G00 X%.4f Y%.4f Z%.4f\n" % (self.startx, self.starty, self.startz)
def end(self):
......
......@@ -520,6 +520,8 @@ class ProjectGui:
self.gui.get_object("MaxStepDownControl").set_sensitive(self.settings.get("path_generator") == "PushCutter")
# "material allowance" requires ODE support
self.gui.get_object("MaterialAllowanceControl").set_sensitive(self.settings.get("enable_ode"))
# toolpath table
self.toolpath_table = self.gui.get_object("ToolPathTable")
@gui_activity_guard
def toggle_3d_view(self, widget=None, value=None):
......@@ -734,6 +736,14 @@ class ProjectGui:
if section in config_list:
self.processing_config_selection.set_active(config_list.index(section))
def update_toolpath_table(self):
toolpath_tab = self.gui.get_object("ToolPathTab")
if self.toolpath is None:
toolpath_tab.hide()
else:
toolpath_tab.show()
#print dir(self.toolpath_table)
@gui_activity_guard
def save_processing_settings_file(self, widget=None, section=None):
no_dialog = False
......@@ -877,6 +887,7 @@ class ProjectGui:
elif direction == "xy":
self.toolpath = self.pathgenerator.GenerateToolPath(minx, maxx, miny, maxy, minz, maxz, dy, dy, dz, draw_callback)
print "Time elapsed: %f" % (time.time() - start_time)
self.update_toolpath_table()
self.update_view()
# for compatibility with old pycam GUI (see pycam.py)
......
......@@ -14,10 +14,10 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkVBox" id="model setup">
<object class="GtkVBox" id="ModelTab">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">4</property>
<property name="spacing">3</property>
<child>
<object class="GtkHBox" id="hbox4">
<property name="visible">True</property>
......@@ -903,7 +903,7 @@
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="Model Settings">
<object class="GtkLabel" id="ModelTabLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Model</property>
<property name="use_markup">True</property>
......@@ -913,7 +913,258 @@
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox9">
<object class="GtkHBox" id="SettingsTab">
<property name="visible">True</property>
<property name="spacing">4</property>
<child>
<object class="GtkVBox" id="vbox7">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkFrame" id="GeneralSettingsFrame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox14">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="SettingEnableODE">
<property name="label" translatable="yes">Enable experimental ODE calculations</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="GeneralSettingsFrameLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;General Settings&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHSeparator" id="hseparator5">
<property name="visible">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame13">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment21">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox13">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkCheckButton" id="ShowModelCheckBox">
<property name="label" translatable="yes">Show Model</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowToolPathCheckBox">
<property name="label" translatable="yes">Show Toolpath</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowBoundingCheckBox">
<property name="label" translatable="yes">Show Bounding Box</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowAxesCheckBox">
<property name="label" translatable="yes">Show Coordinate System</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowDrillProgressCheckBox">
<property name="label" translatable="yes">Show Drill Progress</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox7">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="DrillUpdateFPSLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Maximum Frames per Second:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="DrillProgressFrameSkipControl">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">&#x2022;</property>
<property name="adjustment">DrillProgressMaxFPS</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">5</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="VisualSettingsFrameLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Display settings&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVSeparator" id="vseparator9">
<property name="visible">True</property>
<property name="orientation">vertical</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="View3dToggleFrame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment20">
<property name="visible">True</property>
<property name="yalign">0</property>
<property name="yscale">0</property>
<property name="left_padding">12</property>
<child>
<object class="GtkToggleButton" id="Toggle3dView">
<property name="label" translatable="yes">Show</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="View3dToggleLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;3D View&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="SettingsTabLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Settings</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="ProcessingTab">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
......@@ -970,7 +1221,7 @@
<child type="label">
<object class="GtkLabel" id="LoadProcessingSettingsFromFileFrameLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Load and Save File&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;Load and Save Settings File&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
......@@ -1043,7 +1294,7 @@
<child type="label">
<object class="GtkLabel" id="ProcessingSettingsTemplatesFrameLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Load and Save Template&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;Manage Templates &lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
......@@ -1809,10 +2060,6 @@
<property name="position">8</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox8">
<property name="visible">True</property>
<property name="spacing">3</property>
<child>
<object class="GtkButton" id="GenerateToolPathButton">
<property name="label" translatable="yes">Generate Toolpath</property>
......@@ -1820,22 +2067,6 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="SaveToolPathButton">
<property name="label" translatable="yes">Save Toolpath to File</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">9</property>
......@@ -1843,213 +2074,65 @@
</child>
</object>
<packing>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="Processing">
<object class="GtkLabel" id="ProcessingTabLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Processing</property>
</object>
<packing>
<property name="position">1</property>
<property name="position">2</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox6">
<property name="visible">True</property>
<child>
<object class="GtkVBox" id="vbox7">
<property name="visible">True</property>
<object class="GtkVBox" id="ToolPathTab">
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkFrame" id="GeneralSettingsFrame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox14">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="SettingEnableODE">
<property name="label" translatable="yes">Enable experimental ODE calculations</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="GeneralSettingsFrameLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;General Settings&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHSeparator" id="hseparator5">
<property name="visible">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame13">
<object class="GtkFrame" id="ToolPathTableFrame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment21">
<object class="GtkAlignment" id="alignment8">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox13">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkCheckButton" id="ShowModelCheckBox">
<property name="label" translatable="yes">Show Model</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowToolPathCheckBox">
<property name="label" translatable="yes">Show Toolpath</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowBoundingCheckBox">
<property name="label" translatable="yes">Show Bounding Box</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowAxesCheckBox">
<property name="label" translatable="yes">Show Coordinate System</property>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowDrillProgressCheckBox">
<property name="label" translatable="yes">Show Drill Progress</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox7">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="DrillUpdateFPSLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Maximum Frames per Second:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<child>
<object class="GtkSpinButton" id="DrillProgressFrameSkipControl">
<object class="GtkTreeView" id="ToolPathTable">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">&#x2022;</property>
<property name="adjustment">DrillProgressMaxFPS</property>
<property name="model">GeneratedToolPaths</property>
<property name="search_column">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">5</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="VisualSettingsFrameLabel">
<object class="GtkLabel" id="ToolPathTableLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Display settings&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;List of generated Toolpaths&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVSeparator" id="vseparator9">
<object class="GtkHSeparator" id="hseparator7">
<property name="visible">True</property>
<property name="orientation">vertical</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -2057,34 +2140,12 @@
</packing>
</child>
<child>
<object class="GtkFrame" id="View3dToggleFrame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment20">
<property name="visible">True</property>
<property name="yalign">0</property>
<property name="yscale">0</property>
<property name="left_padding">12</property>
<child>
<object class="GtkToggleButton" id="Toggle3dView">
<property name="label" translatable="yes">Show</property>
<object class="GtkButton" id="SaveToolPathButton">
<property name="label" translatable="yes">Save Toolpath to File</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="View3dToggleLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;3D View&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
......@@ -2092,16 +2153,16 @@
</child>
</object>
<packing>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="SettingsTabLabel">
<object class="GtkLabel" id="ToolPathTabLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Settings</property>
<property name="label" translatable="yes">Toolpaths</property>
</object>
<packing>
<property name="position">2</property>
<property name="position">3</property>
<property name="tab_fill">False</property>
</packing>
</child>
......@@ -2391,4 +2452,12 @@
<property name="page_increment">10</property>
<property name="page_size">10</property>
</object>
<object class="GtkTreeStore" id="ToolPathTableStore">
<columns>
<!-- column-name template -->
<column type="gchararray"/>
<!-- column-name drill_id -->
<column type="guint"/>
</columns>
</object>
</interface>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment