コード例 #1
0
    def on_notification_changed(self, sel):
        rect = self.treeview.get_allocation()
        (origin_x, origin_y) = self.treeview.window.get_origin()

        candidate_x = int(origin_x + rect.width - 10)
        candidate_y = int(self.cursor_y - 50)

        comment_width = comment.STATUS_WIDTH + comment.MAIN_ICON_SIZE
        if candidate_x > gtk.gdk.screen_width() - comment_width - 100:
            candidate_x = origin_x - comment_width - 20

        tlist, it = sel.get_selected()
        if it == None:
            return
        nid = tlist.get(it, 3)[0]
        entry = self.office.get_notification_entry(nid)
        logging.info("herf: " + entry['href'])
        has_detail = tlist.get(it, 2)[0]
        logging.debug("nid: %s" % nid)
        logging.debug("has_detail: %s" % has_detail)

        if self.comment_handler_id != None:
            gobject.source_remove(self.comment_handler_id)
            self.comment_handler_id = None

        for k in self.comments:
            if self.comments[k].window.get_property("visible") == True:
                self.comments[k].window.hide()
        if has_detail:
            status = self.office.get_status_with_nid(nid)
            if status != {}:
                logging.debug("status: %s" % status['message'])
                if not self.comments.has_key(status['post_id']):
                    self.comments[status['post_id']] = comment.Comment(
                        status['post_id'])
                    self.comments[status['post_id']].window.set_transient_for(
                        self.window)

                rect = self.comments[status['post_id']].window.get_allocation()
                if candidate_y + rect.height > utils.get_min_monitor_height(
                ) - 30:
                    logging.debug("orig candidate_y: %d" % candidate_y)
                    candidate_y = utils.get_min_monitor_height(
                    ) - rect.height - 30
                    logging.debug("modify candidate_y: %d" % candidate_y)

                logging.debug("x, y: (%d, %d)" % (candidate_x, candidate_y))
                self.comments[status['post_id']].window.move(
                    candidate_x, candidate_y)
                self.comment_handler_id = \
                    gobject.timeout_add (300, self.delay_show_comment, status['post_id'])
コード例 #2
0
ファイル: notification.py プロジェクト: evaryont/wallbox
    def on_notification_changed (self, sel):
        rect = self.treeview.get_allocation ()
        (origin_x, origin_y) = self.treeview.window.get_origin ()

        candidate_x = int (origin_x + rect.width - 10)
        candidate_y = int (self.cursor_y - 50)
        
        comment_width = comment.STATUS_WIDTH + comment.MAIN_ICON_SIZE
        if candidate_x > gtk.gdk.screen_width () - comment_width - 100:
            candidate_x = origin_x - comment_width - 20
        
        tlist, it = sel.get_selected()
        if it == None:
            return
        nid = tlist.get (it, 3)[0]
        entry = self.office.get_notification_entry (nid)
        logging.info ("herf: " + entry['href'])
        has_detail = tlist.get (it, 2)[0]
        logging.debug ("nid: %s" % nid)
        logging.debug ("has_detail: %s" % has_detail)

        if self.comment_handler_id != None:
            gobject.source_remove (self.comment_handler_id)
            self.comment_handler_id = None

        for k in self.comments:
            if self.comments[k].window.get_property ("visible") == True:
                self.comments[k].window.hide ()
        if has_detail:
            status = self.office.get_status_with_nid (nid)
            if status != {}:
                logging.debug ("status: %s" % status['message'])
                if not self.comments.has_key (status['post_id']):
                    self.comments[status['post_id']] = comment.Comment (status['post_id'])
                    self.comments[status['post_id']].window.set_transient_for (self.window)

                rect = self.comments[status['post_id']].window.get_allocation ()
                if candidate_y + rect.height > utils.get_min_monitor_height () - 30 :
                    logging.debug ("orig candidate_y: %d" % candidate_y)
                    candidate_y = utils.get_min_monitor_height () - rect.height - 30
                    logging.debug ("modify candidate_y: %d" % candidate_y)

                logging.debug ("x, y: (%d, %d)" % (candidate_x, candidate_y))
                self.comments[status['post_id']].window.move (candidate_x, candidate_y)
                self.comment_handler_id = \
                    gobject.timeout_add (300, self.delay_show_comment, status['post_id'])
コード例 #3
0
ファイル: notification.py プロジェクト: evaryont/wallbox
    def view_refresh (self, data=None):
        self.refresh_current_status ()
        self.refresh_users_icon ()
        self.refresh_notification_comments ()

        keys = [k for k in self.comments]
        for k in keys:
            self.comments[k].window.destroy ()
            del self.comments[k]

        self.scrolledwindow.set_size_request (-1, utils.get_min_monitor_height () / 3 * 2)
コード例 #4
0
    def view_refresh(self, data=None):
        self.refresh_current_status()
        self.refresh_users_icon()
        self.refresh_notification_comments()

        keys = [k for k in self.comments]
        for k in keys:
            self.comments[k].window.destroy()
            del self.comments[k]

        self.scrolledwindow.set_size_request(
            -1,
            utils.get_min_monitor_height() / 3 * 2)
コード例 #5
0
ファイル: notification.py プロジェクト: evaryont/wallbox
 def on_office_status_changed (self, status):
     link_refresh = self.builder.get_object ("link_refresh")
     if status == 1:
         #refresh
         link_refresh.set_label (_("Refreshing...."))
         self.progressbar_refresh.show ()
         self.refresh_handler_id = gobject.timeout_add (150, self._refresh_animation)
     else:
         self.view_refresh ()
         link_refresh.set_label (_("Refresh"))
         self.progressbar_refresh.hide ()
         if self.refresh_handler_id != None:
             gobject.source_remove (self.refresh_handler_id)
         self.refresh_handler_id = None
         (width, height) = self.builder.get_object ("aspectframe").size_request ()
         self.scrolledwindow.set_size_request (-1, utils.get_min_monitor_height() / 3 * 2)
コード例 #6
0
 def on_office_status_changed(self, status):
     link_refresh = self.builder.get_object("link_refresh")
     if status == 1:
         #refresh
         link_refresh.set_label(_("Refreshing...."))
         self.progressbar_refresh.show()
         self.refresh_handler_id = gobject.timeout_add(
             150, self._refresh_animation)
     else:
         self.view_refresh()
         link_refresh.set_label(_("Refresh"))
         self.progressbar_refresh.hide()
         if self.refresh_handler_id != None:
             gobject.source_remove(self.refresh_handler_id)
         self.refresh_handler_id = None
         (width,
          height) = self.builder.get_object("aspectframe").size_request()
         self.scrolledwindow.set_size_request(
             -1,
             utils.get_min_monitor_height() / 3 * 2)