Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion lib/python/gladevcp/tooledit_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def match_value_cb(model, path, iter, pathlist):
for path in pathlist:
liststore.remove(liststore.get_iter(path))

# return the selected tool number
# return tool numbers of all rows with checked checkboxes
def get_selected_tool(self):
liststore = self.model
def match_value_cb(model, path, iter, pathlist):
Expand All @@ -211,6 +211,15 @@ def match_value_cb(model, path, iter, pathlist):
else:
return(liststore.get_value(liststore.get_iter(pathlist[0]),1))

# return tool number of the highlighted (ie selected) row
def get_selected_row(self):
model, iter = self.view1.get_selection().get_selected()
if iter:
tool = model.get_value(iter, 1)
return tool
else:
return None

def set_selected_tool(self,toolnumber):
try:
treeselection = self.view2.get_selection()
Expand All @@ -231,6 +240,8 @@ def match_tool(model, path, iter, pathlist):
def add(self,widget,data=[1,0,0,'0','0','0','0','0','0','0','0','0','0','0','0',0,"comment"]):
self.model.append(data)
self.num_of_col +=1
liststore = self.model
self.wTree.get_object("treeview1").scroll_to_cell(len(liststore)-1)

# this is for adding a filename path after the tooleditor is already loaded.
def set_filename(self,filename):
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 28 additions & 36 deletions src/emc/usr_intf/gmoccapy/gmoccapy.glade
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,26 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkImage" id="img_tool_delete">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkImage" id="img_tool_save">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkImage" id="img_tool_reload">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkImage" id="img_tool_add">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkImage" id="img_tool_calculator">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkListStore" id="lstst_icon_themes">
<columns>
<!-- column-name path -->
Expand Down Expand Up @@ -7405,18 +7425,11 @@ MDI history</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkButton" id="btn_delete_tool">
<property name="label" translatable="yes">Delete</property>
<property name="use-action-appearance">False</property>
<object class="GtkLabel" id="lbl_empty_0_tool">
<property name="width-request">90</property>
<property name="height-request">56</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">delete selected tool or tools</property>
<property name="halign">center</property>
<property name="valign">center</property>
<signal name="clicked" handler="on_btn_delete_tool_clicked" swapped="no"/>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -7425,18 +7438,11 @@ MDI history</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_add_tool">
<property name="label" translatable="yes">Add</property>
<property name="use-action-appearance">False</property>
<object class="GtkLabel" id="lbl_empty_1_tool">
<property name="width-request">90</property>
<property name="height-request">56</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">add a new tool to tool table</property>
<property name="halign">center</property>
<property name="valign">center</property>
<signal name="clicked" handler="on_btn_add_tool_clicked" swapped="no"/>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -7445,18 +7451,11 @@ MDI history</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_reload_tooltable">
<property name="label" translatable="yes">Reload</property>
<property name="use-action-appearance">False</property>
<object class="GtkLabel" id="lbl_empty_2_tool">
<property name="width-request">90</property>
<property name="height-request">56</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">reload tool table from file</property>
<property name="halign">center</property>
<property name="valign">center</property>
<signal name="clicked" handler="on_btn_reload_tooltable_clicked" swapped="no"/>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -7465,18 +7464,11 @@ MDI history</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_apply_tool_changes">
<property name="label" translatable="yes">Apply</property>
<property name="use-action-appearance">False</property>
<object class="GtkLabel" id="lbl_empty_3_tool">
<property name="width-request">90</property>
<property name="height-request">56</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">apply the changes you made, G43 will be executed only if it is active G-code</property>
<property name="halign">center</property>
<property name="valign">center</property>
<signal name="clicked" handler="on_btn_apply_tool_changes_clicked" swapped="no"/>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
Expand Down
62 changes: 59 additions & 3 deletions src/emc/usr_intf/gmoccapy/gmoccapy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1957,13 +1957,60 @@ def _init_tooleditor(self):
if not self.get_ini_info.get_lathe_wear_offsets():
# hide the wear offset tabs
self.widgets.tooledit1.set_lathe_display(False)
self.widgets.tooledit1.hide_buttonbox(True)
# Modify the button box at the bottom
buttonbox = self.widgets.tooledit1.wTree.get_object("buttonbox")
buttonbox.set_layout(Gtk.ButtonBoxStyle.EDGE)
buttonbox.set_property("homogeneous", True)
# Delete button
btn_delete = self.widgets.tooledit1.wTree.get_object("delete")
btn_delete.set_size_request(56, 56)
btn_delete.set_label("")
btn_delete.set_image(self.widgets.img_tool_delete)
btn_delete.set_always_show_image(True)
# Add button
btn_add = self.widgets.tooledit1.wTree.get_object("add")
btn_add.set_size_request(56, 56)
btn_add.set_label("")
btn_add.set_image(self.widgets.img_tool_add)
btn_add.set_always_show_image(True)
# Reload button
btn_reload = self.widgets.tooledit1.wTree.get_object("reload")
btn_reload.set_size_request(56, 56)
btn_reload.set_label("")
btn_reload.set_image(self.widgets.img_tool_reload)
btn_reload.set_always_show_image(True)
# Save button
btn_save = self.widgets.tooledit1.wTree.get_object("apply")
btn_save.set_size_request(56, 56)
btn_save.set_label("")
btn_save.set_image(self.widgets.img_tool_save)
btn_save.set_always_show_image(True)
# Create a label for current tool in spindle
lbl_tool = Gtk.Label()
self.widgets.tooledit1.lbl_tool = lbl_tool
lbl_tool.show_all()
buttonbox.pack_start(lbl_tool,True,True,0)
# Calculator button
btn_calculator = Gtk.ToggleButton()
btn_calculator.set_size_request(56, 56)
btn_calculator.set_image(self.widgets.img_tool_calculator)
btn_calculator.set_tooltip_text(_("Use calculator to edit numeric values"))
btn_calculator.show_all()
btn_calculator.set_active(self.toolpage_use_calc)
btn_calculator.connect("toggled", self.on_use_calculator_toggled)
buttonbox.pack_start(btn_calculator,False,False,50)
column_cell_ids = ["toggle", "tool#1", "pos1", "x1", "y1", "z1", "a1", "b1", "c1", "u1", "v1", "w1",
"d1", "front1", "back1", "orient1", "cell_comments1"]
for col, name in enumerate(column_cell_ids):
if col > 0 and col < 16:
temp = self.widgets.tooledit1.wTree.get_object("cell_%s" % name)
temp.connect('editing-started', self.on_tool_col_edit_started, col)
# override 'tooledit_widget' method 'set_selected_tool'
self.widgets.tooledit1.set_selected_tool = self.set_selected_tool

