diff options
| author | glatzor@ubuntu.com <> | 2006-07-28 00:22:49 +0200 |
|---|---|---|
| committer | glatzor@ubuntu.com <> | 2006-07-28 00:22:49 +0200 |
| commit | 18ebb5a4446010824b05b92820689e795498cd87 (patch) | |
| tree | 5c7f3171277a2760d837cfe4af094409f5a027a2 | |
| parent | 8b0c51a898bd788ba5f2285daf4f15ab8d78ae67 (diff) | |
| download | python-apt-18ebb5a4446010824b05b92820689e795498cd87.tar.gz | |
* add a revert and add cdrom button
| -rw-r--r-- | SoftwareProperties/SoftwareProperties.py | 21 | ||||
| -rw-r--r-- | data/glade/SoftwareProperties.glade | 135 |
2 files changed, 131 insertions, 25 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py index 768e942a..35793151 100644 --- a/SoftwareProperties/SoftwareProperties.py +++ b/SoftwareProperties/SoftwareProperties.py @@ -118,6 +118,7 @@ class SoftwareProperties(SimpleGladeApp): self.init_sourceslist() self.reload_sourceslist() + self.backup_sourceslist() self.window_main.show() @@ -572,6 +573,15 @@ class SoftwareProperties(SimpleGladeApp): self.sourceslist = aptsources.SourcesList() + def backup_sourceslist(self): + """ + Duplicate the list of sources + """ + self.sourceslist_backup = [] + for source in self.sourceslist.list: + source_bkp = aptsources.SourceEntry(line=source.line,file=source.file) + self.sourceslist_backup.append(source_bkp) + def on_channel_activate(self, treeview, path, column): """Open the edit dialog if a channel was double clicked""" self.on_edit_clicked(treeview) @@ -607,10 +617,11 @@ class SoftwareProperties(SimpleGladeApp): def on_button_revert_clicked(self, button): """Restore the source list from the startup of the dialog""" - self.sourceslist.restoreBackup(".save") - self.sourceslist.clearBackup(".save") - self.sourceslist.backup(".save") - self.sourceslist.refresh() + self.sourceslist.list = [] + for source in self.sourceslist_backup: + source_reset = aptsources.SourceEntry(line=source.line,file=source.file) + self.sourceslist.list.append(source_reset) + self.save_sourceslist() self.reload_sourceslist() self.button_revert.set_sensitive(False) self.modified = False @@ -619,7 +630,7 @@ class SoftwareProperties(SimpleGladeApp): """The sources list was changed and now needs to be saved and reloaded""" self.massive_debug_output() self.modified = True - #self.button_revert.set_sensitive(True) + self.button_revert.set_sensitive(True) self.save_sourceslist() self.reload_sourceslist() diff --git a/data/glade/SoftwareProperties.glade b/data/glade/SoftwareProperties.glade index 98bf65bc..d262980d 100644 --- a/data/glade/SoftwareProperties.glade +++ b/data/glade/SoftwareProperties.glade @@ -737,7 +737,7 @@ <child> <widget class="GtkHBox" id="hbox9"> <property name="visible">True</property> - <property name="homogeneous">False</property> + <property name="homogeneous">True</property> <property name="spacing">6</property> <child> @@ -759,6 +759,85 @@ </child> <child> + <widget class="GtkButton" id="button_add_cdrom"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_button_add_cdrom_clicked" last_modification_time="Thu, 27 Jul 2006 22:19:37 GMT"/> + + <child> + <widget class="GtkAlignment" id="alignment11"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">0</property> + <property name="yscale">0</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">0</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkHBox" id="hbox12"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">2</property> + + <child> + <widget class="GtkImage" id="image2"> + <property name="visible">True</property> + <property name="stock">gtk-add</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label21"> + <property name="visible">True</property> + <property name="label">Add Cdrom</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> <widget class="GtkButton" id="button_edit"> <property name="visible">True</property> <property name="can_default">True</property> @@ -796,23 +875,8 @@ </widget> <packing> <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button1"> - <property name="can_focus">True</property> - <property name="label">gtk-revert-to-saved</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </widget> - <packing> - <property name="padding">0</property> <property name="expand">False</property> - <property name="fill">False</property> + <property name="fill">True</property> </packing> </child> </widget> @@ -1138,11 +1202,11 @@ The results are used to improve the support for popular applications and to rank </child> <child> - <widget class="GtkHButtonBox" id="hbuttonbox1"> + <widget class="GtkHBox" id="hbox11"> <property name="border_width">6</property> <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_EDGE</property> - <property name="spacing">0</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> <child> <widget class="GtkButton" id="button_help"> @@ -1155,6 +1219,11 @@ The results are used to improve the support for popular applications and to rank <property name="focus_on_click">True</property> <signal name="clicked" handler="on_help_button" last_modification_time="Mon, 04 Jul 2005 21:19:04 GMT"/> </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> </child> <child> @@ -1168,6 +1237,32 @@ The results are used to improve the support for popular applications and to rank <property name="focus_on_click">True</property> <signal name="clicked" handler="on_close_button" last_modification_time="Mon, 04 Jul 2005 21:18:56 GMT"/> </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="button_revert"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-revert-to-saved</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_button_revert_clicked" last_modification_time="Thu, 27 Jul 2006 21:47:47 GMT"/> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> </child> </widget> <packing> |
