Skip to content

Commit 7894fe9

Browse files
authored
Merge pull request #6 from PyCoder/development
Development
2 parents c347126 + 8eb1dee commit 7894fe9

5 files changed

Lines changed: 24 additions & 13 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# KWipe 3.1.0
1+
# KWipe 3.1.1
22
### KWipe is a secure erase (wipe) application, completely written in PyQt!
33

44
![KWipe 3.1.0](https://github.com/PyCoder/KWipe/blob/master/screenshots/difference.png?raw=true)

RELEASE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.0
1+
3.1.1

share/kwipe/docs/changelog.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,13 @@ Changed removed thread.setPriority from main.py
177177
Changed from time.time to time.perf_counter
178178
Changed to f'{} style
179179
Changed "Creating TableWidget Items" part to use enumerate()
180-
Changed from open() to directio to increase the speed by up to 4 times
180+
Changed from open().write() to directio.write() to increase the speed by up to 4 times
181181
Added exclude devices in settings
182182
Updated copyright date
183183
Updated donation.ui
184184
Fixed crash in case of using a card reader and such
185185
Fixed glitch in about.ui
186+
187+
3.1.1
188+
Fixed catching IOError and OSError in main.py thread.run()
189+
Added error handeling in case the directio.write() crashes

share/kwipe/main.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ def on_finish(self):
240240
if self.sender() == v[0]:
241241
if self.sender().terminated:
242242
v[1].setFormat(self.tr('Aborted'))
243+
elif self.sender().error:
244+
v[1].setFormat(self.tr('Error'))
243245
else:
244246
v[1].setFormat(self.tr('Completed'))
245247
serial = utils.get_partition_info(k)[1]
@@ -304,8 +306,8 @@ def check_update(self): #Use json instead!
304306
Please visit:<br><a href=https://github.com/PyCoder/KWipe>
305307
https://github.com/PyCoder/KWipe</a></center>'''),
306308
QtWidgets.QMessageBox.StandardButton.Close)
307-
except (urllib.error.URLError, urllib.error.HTTPError):
308-
pass
309+
except (urllib.error.URLError, urllib.error.HTTPError) as _error:
310+
print(_error)
309311

310312
def donate(self):
311313
d = showDonate()
@@ -355,7 +357,7 @@ def run(self):
355357
limit = int(self.size / _MEGABYTE) * _MEGABYTE
356358
rest = int(self.size - limit)
357359

358-
fd = os.open(self.device, os.O_WRONLY|os.O_DIRECT)
360+
fd = os.open(self.device, os.O_RDWR|os.O_DIRECT|os.O_SYNC|os.O_NONBLOCK)
359361

360362
# Set current position like seek()
361363
os.lseek(fd, self.position, os.SEEK_SET)
@@ -370,11 +372,16 @@ def run(self):
370372
for total_bytes_written in range(self.position, self.size, _MEGABYTE):
371373
if self.semaphore.available():
372374

373-
# Write to file/device, flush and fsync it
374-
if total_bytes_written == limit and rest != 0:
375-
directio.write(fd, rest_data)
376-
else:
377-
directio.write(fd, data)
375+
# Write to file/device
376+
try:
377+
if total_bytes_written == limit and rest != 0:
378+
directio.write(fd, rest_data)
379+
else:
380+
directio.write(fd, data)
381+
except (OSError, IOError) as _error:
382+
self.error = True
383+
print(_error)
384+
break
378385

379386
# Get current position like .tell()
380387
self.position = os.lseek(fd, 0, os.SEEK_CUR)
@@ -393,7 +400,7 @@ def run(self):
393400
seconds = int((self.size - total_bytes_written) / (total_bytes_written / (self.offset or 1))
394401
) if total_bytes_written else 0
395402
eta = str(timedelta(seconds=seconds))
396-
mbps = str(round(total_bytes_written / _MEGABYTE / (self.offset or 1), 1))
403+
mbps = str(round(total_bytes_written / _MEGABYTE / (self.offset or 1), 2))
397404
self.current_speed.emit(mbps)
398405
self.current_eta.emit(eta)
399406
else:

share/kwipe/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
#
1818
# Author(s): Fabian Di Milia <fabian.dimilia@gmail.com>
1919

20-
VERSION = '3.1.0'
20+
VERSION = '3.1.1'
2121
URL = 'https://raw.githubusercontent.com/PyCoder/KWipe/master/RELEASE'

0 commit comments

Comments
 (0)