Skip to content

Commit

Permalink
plasmac: compress config backup
Browse files Browse the repository at this point in the history
  • Loading branch information
phillc54 committed Sep 7, 2020
1 parent 6def9a4 commit 9bb4e1d
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 5 deletions.
19 changes: 18 additions & 1 deletion configs/by_machine/plasmac/plasmac_config.glade
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gladevcp 0.0 -->
<requires lib="gtk+" version="2.18"/>
<!-- interface-requires gladevcp 0.0 -->
<!-- interface-naming-policy project-wide -->
<object class="GtkAdjustment" id="arc-fail-delay-adj"/>
<object class="GtkAdjustment" id="arc-max-starts-adj"/>
Expand Down Expand Up @@ -772,9 +772,26 @@ for mode 2 this is the percentage of max velocity used for THC</property>
<object class="GtkLabel" id="version-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">PlasmaC version number</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
</packing>
</child>
<child>
<object class="HAL_Button" id="backup">
<property name="label" translatable="yes">Backup</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">create a compressed backup of the
complete machine configuration</property>
<signal name="clicked" handler="on_backup_clicked" swapped="no"/>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
</packing>
</child>
Expand Down
34 changes: 32 additions & 2 deletions configs/by_machine/plasmac/plasmac_config.py
Expand Up @@ -27,6 +27,7 @@
import hal, hal_glib
from gladevcp.persistence import widget_defaults,select_widgets
import gladevcp
import tarfile

class HandlerClass:

Expand All @@ -36,13 +37,41 @@ def on_save_clicked(self,widget,data=None):
def on_reload_clicked(self,widget,data=None):
self.load_settings()

def on_backup_clicked(self,widget):
outPath = '{}'.format(os.path.expanduser('~'))
outName = '{}.tar.gz'.format(self.i.find('EMC', 'MACHINE'))
configDir = os.path.realpath(os.path.dirname(os.environ['INI_FILE_NAME']))
with tarfile.open('{}/{}'.format(outPath, outName), mode='w:gz', ) as archive:
archive.add('{}'.format(configDir), filter=self.tar_filter)
msg = 'A compressed backup of the machine configuration\n'
msg += 'has been saved in your home directory.\n\n'
msg += 'The file name is: {}\n\n'.format(outName)
msg += 'This file may be attached to a post on the\n'
msg += 'LinuxCNC forum to aid in problem solving.\n\n'
md = gtk.MessageDialog(self.W,
gtk.DIALOG_DESTROY_WITH_PARENT,
gtk.MESSAGE_INFO,
gtk.BUTTONS_CLOSE,
msg)
md.set_title('Config Backup')
md.set_keep_above(True)
md.set_position(gtk.WIN_POS_CENTER_ALWAYS)
md.run()
md.destroy()

def tar_filter(self, tarinfo):
if os.path.splitext(tarinfo.name)[1] in ['.pyc']:
return None
else:
return tarinfo

def on_setupFeedRate_value_changed(self, widget):
self.builder.get_object('probe-feed-rate-adj').configure(self.builder.get_object('probe-feed-rate').get_value(),0,self.builder.get_object('setup-feed-rate').get_value(),1,0,0)

def configure_widgets(self):
# set_digits = number of digits after decimal
# configure = (value, lower limit, upper limit, step size, 0, 0)
self.builder.get_object('version-label').set_text(self.plasmacVersion)
self.builder.get_object('version-label').set_text(self.plasmacVersion.strip('PlasmaC '))
self.builder.get_object('arc-fail-delay').set_digits(1)
self.builder.get_object('arc-fail-delay-adj').configure(3,0.1,60,0.1,0,0)
self.builder.get_object('arc-ok-low').set_digits(0)
Expand Down Expand Up @@ -321,8 +350,9 @@ def idle_changed(self, halpin):

def __init__(self, halcomp,builder,useropts):

self.plasmacVersion = 'PlasmaC v0.170'
self.plasmacVersion = 'PlasmaC v0.171'

self.W = gtk.Window()
self.halcomp = halcomp
self.builder = builder
self.i = linuxcnc.ini(os.environ['INI_FILE_NAME'])
Expand Down
8 changes: 8 additions & 0 deletions configs/by_machine/plasmac/versions.html
Expand Up @@ -19,6 +19,14 @@ <h2>PlasmaC Updates</h2>
</head>
<body>

<br><b><u>v0.171 - 2020 Sep 07</u></b>
<ul style="margin:0;">
<li>compress config backup</li>
<li>fix gcode file load</li>
<li>fix wizard spindle codes</li>
<li>fix sample scribe code</li>
</ul>

<br><b><u>v0.170 - 2020 Sep 02</u></b>
<ul style="margin:0;">
<li>add speed adjustment for final probe up</li>
Expand Down
Binary file modified docs/src/plasma/images/plasmac_config.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion docs/src/plasma/plasmac-user-guide.txt
Expand Up @@ -549,6 +549,10 @@ The **Save** button will save the currently displayed parameters.

The **Reload** button will reload all the parameters.

The **version** label displays the current PlasmaC version.

The **Backup** button will create a complete machine configuration backup for archiving or to aid in fault diagnosis.

[[run-panel]]

=== Run Panel
Expand Down Expand Up @@ -2432,8 +2436,10 @@ The THCAD-10 and THCAD-300 examples above would be:

== Support

On line help and support are available from the https://forum.linuxcnc.org/plasmac[PlasmaC forum] section of the https://forum.linuxcnc.org/[LinuxCNC forum].
On line help and support are available from the https://forum.linuxcnc.org/plasmac[PlasmaC section] of the https://forum.linuxcnc.org/[LinuxCNC Forum].

You can create a complete backup of the machine configuration to aid in fault diagnosis by pressing the 'Backup' button in the config panel. This will create a compressed file in your home directory that is suitable for attaching to a post on the LinuxCNC Forum.

== Appendix


Expand Down
2 changes: 1 addition & 1 deletion src/hal/components/plasmac.comp
Expand Up @@ -7,7 +7,7 @@ A plasma cutting table control component for use with the LinuxCNC V2.8 or later

.I VERSION:
.br
0.170 - 2020 Sep 02
0.171 - 2020 Sep 07

.I SUMMARY:
.br
Expand Down

0 comments on commit 9bb4e1d

Please sign in to comment.