aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageialinux-online.org>2015-03-30 21:39:43 +0200
committerPapoteur <papoteur@mageialinux-online.org>2015-03-30 21:39:43 +0200
commit36a3d21f7219a00d70fdc819c7e1da7371034b26 (patch)
tree6a93edbad1ade89a084345db516f665cf88e6050
parent86a70a8d5eea9ed532f28985f44701714c47a63d (diff)
downloadisodumper-36a3d21f7219a00d70fdc819c7e1da7371034b26.tar
isodumper-36a3d21f7219a00d70fdc819c7e1da7371034b26.tar.gz
isodumper-36a3d21f7219a00d70fdc819c7e1da7371034b26.tar.bz2
isodumper-36a3d21f7219a00d70fdc819c7e1da7371034b26.tar.xz
isodumper-36a3d21f7219a00d70fdc819c7e1da7371034b26.zip
Exit properly, writing logfile
addind pollEvent for GTK freeze avoiding.
-rw-r--r--lib/isodumper.py44
1 files changed, 9 insertions, 35 deletions
diff --git a/lib/isodumper.py b/lib/isodumper.py
index b14ac50..55b1193 100644
--- a/lib/isodumper.py
+++ b/lib/isodumper.py
@@ -209,34 +209,6 @@ class Info(object):
class IsoDumper(object):
-# self.backup_select = self.wTree.get_widget("backup_select")
-# self.backup_name = self.wTree.get_widget("backup_name")
-# self.backup_button = self.wTree.get_widget("backup_button")
-# self.choose = self.wTree.get_widget("choose")
-# self.backup_bname = self.wTree.get_widget("bname")
-#
-
- # set callbacks
-# dict = { "on_main_dialog_destroy_event" : self.confirm_close,
-# "on_main_dialog_delete_event" : self.confirm_close,
-# "on_cancel_button_clicked" : self.confirm_close,
-# "on_emergency_button_clicked" : self.restore,
-# "on_confirm_cancel_button_clicked": self.restore,
-# "on_filechooserbutton_file_set" : self.activate_devicelist,
-# "on_device_combobox_changed" : self.device_selected,
-# "on_nodev_close_clicked" : self.close,
-# "on_backup_button_clicked" : self.backup_go,
-# "on_backup_select_clicked" : self.backup_sel,
-# "on_select_clicked" : self.backup_choosed,
-# "on_choose_cancel_clicked" : self.backup_cancel,
-# "on_format_button_clicked" : self.format_dialog,
-# "on_format_cancel_clicked" : self.format_cancel,
-# "on_format_go_clicked" : self.do_format,
-# "on_write_button_clicked" : self.do_write,
-# "on_help_close_clicked": self.help_close,
-# "on_help_clicked": self.help_dialog,
-# }
-
def get_devices(self):
self.list=self.u.find_devices()
while len(self.list)==0:
@@ -546,6 +518,7 @@ class IsoDumper(object):
if indice%1==0:
self.logger(_('Wrote: ')+str(indice)+'% '+str(written)+' bytes')
self.progress.setValue(indice)
+ self.dialog.pollEvent()
indice +=1
try:
os.fsync(ofc)
@@ -585,6 +558,7 @@ class IsoDumper(object):
md5func.update(block)
if checked > steps[indice]:
self.progress.setValue(indice)
+ self.dialog.pollEvent()
indice +=1
checked+=1024
block = f.read(b-ncuts*1024)
@@ -692,11 +666,9 @@ class IsoDumper(object):
def close(self):
self.write_logfile()
self.dialog.destroy
- exit(0)
+ #exit(0)
def write_logfile(self):
- start = self.log.get_start_iter()
- end = self.log.get_end_iter()
import pwd
pw = pwd.getpwnam(self.user)
uid = pw.pw_uid
@@ -710,10 +682,10 @@ class IsoDumper(object):
else:
logpath='/root'
logfile=open(logpath+'/isodumper.log',"w")
- logfile.write(self.log.get_text(start, end, False))
+ logfile.write(self.logview.logText())
logfile.close()
- print self.log.get_text(start, end, False)
+ print self.logview.logText()
def logger(self, text):
self.logview.appendLines(text+"\n")
@@ -954,10 +926,12 @@ The fields of the main window are as follows:\n\
while True:
event = self.dialog.waitForEvent()
if event.eventType() == yui.YEvent.CancelEvent:
- self.dialog.destroy()
+ self.close()
+ #self.dialog.destroy()
break
if event.widget() == self.quitbt:
- self.dialog.destroy()
+ self.close()
+ #self.dialog.destroy()
break
if event.widget() == self.ima:
self.img_name=yui.YUI.app().askForExistingFile('file:///home/'+self.user,"*.iso *.img","Choose an image")