def set_selected_tool(self, toolnumber):
lbl_tool_text = "Tool loaded: " + str(toolnumber)
self.widgets.tooledit1.lbl_tool.set_text(lbl_tool_text)

def on_tree_navigate_key_press(self, treeview, event, filter):
keyname = Gdk.keyval_name(event.keyval)
Expand Down Expand Up @@ -2006,6 +2053,9 @@ def on_tree_navigate_key_press(self, treeview, event, filter):
else:
pass

def on_use_calculator_toggled(self,widget):
self.toolpage_use_calc = widget.get_active()

def on_tool_col_edit_started(self, widget, filtered_path, new_text, col):
if not self.toolpage_use_calc:
return
Expand Down Expand Up @@ -4783,6 +4833,12 @@ def _set_icon_theme(self, name):
("img_tool_clear", "clear", 24),
("img_tool_path", "toolpath", 24),
("img_dimensions", "dimensions", 24),
# tooledit frame controls
("img_tool_delete", "delete", 32),
("img_tool_add", "add", 32),
("img_tool_reload", "refresh", 32),
("img_tool_save", "save", 32),
("img_tool_calculator", "calculator_open", 32),
# coolant
("img_coolant_on", "coolant_flood_active", 48),
("img_coolant_off", "coolant_flood_inactive", 48),
Expand Down Expand Up @@ -5276,7 +5332,7 @@ def on_btn_reload_tooltable_clicked(self, widget, data=None):
self.widgets.tooledit1.reload(None)
self.widgets.tooledit1.set_selected_tool(self.stat.tool_in_spindle)

def on_btn_apply_tool_changes_clicked(self, widget, data=None):
def on_btn_save_tool_changes_clicked(self, widget, data=None):
self.widgets.tooledit1.save(None)
self.widgets.tooledit1.set_selected_tool(self.stat.tool_in_spindle)

Expand Down Expand Up @@ -5360,7 +5416,7 @@ def on_btn_select_tool_by_no_clicked(self, widget, data=None):

# set tool with M61 Q? or with T? M6
def on_btn_selected_tool_clicked(self, widget, data=None):
tool = self.widgets.tooledit1.get_selected_tool()
tool = self.widgets.tooledit1.get_selected_row()
if tool == None:
message = _("you selected no or more than one tool, the tool selection must be unique")
self.dialogs.warning_dialog(self, _("Important Warning!"), message)
Expand Down
Loading