def search_button_clicked(self, widget=None): """ Reload the subscriptions from the server when the Search button is clicked. """ if not self.date_picker.date_entry_validate(): return try: pb_title = _("Searching") pb_label = _("Searching for subscriptions. Please wait.") if self.pb: self.pb.set_title(pb_title) self.pb.set_label(pb_label) else: # show pulsating progress bar while we wait for results self.pb = progress.Progress(pb_title, pb_label) self.timer = ga_GObject.timeout_add(100, self.pb.pulse) self.pb.set_transient_for(self.parent_win) # fire off async refresh async_stash = async .AsyncPool(self.pool_stash) async_stash.refresh(self.date_picker.date, self._update_display) except Exception as e: handle_gui_exception( e, _("Error fetching subscriptions from server: %s"), self.parent_win)
def search_button_clicked(self, widget=None): """ Reload the subscriptions from the server when the Search button is clicked. """ if not self.date_picker.date_entry_validate(): return try: pb_title = _("Searching") pb_label = _("Searching for subscriptions. Please wait.") if self.pb: self.pb.set_title(pb_title) self.pb.set_label(pb_label) else: # show pulsating progress bar while we wait for results self.pb = progress.Progress(pb_title, pb_label) self.timer = ga_GObject.timeout_add(100, self.pb.pulse) self.pb.set_transient_for(self.parent_win) # fire off async refresh async_stash = async_utils.AsyncPool(self.pool_stash) async_stash.refresh(self.date_picker.date, self._update_display) except Exception as e: handle_gui_exception(e, _("Error fetching subscriptions from server: %s"), self.parent_win)
def _display_progress_bar(self): if self.progress_bar: self.progress_bar.set_title(_("Testing Connection")) self.progress_bar.set_label(_("Please wait")) else: self.progress_bar = progress.Progress(_("Testing Connection"), _("Please wait")) self.timer = ga_GObject.timeout_add(100, self.progress_bar.pulse) self.progress_bar.set_parent_window(self.networkConfigDialog)
def _display_progress_bar(self): if self.progress_bar: self.progress_bar.set_title(_("Testing Connection")) self.progress_bar.set_label(_("Please wait")) else: self.progress_bar = progress.Progress(_("Testing Connection"), _("Please wait")) self.timer = ga_GObject.timeout_add(100, self.progress_bar.pulse) self.progress_bar.set_transient_for(self.networkConfigDialog)
def test_registration_error_returns_to_page(self): self.rs.initialize() self.correct_page = None self.rs.register_notebook.connect('notify::page', self.page_notify_handler) self.rs.connect('register-error', self.error_handler) ga_GObject.timeout_add(3000, self.gtk_quit_on_fail) ga_GObject.idle_add(self.emit_proceed) ga_GObject.idle_add(self.emit_error) # run till quit or timeout # if we get to the state we want we can call quit ga_Gtk.main() # If we saw any exceptions, raise them now so we fail nosetests for exc_info in self.exc_infos: raise exc_info[1], None, exc_info[2] self.assertTrue(self.correct_page)
def test_registration_error_returns_to_page(self): self.rs.initialize() self.correct_page = None self.rs.register_notebook.connect('notify::page', self.page_notify_handler) self.rs.connect('register-error', self.error_handler) ga_GObject.timeout_add(3000, self.gtk_quit_on_fail) ga_GObject.idle_add(self.emit_proceed) ga_GObject.idle_add(self.emit_error) # run till quit or timeout # if we get to the state we want we can call quit ga_Gtk.main() # If we saw any exceptions, raise them now so we fail nosetests for exc_info in self.exc_infos: six.reraise(*exc_info) self.assertTrue(self.correct_page)
def _create_async_pool(self): provide(inj.CP_PROVIDER, stubs.StubCPProvider()) inj.provide(inj.PROD_DIR, stubs.StubProductDirectory()) inj.provide(inj.ENT_DIR, stubs.StubEntitlementDirectory()) inj.provide(inj.CERT_SORTER, stubs.StubCertSorter()) self.pool_stash = \ managerlib.PoolStash() self.ap = async_utils.AsyncPool(self.pool_stash) # add a timeout and a idle handler self.idle = ga_GObject.idle_add(self.ap.refresh, datetime.date.today(), self.idle_callback) self.timer = ga_GObject.timeout_add(50, self.idle_callback) self.mainloop = ga_GObject.MainLoop()
def _create_async_pool(self): provide(inj.CP_PROVIDER, stubs.StubCPProvider()) inj.provide(inj.PROD_DIR, stubs.StubProductDirectory()) inj.provide(inj.ENT_DIR, stubs.StubEntitlementDirectory()) inj.provide(inj.CERT_SORTER, stubs.StubCertSorter()) self.pool_stash = \ managerlib.PoolStash(facts=self.stub_facts) self.ap = async.AsyncPool(self.pool_stash) # add a timeout and a idle handler self.idle = ga_GObject.idle_add(self.ap.refresh, datetime.date.today(), self.idle_callback) self.timer = ga_GObject.timeout_add(50, self.idle_callback) self.mainloop = ga_GObject.MainLoop()
def _on_unsubscribe_prompt_response(self, dialog, response, selection): if not response: return serial = long(selection["serial"]) if self.identity.is_valid(): self.pb = progress.Progress(_("Removing"), _("Removing subscription. Please wait.")) self.timer = ga_GObject.timeout_add(100, self.pb.pulse) self.pb.set_transient_for(self.parent_win) self.async_bind.unbind(serial, selection, self._unsubscribe_callback, self._handle_unbind_exception) else: # unregistered, just delete the certs directly action = EntCertDeleteAction(self.entitlement_dir) action.perform([serial]) self.update_subscriptions()
def _on_unsubscribe_prompt_response(self, dialog, response, selection): if not response: return serial = int(selection['serial']) if self.identity.is_valid(): self.pb = progress.Progress(_("Removing"), _("Removing subscription. Please wait.")) self.timer = ga_GObject.timeout_add(100, self.pb.pulse) self.pb.set_transient_for(self.parent_win) self.async_bind.unbind(serial, selection, self._unsubscribe_callback, self._handle_unbind_exception) else: # unregistered, just delete the certs directly action = EntCertDeleteAction(self.entitlement_dir) action.perform([serial]) self.update_subscriptions()
def _on_unsubscribe_prompt_response(self, dialog, response, selection): if not response: return serial = long(selection['serial']) if self.identity.is_valid(): self.pb = progress.Progress(_("Removing"), _("Removing subscription. Please wait.")) self.timer = ga_GObject.timeout_add(100, self.pb.pulse) content_toplevel = self.content.get_toplevel() if content_toplevel.is_toplevel(): self.pb.set_parent_window(content_toplevel) self.async_bind.unbind(serial, selection, self._unsubscribe_callback, self._handle_unbind_exception) else: # unregistered, just delete the certs directly self.backend.entcertlib.delete([serial]) self.backend.cs.force_cert_check()
def _contract_selected(self, pool, quantity=1): if not valid_quantity(quantity): show_error_window(_("Quantity must be a positive number."), parent=self.parent_win) return self._contract_selection_cancelled() # Start the progress bar self.pb = progress.Progress(_("Attaching"), _("Attaching subscription. Please wait.")) self.timer = ga_GObject.timeout_add(100, self.pb.pulse) self.pb.set_transient_for(self.parent_win) # Spin off a thread to handle binding the selected pool. # After it has completed the actual bind call, available # subs will be refreshed, but we won't re-run compliance # until we have serialized the certificates self.async_bind.bind(pool, quantity, bind_callback=self._async_bind_callback, cert_callback=self.backend.cs.force_cert_check, except_callback=self._async_bind_exception_callback)
def _contract_selected(self, pool, quantity=1): if not valid_quantity(quantity): show_error_window(_("Quantity must be a positive number."), parent=self.parent_win) return self._contract_selection_cancelled() # Start the progress bar self.pb = progress.Progress(_("Attaching"), _("Attaching subscription. Please wait.")) self.timer = ga_GObject.timeout_add(100, self.pb.pulse) self.pb.set_transient_for(self.parent_win) # Spin off a thread to handle binding the selected pool. # After it has completed the actual bind call, available # subs will be refreshed, but we won't re-run compliance # until we have serialized the certificates self.async_bind.bind( pool, quantity, bind_callback=self._async_bind_callback, cert_callback=self.backend.cs.force_cert_check, except_callback=self._async_bind_exception_callback)
def _show_progress_bar(self, title, label, progress_parent=None): self.pb = progress.Progress(title, label, True) self.timer = ga_GObject.timeout_add(100, self.pb.pulse) self.pb.set_transient_for(progress_parent or self._get_dialog_widget())
def _show_progress_bar(self, title, label, progress_parent=None): self.pb = progress.Progress(title, label, True) self.timer = ga_GObject.timeout_add(100, self.pb.pulse) self.pb.set_transient_for(progress_parent or self._get_dialog_widget())