def init_user_info_thread(self, button, text_view): '''get user name thread''' time.sleep(0.1) for weibo in self.__weibo_list: self.get_user_info(weibo) gtk.gdk.threads_enter() #self.share_box.set_sensitive(True) button.set_sensitive(True) text_view.set_editable(True) for weibo in self.__weibo_list: weibo.get_box().show_all() weibo.get_box().queue_draw() self.loading_label.destroy() gtk.gdk.threads_leave()
def get_user_info(self, weibo): '''get weibo user info''' info = weibo.get_user_name() gtk.gdk.threads_enter() #self.get_user_error_text = "" weibo_hbox = weibo.get_box() hbox = gtk.HBox(False) vbox = gtk.VBox(False) weibo_hbox.pack_start(vbox, False, False) vbox.pack_start(hbox) #print weibo.t_type, info if info: self.is_get_user_info[weibo] = 1 label = Label(text=info, label_width=70, enable_select=False) check = CheckButton() #check = gtk.CheckButton() check.connect("toggled", self.weibo_check_toggle, weibo) check.set_active(True) check_vbox = gtk.VBox(False) check_align = gtk.Alignment(0.5, 0.5, 0, 0) check_align.add(check_vbox) check_vbox.pack_start(check, False, False) button = ImageButton( app_theme.get_pixbuf("share/" + weibo.t_type + ".png"), app_theme.get_pixbuf("share/" + weibo.t_type + ".png"), app_theme.get_pixbuf("share/" + weibo.t_type + ".png")) utils.set_clickable_cursor(button) button.connect("enter-notify-event", self.show_tooltip, _("Click to switch user")) hbox.pack_start(check_align, False, False) hbox.pack_start(button, False, False, 5) hbox.pack_start(label, False, False) else: self.is_get_user_info[weibo] = 0 check = CheckButton() #check = gtk.CheckButton() check.set_sensitive(False) check_vbox = gtk.VBox(False) check_align = gtk.Alignment(0.5, 0.5, 0, 0) check_align.add(check_vbox) check_vbox.pack_start(check, False, False) button = ImageButton( app_theme.get_pixbuf("share/" + weibo.t_type + "_no.png"), app_theme.get_pixbuf("share/" + weibo.t_type + "_no.png"), app_theme.get_pixbuf("share/" + weibo.t_type + "_no.png")) utils.set_clickable_cursor(button) button.connect("enter-notify-event", self.show_tooltip, _("Click to login")) hbox.pack_start(check_align, False, False) hbox.pack_start(button, False, False, 5) # curl time out info_error = weibo.get_curl_error() if info_error: #self.get_user_error_text += "%s:%s." % (weibo.t_type, _(info_error)) hbox.pack_start( Label(text="(%s)" % _(info_error), label_width=70,enable_select=False, text_color = app_theme.get_color("left_char_num1")), False, False) button.connect("clicked", self.weibo_login, weibo) self.__weibo_check_button_list.append(check) self.__weibo_image_button_list.append(button) gtk.gdk.threads_leave() return weibo_hbox
def get_user_info(self, weibo): '''get weibo user info''' info = weibo.get_user_name() gtk.gdk.threads_enter() #self.get_user_error_text = "" weibo_hbox = weibo.get_box() hbox = gtk.HBox(False) vbox = gtk.VBox(False) weibo_hbox.pack_start(vbox, False, False) vbox.pack_start(hbox) #print weibo.t_type, info if info: self.is_get_user_info[weibo] = 1 label = Label(text=info, label_width=70, enable_select=False) check = CheckButton() #check = gtk.CheckButton() check.connect("toggled", self.weibo_check_toggle, weibo) check.set_active(True) check_vbox = gtk.VBox(False) check_align = gtk.Alignment(0.5, 0.5, 0, 0) check_align.add(check_vbox) check_vbox.pack_start(check, False, False) button = ImageButton( app_theme.get_pixbuf("share/" + weibo.t_type + ".png"), app_theme.get_pixbuf("share/" + weibo.t_type + ".png"), app_theme.get_pixbuf("share/" + weibo.t_type + ".png")) utils.set_clickable_cursor(button) button.connect("enter-notify-event", self.show_tooltip, _("Click to switch user")) hbox.pack_start(check_align, False, False) hbox.pack_start(button, False, False, 5) hbox.pack_start(label, False, False) else: self.is_get_user_info[weibo] = 0 check = CheckButton() #check = gtk.CheckButton() check.set_sensitive(False) check_vbox = gtk.VBox(False) check_align = gtk.Alignment(0.5, 0.5, 0, 0) check_align.add(check_vbox) check_vbox.pack_start(check, False, False) button = ImageButton( app_theme.get_pixbuf("share/" + weibo.t_type + "_no.png"), app_theme.get_pixbuf("share/" + weibo.t_type + "_no.png"), app_theme.get_pixbuf("share/" + weibo.t_type + "_no.png")) utils.set_clickable_cursor(button) button.connect("enter-notify-event", self.show_tooltip, _("Click to login")) hbox.pack_start(check_align, False, False) hbox.pack_start(button, False, False, 5) # curl time out info_error = weibo.get_curl_error() if info_error: #self.get_user_error_text += "%s:%s." % (weibo.t_type, _(info_error)) hbox.pack_start( Label(text="(%s)" % _(info_error), label_width=70,enable_select=False, text_color = ui_theme.get_color("category_item")), False, False) button.connect("clicked", self.weibo_login, weibo) self.__weibo_check_button_list.append(check) self.__weibo_image_button_list.append(button) gtk.gdk.threads_leave() return weibo_hbox