예제 #1
0
 def transact_cb(worker, dep_comp):
     try:
         download_id, transact_id, step_id = worker.get_result()
     except ximian_xmlrpclib.Fault, f:
         self.busy(0)
         rcd_util.dialog_from_fault(f)
         return
예제 #2
0
        def query_finished_cb(worker, array):
            if not worker.is_cancelled():
                packages = []
                try:
                    updates = worker.get_result()
                except ximian_xmlrpclib.Fault, f:
                    rcd_util.dialog_from_fault(f)
                else:
                    def pkg_to_key(p):
                        return "%s:%d:%s:%s" % \
                               (p["name"], p["epoch"],
                                p["version"], p["release"])
                    
                    dup_dict = {}
                    
                    for old_pkg, pkg, history in updates:
                        pkg["__old_package"] = old_pkg
                        pkg["__history"] = history

                        key = pkg_to_key(pkg)
                        if not dup_dict.has_key(key):
                            dup_dict[key] = pkg

                    packages = dup_dict.values()

                    del dup_dict
                    
                array.set_packages(packages)
예제 #3
0
 def dump_finished_cb(worker, f):
     if not worker.is_cancelled():
         try:
             dump = worker.get_result()
         except ximian_xmlrpclib.Fault, f:
             rcd_util.dialog_from_fault(f)
         else:
             f.write(zlib.decompress(dump.data))
예제 #4
0
        def service_added_cb (th, parent):
            if th.is_cancelled():
                return

            try:
                th.get_result()
            except ximian_xmlrpclib.Fault, f:
                rcd_util.dialog_from_fault(f)
                return
예제 #5
0
 def get_history_cb(worker, this):
     this.busy(0)
     this.message_pop()
     if not worker.is_cancelled():
         try:
             history = worker.get_result()
         except ximian_xmlrpclib.Fault, f:
             rcd_util.dialog_from_fault(f)
             return
         this.set_history(history)
예제 #6
0
        def got_cb(worker, this):
            if not worker.is_cancelled():
                try:
                    users = worker.get_result()
                except ximian_xmlrpclib.Fault, f:
                    rcd_util.dialog_from_fault(f)
                    return

                this.set_users(users)
                self.emit("updated")
예제 #7
0
        def got_cb(worker, this):
            if not worker.is_cancelled():
                try:
                    users = worker.get_result()
                except ximian_xmlrpclib.Fault, f:
                    rcd_util.dialog_from_fault(f)
                    return

                this.set_users(users)
                self.emit("updated")
예제 #8
0
 def get_history_cb(worker, this):
     this.busy(0)
     this.message_pop()
     if not worker.is_cancelled():
         try:
             history = worker.get_result()
         except ximian_xmlrpclib.Fault, f:
             rcd_util.dialog_from_fault(f)
             return
         this.set_history(history)
예제 #9
0
        def get_news_cb(worker, this):
            if not worker.is_cancelled():
                try:
                    news = worker.get_result()
                except ximian_xmlrpclib.Fault, f:
                    rcd_util.dialog_from_fault(f)
                    return
                if news:
                    for item in news:
                        item["icon"] = this.get_icon(item["channel_name"])

                    this.set_news(news)
예제 #10
0
        def get_news_cb(worker, this):
            if not worker.is_cancelled():
                try:
                    news = worker.get_result()
                except ximian_xmlrpclib.Fault, f:
                    rcd_util.dialog_from_fault(f)
                    return
                if news:
                    for item in news:
                        item["icon"] = this.get_icon(item["channel_name"])

                    this.set_news(news)
예제 #11
0
        def got_cb(worker, this):
            if not worker.is_cancelled():
                try:
                    privs = worker.get_result()
                except ximian_xmlrpclib.Fault, f:
                    rcd_util.dialog_from_fault(f)
                    return
                if privs:
                    privs = map(string.lower, privs)
                    privs.sort()
                    privs.append("superuser")

                    this.set_privileges(privs)
예제 #12
0
        def got_cb(worker, this):
            if not worker.is_cancelled():
                try:
                    privs = worker.get_result()
                except ximian_xmlrpclib.Fault, f:
                    rcd_util.dialog_from_fault(f)
                    return
                if privs:
                    privs = map(string.lower, privs)
                    privs.sort()
                    privs.append("superuser")

                    this.set_privileges(privs)
예제 #13
0
        def activate_finished_cb(worker, this):
            if worker.is_cancelled():
                return

            try:
                worker.get_result()
            except ximian_xmlrpclib.Fault, f:
                rcd_util.dialog_from_fault(f,
                                           error_text=_("Unable to activate"),
                                           additional_text=_("Please ensure "
                                           "you typed the email address "
                                           "and registration code correctly"),
                                           parent=self)
                return
예제 #14
0
        def activate_finished_cb(worker, this):
            if worker.is_cancelled():
                return

            try:
                worker.get_result()
            except ximian_xmlrpclib.Fault, f:
                rcd_util.dialog_from_fault(
                    f,
                    error_text=_("Unable to activate"),
                    additional_text=_("Please ensure "
                                      "you typed the email address "
                                      "and registration code correctly"),
                    parent=self)
                return
예제 #15
0
    def cancelled(self):
        PendingView.cancelled(self)

        if self.download_id == -1 or self.download_complete:
            print "Can't abort transaction"
            return

        serv = rcd_util.get_server()

        try:
            ret = serv.rcd.packsys.abort_download(self.download_id)
        except ximian_xmlrpclib.Fault, f:
            ## FIXME: This is really ugly hack, but otherwise ui will be
            ## unresponsive if connection with rcd is lost (even if rcd
            ## comes back).
            rcd_util.dialog_from_fault(f)
            ret = 1
