diff options
-rw-r--r-- | CHANGELOG | 17 | ||||
-rwxr-xr-x | lib/isodumper.py | 58 | ||||
-rw-r--r-- | share/isodumper/isodumper.glade | 271 |
3 files changed, 218 insertions, 128 deletions
@@ -5,10 +5,23 @@ IsoDumper 0.30 ------------ - added function to format the device in Fat32, ntfs or ext4. - separated backup from writing. - + - added a dialog box to warning against close when operationin action + - added close the application when X of the window bar clicked + - added file name and device name in the logview when selected + - changed a window to a dialog form. + - set the user owner of log file and directory + - suppress window redraw when closing the logview + +IsoDumper 0.23 +------------ + - added close the application when X of the window bar clicked + - added file name and device name in the logview when selected + - set the user owner of log file and directory + - suppress window redraw when closing the logview + IsoDumper 0.22 ------------ - - changed a window to a dialog form. + - changed a window in a dialog form. - added default values for the backup name and directory. - improvement to the isodumper icon with a new SVG. - improvement to the Makefile. diff --git a/lib/isodumper.py b/lib/isodumper.py index 388126b..edffd71 100755 --- a/lib/isodumper.py +++ b/lib/isodumper.py @@ -73,6 +73,7 @@ class IsoDumper: # get glade tree self.gladefile = "/usr/share/isodumper/isodumper.glade" + #self.gladefile = "/documents/isodumper-dev/share/isodumper/isodumper.glade" self.wTree = gtk.glade.XML(self.gladefile) # get globally needed widgets @@ -80,11 +81,15 @@ class IsoDumper: self.devicelist = self.wTree.get_widget("device_combobox") self.logview = self.wTree.get_widget("detail_text") self.log = self.logview.get_buffer() + # set RELEASE number on title and About self.window.set_title(self.window.get_title()+' '+RELEASE) self.wTree.get_widget("about_dialog").set_version(RELEASE) # define size of the selected device self.deviceSize=0 + + # Operation running + self.operation=False # set default file filter to *.img # Added for Mageia : *.iso @@ -105,12 +110,12 @@ class IsoDumper: # set callbacks dict = { "on_main_dialog_destroy" : self.close, - "on_cancel_button_clicked" : self.close, + "on_cancel_button_clicked" : self.confirm_close, "on_emergency_button_clicked" : self.restore, "on_success_button_clicked" : self.close, "on_confirm_cancel_button_clicked": self.restore, "on_filechooserbutton_file_set" : self.activate_devicelist, - "on_detail_expander_activate" : self.expander_control, +# "on_detail_expander_activate" : self.expander_control, "on_device_combobox_changed" : self.device_selected, "on_nodev_close_clicked" : self.close, "on_backup_button_clicked" : self.backup_go, @@ -121,7 +126,9 @@ class IsoDumper: "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_write_button_clicked" : self.do_write, + "on_main_dialog_delete_event" : gtk.main_quit, + } self.wTree.signal_autoconnect(dict) self.window.show_all() @@ -146,13 +153,13 @@ class IsoDumper: self.devicelist.append_text(name+' ('+path.lstrip()+') '+sizeM+_('Mb')) self.device_name=name.rstrip().replace(' ', '') dialog.destroy() - - + def device_selected(self, widget): self.dev = self.devicelist.get_active_text() self.backup_select.set_sensitive(True) self.wTree.get_widget("format_button").set_sensitive(True) self.wTree.get_widget("filechooserbutton").set_sensitive(True) + self.logger(_('Target Device: ')+ self.dev) def backup_sel(self,widget): if self.backup_bname.get_current_folder_uri() == None : @@ -185,10 +192,9 @@ class IsoDumper: write_button.set_sensitive(False) self.devicelist.set_sensitive(False) dialog=self.wTree.get_widget("format") - dialog.present() self.wTree.get_widget("format_device").set_text(self.dev) self.wTree.get_widget("format_name").set_text(self.dev.split('(')[0]) - exit_dialog=dialog.show_all() + exit_dialog=dialog.run() if exit_dialog==0: dialog.hide() @@ -213,10 +219,11 @@ class IsoDumper: self.wTree.get_widget("format_button").set_sensitive(True) self.wTree.get_widget("filechooserbutton").set_sensitive(True) self.devicelist.set_sensitive(True) - self.write_logfile() +# self.write_logfile() self.wTree.get_widget("emergency_dialog").hide() def raw_format(self, usb_path, fstype, label): + self.operation=True if os.geteuid() > 0: launcher='pkexec' self.process = Popen([launcher,'/usr/bin/python', '-u', '/usr/lib/isodumper/raw_format.py','-d',usb_path,'-f',fstype, '-l', label, '-u', str(os.geteuid()), '-g', str(os.getgid())], shell=False, stdout=PIPE, preexec_fn=os.setsid) @@ -345,6 +352,7 @@ class IsoDumper: self.emergency() def raw_write(self, source, target, b): + self.operation=True bs=4096*128 try: ifc=io.open(source, "rb",1) @@ -357,6 +365,7 @@ class IsoDumper: except: self.logger(_('You have not the rights for writing on the device')) self.emergency() + self.close('dummy') else: progress = self.wTree.get_widget("progressbar") progress.set_sensitive(True) @@ -413,6 +422,17 @@ class IsoDumper: dialog.hide() + def confirm_close(self, widget): + if self.operation==False: # no writing , backup nor format running + self.close('dummy') + else: # writing , backup nor format running + dialog=self.wTree.get_widget("Quit_warning") + resp = dialog.run() + if resp==-5 : # GTK_RESPONSE_OK + self.close('dummy') + else: + dialog.hide() + def emergency(self): self.final_unsensitive() dialog = self.wTree.get_widget("emergency_dialog") @@ -442,14 +462,22 @@ class IsoDumper: 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 + gid= pw.pw_gid if (self.user != 'root') and (self.user !=''): home='/home/'+self.user else: home='/root' if not(os.path.isdir(home+'/.isodumper')): os.mkdir(home+'/.isodumper') + os.chown(home+'/.isodumper',uid, gid) logfile=open(home+'/.isodumper/isodumper.log',"w") logfile.write(self.log.get_text(start, end, False)) + logfile.close() + + os.chown(home+'/.isodumper/isodumper.log',uid, gid) print self.log.get_text(start, end, False) def logger(self, text): @@ -464,15 +492,17 @@ class IsoDumper: self.img_name = self.chooser.get_filename() write_button = self.wTree.get_widget("write_button") write_button.set_sensitive(True) - + self.logger(_('Image ')+": "+ self.img_name) + self.chooser.set_tooltip_text(self.img_name) + def activate_backup(self, widget): self.backup_img_name = self.backup_dir.get_filename() - def expander_control(self, widget): - # this is darn ugly but still better than the UI behavior of - # the unexpanded expander which doesnt reset the window size - if widget.get_expanded(): - gobject.timeout_add(130, lambda: self.window.reshow_with_initial_size()) +# def expander_control(self, widget): +# # this is darn ugly but still better than the UI behavior of +# # the unexpanded expander which doesnt reset the window size +# if widget.get_expanded(): +# gobject.timeout_add(130, lambda: self.window.reshow_with_initial_size()) def about(self, widget): about_button = self.wTree.get_widget("about_button") diff --git a/share/isodumper/isodumper.glade b/share/isodumper/isodumper.glade index 6985e4f..480e801 100644 --- a/share/isodumper/isodumper.glade +++ b/share/isodumper/isodumper.glade @@ -2,6 +2,41 @@ <glade-interface> <!-- interface-requires gtk+ 2.16 --> <!-- interface-naming-policy toplevel-contextual --> + <widget class="GtkMessageDialog" id="Quit_warning"> + <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="text" translatable="yes">Writing is in progress. Exiting will occur that the device will be unusable. +Are you sure you want to quit during writing on the device?</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="GtkAboutDialog" id="about_dialog"> <property name="can_focus">False</property> <property name="border_width">5</property> @@ -11,6 +46,7 @@ <property name="type_hint">dialog</property> <property name="has_separator">True</property> <property name="program_name">IsoDumper</property> + <property name="version">v0.30</property> <property name="copyright">© 2013-2014 Mageia</property> <property name="comments" translatable="yes">A tool for writing ISO images on a USB stick. It's a fork of usb-imagewriter.</property> <property name="website">https://github.com/papoteur-mga/isodumper</property> @@ -409,14 +445,12 @@ Public License instead of this License. </child> </widget> <widget class="GtkDialog" id="choose"> + <property name="height_request">540</property> <property name="can_focus">False</property> + <property name="no_show_all">True</property> <property name="border_width">5</property> - <property name="title" translatable="yes">IsoDumper</property> - <property name="modal">True</property> - <property name="window_position">center-on-parent</property> - <property name="default_width">715</property> - <property name="default_height">540</property> - <property name="icon_name">isodumper</property> + <property name="title" translatable="yes">Isodumper</property> + <property name="icon">isodumper</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> <widget class="GtkVBox" id="dialog-vbox6"> @@ -664,9 +698,9 @@ Public License instead of this License. <property name="label" translatable="yes"><b>Error</b> Something went wrong, please see the details window for the exact error. - - A logfile isodumper.log with the content will be saved in your - homedir/.isodumper when the application is closed.</property> + +The application will be closed with this window, and a logfile + isodumper.log will be saved in your homedir/.isodumper </property> <property name="use_markup">True</property> </widget> <packing> @@ -685,37 +719,28 @@ Public License instead of this License. </widget> </child> </widget> - <widget class="GtkWindow" id="format"> + <widget class="GtkDialog" id="format"> <property name="can_focus">False</property> - <property name="title" translatable="yes">Formatting the device</property> - <property name="window_position">center</property> - <property name="default_width">350</property> - <property name="icon_name">isodumper</property> - <child> - <widget class="GtkVBox" id="vbox1"> + <property name="border_width">5</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox8"> <property name="visible">True</property> <property name="can_focus">False</property> - <child> - <widget class="GtkLabel" id="format_device"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label">label</property> - </widget> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <widget class="GtkHBox" id="hbox2"> + <property name="spacing">2</property> + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area8"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="layout_style">end</property> <child> - <widget class="GtkLabel" id="label1"> + <widget class="GtkButton" id="format_go"> + <property name="label">gtk-execute</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Label for the device:</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_format_go_clicked" swapped="no"/> </widget> <packing> <property name="expand">True</property> @@ -724,15 +749,13 @@ Public License instead of this License. </packing> </child> <child> - <widget class="GtkEntry" id="format_name"> + <widget class="GtkButton" id="format_cancel"> + <property name="label">gtk-undo</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="width_chars">32</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> - <property name="primary_icon_sensitive">True</property> - <property name="secondary_icon_sensitive">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_format_cancel_clicked" swapped="no"/> </widget> <packing> <property name="expand">True</property> @@ -744,110 +767,133 @@ Public License instead of this License. <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">0</property> </packing> </child> <child> - <widget class="GtkVButtonBox" id="vbuttonbox1"> + <widget class="GtkVBox" id="vbox1"> <property name="visible">True</property> <property name="can_focus">False</property> <child> - <widget class="GtkRadioButton" id="format_fat"> - <property name="label" translatable="yes">FAT 32 (Windows)</property> + <widget class="GtkLabel" id="format_device"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="has_tooltip">True</property> - <property name="tooltip" translatable="yes">The standard. The size of files are limited to 4Gb</property> - <property name="active">True</property> - <property name="draw_indicator">True</property> + <property name="can_focus">False</property> + <property name="label">label</property> </widget> <packing> - <property name="expand">False</property> - <property name="fill">False</property> + <property name="expand">True</property> + <property name="fill">True</property> <property name="position">0</property> </packing> </child> <child> - <widget class="GtkRadioButton" id="format_ntfs"> - <property name="label" translatable="yes">NTFS (Windows)</property> + <widget class="GtkHBox" id="hbox2"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="has_tooltip">True</property> - <property name="tooltip" translatable="yes">To handle files bigger than 4Gb</property> - <property name="draw_indicator">True</property> - <property name="group">format_fat</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <widget class="GtkRadioButton" id="format_ext4"> - <property name="label" translatable="yes">ext4 (Linux)</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="has_tooltip">True</property> - <property name="tooltip" translatable="yes">Only for Linux systems</property> - <property name="draw_indicator">True</property> - <property name="group">format_fat</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> - </child> - </widget> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <widget class="GtkHBox" id="hbox1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <widget class="GtkButton" id="format_go"> - <property name="label">gtk-execute</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_format_go_clicked" swapped="no"/> + <property name="can_focus">False</property> + <child> + <widget class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Label for the device:</property> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkEntry" id="format_name"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + <property name="width_chars">32</property> + <property name="invisible_char_set">True</property> + <property name="primary_icon_activatable">False</property> + <property name="secondary_icon_activatable">False</property> + <property name="primary_icon_sensitive">True</property> + <property name="secondary_icon_sensitive">True</property> + </widget> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> </widget> <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> <child> - <widget class="GtkButton" id="format_cancel"> - <property name="label">gtk-undo</property> + <widget class="GtkVButtonBox" id="vbuttonbox1"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_format_cancel_clicked" swapped="no"/> + <property name="can_focus">False</property> + <child> + <widget class="GtkRadioButton" id="format_fat"> + <property name="label" translatable="yes">FAT 32 (Windows)</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="has_tooltip">True</property> + <property name="tooltip" translatable="yes">The standard. The size of files are limited to 4Gb</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkRadioButton" id="format_ntfs"> + <property name="label" translatable="yes">NTFS (Windows)</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="has_tooltip">True</property> + <property name="tooltip" translatable="yes">To handle files bigger than 4Gb</property> + <property name="draw_indicator">True</property> + <property name="group">format_fat</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkRadioButton" id="format_ext4"> + <property name="label" translatable="yes">ext4 (Linux)</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="has_tooltip">True</property> + <property name="tooltip" translatable="yes">Only for Linux systems</property> + <property name="draw_indicator">True</property> + <property name="group">format_fat</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> + </child> </widget> <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> </widget> <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">1</property> </packing> </child> </widget> @@ -860,6 +906,7 @@ Public License instead of this License. <property name="window_position">center-always</property> <property name="icon_name">isodumper</property> <property name="type_hint">dialog</property> + <signal name="delete_event" handler="on_main_dialog_delete_event" swapped="no"/> <child> <widget class="GtkVBox" id="vbox2"> <property name="visible">True</property> |