Skip to content

Gmoccapy: Move tool table buttons to table frame, add toggle button for calculator use #3509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions lib/python/gladevcp/tooledit_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,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
53 changes: 51 additions & 2 deletions src/emc/usr_intf/gmoccapy/gmoccapy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1954,14 +1954,57 @@ 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)
# Empty space in between
spacer = Gtk.Label()
spacer.show_all()
buttonbox.pack_start(spacer,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)

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 @@ -4731,6 +4774,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 @@ -5224,7 +5273,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
Loading