예제 #16
0
    def cancelled(self):
        PendingView.cancelled(self)
        
        if self.download_id == -1 or self.download_complete:
            print "Can't abort transaction"
            return

        serv = rcd_util.get_server()

        try:
            ret = serv.rcd.packsys.abort_download(self.download_id)
        except ximian_xmlrpclib.Fault, f:
            ## FIXME: This is really ugly hack, but otherwise ui will be
            ## unresponsive if connection with rcd is lost (even if rcd
            ## comes back).
            rcd_util.dialog_from_fault(f)
            ret = 1
예제 #17
0
        def query_finished_cb(worker, array):
            array.message_pop()

            if not worker.is_cancelled():
                try:
                    packages = worker.get_result()
                except ximian_xmlrpclib.Fault, f:
                    rcd_util.dialog_from_fault(f)
                    packages = []
                else:
                    elapsed = time.time() - worker.t1

                    packages = self.filter_duplicates(packages)
                    _cache_query_results(self.query, packages)

                    if self.__query_filter:
                        filter_fn = self.__query_filter()
                        packages = filter(filter_fn, packages)

                array.set_packages(packages or [])
예제 #18
0
        def query_finished_cb(worker, array):
            array.message_pop()

            if not worker.is_cancelled():
                try:
                    bundles = worker.get_result()
                    bundles = fix_bundles(map(lambda x:x["bundle"], bundles))
                except ximian_xmlrpclib.Fault, f:
                    rcd_util.dialog_from_fault(f)
                    bundles = []
                else:
                    elapsed = time.time() - worker.t1

##                     bundles = self.filter_duplicates(packages)
##                     _cache_query_results(self.query, packages)

##                     if self.__query_filter:
##                         filter_fn = self.__query_filter()
##                         packages = filter(filter_fn, packages)

                array.set_bundles(bundles or [])
예제 #19
0
        def query_finished_cb(worker, array):
            array.message_pop()

            if not worker.is_cancelled():
                try:
                    bundles = worker.get_result()
                    bundles = fix_bundles(map(lambda x: x["bundle"], bundles))
                except ximian_xmlrpclib.Fault, f:
                    rcd_util.dialog_from_fault(f)
                    bundles = []
                else:
                    elapsed = time.time() - worker.t1


##                     bundles = self.filter_duplicates(packages)
##                     _cache_query_results(self.query, packages)

##                     if self.__query_filter:
##                         filter_fn = self.__query_filter()
##                         packages = filter(filter_fn, packages)

                array.set_bundles(bundles or [])
예제 #20
0
        def get_deps_cb(worker, this):
            this.busy(0)

            # Clean up
            if this.__worker_handler_id:
                this.__worker.disconnect(this.__worker_handler_id)
                this.__worker_handler_is = 0
            this.__worker = None


            if worker.is_cancelled():
                this.pop()
                return
            else:
                try:
                    F = worker.get_result()
                except ximian_xmlrpclib.Fault, f:
                    if f.faultCode == rcd_util.fault.failed_dependencies:
                        this.dep_error = f.faultString
                    else:
                        rcd_util.dialog_from_fault(f,
                                                   post_dialog_thunk=lambda:self.pop())
                else:
예제 #21
0
 def unmount_cb(th, name):
     try:
         success = th.get_result()
     except ximian_xmlrpclib.Fault, f:
         rcd_util.dialog_from_fault(f)
         return
예제 #22
0
 def rpc_call_ready_cb(self, th, reset_polling=1):
     try:
         success = th.get_result()
     except ximian_xmlrpclib.Fault, f:
         rcd_util.dialog_from_fault(f)
         return
예제 #23
0
 def rpc_call_ready_cb(self, th, reset_polling=1):
     try:
         success = th.get_result()
     except ximian_xmlrpclib.Fault, f:
         rcd_util.dialog_from_fault(f)
         return
예제 #24
0
                rcd_util.dialog_from_fault(f)
                return
            else:
                rcd_util.reset_services()
                parent.view.get_model().refresh()

        win = ServiceAddWindow()
        response = win.run()
        if response == gtk.RESPONSE_OK:
            server = rcd_util.get_server_proxy()
            try:
                th = server.rcd.service.add(win.service_type.get_service_id(),
                                            win.url.get_text(),
                                            win.key.get_text())
            except ximian_xmlrpclib.Fault, f:
                rcd_util.dialog_from_fault(f)
                return

            rcd_util.server_proxy_dialog(th, callback=service_added_cb,
                                         user_data=self, parent=self)
        win.destroy()

    def busy_start(self):
        self.__busy = 1
        if self.window:
            self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))

    def busy_stop(self):
        self.__busy = 0
        if self.window:
            self.window.set_cursor(None)
예제 #25
0
 def unmount_cb(th, name):
     try:
         success = th.get_result()
     except ximian_xmlrpclib.Fault, f:
         rcd_util.dialog_from_fault(f)
         return
예제 #26
0
 def get_prefs_cb(worker, this):
     try:
         prefs = worker.get_result()
     except ximian_xmlrpclib.Fault, f:
         prefs = []
         rcd_util.dialog_from_fault(f)
예제 #27
0
 def remove_service_cb(th, win):
     try:
         th.get_result()
     except ximian_xmlrpclib.Fault, f:
         rcd_util.dialog_from_fault(f)
         return
예제 #28
0
 def ready_cb(th):
     try:
         success = th.get_result()
     except ximian_xmlrpclib.Fault, f:
         rcd_util.dialog_from_fault(f)
         return
예제 #29
0
 def ready_cb(th):
     try:
         success = th.get_result()
     except ximian_xmlrpclib.Fault, f:
         rcd_util.dialog_from_fault(f)
         return