Merge lp:~ilidrissi.amine/software-center/fix-conflicting-packages into lp:software-center

Proposed by Mohamed Amine Ilidrissi
Status: Merged
Merged at revision: 1134
Proposed branch: lp:~ilidrissi.amine/software-center/fix-conflicting-packages
Merge into: lp:software-center
Diff against target: 209 lines (+108/-11)
6 files modified
debian/changelog (+4/-2)
softwarecenter/app.py (+26/-1)
softwarecenter/distro/Debian.py (+31/-0)
softwarecenter/distro/Ubuntu.py (+31/-0)
softwarecenter/view/dialogs.py (+3/-3)
softwarecenter/view/pkgview.py (+13/-5)
To merge this branch: bzr merge lp:~ilidrissi.amine/software-center/fix-conflicting-packages
Reviewer Review Type Date Requested Status
software-store-developers Pending
Review via email: mp+33818@code.launchpad.net

Description of the change

This branch fixes bug 554319.

To post a comment you must log in.
1074. By Mohamed Amine Ilidrissi

merge with trunk.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2010-08-26 18:44:15 +0000
3+++ debian/changelog 2010-08-26 18:54:41 +0000
4@@ -22,8 +22,10 @@
5
6 [ Mohamed Amine IL Idrissi ]
7 * Do not include download size of installed app.
8-
9- -- Gary Lasker <gary.lasker@canonical.com> Thu, 26 Aug 2010 14:36:13 -0400
10+ * An alert will show if you try to remove conflicting packages (LP: #554319)
11+ * The dependency remove alert will now show application icons
12+
13+ -- Mohamed Amine IL Idrissi <ilidrissiamine@gmail.com> Thu, 26 Aug 2010 18:44:58 +0000
14
15 software-center (2.1.13) maverick; urgency=low
16
17
18=== modified file 'softwarecenter/app.py'
19--- softwarecenter/app.py 2010-08-26 15:26:00 +0000
20+++ softwarecenter/app.py 2010-08-26 18:54:41 +0000
21@@ -498,7 +498,32 @@
22 iconpath = self.get_icon_filename(appdetails.icon, self.APP_ICON_SIZE)
23
24 if not dialogs.confirm_remove(None, self.datadir, primary, self.cache,
25- button_text, iconpath, depends):
26+ button_text, iconpath, depends, self.icons, self.db):
27+ # for appdetailsview-webkit
28+ # self._set_action_button_sensitive(True)
29+
30+ self.backend.emit("transaction-stopped", app.pkgname)
31+ return
32+ elif action == "install":
33+ # If we are installing a package, check for dependencies that will
34+ # also be removed and show a dialog for confirmation
35+ # generic removal text (fixing LP bug #554319)
36+ (primary, button_text) = self.distro.get_install_warning_text(self.cache,
37+ appdetails.pkg,
38+ app.name)
39+
40+ # ask for confirmation if we have depends that will be removed
41+ depends = []
42+ deps_remove = self.cache.get_all_deps_removing(appdetails.pkg)
43+ for dep in deps_remove:
44+ if self.cache[dep].installed != None:
45+ depends.append(dep)
46+
47+ if depends:
48+ iconpath = self.get_icon_filename(appdetails.icon, self.APP_ICON_SIZE)
49+
50+ if not dialogs.confirm_remove(None, self.datadir, primary, self.cache,
51+ button_text, iconpath, depends, self.icons, self.db):
52 # for appdetailsview-webkit
53 # self._set_action_button_sensitive(True)
54
55
56=== modified file 'softwarecenter/distro/Debian.py'
57--- softwarecenter/distro/Debian.py 2010-08-13 16:50:30 +0000
58+++ softwarecenter/distro/Debian.py 2010-08-26 18:54:41 +0000
59@@ -71,6 +71,37 @@
60 depends = None
61 break
62 return (primary, button_text)
63+
64+ def get_install_warning_text(self, cache, pkg, appname):
65+ primary = _("To install %s, these items must be removed:" % appname)
66+ button_text = _("Install Anyway")
67+
68+ depends = []
69+ deps_remove = self.cache.get_all_deps_removing(pkg)
70+ for dep in deps_remove:
71+ if self.cache[dep].installed != None:
72+ depends.append(dep)
73+
74+ # alter it if a meta-package is affected
75+ for m in depends:
76+ if cache[m].section == "metapackages":
77+ primary = _("If you install %s, future updates will not "
78+ "include new items in <b>%s</b> set. "
79+ "Are you sure you want to continue?") % (appname, cache[m].installed.summary)
80+ button_text = _("Install Anyway")
81+ depends = []
82+ break
83+
84+ # alter it if an important meta-package is affected
85+ for m in self.IMPORTANT_METAPACKAGES:
86+ if m in depends:
87+ primary = _("Installing %s may cause core applications to "
88+ "be removed. "
89+ "Are you sure you want to continue?" % appname)
90+ button_text = _("Install Anyway")
91+ depends = None
92+ break
93+ return (primary, button_text)
94
95 def get_distro_codename(self):
96 if not hasattr(self ,"codename"):
97
98=== modified file 'softwarecenter/distro/Ubuntu.py'
99--- softwarecenter/distro/Ubuntu.py 2010-08-25 13:16:17 +0000
100+++ softwarecenter/distro/Ubuntu.py 2010-08-26 18:54:41 +0000
101@@ -80,6 +80,37 @@
102 depends = None
103 break
104 return (primary, button_text)
105+
106+ def get_install_warning_text(self, cache, pkg, appname):
107+ primary = _("To install %s, these items must be removed:" % appname)
108+ button_text = _("Install Anyway")
109+
110+ depends = []
111+ deps_remove = cache.get_all_deps_removing(pkg)
112+ for dep in deps_remove:
113+ if cache[dep].installed != None:
114+ depends.append(dep)
115+
116+ # alter it if a meta-package is affected
117+ for m in depends:
118+ if cache[m].section == "metapackages":
119+ primary = _("If you install %s, future updates will not "
120+ "include new items in <b>%s</b> set. "
121+ "Are you sure you want to continue?") % (appname, cache[m].installed.summary)
122+ button_text = _("Install Anyway")
123+ depends = []
124+ break
125+
126+ # alter it if an important meta-package is affected
127+ for m in self.IMPORTANT_METAPACKAGES:
128+ if m in depends:
129+ primary = _("Installing %s may cause core applications to "
130+ "be removed. "
131+ "Are you sure you want to continue?" % appname)
132+ button_text = _("Install Anyway")
133+ depends = None
134+ break
135+ return (primary, button_text)
136
137 def get_distro_codename(self):
138 if not hasattr(self ,"codename"):
139
140=== modified file 'softwarecenter/view/dialogs.py'
141--- softwarecenter/view/dialogs.py 2010-07-14 15:47:46 +0000
142+++ softwarecenter/view/dialogs.py 2010-08-26 18:54:41 +0000
143@@ -34,7 +34,7 @@
144 else:
145 print >> sys.stderr, "WARNING: can not get name for '%s'" % o
146
147-def confirm_remove(parent, datadir, primary, cache, button_text, icon_path, depends):
148+def confirm_remove(parent, datadir, primary, cache, button_text, icon_path, depends, icons, db):
149 """Confirm removing of the given app with the given depends"""
150 glade_dialog = SimpleGladeDialog(datadir)
151 dialog = glade_dialog.dialog_dependency_alert
152@@ -53,7 +53,7 @@
153 # add the dependencies
154 vbox = dialog.get_content_area()
155 # FIXME: make this a generic pkgview widget
156- view = PkgNamesView(_("Dependency"), cache, depends)
157+ view = PkgNamesView(_("Dependency"), cache, depends, icons, db)
158 view.set_headers_visible(False)
159 glade_dialog.scrolledwindow_dependencies.add(view)
160 glade_dialog.scrolledwindow_dependencies.show_all()
161@@ -63,7 +63,7 @@
162 if result == gtk.RESPONSE_ACCEPT:
163 return True
164 return False
165-
166+
167 def confirm_repair_broken_cache(parent, datadir):
168 glade_dialog = SimpleGladeDialog(datadir)
169 dialog = glade_dialog.dialog_broken_cache
170
171=== modified file 'softwarecenter/view/pkgview.py'
172--- softwarecenter/view/pkgview.py 2010-07-08 08:11:34 +0000
173+++ softwarecenter/view/pkgview.py 2010-08-26 18:54:41 +0000
174@@ -19,6 +19,7 @@
175
176 import gtk
177 import pango
178+from softwarecenter.db.application import Application
179
180 #FIXME: These need to come from the main app
181 ICON_SIZE = 24
182@@ -30,7 +31,7 @@
183 (COL_ICON,
184 COL_TEXT) = range(2)
185
186- def __init__(self, header, cache, pkgnames):
187+ def __init__(self, header, cache, pkgnames, icons, db):
188 super(PkgNamesView, self).__init__()
189 model = gtk.ListStore(gtk.gdk.Pixbuf, str)
190 self.set_model(model)
191@@ -44,7 +45,14 @@
192 for pkgname in sorted(pkgnames):
193 s = "%s \n<small>%s</small>" % (
194 cache[pkgname].installed.summary.capitalize(), pkgname)
195- # FIXME: use xapian query here to find a matching icon
196- pix = gtk.gdk.pixbuf_new_from_file_at_size(MISSING_APP_ICON,
197- ICON_SIZE, ICON_SIZE)
198- row = model.append([pix, s])
199+
200+ app_details = Application("", pkgname).get_details(db)
201+ proposed_icon = app_details.icon
202+ if not proposed_icon or not icons.has_icon(proposed_icon):
203+ proposed_icon = MISSING_APP_ICON
204+ try:
205+ pix = icons.load_icon(proposed_icon, ICON_SIZE, ()).scale_simple(ICON_SIZE,
206+ ICON_SIZE, gtk.gdk.INTERP_BILINEAR)
207+ row = model.append([pix, s])
208+ except TypeError:
209+ logging.warning("cant set icon for '%s' " % pkgname)

Subscribers

People subscribed via source and target branches