Skip to content

Commit 415d725

Browse files
committed
qtplasmac: fix updates for v154 and v170
1 parent e016dc0 commit 415d725

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

lib/python/qtvcp/lib/qtplasmac/updater.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ def split_prefs_file(old, new, prefs):
209209

210210
# use qtplasmac_comp.hal for component connections (pre V1.221.154 2022/01/18)
211211
def add_component_hal_file(path, halfiles):
212+
tmpFile = None
212213
pinsToCheck = ['PLASMAC COMPONENT INPUTS','plasmac.arc-ok-in','plasmac.axis-x-position',
213214
'plasmac.axis-y-position','plasmac.breakaway','plasmac.current-velocity',
214215
'plasmac.cutting-start','plasmac.cutting-stop','plasmac.feed-override',
@@ -231,15 +232,14 @@ def add_component_hal_file(path, halfiles):
231232
with open(halfile, 'r') as inFile:
232233
if 'plasmac.cutting-start' in inFile.read():
233234
inFile.seek(0)
234-
tmpFile = '{}~'.format(halfile)
235235
COPY(halfile, tmpFile)
236236
with open(tmpFile, 'r') as inFile:
237237
with open(f, 'w') as outFile:
238238
for line in inFile:
239239
if any(pin in line for pin in pinsToCheck):
240240
continue
241241
outFile.write(line)
242-
if os.path.isfile(tmpFile):
242+
if tmpFile and os.path.isfile(tmpFile):
243243
os.remove(tmpFile)
244244

245245
def add_component_hal_file_iniwrite(inifile):

share/qtvcp/screens/qtplasmac/qtplasmac_handler.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,12 @@ def __init__(self, halcomp, widgets, paths):
135135
if self.units == 'inch':
136136
self.units = 'in'
137137
self.unitsPerMm = 0.03937
138-
# try to open prefs file so we can use it for updates
138+
# open prefs file so we can use it for updates
139139
# it will not exist prior to V1.222.170 2022/03/08
140-
self.PREFS = None
141-
try:
140+
if os.path.isfile(os.path.join(self.PATHS.CONFIGPATH, self.machineName + '.prefs')):
142141
self.PREFS = Access(os.path.join(self.PATHS.CONFIGPATH, self.machineName + '.prefs'))
143-
except:
144-
pass
142+
else:
143+
self.PREFS = None
145144
self.updateIni = []
146145
self.update_check()
147146
self.PREFS = Access(os.path.join(self.PATHS.CONFIGPATH, self.machineName + '.prefs'))
@@ -2180,6 +2179,7 @@ def update_check(self):
21802179
old = os.path.join(self.PATHS.CONFIGPATH, 'qtplasmac.prefs')
21812180
if os.path.isfile(old):
21822181
UPDATER.split_prefs_file(old, qtvcpPrefsFile, machinePrefsFile)
2182+
self.PREFS = Access(os.path.join(self.PATHS.CONFIGPATH, self.machineName + '.prefs'))
21832183
# move conversational prefs from qtvcp.prefs to <machine_name>.prefs (pre V1.222.187 2022/05/03)
21842184
if os.path.isfile(qtvcpPrefsFile) and os.path.isfile(machinePrefsFile):
21852185
with open(qtvcpPrefsFile, 'r') as inFile:

share/qtvcp/screens/qtplasmac/versions.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ <h2>QtPlasmaC Version History</h2>
3636
</ul>
3737
<i>Changes submitted by snowgoer540 (Greg Carl)</i><br>
3838

39+
<br><b><u>v1.229.229 2022 Aug 19</u></b>
40+
<ul style="margin:0;">
41+
<li>fix updates for v154 and v170</li>
42+
</ul>
43+
3944
<br><b><u>v1.229.227 2022 Aug 17</u></b>
4045
<ul style="margin:0;">
4146
<li>material files naming consistency</li>

0 commit comments

Comments
 (0)