1. asypost
  2. Sina weibo

Commits

asypost  committed fd9290f

remove custom alert,tooltip

  • Participants
  • Parent commits a5401bd
  • Branches master

Comments (0)

Files changed (4)

File core/view.py

View file
     def __connect_signals(self):
         self.connect("navigation-requested",self.on_navigation_requested)
         self.connect("new-window-policy-decision-requested",self.on_new_window_requested)
-        self.connect("script-alert",self.on_script_alert)
+        #self.connect("script-alert",self.on_script_alert)
         self.connect("load-finished",self.on_load_finished)
-        self.connect("hovering-over-link",self.on_over_link)
+        #self.connect("hovering-over-link",self.on_over_link)
         self.connect("title-changed",self.on_title_changed)
     
     def __uri_protocol(self,uri):

File core/view_pywebkit.py

View file
     def __connect_signals(self):
         self.connect("navigation-requested",self.on_navigation_requested)
         self.connect("new-window-policy-decision-requested",self.on_new_window_requested)
-        self.connect("script-alert",self.on_script_alert)
+        #self.connect("script-alert",self.on_script_alert)
         self.connect("load-finished",self.on_load_finished)
-        self.connect("hovering-over-link",self.on_over_link)
+        #self.connect("hovering-over-link",self.on_over_link)
         self.connect("title-changed",self.on_title_changed)
     
     def __uri_protocol(self,uri):

File ui.py

View file
         response_json=json.dumps({"request_id":request.id,"data":response})
         self.weibo_view.execute_script("Native.Contact.pendingResponse({0})".format(response_json))
 
-    def handle_request_async(self,client,request):
-        data=client.do_request(request)
+    def handle_request_async(self,request,func):
+        data=func(**request.params)
         return request,data
 
     def handle_uri(self,uri,*args,**kwargs):
             try:
                 if action:
                     if isinstance(action,AsyncAttribute):
-                        async(self.handle_request_async)(action)(**args)
+                        async(self.pending_response)(self.handle_request_async)(request,action)
                     else:
-                        data= getattr(self,action)(**args)
+                        data= getattr(self,action)(**request.params)
                         self.pending_response(request,data)
             except Exception as e:
-                logger.error("Call {0}({1}) error:{2}".format(action,args,e))
+                logger.error("Call {0}({1}) error:{2}".format(action,request.params,e))
 
     def is_support(self,uri):
         ret=False
         image_view.show_all()
 
     @debug
-    def alert(self,message=None):
-        if not message:return True
-        dialog=Gtk.MessageDialog(self.main_window,Gtk.DialogFlags.DESTROY_WITH_PARENT,
-                          Gtk.MessageType.INFO,Gtk.ButtonsType.OK,message)
-        dialog.set_title(_("Sina micorblog"))
-        dialog.run()
-        dialog.destroy()
-        return True
-
-    @debug
     def show_authorize_dialog(self,auhorize_url,code_url):
         logger.debug("start Authorize dialog")
         dialog=AuthorizeDialog(self.main_window)

File ui_pygtk.py

View file
         response_json=json.dumps({"request_id":request.id,"data":response})
         self.weibo_view.execute_script("Native.Contact.pendingResponse({0})".format(response_json))
 
-    def handle_request_async(self,client,request):
-        data=client.do_request(request)
+    def handle_request_async(self,request,func):
+        data=func(**request.params)
         return request,data
 
     def handle_uri(self,uri,*args,**kwargs):
         if self.is_support(uri):
             request=Request.from_uri(uri)
-            args=request.params
             action_array=request.path[len(self.protocol):].split("/")
             action=action_array[0] if action_array else None
             try:
                 if action:
                     if isinstance(action,AsyncAttribute):
-                        async(self.handle_request_async)(action)(**args)
+                        async(self.pending_response)(self.handle_request_async)(request,action)
                     else:
-                        data= getattr(self,action)(**args)
+                        data= getattr(self,action)(**request.params)
                         self.pending_response(request,data)
             except Exception as e:
-                logger.error("Call {0}({1}) error:{2}".format(action,args,e))
+                logger.error("Call {0}({1}) error:{2}".format(action,request.params,e))
 
     def is_support(self,uri):
         ret=False