Status: | Merged |
---|---|
Merged at revision: | 442 |
Proposed branch: | lp:~mvo/gdebi/add-linitan |
Merge into: | lp:gdebi |
Diff against target: |
921 lines (+242/-107) (has conflicts) 4 files modified
GDebi/GDebi.py (+109/-45) GDebi/GDebiCommon.py (+9/-8) data/gdebi.ui (+61/-54) tests/test_gdebi_gtk_lintian.py (+63/-0) Text conflict in GDebi/GDebi.py |
To merge this branch: | bzr merge lp:~mvo/gdebi/add-linitan |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
gdebi-developers | Pending | ||
Review via email:
|
Commit message
Description of the change
This branch adds a "lintian" tab to the main notebook that show the
lintian status of the deb in question
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'GDebi/GDebi.py' | |||
2 | --- GDebi/GDebi.py 2012-10-05 10:32:37 +0000 | |||
3 | +++ GDebi/GDebi.py 2012-10-08 06:56:32 +0000 | |||
4 | @@ -52,7 +52,7 @@ | |||
5 | 52 | from gettext import gettext as _ | 52 | from gettext import gettext as _ |
6 | 53 | 53 | ||
7 | 54 | # the timeout when the termial is expanded if no activity from dpkg | 54 | # the timeout when the termial is expanded if no activity from dpkg |
9 | 55 | # is happening | 55 | # is happening |
10 | 56 | GDEBI_TERMINAL_TIMEOUT=4*60.0 | 56 | GDEBI_TERMINAL_TIMEOUT=4*60.0 |
11 | 57 | 57 | ||
12 | 58 | # HACK - there are two ubuntu specific patches, one for VTE, one | 58 | # HACK - there are two ubuntu specific patches, one for VTE, one |
13 | @@ -67,7 +67,7 @@ | |||
14 | 67 | class GDebi(SimpleGtkbuilderApp, GDebiCommon): | 67 | class GDebi(SimpleGtkbuilderApp, GDebiCommon): |
15 | 68 | 68 | ||
16 | 69 | def __init__(self, datadir, options, file=""): | 69 | def __init__(self, datadir, options, file=""): |
18 | 70 | GDebiCommon.__init__(self,datadir,options,file) | 70 | GDebiCommon.__init__(self,datadir, options, file) |
19 | 71 | localesApp="gdebi" | 71 | localesApp="gdebi" |
20 | 72 | localesDir="/usr/share/locale" | 72 | localesDir="/usr/share/locale" |
21 | 73 | 73 | ||
22 | @@ -79,13 +79,13 @@ | |||
23 | 79 | logo=icons.load_icon("gnome-mime-application-x-deb", 48, 0) | 79 | logo=icons.load_icon("gnome-mime-application-x-deb", 48, 0) |
24 | 80 | if logo != "": | 80 | if logo != "": |
25 | 81 | Gtk.Window.set_default_icon_list([logo]) | 81 | Gtk.Window.set_default_icon_list([logo]) |
27 | 82 | except Exception, e: | 82 | except Exception as e: |
28 | 83 | print "Error loading logo" | 83 | print "Error loading logo" |
29 | 84 | pass | 84 | pass |
30 | 85 | 85 | ||
31 | 86 | # create terminal | 86 | # create terminal |
32 | 87 | self.vte_terminal = Vte.Terminal() | 87 | self.vte_terminal = Vte.Terminal() |
34 | 88 | # FIXME: this sucks but without it the terminal window is only | 88 | # FIXME: this sucks but without it the terminal window is only |
35 | 89 | # 1 line height | 89 | # 1 line height |
36 | 90 | self.vte_terminal.set_size_request(80*10, 25*10) | 90 | self.vte_terminal.set_size_request(80*10, 25*10) |
37 | 91 | menu = Gtk.Menu() | 91 | menu = Gtk.Menu() |
38 | @@ -124,7 +124,7 @@ | |||
39 | 124 | self.show_alert(Gtk.MessageType.ERROR, self.error_header, self.error_body) | 124 | self.show_alert(Gtk.MessageType.ERROR, self.error_header, self.error_body) |
40 | 125 | sys.exit(1) | 125 | sys.exit(1) |
41 | 126 | self.statusbar_main.push(self.context, "") | 126 | self.statusbar_main.push(self.context, "") |
43 | 127 | 127 | ||
44 | 128 | # setup the details treeview | 128 | # setup the details treeview |
45 | 129 | self.details_list = Gtk.ListStore(GObject.TYPE_STRING) | 129 | self.details_list = Gtk.ListStore(GObject.TYPE_STRING) |
46 | 130 | column = Gtk.TreeViewColumn("") | 130 | column = Gtk.TreeViewColumn("") |
47 | @@ -145,6 +145,7 @@ | |||
48 | 145 | self.synaptic_config = apt_pkg.Configuration() | 145 | self.synaptic_config = apt_pkg.Configuration() |
49 | 146 | 146 | ||
50 | 147 | if file != "" and os.path.exists(file): | 147 | if file != "" and os.path.exists(file): |
51 | 148 | <<<<<<< TREE | ||
52 | 148 | self.open(file) | 149 | self.open(file) |
53 | 149 | self.window_main.set_sensitive(True) | 150 | self.window_main.set_sensitive(True) |
54 | 150 | 151 | ||
55 | @@ -158,6 +159,15 @@ | |||
56 | 158 | Gtk.main_iteration() | 159 | Gtk.main_iteration() |
57 | 159 | else: | 160 | else: |
58 | 160 | win.set_cursor(None) | 161 | win.set_cursor(None) |
59 | 162 | ======= | ||
60 | 163 | self.window_main.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH)) | ||
61 | 164 | while Gtk.events_pending(): | ||
62 | 165 | Gtk.main_iteration() | ||
63 | 166 | self.open(file) | ||
64 | 167 | self.window_main.get_window().set_cursor(None) | ||
65 | 168 | |||
66 | 169 | self.window_main.set_sensitive(True) | ||
67 | 170 | >>>>>>> MERGE-SOURCE | ||
68 | 161 | 171 | ||
69 | 162 | def gio_progress_callback(self, bytes_read, bytes_total, data): | 172 | def gio_progress_callback(self, bytes_read, bytes_total, data): |
70 | 163 | self.progressbar_download.set_fraction(bytes_read/float(bytes_total)) | 173 | self.progressbar_download.set_fraction(bytes_read/float(bytes_total)) |
71 | @@ -173,7 +183,7 @@ | |||
72 | 173 | if (gio_file.get_uri_scheme() == "file"): | 183 | if (gio_file.get_uri_scheme() == "file"): |
73 | 174 | return file | 184 | return file |
74 | 175 | if (os.getuid()==0): | 185 | if (os.getuid()==0): |
76 | 176 | self.show_alert(Gtk.MessageType.ERROR, | 186 | self.show_alert(Gtk.MessageType.ERROR, |
77 | 177 | _("Can not download as root"), | 187 | _("Can not download as root"), |
78 | 178 | _("Remote packages can not be downloaded when " | 188 | _("Remote packages can not be downloaded when " |
79 | 179 | "running as root. Please try again as a " | 189 | "running as root. Please try again as a " |
80 | @@ -194,7 +204,7 @@ | |||
81 | 194 | file = gio_dest.get_path() | 204 | file = gio_dest.get_path() |
82 | 195 | self.dialog_gio_download.hide() | 205 | self.dialog_gio_download.hide() |
83 | 196 | except Exception, e: | 206 | except Exception, e: |
85 | 197 | self.show_alert(Gtk.MessageType.ERROR, | 207 | self.show_alert(Gtk.MessageType.ERROR, |
86 | 198 | _("Download failed"), | 208 | _("Download failed"), |
87 | 199 | _("Downloading the package failed: " | 209 | _("Downloading the package failed: " |
88 | 200 | "file '%s' '%s'") % (file, e)) | 210 | "file '%s' '%s'") % (file, e)) |
89 | @@ -213,7 +223,7 @@ | |||
90 | 213 | elif path.startswith('file:'): # xffm | 223 | elif path.startswith('file:'): # xffm |
91 | 214 | path = path[5:] # 5 is len('file:') | 224 | path = path[5:] # 5 is len('file:') |
92 | 215 | return path | 225 | return path |
94 | 216 | 226 | ||
95 | 217 | def on_menuitem_quit_activate(self, widget): | 227 | def on_menuitem_quit_activate(self, widget): |
96 | 218 | try: | 228 | try: |
97 | 219 | Gtk.main_quit() | 229 | Gtk.main_quit() |
98 | @@ -230,20 +240,31 @@ | |||
99 | 230 | path = self._get_file_path_from_dnd_dropped_uri(uri) | 240 | path = self._get_file_path_from_dnd_dropped_uri(uri) |
100 | 231 | #print 'path to open', path | 241 | #print 'path to open', path |
101 | 232 | if path.endswith(".deb"): | 242 | if path.endswith(".deb"): |
102 | 243 | <<<<<<< TREE | ||
103 | 244 | ======= | ||
104 | 245 | self.window_main.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH)) | ||
105 | 246 | while Gtk.events_pending(): | ||
106 | 247 | Gtk.main_iteration() | ||
107 | 248 | >>>>>>> MERGE-SOURCE | ||
108 | 233 | self.open(path) | 249 | self.open(path) |
109 | 234 | 250 | ||
110 | 251 | <<<<<<< TREE | ||
111 | 235 | def open(self, file, downloaded=False): | 252 | def open(self, file, downloaded=False): |
112 | 236 | self._show_busy_cursor(True) | 253 | self._show_busy_cursor(True) |
113 | 237 | res = GDebiCommon.open(self, file, downloaded) | 254 | res = GDebiCommon.open(self, file, downloaded) |
114 | 238 | self._show_busy_cursor(False) | 255 | self._show_busy_cursor(False) |
115 | 256 | ======= | ||
116 | 257 | def open(self, filename, downloaded=False): | ||
117 | 258 | res = GDebiCommon.open(self, filename, downloaded) | ||
118 | 259 | >>>>>>> MERGE-SOURCE | ||
119 | 239 | if res == False: | 260 | if res == False: |
120 | 240 | self.show_alert(Gtk.MessageType.ERROR, self.error_header, self.error_body) | 261 | self.show_alert(Gtk.MessageType.ERROR, self.error_header, self.error_body) |
121 | 241 | return False | 262 | return False |
123 | 242 | 263 | ||
124 | 243 | self.statusbar_main.push(self.context, "") | 264 | self.statusbar_main.push(self.context, "") |
125 | 244 | 265 | ||
126 | 245 | # set window title | 266 | # set window title |
128 | 246 | self.window_main.set_title(_("Package Installer - %s") % | 267 | self.window_main.set_title(_("Package Installer - %s") % |
129 | 247 | self._deb.pkgname) | 268 | self._deb.pkgname) |
130 | 248 | 269 | ||
131 | 249 | # set name and ungrey some widgets | 270 | # set name and ungrey some widgets |
132 | @@ -315,6 +336,11 @@ | |||
133 | 315 | # and the file content textview | 336 | # and the file content textview |
134 | 316 | font_desc = Pango.FontDescription('monospace') | 337 | font_desc = Pango.FontDescription('monospace') |
135 | 317 | self.textview_file_content.modify_font(font_desc) | 338 | self.textview_file_content.modify_font(font_desc) |
136 | 339 | self.textview_lintian_output.modify_font(font_desc) | ||
137 | 340 | |||
138 | 341 | # run lintian async | ||
139 | 342 | if self._options and self._options.non_interactive is False: | ||
140 | 343 | self._run_lintian(filename) | ||
141 | 318 | 344 | ||
142 | 319 | # check the deps | 345 | # check the deps |
143 | 320 | if not self._deb.check(): | 346 | if not self._deb.check(): |
144 | @@ -322,7 +348,7 @@ | |||
145 | 322 | "<span foreground=\"red\" weight=\"bold\">"+ | 348 | "<span foreground=\"red\" weight=\"bold\">"+ |
146 | 323 | _("Error: ") + | 349 | _("Error: ") + |
147 | 324 | #glib.markup_escape_text(self._deb._failure_string) + | 350 | #glib.markup_escape_text(self._deb._failure_string) + |
149 | 325 | self._deb._failure_string + | 351 | self._deb._failure_string + |
150 | 326 | "</span>") | 352 | "</span>") |
151 | 327 | self.button_install.set_label(_("_Install Package")) | 353 | self.button_install.set_label(_("_Install Package")) |
152 | 328 | 354 | ||
153 | @@ -376,7 +402,7 @@ | |||
154 | 376 | self.button_details.hide() | 402 | self.button_details.hide() |
155 | 377 | else: | 403 | else: |
156 | 378 | self.button_details.show() | 404 | self.button_details.show() |
158 | 379 | 405 | ||
159 | 380 | self.label_status.set_markup(self.deps) | 406 | self.label_status.set_markup(self.deps) |
160 | 381 | #img = Gtk.Image() | 407 | #img = Gtk.Image() |
161 | 382 | #img.set_from_stock(Gtk.STOCK_APPLY,Gtk.IconSize.BUTTON) | 408 | #img.set_from_stock(Gtk.STOCK_APPLY,Gtk.IconSize.BUTTON) |
162 | @@ -386,6 +412,44 @@ | |||
163 | 386 | self.button_install.grab_default() | 412 | self.button_install.grab_default() |
164 | 387 | self.button_remove.hide() | 413 | self.button_remove.hide() |
165 | 388 | 414 | ||
166 | 415 | def _run_lintian(self, filename): | ||
167 | 416 | buf = self.textview_lintian_output.get_buffer() | ||
168 | 417 | if not os.path.exists("/usr/bin/lintian"): | ||
169 | 418 | buf.set_text( | ||
170 | 419 | _("No lintian available.\n" | ||
171 | 420 | "Please install using sudo apt-get install lintian")) | ||
172 | 421 | return | ||
173 | 422 | buf.set_text(_("Running lintian...")) | ||
174 | 423 | self._lintian_output = "" | ||
175 | 424 | self._lintian_exit_status = None | ||
176 | 425 | cmd = ["/usr/bin/lintian", filename] | ||
177 | 426 | (pid, stdin, stdout, stderr) = GLib.spawn_async( | ||
178 | 427 | cmd, flags=GObject.SPAWN_DO_NOT_REAP_CHILD, | ||
179 | 428 | standard_output=True, standard_error=True) | ||
180 | 429 | for fd in [stdout, stderr]: | ||
181 | 430 | channel = GLib.IOChannel(filedes=fd) | ||
182 | 431 | channel.set_flags(GLib.IOFlags.NONBLOCK) | ||
183 | 432 | channel.add_watch(GLib.IOCondition.IN, self._on_lintian_output) | ||
184 | 433 | GObject.child_watch_add( | ||
185 | 434 | pid, self._on_lintian_finished) | ||
186 | 435 | |||
187 | 436 | def _on_lintian_finished(self, pid, condition): | ||
188 | 437 | exit_status = os.WEXITSTATUS(condition) | ||
189 | 438 | self._lintian_exit_status = exit_status | ||
190 | 439 | text = _("\nLintian finished with exit status %s") % exit_status | ||
191 | 440 | self._lintian_output += text | ||
192 | 441 | buf = self.textview_lintian_output.get_buffer() | ||
193 | 442 | buf.set_text(self._lintian_output) | ||
194 | 443 | |||
195 | 444 | def _on_lintian_output(self, gio_file, condition): | ||
196 | 445 | if condition & GLib.IOCondition.IN: | ||
197 | 446 | content = gio_file.read() | ||
198 | 447 | if content: | ||
199 | 448 | self._lintian_output += content | ||
200 | 449 | buf = self.textview_lintian_output.get_buffer() | ||
201 | 450 | buf.set_text(self._lintian_output) | ||
202 | 451 | return True | ||
203 | 452 | |||
204 | 389 | def on_treeview_files_cursor_changed(self, treeview): | 453 | def on_treeview_files_cursor_changed(self, treeview): |
205 | 390 | " the selection in the files list chanaged " | 454 | " the selection in the files list chanaged " |
206 | 391 | model = treeview.get_model() | 455 | model = treeview.get_model() |
207 | @@ -437,9 +501,9 @@ | |||
208 | 437 | # build dialog | 501 | # build dialog |
209 | 438 | self.window_main.set_sensitive(False) | 502 | self.window_main.set_sensitive(False) |
210 | 439 | fs = Gtk.FileChooserDialog(parent=self.window_main, | 503 | fs = Gtk.FileChooserDialog(parent=self.window_main, |
214 | 440 | buttons=(Gtk.STOCK_CANCEL, | 504 | buttons=(Gtk.STOCK_CANCEL, |
215 | 441 | Gtk.ResponseType.CANCEL, | 505 | Gtk.ResponseType.CANCEL, |
216 | 442 | Gtk.STOCK_OPEN, | 506 | Gtk.STOCK_OPEN, |
217 | 443 | Gtk.ResponseType.OK), | 507 | Gtk.ResponseType.OK), |
218 | 444 | action=Gtk.FileChooserAction.OPEN, | 508 | action=Gtk.FileChooserAction.OPEN, |
219 | 445 | title=_("Open Software Package")) | 509 | title=_("Open Software Package")) |
220 | @@ -466,7 +530,7 @@ | |||
221 | 466 | self.window_main.set_sensitive(True) | 530 | self.window_main.set_sensitive(True) |
222 | 467 | 531 | ||
223 | 468 | def on_copy_activate(self, widget): | 532 | def on_copy_activate(self, widget): |
225 | 469 | clipboard = Gtk.Clipboard.get(Gdk.atom_intern('CLIPBOARD', True)) | 533 | clipboard = Gtk.Clipboard.get(Gdk.atom_intern('CLIPBOARD', True)) |
226 | 470 | buf = self.textview_description.get_buffer() | 534 | buf = self.textview_description.get_buffer() |
227 | 471 | if buf.get_has_selection(): | 535 | if buf.get_has_selection(): |
228 | 472 | buf.copy_clipboard(clipboard) | 536 | buf.copy_clipboard(clipboard) |
229 | @@ -535,7 +599,7 @@ | |||
230 | 535 | scrolled = Gtk.ScrolledWindow() | 599 | scrolled = Gtk.ScrolledWindow() |
231 | 536 | textview = Gtk.TextView() | 600 | textview = Gtk.TextView() |
232 | 537 | textview.set_cursor_visible(False) | 601 | textview.set_cursor_visible(False) |
234 | 538 | textview.set_editable(False) | 602 | textview.set_editable(False) |
235 | 539 | buf = textview.get_buffer() | 603 | buf = textview.get_buffer() |
236 | 540 | buf.set_text("\n".join(self.unauthenticated)) | 604 | buf.set_text("\n".join(self.unauthenticated)) |
237 | 541 | scrolled.add(textview) | 605 | scrolled.add(textview) |
238 | @@ -584,13 +648,13 @@ | |||
239 | 584 | self.statusbar_main.push(self.context, msgstring) | 648 | self.statusbar_main.push(self.context, msgstring) |
240 | 585 | self.show_alert(Gtk.MessageType.ERROR, self.error_header, self.error_body) | 649 | self.show_alert(Gtk.MessageType.ERROR, self.error_header, self.error_body) |
241 | 586 | return False | 650 | return False |
243 | 587 | 651 | ||
244 | 588 | # lock for install | 652 | # lock for install |
245 | 589 | self.window_main.set_sensitive(False) | 653 | self.window_main.set_sensitive(False) |
246 | 590 | self.button_deb_install_close.set_sensitive(False) | 654 | self.button_deb_install_close.set_sensitive(False) |
247 | 591 | # clear terminal | 655 | # clear terminal |
248 | 592 | #self.vte_terminal.feed(str(0x1b)+"[2J") | 656 | #self.vte_terminal.feed(str(0x1b)+"[2J") |
250 | 593 | 657 | ||
251 | 594 | # Get whether we auto close from synaptic's config file and | 658 | # Get whether we auto close from synaptic's config file and |
252 | 595 | # update the toggle button as neccessary | 659 | # update the toggle button as neccessary |
253 | 596 | config = apt_pkg.Configuration() | 660 | config = apt_pkg.Configuration() |
254 | @@ -602,7 +666,7 @@ | |||
255 | 602 | config["Synaptic::closeZvt"] = "false" | 666 | config["Synaptic::closeZvt"] = "false" |
256 | 603 | self.synaptic_config = config.subtree("Synaptic") | 667 | self.synaptic_config = config.subtree("Synaptic") |
257 | 604 | self.checkbutton_autoclose.set_active(self.synaptic_config.find_b("closeZvt")) | 668 | self.checkbutton_autoclose.set_active(self.synaptic_config.find_b("closeZvt")) |
259 | 605 | 669 | ||
260 | 606 | self.dialog_deb_install.set_transient_for(self.window_main) | 670 | self.dialog_deb_install.set_transient_for(self.window_main) |
261 | 607 | self.dialog_deb_install.show_all() | 671 | self.dialog_deb_install.show_all() |
262 | 608 | 672 | ||
263 | @@ -638,13 +702,13 @@ | |||
264 | 638 | if not res: | 702 | if not res: |
265 | 639 | self.show_alert(Gtk.MessageType.ERROR, header, body, msg, | 703 | self.show_alert(Gtk.MessageType.ERROR, header, body, msg, |
266 | 640 | parent=self.dialog_deb_install) | 704 | parent=self.dialog_deb_install) |
268 | 641 | 705 | ||
269 | 642 | self.label_install_status.set_markup("<span foreground=\"red\" weight=\"bold\">%s</span>" % header) | 706 | self.label_install_status.set_markup("<span foreground=\"red\" weight=\"bold\">%s</span>" % header) |
270 | 643 | self.button_deb_install_close.set_sensitive(True) | 707 | self.button_deb_install_close.set_sensitive(True) |
271 | 644 | self.button_deb_install_close.grab_default() | 708 | self.button_deb_install_close.grab_default() |
272 | 645 | self.statusbar_main.push(self.context,_("Failed to install package file")) | 709 | self.statusbar_main.push(self.context,_("Failed to install package file")) |
275 | 646 | return | 710 | return |
276 | 647 | 711 | ||
277 | 648 | # install the package itself | 712 | # install the package itself |
278 | 649 | self.dialog_deb_install.set_title(self.window_main.get_title()) | 713 | self.dialog_deb_install.set_title(self.window_main.get_title()) |
279 | 650 | if install: | 714 | if install: |
280 | @@ -683,10 +747,10 @@ | |||
281 | 683 | self.label_install_status.set_markup("<i>"+_("Package '%s' was removed") % os.path.basename(self._deb.pkgname)+"</i>") | 747 | self.label_install_status.set_markup("<i>"+_("Package '%s' was removed") % os.path.basename(self._deb.pkgname)+"</i>") |
282 | 684 | else: | 748 | else: |
283 | 685 | if install: | 749 | if install: |
285 | 686 | self.label_install_status.set_markup("<b>"+_("Failed to install package '%s'") % | 750 | self.label_install_status.set_markup("<b>"+_("Failed to install package '%s'") % |
286 | 687 | os.path.basename(self._deb.filename)+"</b>") | 751 | os.path.basename(self._deb.filename)+"</b>") |
287 | 688 | else: | 752 | else: |
289 | 689 | self.label_install_status.set_markup("<b>"+_("Failed to remove package '%s'") % | 753 | self.label_install_status.set_markup("<b>"+_("Failed to remove package '%s'") % |
290 | 690 | os.path.basename(self._deb.pkgname)+"</b>") | 754 | os.path.basename(self._deb.pkgname)+"</b>") |
291 | 691 | self.expander_install.set_expanded(True) | 755 | self.expander_install.set_expanded(True) |
292 | 692 | if install: | 756 | if install: |
293 | @@ -718,7 +782,7 @@ | |||
294 | 718 | 782 | ||
295 | 719 | def on_button_remove_clicked(self, widget): | 783 | def on_button_remove_clicked(self, widget): |
296 | 720 | self.dpkg_action(widget, False) | 784 | self.dpkg_action(widget, False) |
298 | 721 | 785 | ||
299 | 722 | def on_button_deb_install_close_clicked(self, widget): | 786 | def on_button_deb_install_close_clicked(self, widget): |
300 | 723 | # Set the autoclose option when we close | 787 | # Set the autoclose option when we close |
301 | 724 | autoclose = self.checkbutton_autoclose.get_active() | 788 | autoclose = self.checkbutton_autoclose.get_active() |
302 | @@ -731,17 +795,17 @@ | |||
303 | 731 | self._gio_cancellable.cancel() | 795 | self._gio_cancellable.cancel() |
304 | 732 | self.dialog_deb_install.hide() | 796 | self.dialog_deb_install.hide() |
305 | 733 | self.window_main.set_sensitive(True) | 797 | self.window_main.set_sensitive(True) |
307 | 734 | 798 | ||
308 | 735 | def on_checkbutton_autoclose_clicked(self, widget): | 799 | def on_checkbutton_autoclose_clicked(self, widget): |
309 | 736 | if self.action_completed: | 800 | if self.action_completed: |
311 | 737 | self.on_button_deb_install_close_clicked(None) | 801 | self.on_button_deb_install_close_clicked(None) |
312 | 738 | 802 | ||
313 | 739 | def on_window_main_delete_event(self, *args): | 803 | def on_window_main_delete_event(self, *args): |
314 | 740 | if self.window_main.get_property("sensitive"): | 804 | if self.window_main.get_property("sensitive"): |
315 | 741 | if Gtk.main_level() > 0: | 805 | if Gtk.main_level() > 0: |
316 | 742 | Gtk.main_quit() | 806 | Gtk.main_quit() |
317 | 743 | return False | 807 | return False |
319 | 744 | else: | 808 | else: |
320 | 745 | return True | 809 | return True |
321 | 746 | 810 | ||
322 | 747 | def show_alert(self, type, header, body=None, details=None, parent=None): | 811 | def show_alert(self, type, header, body=None, details=None, parent=None): |
323 | @@ -754,26 +818,26 @@ | |||
324 | 754 | if not body == None: | 818 | if not body == None: |
325 | 755 | message = "%s\n\n%s" % (message, body) | 819 | message = "%s\n\n%s" % (message, body) |
326 | 756 | self.label_hig.set_markup(message) | 820 | self.label_hig.set_markup(message) |
328 | 757 | 821 | ||
329 | 758 | if not details == None: | 822 | if not details == None: |
330 | 759 | buffer = self.textview_hig.get_buffer() | 823 | buffer = self.textview_hig.get_buffer() |
331 | 760 | buffer.set_text(str(details)) | 824 | buffer.set_text(str(details)) |
332 | 761 | self.expander_hig.set_expanded(False) | 825 | self.expander_hig.set_expanded(False) |
333 | 762 | self.expander_hig.show() | 826 | self.expander_hig.show() |
335 | 763 | 827 | ||
336 | 764 | if type == Gtk.MessageType.ERROR: | 828 | if type == Gtk.MessageType.ERROR: |
337 | 765 | self.image_hig.set_property("stock", "gtk-dialog-error") | 829 | self.image_hig.set_property("stock", "gtk-dialog-error") |
338 | 766 | elif type == Gtk.MessageType.WARNING: | 830 | elif type == Gtk.MessageType.WARNING: |
339 | 767 | self.image_hig.set_property("stock", "gtk-dialog-warning") | 831 | self.image_hig.set_property("stock", "gtk-dialog-warning") |
340 | 768 | elif type == Gtk.MessageType.INFO: | 832 | elif type == Gtk.MessageType.INFO: |
341 | 769 | self.image_hig.set_property("stock", "gtk-dialog-info") | 833 | self.image_hig.set_property("stock", "gtk-dialog-info") |
343 | 770 | 834 | ||
344 | 771 | res = self.dialog_hig.run() | 835 | res = self.dialog_hig.run() |
345 | 772 | self.dialog_hig.hide() | 836 | self.dialog_hig.hide() |
346 | 773 | if res == Gtk.ResponseType.CLOSE: | 837 | if res == Gtk.ResponseType.CLOSE: |
347 | 774 | return True | 838 | return True |
348 | 775 | return False | 839 | return False |
350 | 776 | 840 | ||
351 | 777 | def write_synaptic_config_file(self, config, path): | 841 | def write_synaptic_config_file(self, config, path): |
352 | 778 | if not os.path.exists(path): | 842 | if not os.path.exists(path): |
353 | 779 | return | 843 | return |
354 | @@ -791,7 +855,7 @@ | |||
355 | 791 | 855 | ||
356 | 792 | def menu_action(self, widget, terminal): | 856 | def menu_action(self, widget, terminal): |
357 | 793 | terminal.copy_clipboard() | 857 | terminal.copy_clipboard() |
359 | 794 | 858 | ||
360 | 795 | # embedded classes | 859 | # embedded classes |
361 | 796 | class DpkgActionProgress(object): | 860 | class DpkgActionProgress(object): |
362 | 797 | def __init__(self, debfile, status, progress, term, expander, install=True): | 861 | def __init__(self, debfile, status, progress, term, expander, install=True): |
363 | @@ -838,7 +902,7 @@ | |||
364 | 838 | 902 | ||
365 | 839 | # the command | 903 | # the command |
366 | 840 | argv = ["/usr/bin/dpkg", "--auto-deconfigure"] | 904 | argv = ["/usr/bin/dpkg", "--auto-deconfigure"] |
368 | 841 | # ubuntu supports VTE_PTY_KEEP_FD, see | 905 | # ubuntu supports VTE_PTY_KEEP_FD, see |
369 | 842 | # https://bugzilla.gnome.org/320128 for the upstream bug | 906 | # https://bugzilla.gnome.org/320128 for the upstream bug |
370 | 843 | if UBUNTU: | 907 | if UBUNTU: |
371 | 844 | argv += ["--status-fd", "%s"%writefd] | 908 | argv += ["--status-fd", "%s"%writefd] |
372 | @@ -857,8 +921,8 @@ | |||
373 | 857 | self.term.connect("child-exited", finish_dpkg, lock) | 921 | self.term.connect("child-exited", finish_dpkg, lock) |
374 | 858 | (res, pid) =self.term.fork_command_full( | 922 | (res, pid) =self.term.fork_command_full( |
375 | 859 | Vte.PtyFlags.DEFAULT, | 923 | Vte.PtyFlags.DEFAULT, |
378 | 860 | "/", | 924 | "/", |
379 | 861 | argv, | 925 | argv, |
380 | 862 | env, | 926 | env, |
381 | 863 | GLib.SpawnFlags.LEAVE_DESCRIPTORS_OPEN, | 927 | GLib.SpawnFlags.LEAVE_DESCRIPTORS_OPEN, |
382 | 864 | # FIXME: add setup_func that closes all fds excpet for writefd | 928 | # FIXME: add setup_func that closes all fds excpet for writefd |
383 | @@ -895,11 +959,11 @@ | |||
384 | 895 | Gtk.main_iteration() | 959 | Gtk.main_iteration() |
385 | 896 | time.sleep(0.2) | 960 | time.sleep(0.2) |
386 | 897 | # if the terminal has not reacted for some time, do something | 961 | # if the terminal has not reacted for some time, do something |
388 | 898 | if (not self.term_expander.get_expanded() and | 962 | if (not self.term_expander.get_expanded() and |
389 | 899 | (self.time_last_update + GDEBI_TERMINAL_TIMEOUT) < time.time()): | 963 | (self.time_last_update + GDEBI_TERMINAL_TIMEOUT) < time.time()): |
390 | 900 | self.term_expander.set_expanded(True) | 964 | self.term_expander.set_expanded(True) |
391 | 901 | self.progress.set_fraction(1.0) | 965 | self.progress.set_fraction(1.0) |
393 | 902 | 966 | ||
394 | 903 | class InstallProgressAdapter(InstallProgress): | 967 | class InstallProgressAdapter(InstallProgress): |
395 | 904 | def __init__(self,progress,term,label,term_expander): | 968 | def __init__(self,progress,term,label,term_expander): |
396 | 905 | InstallProgress.__init__(self) | 969 | InstallProgress.__init__(self) |
397 | @@ -941,7 +1005,7 @@ | |||
398 | 941 | InstallProgress.update_interface(self) | 1005 | InstallProgress.update_interface(self) |
399 | 942 | while Gtk.events_pending(): | 1006 | while Gtk.events_pending(): |
400 | 943 | Gtk.main_iteration() | 1007 | Gtk.main_iteration() |
402 | 944 | if (not self.term_expander.get_expanded() and | 1008 | if (not self.term_expander.get_expanded() and |
403 | 945 | (self.time_last_update + GDEBI_TERMINAL_TIMEOUT) < time.time()): | 1009 | (self.time_last_update + GDEBI_TERMINAL_TIMEOUT) < time.time()): |
404 | 946 | self.term_expander.set_expanded(True) | 1010 | self.term_expander.set_expanded(True) |
405 | 947 | # sleep just long enough to not create a busy loop | 1011 | # sleep just long enough to not create a busy loop |
406 | @@ -965,7 +1029,7 @@ | |||
407 | 965 | while not self.finished: | 1029 | while not self.finished: |
408 | 966 | self.update_interface() | 1030 | self.update_interface() |
409 | 967 | return self.apt_status | 1031 | return self.apt_status |
411 | 968 | 1032 | ||
412 | 969 | class FetchProgressAdapter(apt.progress.base.AcquireProgress): | 1033 | class FetchProgressAdapter(apt.progress.base.AcquireProgress): |
413 | 970 | def __init__(self,progress,action,main): | 1034 | def __init__(self,progress,action,main): |
414 | 971 | super(GDebi.FetchProgressAdapter, self).__init__() | 1035 | super(GDebi.FetchProgressAdapter, self).__init__() |
415 | @@ -1017,7 +1081,7 @@ | |||
416 | 1017 | Gtk.main_iteration() | 1081 | Gtk.main_iteration() |
417 | 1018 | def done(self): | 1082 | def done(self): |
418 | 1019 | self.progressbar.hide() | 1083 | self.progressbar.hide() |
420 | 1020 | 1084 | ||
421 | 1021 | if __name__ == "__main__": | 1085 | if __name__ == "__main__": |
422 | 1022 | app = GDebi("data/",None) | 1086 | app = GDebi("data/",None) |
423 | 1023 | 1087 | ||
424 | @@ -1033,16 +1097,16 @@ | |||
425 | 1033 | apt_pkg.pkgsystem_lock() | 1097 | apt_pkg.pkgsystem_lock() |
426 | 1034 | app.dialog_deb_install.set_transient_for(app.window_main) | 1098 | app.dialog_deb_install.set_transient_for(app.window_main) |
427 | 1035 | app.dialog_deb_install.show_all() | 1099 | app.dialog_deb_install.show_all() |
429 | 1036 | 1100 | ||
430 | 1037 | # install the dependecnies | 1101 | # install the dependecnies |
431 | 1038 | fprogress = app.FetchProgressAdapter(app.progressbar_install, | 1102 | fprogress = app.FetchProgressAdapter(app.progressbar_install, |
432 | 1039 | app.label_action, | 1103 | app.label_action, |
433 | 1040 | app.dialog_deb_install) | 1104 | app.dialog_deb_install) |
435 | 1041 | iprogress = app.InstallProgressAdapter(app.progressbar_install, | 1105 | iprogress = app.InstallProgressAdapter(app.progressbar_install, |
436 | 1042 | app.vte_terminal, | 1106 | app.vte_terminal, |
437 | 1043 | app.label_action, | 1107 | app.label_action, |
438 | 1044 | app.expander_install) | 1108 | app.expander_install) |
439 | 1045 | res = app._cache.commit(fprogress,iprogress) | 1109 | res = app._cache.commit(fprogress,iprogress) |
440 | 1046 | print "commit retured: %s" % res | 1110 | print "commit retured: %s" % res |
442 | 1047 | 1111 | ||
443 | 1048 | Gtk.main() | 1112 | Gtk.main() |
444 | 1049 | 1113 | ||
445 | === modified file 'GDebi/GDebiCommon.py' | |||
446 | --- GDebi/GDebiCommon.py 2012-09-12 21:28:17 +0000 | |||
447 | +++ GDebi/GDebiCommon.py 2012-10-08 06:56:32 +0000 | |||
448 | @@ -49,6 +49,7 @@ | |||
449 | 49 | return unicode(str, 'latin1') | 49 | return unicode(str, 'latin1') |
450 | 50 | 50 | ||
451 | 51 | class GDebiCommon(object): | 51 | class GDebiCommon(object): |
452 | 52 | |||
453 | 52 | # cprogress may be different in child classes | 53 | # cprogress may be different in child classes |
454 | 53 | def __init__(self, datadir, options, file=""): | 54 | def __init__(self, datadir, options, file=""): |
455 | 54 | self.cprogress = None | 55 | self.cprogress = None |
456 | @@ -64,14 +65,14 @@ | |||
457 | 64 | def openCache(self): | 65 | def openCache(self): |
458 | 65 | self._cache = Cache(self.cprogress) | 66 | self._cache = Cache(self.cprogress) |
459 | 66 | if self._cache._depcache.broken_count > 0: | 67 | if self._cache._depcache.broken_count > 0: |
468 | 67 | self.error_header = _("Broken dependencies") | 68 | self.error_header = _("Broken dependencies") |
469 | 68 | self.error_body = _("Your system has broken dependencies. " | 69 | self.error_body = _("Your system has broken dependencies. " |
470 | 69 | "This application can not continue until " | 70 | "This application can not continue until " |
471 | 70 | "this is fixed. " | 71 | "this is fixed. " |
472 | 71 | "To fix it run 'gksudo synaptic' or " | 72 | "To fix it run 'gksudo synaptic' or " |
473 | 72 | "'sudo apt-get install -f' " | 73 | "'sudo apt-get install -f' " |
474 | 73 | "in a terminal window.") | 74 | "in a terminal window.") |
475 | 74 | return False | 75 | return False |
476 | 75 | return True | 76 | return True |
477 | 76 | 77 | ||
478 | 77 | def open(self, file, downloaded=False): | 78 | def open(self, file, downloaded=False): |
479 | 78 | 79 | ||
480 | === modified file 'data/gdebi.ui' | |||
481 | --- data/gdebi.ui 2012-09-13 21:32:07 +0000 | |||
482 | +++ data/gdebi.ui 2012-10-08 06:56:32 +0000 | |||
483 | @@ -1,6 +1,6 @@ | |||
484 | 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
485 | 2 | <interface> | 2 | <interface> |
487 | 3 | <requires lib="gtk+" version="2.16"/> | 3 | <!-- interface-requires gtk+ 3.0 --> |
488 | 4 | <object class="GtkAccelGroup" id="accelgroup1"/> | 4 | <object class="GtkAccelGroup" id="accelgroup1"/> |
489 | 5 | <object class="GtkAboutDialog" id="dialog_about"> | 5 | <object class="GtkAboutDialog" id="dialog_about"> |
490 | 6 | <property name="can_focus">False</property> | 6 | <property name="can_focus">False</property> |
491 | @@ -69,7 +69,6 @@ | |||
492 | 69 | <property name="can_focus">True</property> | 69 | <property name="can_focus">True</property> |
493 | 70 | <property name="can_default">True</property> | 70 | <property name="can_default">True</property> |
494 | 71 | <property name="receives_default">False</property> | 71 | <property name="receives_default">False</property> |
495 | 72 | <property name="use_action_appearance">False</property> | ||
496 | 73 | <property name="use_stock">True</property> | 72 | <property name="use_stock">True</property> |
497 | 74 | <signal name="clicked" handler="on_button_deb_install_close_clicked" swapped="no"/> | 73 | <signal name="clicked" handler="on_button_deb_install_close_clicked" swapped="no"/> |
498 | 75 | </object> | 74 | </object> |
499 | @@ -180,8 +179,8 @@ | |||
500 | 180 | <property name="visible">True</property> | 179 | <property name="visible">True</property> |
501 | 181 | <property name="can_focus">True</property> | 180 | <property name="can_focus">True</property> |
502 | 182 | <property name="receives_default">False</property> | 181 | <property name="receives_default">False</property> |
503 | 183 | <property name="use_action_appearance">False</property> | ||
504 | 184 | <property name="use_underline">True</property> | 182 | <property name="use_underline">True</property> |
505 | 183 | <property name="xalign">0.5</property> | ||
506 | 185 | <property name="draw_indicator">True</property> | 184 | <property name="draw_indicator">True</property> |
507 | 186 | <signal name="clicked" handler="on_checkbutton_autoclose_clicked" swapped="no"/> | 185 | <signal name="clicked" handler="on_checkbutton_autoclose_clicked" swapped="no"/> |
508 | 187 | </object> | 186 | </object> |
509 | @@ -230,7 +229,6 @@ | |||
510 | 230 | <property name="can_focus">True</property> | 229 | <property name="can_focus">True</property> |
511 | 231 | <property name="can_default">True</property> | 230 | <property name="can_default">True</property> |
512 | 232 | <property name="receives_default">False</property> | 231 | <property name="receives_default">False</property> |
513 | 233 | <property name="use_action_appearance">False</property> | ||
514 | 234 | <property name="use_stock">True</property> | 232 | <property name="use_stock">True</property> |
515 | 235 | </object> | 233 | </object> |
516 | 236 | <packing> | 234 | <packing> |
517 | @@ -328,7 +326,6 @@ | |||
518 | 328 | <property name="can_focus">True</property> | 326 | <property name="can_focus">True</property> |
519 | 329 | <property name="can_default">True</property> | 327 | <property name="can_default">True</property> |
520 | 330 | <property name="receives_default">True</property> | 328 | <property name="receives_default">True</property> |
521 | 331 | <property name="use_action_appearance">False</property> | ||
522 | 332 | <property name="use_stock">True</property> | 329 | <property name="use_stock">True</property> |
523 | 333 | </object> | 330 | </object> |
524 | 334 | <packing> | 331 | <packing> |
525 | @@ -439,7 +436,6 @@ | |||
526 | 439 | <property name="can_focus">True</property> | 436 | <property name="can_focus">True</property> |
527 | 440 | <property name="can_default">True</property> | 437 | <property name="can_default">True</property> |
528 | 441 | <property name="receives_default">False</property> | 438 | <property name="receives_default">False</property> |
529 | 442 | <property name="use_action_appearance">False</property> | ||
530 | 443 | <property name="use_stock">True</property> | 439 | <property name="use_stock">True</property> |
531 | 444 | </object> | 440 | </object> |
532 | 445 | <packing> | 441 | <packing> |
533 | @@ -589,7 +585,6 @@ | |||
534 | 589 | <object class="GtkMenuItem" id="menuitem1"> | 585 | <object class="GtkMenuItem" id="menuitem1"> |
535 | 590 | <property name="visible">True</property> | 586 | <property name="visible">True</property> |
536 | 591 | <property name="can_focus">False</property> | 587 | <property name="can_focus">False</property> |
537 | 592 | <property name="use_action_appearance">False</property> | ||
538 | 593 | <property name="label" translatable="yes">_File</property> | 588 | <property name="label" translatable="yes">_File</property> |
539 | 594 | <property name="use_underline">True</property> | 589 | <property name="use_underline">True</property> |
540 | 595 | <child type="submenu"> | 590 | <child type="submenu"> |
541 | @@ -600,7 +595,6 @@ | |||
542 | 600 | <property name="label" translatable="yes">_Open…</property> | 595 | <property name="label" translatable="yes">_Open…</property> |
543 | 601 | <property name="visible">True</property> | 596 | <property name="visible">True</property> |
544 | 602 | <property name="can_focus">False</property> | 597 | <property name="can_focus">False</property> |
545 | 603 | <property name="use_action_appearance">False</property> | ||
546 | 604 | <property name="use_underline">True</property> | 598 | <property name="use_underline">True</property> |
547 | 605 | <property name="image">image1</property> | 599 | <property name="image">image1</property> |
548 | 606 | <property name="use_stock">False</property> | 600 | <property name="use_stock">False</property> |
549 | @@ -614,7 +608,6 @@ | |||
550 | 614 | <property name="label" translatable="yes">_Refresh</property> | 608 | <property name="label" translatable="yes">_Refresh</property> |
551 | 615 | <property name="visible">True</property> | 609 | <property name="visible">True</property> |
552 | 616 | <property name="can_focus">False</property> | 610 | <property name="can_focus">False</property> |
553 | 617 | <property name="use_action_appearance">False</property> | ||
554 | 618 | <property name="use_underline">True</property> | 611 | <property name="use_underline">True</property> |
555 | 619 | <property name="image">image2</property> | 612 | <property name="image">image2</property> |
556 | 620 | <property name="use_stock">False</property> | 613 | <property name="use_stock">False</property> |
557 | @@ -634,7 +627,6 @@ | |||
558 | 634 | <property name="label">gtk-quit</property> | 627 | <property name="label">gtk-quit</property> |
559 | 635 | <property name="visible">True</property> | 628 | <property name="visible">True</property> |
560 | 636 | <property name="can_focus">False</property> | 629 | <property name="can_focus">False</property> |
561 | 637 | <property name="use_action_appearance">False</property> | ||
562 | 638 | <property name="use_underline">True</property> | 630 | <property name="use_underline">True</property> |
563 | 639 | <property name="use_stock">True</property> | 631 | <property name="use_stock">True</property> |
564 | 640 | <property name="accel_group">accelgroup1</property> | 632 | <property name="accel_group">accelgroup1</property> |
565 | @@ -649,7 +641,6 @@ | |||
566 | 649 | <object class="GtkMenuItem" id="menuitem3"> | 641 | <object class="GtkMenuItem" id="menuitem3"> |
567 | 650 | <property name="visible">True</property> | 642 | <property name="visible">True</property> |
568 | 651 | <property name="can_focus">False</property> | 643 | <property name="can_focus">False</property> |
569 | 652 | <property name="use_action_appearance">False</property> | ||
570 | 653 | <property name="label" translatable="yes">_Edit</property> | 644 | <property name="label" translatable="yes">_Edit</property> |
571 | 654 | <property name="use_underline">True</property> | 645 | <property name="use_underline">True</property> |
572 | 655 | <child type="submenu"> | 646 | <child type="submenu"> |
573 | @@ -660,7 +651,6 @@ | |||
574 | 660 | <property name="label">gtk-copy</property> | 651 | <property name="label">gtk-copy</property> |
575 | 661 | <property name="visible">True</property> | 652 | <property name="visible">True</property> |
576 | 662 | <property name="can_focus">False</property> | 653 | <property name="can_focus">False</property> |
577 | 663 | <property name="use_action_appearance">False</property> | ||
578 | 664 | <property name="use_underline">True</property> | 654 | <property name="use_underline">True</property> |
579 | 665 | <property name="use_stock">True</property> | 655 | <property name="use_stock">True</property> |
580 | 666 | <property name="accel_group">accelgroup1</property> | 656 | <property name="accel_group">accelgroup1</property> |
581 | @@ -675,7 +665,6 @@ | |||
582 | 675 | <object class="GtkMenuItem" id="menuitem4"> | 665 | <object class="GtkMenuItem" id="menuitem4"> |
583 | 676 | <property name="visible">True</property> | 666 | <property name="visible">True</property> |
584 | 677 | <property name="can_focus">False</property> | 667 | <property name="can_focus">False</property> |
585 | 678 | <property name="use_action_appearance">False</property> | ||
586 | 679 | <property name="label" translatable="yes">_Help</property> | 668 | <property name="label" translatable="yes">_Help</property> |
587 | 680 | <property name="use_underline">True</property> | 669 | <property name="use_underline">True</property> |
588 | 681 | <child type="submenu"> | 670 | <child type="submenu"> |
589 | @@ -686,7 +675,6 @@ | |||
590 | 686 | <property name="label">gtk-about</property> | 675 | <property name="label">gtk-about</property> |
591 | 687 | <property name="visible">True</property> | 676 | <property name="visible">True</property> |
592 | 688 | <property name="can_focus">False</property> | 677 | <property name="can_focus">False</property> |
593 | 689 | <property name="use_action_appearance">False</property> | ||
594 | 690 | <property name="use_underline">True</property> | 678 | <property name="use_underline">True</property> |
595 | 691 | <property name="use_stock">True</property> | 679 | <property name="use_stock">True</property> |
596 | 692 | <property name="accel_group">accelgroup1</property> | 680 | <property name="accel_group">accelgroup1</property> |
597 | @@ -727,7 +715,7 @@ | |||
598 | 727 | </object> | 715 | </object> |
599 | 728 | <packing> | 716 | <packing> |
600 | 729 | <property name="x_options">GTK_FILL</property> | 717 | <property name="x_options">GTK_FILL</property> |
602 | 730 | <property name="y_options"></property> | 718 | <property name="y_options"/> |
603 | 731 | </packing> | 719 | </packing> |
604 | 732 | </child> | 720 | </child> |
605 | 733 | <child> | 721 | <child> |
606 | @@ -737,14 +725,12 @@ | |||
607 | 737 | <property name="xalign">0</property> | 725 | <property name="xalign">0</property> |
608 | 738 | <property name="label" translatable="yes"><b><big> </big></b></property> | 726 | <property name="label" translatable="yes"><b><big> </big></b></property> |
609 | 739 | <property name="use_markup">True</property> | 727 | <property name="use_markup">True</property> |
610 | 740 | <property name="selectable">False</property> | ||
611 | 741 | <property name="sensitive">True</property> | ||
612 | 742 | </object> | 728 | </object> |
613 | 743 | <packing> | 729 | <packing> |
614 | 744 | <property name="left_attach">1</property> | 730 | <property name="left_attach">1</property> |
615 | 745 | <property name="right_attach">2</property> | 731 | <property name="right_attach">2</property> |
616 | 746 | <property name="x_options">GTK_FILL</property> | 732 | <property name="x_options">GTK_FILL</property> |
618 | 747 | <property name="y_options"></property> | 733 | <property name="y_options"/> |
619 | 748 | </packing> | 734 | </packing> |
620 | 749 | </child> | 735 | </child> |
621 | 750 | <child> | 736 | <child> |
622 | @@ -758,8 +744,6 @@ | |||
623 | 758 | <property name="xalign">0</property> | 744 | <property name="xalign">0</property> |
624 | 759 | <property name="yalign">0</property> | 745 | <property name="yalign">0</property> |
625 | 760 | <property name="wrap">True</property> | 746 | <property name="wrap">True</property> |
626 | 761 | <property name="selectable">False</property> | ||
627 | 762 | <property name="sensitive">True</property> | ||
628 | 763 | </object> | 747 | </object> |
629 | 764 | <packing> | 748 | <packing> |
630 | 765 | <property name="expand">True</property> | 749 | <property name="expand">True</property> |
631 | @@ -777,7 +761,6 @@ | |||
632 | 777 | <property name="label" translatable="yes">_Details</property> | 761 | <property name="label" translatable="yes">_Details</property> |
633 | 778 | <property name="can_focus">True</property> | 762 | <property name="can_focus">True</property> |
634 | 779 | <property name="receives_default">True</property> | 763 | <property name="receives_default">True</property> |
635 | 780 | <property name="use_action_appearance">False</property> | ||
636 | 781 | <property name="use_underline">True</property> | 764 | <property name="use_underline">True</property> |
637 | 782 | <signal name="clicked" handler="on_button_details_clicked" swapped="no"/> | 765 | <signal name="clicked" handler="on_button_details_clicked" swapped="no"/> |
638 | 783 | </object> | 766 | </object> |
639 | @@ -804,7 +787,7 @@ | |||
640 | 804 | <property name="top_attach">2</property> | 787 | <property name="top_attach">2</property> |
641 | 805 | <property name="bottom_attach">3</property> | 788 | <property name="bottom_attach">3</property> |
642 | 806 | <property name="x_options">GTK_FILL</property> | 789 | <property name="x_options">GTK_FILL</property> |
644 | 807 | <property name="y_options"></property> | 790 | <property name="y_options"/> |
645 | 808 | </packing> | 791 | </packing> |
646 | 809 | </child> | 792 | </child> |
647 | 810 | <child> | 793 | <child> |
648 | @@ -832,7 +815,7 @@ | |||
649 | 832 | <property name="top_attach">1</property> | 815 | <property name="top_attach">1</property> |
650 | 833 | <property name="bottom_attach">2</property> | 816 | <property name="bottom_attach">2</property> |
651 | 834 | <property name="x_options">GTK_FILL</property> | 817 | <property name="x_options">GTK_FILL</property> |
653 | 835 | <property name="y_options"></property> | 818 | <property name="y_options"/> |
654 | 836 | </packing> | 819 | </packing> |
655 | 837 | </child> | 820 | </child> |
656 | 838 | <child> | 821 | <child> |
657 | @@ -846,7 +829,7 @@ | |||
658 | 846 | <property name="right_attach">2</property> | 829 | <property name="right_attach">2</property> |
659 | 847 | <property name="top_attach">1</property> | 830 | <property name="top_attach">1</property> |
660 | 848 | <property name="bottom_attach">2</property> | 831 | <property name="bottom_attach">2</property> |
662 | 849 | <property name="y_options"></property> | 832 | <property name="y_options"/> |
663 | 850 | </packing> | 833 | </packing> |
664 | 851 | </child> | 834 | </child> |
665 | 852 | </object> | 835 | </object> |
666 | @@ -869,7 +852,6 @@ | |||
667 | 869 | <property name="can_focus">True</property> | 852 | <property name="can_focus">True</property> |
668 | 870 | <property name="can_default">True</property> | 853 | <property name="can_default">True</property> |
669 | 871 | <property name="receives_default">False</property> | 854 | <property name="receives_default">False</property> |
670 | 872 | <property name="use_action_appearance">False</property> | ||
671 | 873 | <property name="use_underline">True</property> | 855 | <property name="use_underline">True</property> |
672 | 874 | <signal name="clicked" handler="on_button_install_clicked" swapped="no"/> | 856 | <signal name="clicked" handler="on_button_install_clicked" swapped="no"/> |
673 | 875 | </object> | 857 | </object> |
674 | @@ -880,13 +862,28 @@ | |||
675 | 880 | </packing> | 862 | </packing> |
676 | 881 | </child> | 863 | </child> |
677 | 882 | <child> | 864 | <child> |
678 | 865 | <object class="GtkButton" id="button_remove"> | ||
679 | 866 | <property name="label" translatable="yes">_Remove Package</property> | ||
680 | 867 | <property name="sensitive">False</property> | ||
681 | 868 | <property name="can_focus">True</property> | ||
682 | 869 | <property name="can_default">True</property> | ||
683 | 870 | <property name="receives_default">False</property> | ||
684 | 871 | <property name="use_underline">True</property> | ||
685 | 872 | <signal name="clicked" handler="on_button_remove_clicked" swapped="no"/> | ||
686 | 873 | </object> | ||
687 | 874 | <packing> | ||
688 | 875 | <property name="expand">False</property> | ||
689 | 876 | <property name="fill">False</property> | ||
690 | 877 | <property name="position">1</property> | ||
691 | 878 | </packing> | ||
692 | 879 | </child> | ||
693 | 880 | <child> | ||
694 | 883 | <object class="GtkButton" id="button_download"> | 881 | <object class="GtkButton" id="button_download"> |
695 | 884 | <property name="label" translatable="yes">_Download Package</property> | 882 | <property name="label" translatable="yes">_Download Package</property> |
696 | 885 | <property name="sensitive">False</property> | 883 | <property name="sensitive">False</property> |
697 | 886 | <property name="can_focus">True</property> | 884 | <property name="can_focus">True</property> |
698 | 887 | <property name="can_default">True</property> | 885 | <property name="can_default">True</property> |
699 | 888 | <property name="receives_default">False</property> | 886 | <property name="receives_default">False</property> |
700 | 889 | <property name="use_action_appearance">False</property> | ||
701 | 890 | <property name="use_underline">True</property> | 887 | <property name="use_underline">True</property> |
702 | 891 | <signal name="clicked" handler="on_button_download_clicked" swapped="no"/> | 888 | <signal name="clicked" handler="on_button_download_clicked" swapped="no"/> |
703 | 892 | </object> | 889 | </object> |
704 | @@ -897,24 +894,6 @@ | |||
705 | 897 | </packing> | 894 | </packing> |
706 | 898 | </child> | 895 | </child> |
707 | 899 | <child> | 896 | <child> |
708 | 900 | <object class="GtkButton" id="button_remove"> | ||
709 | 901 | <property name="label" translatable="yes">_Remove Package</property> | ||
710 | 902 | <property name="visible">False</property> | ||
711 | 903 | <property name="sensitive">False</property> | ||
712 | 904 | <property name="can_focus">True</property> | ||
713 | 905 | <property name="can_default">True</property> | ||
714 | 906 | <property name="receives_default">False</property> | ||
715 | 907 | <property name="use_action_appearance">False</property> | ||
716 | 908 | <property name="use_underline">True</property> | ||
717 | 909 | <signal name="clicked" handler="on_button_remove_clicked" swapped="no"/> | ||
718 | 910 | </object> | ||
719 | 911 | <packing> | ||
720 | 912 | <property name="expand">False</property> | ||
721 | 913 | <property name="fill">False</property> | ||
722 | 914 | <property name="position">1</property> | ||
723 | 915 | </packing> | ||
724 | 916 | </child> | ||
725 | 917 | <child> | ||
726 | 918 | <placeholder/> | 897 | <placeholder/> |
727 | 919 | </child> | 898 | </child> |
728 | 920 | </object> | 899 | </object> |
729 | @@ -987,7 +966,7 @@ | |||
730 | 987 | </object> | 966 | </object> |
731 | 988 | <packing> | 967 | <packing> |
732 | 989 | <property name="x_options">GTK_FILL</property> | 968 | <property name="x_options">GTK_FILL</property> |
734 | 990 | <property name="y_options"></property> | 969 | <property name="y_options"/> |
735 | 991 | </packing> | 970 | </packing> |
736 | 992 | </child> | 971 | </child> |
737 | 993 | <child> | 972 | <child> |
738 | @@ -1002,7 +981,7 @@ | |||
739 | 1002 | <property name="top_attach">1</property> | 981 | <property name="top_attach">1</property> |
740 | 1003 | <property name="bottom_attach">2</property> | 982 | <property name="bottom_attach">2</property> |
741 | 1004 | <property name="x_options">GTK_FILL</property> | 983 | <property name="x_options">GTK_FILL</property> |
743 | 1005 | <property name="y_options"></property> | 984 | <property name="y_options"/> |
744 | 1006 | </packing> | 985 | </packing> |
745 | 1007 | </child> | 986 | </child> |
746 | 1008 | <child> | 987 | <child> |
747 | @@ -1017,7 +996,7 @@ | |||
748 | 1017 | <property name="top_attach">2</property> | 996 | <property name="top_attach">2</property> |
749 | 1018 | <property name="bottom_attach">3</property> | 997 | <property name="bottom_attach">3</property> |
750 | 1019 | <property name="x_options">GTK_FILL</property> | 998 | <property name="x_options">GTK_FILL</property> |
752 | 1020 | <property name="y_options"></property> | 999 | <property name="y_options"/> |
753 | 1021 | </packing> | 1000 | </packing> |
754 | 1022 | </child> | 1001 | </child> |
755 | 1023 | <child> | 1002 | <child> |
756 | @@ -1032,7 +1011,7 @@ | |||
757 | 1032 | <property name="top_attach">3</property> | 1011 | <property name="top_attach">3</property> |
758 | 1033 | <property name="bottom_attach">4</property> | 1012 | <property name="bottom_attach">4</property> |
759 | 1034 | <property name="x_options">GTK_FILL</property> | 1013 | <property name="x_options">GTK_FILL</property> |
761 | 1035 | <property name="y_options"></property> | 1014 | <property name="y_options"/> |
762 | 1036 | </packing> | 1015 | </packing> |
763 | 1037 | </child> | 1016 | </child> |
764 | 1038 | <child> | 1017 | <child> |
765 | @@ -1047,7 +1026,7 @@ | |||
766 | 1047 | <property name="top_attach">4</property> | 1026 | <property name="top_attach">4</property> |
767 | 1048 | <property name="bottom_attach">5</property> | 1027 | <property name="bottom_attach">5</property> |
768 | 1049 | <property name="x_options">GTK_FILL</property> | 1028 | <property name="x_options">GTK_FILL</property> |
770 | 1050 | <property name="y_options"></property> | 1029 | <property name="y_options"/> |
771 | 1051 | </packing> | 1030 | </packing> |
772 | 1052 | </child> | 1031 | </child> |
773 | 1053 | <child> | 1032 | <child> |
774 | @@ -1063,7 +1042,7 @@ | |||
775 | 1063 | <property name="top_attach">1</property> | 1042 | <property name="top_attach">1</property> |
776 | 1064 | <property name="bottom_attach">2</property> | 1043 | <property name="bottom_attach">2</property> |
777 | 1065 | <property name="x_options">GTK_FILL</property> | 1044 | <property name="x_options">GTK_FILL</property> |
779 | 1066 | <property name="y_options"></property> | 1045 | <property name="y_options"/> |
780 | 1067 | </packing> | 1046 | </packing> |
781 | 1068 | </child> | 1047 | </child> |
782 | 1069 | <child> | 1048 | <child> |
783 | @@ -1079,7 +1058,7 @@ | |||
784 | 1079 | <property name="top_attach">2</property> | 1058 | <property name="top_attach">2</property> |
785 | 1080 | <property name="bottom_attach">3</property> | 1059 | <property name="bottom_attach">3</property> |
786 | 1081 | <property name="x_options">GTK_FILL</property> | 1060 | <property name="x_options">GTK_FILL</property> |
788 | 1082 | <property name="y_options"></property> | 1061 | <property name="y_options"/> |
789 | 1083 | </packing> | 1062 | </packing> |
790 | 1084 | </child> | 1063 | </child> |
791 | 1085 | <child> | 1064 | <child> |
792 | @@ -1095,7 +1074,7 @@ | |||
793 | 1095 | <property name="top_attach">3</property> | 1074 | <property name="top_attach">3</property> |
794 | 1096 | <property name="bottom_attach">4</property> | 1075 | <property name="bottom_attach">4</property> |
795 | 1097 | <property name="x_options">GTK_FILL</property> | 1076 | <property name="x_options">GTK_FILL</property> |
797 | 1098 | <property name="y_options"></property> | 1077 | <property name="y_options"/> |
798 | 1099 | </packing> | 1078 | </packing> |
799 | 1100 | </child> | 1079 | </child> |
800 | 1101 | <child> | 1080 | <child> |
801 | @@ -1109,7 +1088,7 @@ | |||
802 | 1109 | <property name="left_attach">1</property> | 1088 | <property name="left_attach">1</property> |
803 | 1110 | <property name="right_attach">2</property> | 1089 | <property name="right_attach">2</property> |
804 | 1111 | <property name="x_options">GTK_FILL</property> | 1090 | <property name="x_options">GTK_FILL</property> |
806 | 1112 | <property name="y_options"></property> | 1091 | <property name="y_options"/> |
807 | 1113 | </packing> | 1092 | </packing> |
808 | 1114 | </child> | 1093 | </child> |
809 | 1115 | <child> | 1094 | <child> |
810 | @@ -1124,7 +1103,7 @@ | |||
811 | 1124 | <property name="right_attach">2</property> | 1103 | <property name="right_attach">2</property> |
812 | 1125 | <property name="top_attach">4</property> | 1104 | <property name="top_attach">4</property> |
813 | 1126 | <property name="bottom_attach">5</property> | 1105 | <property name="bottom_attach">5</property> |
815 | 1127 | <property name="y_options"></property> | 1106 | <property name="y_options"/> |
816 | 1128 | </packing> | 1107 | </packing> |
817 | 1129 | </child> | 1108 | </child> |
818 | 1130 | </object> | 1109 | </object> |
819 | @@ -1216,6 +1195,34 @@ | |||
820 | 1216 | <property name="tab_fill">False</property> | 1195 | <property name="tab_fill">False</property> |
821 | 1217 | </packing> | 1196 | </packing> |
822 | 1218 | </child> | 1197 | </child> |
823 | 1198 | <child> | ||
824 | 1199 | <object class="GtkScrolledWindow" id="scrolledwindow3"> | ||
825 | 1200 | <property name="visible">True</property> | ||
826 | 1201 | <property name="can_focus">True</property> | ||
827 | 1202 | <property name="shadow_type">in</property> | ||
828 | 1203 | <child> | ||
829 | 1204 | <object class="GtkTextView" id="textview_lintian_output"> | ||
830 | 1205 | <property name="visible">True</property> | ||
831 | 1206 | <property name="can_focus">True</property> | ||
832 | 1207 | <property name="editable">False</property> | ||
833 | 1208 | </object> | ||
834 | 1209 | </child> | ||
835 | 1210 | </object> | ||
836 | 1211 | <packing> | ||
837 | 1212 | <property name="position">3</property> | ||
838 | 1213 | </packing> | ||
839 | 1214 | </child> | ||
840 | 1215 | <child type="tab"> | ||
841 | 1216 | <object class="GtkLabel" id="label_lintian"> | ||
842 | 1217 | <property name="visible">True</property> | ||
843 | 1218 | <property name="can_focus">False</property> | ||
844 | 1219 | <property name="label" translatable="yes">Lintian output</property> | ||
845 | 1220 | </object> | ||
846 | 1221 | <packing> | ||
847 | 1222 | <property name="position">3</property> | ||
848 | 1223 | <property name="tab_fill">False</property> | ||
849 | 1224 | </packing> | ||
850 | 1225 | </child> | ||
851 | 1219 | </object> | 1226 | </object> |
852 | 1220 | <packing> | 1227 | <packing> |
853 | 1221 | <property name="expand">True</property> | 1228 | <property name="expand">True</property> |
854 | 1222 | 1229 | ||
855 | === added file 'tests/test_gdebi_gtk_lintian.py' | |||
856 | --- tests/test_gdebi_gtk_lintian.py 1970-01-01 00:00:00 +0000 | |||
857 | +++ tests/test_gdebi_gtk_lintian.py 2012-10-08 06:56:32 +0000 | |||
858 | @@ -0,0 +1,63 @@ | |||
859 | 1 | #!/usr/bin/python | ||
860 | 2 | |||
861 | 3 | import os | ||
862 | 4 | import time | ||
863 | 5 | import unittest | ||
864 | 6 | |||
865 | 7 | from gi.repository import GObject | ||
866 | 8 | from mock import patch | ||
867 | 9 | |||
868 | 10 | from GDebi.GDebi import GDebi | ||
869 | 11 | from GDebi.GDebiCommon import GDebiCommon | ||
870 | 12 | |||
871 | 13 | EXPECTED_LINTIAN_OUTPUT = """E: error-package: file-in-etc-not-marked-as-conffile etc/foo | ||
872 | 14 | E: error-package: control-file-has-bad-owner postinst egon/egon != root/root | ||
873 | 15 | E: error-package: no-copyright-file | ||
874 | 16 | E: error-package: package-has-no-description | ||
875 | 17 | E: error-package: no-maintainer-field | ||
876 | 18 | W: error-package: no-section-field | ||
877 | 19 | W: error-package: no-priority-field | ||
878 | 20 | E: error-package: wrong-file-owner-uid-or-gid etc/ 1000/1000 | ||
879 | 21 | E: error-package: wrong-file-owner-uid-or-gid etc/foo 1000/1000 | ||
880 | 22 | W: error-package: maintainer-script-ignores-errors postinst | ||
881 | 23 | |||
882 | 24 | Lintian finished with exit status 1""" | ||
883 | 25 | |||
884 | 26 | |||
885 | 27 | def do_events(): | ||
886 | 28 | context = GObject.main_context_default() | ||
887 | 29 | while context.pending(): | ||
888 | 30 | context.iteration() | ||
889 | 31 | |||
890 | 32 | |||
891 | 33 | class GDebiGtkTestCase(unittest.TestCase): | ||
892 | 34 | |||
893 | 35 | def setUp(self): | ||
894 | 36 | self.testsdir = os.path.dirname(__file__) | ||
895 | 37 | self.datadir = os.path.join(self.testsdir, "..", "data") | ||
896 | 38 | self.options = None | ||
897 | 39 | |||
898 | 40 | # we don't need a cache for this test so patch it out | ||
899 | 41 | @patch.object(GDebiCommon, "openCache") | ||
900 | 42 | def test_lintian(self, mock_open_cache): | ||
901 | 43 | gdebi = GDebi(self.datadir, self.options) | ||
902 | 44 | gdebi._run_lintian( | ||
903 | 45 | os.path.join(self.testsdir, "error-package_1.0_all.deb")) | ||
904 | 46 | # wait for lintian to finish | ||
905 | 47 | for i in range(25): | ||
906 | 48 | time.sleep(0.2) | ||
907 | 49 | do_events() | ||
908 | 50 | if gdebi._lintian_exit_status is not None: | ||
909 | 51 | break | ||
910 | 52 | else: | ||
911 | 53 | self.fail("lintian did not finish") | ||
912 | 54 | # compare the results | ||
913 | 55 | buf = gdebi.textview_lintian_output.get_buffer() | ||
914 | 56 | start = buf.get_start_iter() | ||
915 | 57 | end = buf.get_end_iter() | ||
916 | 58 | lintian_output = buf.get_text(start, end, False) | ||
917 | 59 | self.assertEqual(lintian_output.strip(), EXPECTED_LINTIAN_OUTPUT) | ||
918 | 60 | |||
919 | 61 | |||
920 | 62 | if __name__ == "__main__": | ||
921 | 63 | unittest.main() |