179
179
self._selected_pkgname_for_page[page] = pkgname
180
180
self.menuitem_copy.set_sensitive(True)
181
181
self.menuitem_copy_web_link.set_sensitive(True)
183
def on_menuitem_help_activate(self, menuitem):
185
p = subprocess.Popen(["yelp","ghelp:software-store"])
186
# collect the exit status (otherwise we leave zombies)
187
glib.timeout_add(1000, lambda p: p.poll() == None, p)
189
def on_menuitem_close_activate(self, widget):
192
def on_menuitem_about_activate(self, widget):
194
self.aboutdialog.run()
195
self.aboutdialog.hide()
197
183
def on_window_main_delete_event(self, widget, event):
200
186
def on_view_switcher_changed(self, view_switcher, action):
201
187
logging.debug("view_switcher_activated: %s %s" % (view_switcher,action))
202
188
if action == self.NOTEBOOK_PAGE_AVAILABLE:
223
209
self.update_status_bar()
224
210
self.update_app_status_menu()
226
def on_menuitem_view_all_activate(self, widget):
227
if self._block_menuitem_view:
229
self.active_pane.apps_filter.set_supported_only(False)
230
self.active_pane.refresh_apps()
232
def on_menuitem_view_supported_only_activate(self, widget):
233
if self._block_menuitem_view:
235
self.active_pane.apps_filter.set_supported_only(True)
236
self.active_pane.refresh_apps()
214
def on_menuitem_install_activate(self, menuitem):
215
self.active_pane.app_details.install()
217
def on_menuitem_remove_activate(self, menuitem):
218
self.active_pane.app_details.remove()
220
def on_menuitem_close_activate(self, widget):
223
def on_menu_edit_activate(self, menuitem):
225
Check whether the search field is focused and if so, focus some items
227
state = self.active_pane.searchentry.is_focus()
228
edit_menu_items = [self.menuitem_undo,
233
self.menuitem_delete,
234
self.menuitem_select_all]
235
for item in edit_menu_items:
236
item.set_sensitive(state)
238
def on_menuitem_undo_activate(self, menuitem):
239
self.active_pane.searchentry.undo()
241
def on_menuitem_redo_activate(self, menuitem):
242
self.active_pane.searchentry.redo()
244
def on_menuitem_cut_activate(self, menuitem):
245
self.active_pane.searchentry.cut_clipboard()
247
def on_menuitem_copy_activate(self, menuitem):
248
self.active_pane.searchentry.copy_clipboard()
250
def on_menuitem_paste_activate(self, menuitem):
251
self.active_pane.searchentry.paste_clipboard()
253
def on_menuitem_delete_activate(self, menuitem):
254
self.active_pane.searchentry.set_text("")
256
def on_menuitem_select_all_activate(self, menuitem):
257
self.active_pane.searchentry.select_region(0, -1)
259
def on_menuitem_copy_web_link_activate(self, menuitem):
260
page = self.notebook_view.get_current_page()
262
pkg = self._selected_pkgname_for_page[page]
265
clipboard = gtk.Clipboard()
266
clipboard.set_text(self.WEBLINK_URL % pkg)
238
268
def on_menuitem_search_activate(self, widget):
239
#print "on_menuitem_search_activate"
240
269
if self.active_pane:
241
270
self.active_pane.searchentry.grab_focus()
242
271
self.active_pane.searchentry.select_region(0, -1)
263
292
self.run_update_cache()
264
293
self.window_main.set_sensitive(True)
266
def on_menuitem_install_activate(self, menuitem):
267
self.active_pane.app_details.install()
269
def on_menuitem_remove_activate(self, menuitem):
270
self.active_pane.app_details.remove()
272
def on_menuitem_copy_activate(self, menuitem):
273
page = self.notebook_view.get_current_page()
275
app = self._selected_appname_for_page[page]
278
clipboard = gtk.Clipboard()
279
clipboard.set_text(app)
281
def on_menuitem_copy_web_link_activate(self, menuitem):
282
page = self.notebook_view.get_current_page()
284
pkg = self._selected_pkgname_for_page[page]
287
clipboard = gtk.Clipboard()
288
clipboard.set_text(self.WEBLINK_URL % pkg)
295
def on_menuitem_about_activate(self, widget):
296
self.aboutdialog.run()
297
self.aboutdialog.hide()
299
def on_menuitem_help_activate(self, menuitem):
301
p = subprocess.Popen(["yelp","ghelp:software-store"])
302
# collect the exit status (otherwise we leave zombies)
303
glib.timeout_add(1000, lambda p: p.poll() == None, p)
305
def on_menuitem_view_all_activate(self, widget):
306
if self._block_menuitem_view:
308
self.active_pane.apps_filter.set_supported_only(False)
309
self.active_pane.refresh_apps()
311
def on_menuitem_view_supported_only_activate(self, widget):
312
if self._block_menuitem_view:
314
self.active_pane.apps_filter.set_supported_only(True)
315
self.active_pane.refresh_apps()
340
366
self.menuitem_remove.set_sensitive(False)
341
367
self.menuitem_copy_web_link.set_sensitive(False)
342
368
# update File menu status
343
pkg = self.cache[pkgname]
344
installed = bool(pkg.installed)
345
self.menuitem_install.set_sensitive(not installed)
346
self.menuitem_remove.set_sensitive(installed)
369
if self.cache.has_key(pkgname):
370
pkg = self.cache[pkgname]
371
installed = bool(pkg.installed)
372
self.menuitem_install.set_sensitive(not installed)
373
self.menuitem_remove.set_sensitive(installed)
375
self.menuitem_install.set_sensitive(False)
376
self.menuitem_remove.set_sensitive(False)
347
377
# return False to ensure that a possible glib.timeout_add ends
384
414
self.window_main.show_all()
385
415
SimpleGtkbuilderApp.run(self)
387
#FIXME: dead-code in multi-view
388
def on_button_home_clicked(self, widget):
389
logging.debug("on_button_home_clicked")
390
# we get the clicked signal when the radio-group toggles
391
# so we do not react unless we were not already pressed in
392
if not widget.get_active():
394
self.apps_category_query = None
395
# HACK: ensure that no signal term-changed is send, otherwise
396
# self.on_search_entry_changed() is called and that
397
# moves to a new notebook page
398
# FIXME: deal with it in a cleaner way
399
self.entry_search.clear_with_no_signal()
400
self.change_notebook_view(self.NOTEBOOK_PAGE_CATEGORIES)