diff options
-rwxr-xr-x | lib/isodumper.py | 23 | ||||
-rw-r--r-- | share/isodumper/isodumper.glade | 49 |
2 files changed, 67 insertions, 5 deletions
diff --git a/lib/isodumper.py b/lib/isodumper.py index a798105..19bafa3 100755 --- a/lib/isodumper.py +++ b/lib/isodumper.py @@ -171,9 +171,10 @@ class IsoDumper: exit_dialog=self.backup_bname.get_filename() if exit_dialog != None: # Add .iso if not specified - if not exit_dialog.lower().endswith('.iso'): - exit_dialog=exit_dialog+".iso" + if not exit_dialog.lower().endswith('.img'): + exit_dialog=exit_dialog+".img" head, tail = os.path.split(exit_dialog) + self.backup_dest=exit_dialog self.backup_select.set_label(tail) self.backup_button.set_sensitive(True) self.backup_select.set_tooltip_text(exit_dialog) @@ -245,13 +246,16 @@ class IsoDumper: self.success() elif rc == 5: message = _("An error occurred while creating a partition.") + self.logger(message) + self.emergency() elif rc == 127: message = _('Authentication error.') + self.logger(message) + self.emergency() else: message = _('An error occurred.') + self.emergency() self.wTree.get_widget("format").hide() - self.logger(message) - self.emergency() self.process = None working= False self.backup_select.set_sensitive(True) @@ -269,13 +273,22 @@ class IsoDumper: self.devicelist.set_sensitive(True) def backup_go(self,widget): - dest = self.backup_select.get_label() + dest = self.backup_dest + if os.path.exists(dest): + dialog=self.wTree.get_widget("confirm_overwrite") + resp=dialog.run() + if resp !=-5: + dialog.hide() + return True + else: + dialog.hide() source = self.dev.split('(')[1].split(')')[0] self.logger(_('Backup in:')+' '+dest) task = self.raw_write(source, dest, eval(self.deviceSize)) gobject.idle_add(task.next) while gtk.events_pending(): gtk.main_iteration(True) + self.success() def do_write(self, widget): write_button = self.wTree.get_widget("write_button") diff --git a/share/isodumper/isodumper.glade b/share/isodumper/isodumper.glade index 69e0c09..701f4a9 100644 --- a/share/isodumper/isodumper.glade +++ b/share/isodumper/isodumper.glade @@ -13,6 +13,21 @@ <property name="buttons">ok-cancel</property> <property name="text" translatable="yes">Writing is in progress. Exiting during writing will occur that the device or the backup will be unusable. Are you sure you want to quit during writing?</property> + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox2"> + <property name="can_focus">False</property> + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area2"> + <property name="can_focus">False</property> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </widget> + </child> </widget> <widget class="GtkAboutDialog" id="about_dialog"> <property name="can_focus">False</property> @@ -596,6 +611,40 @@ Public License instead of this License. </widget> </child> </widget> + <widget class="GtkMessageDialog" id="confirm_overwrite"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="type_hint">dialog</property> + <property name="skip_taskbar_hint">True</property> + <property name="message_type">warning</property> + <property name="buttons">ok-cancel</property> + <property name="secondary_text" translatable="yes">Do you want to overwrite the file?</property> + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </widget> + </child> + </widget> <widget class="GtkDialog" id="emergency_dialog"> <property name="can_focus">False</property> <property name="border_width">5</property> |