Пример #1
0
 def _fill(self):
     """ take the review data object from self.reviews and build the
         UI vbox out of them
     """
     self.logged_in_person = get_person_from_config()
     if self.reviews:
         for r in self.reviews:
             pkgversion = self._parent.app_details.version
             review = UIReview(r, pkgversion, self.logged_in_person,
                 self.useful_votes)
             self.vbox.pack_start(review, True, True, 0)
Пример #2
0
 def _fill(self):
     """ take the review data object from self.reviews and build the
         UI vbox out of them
     """
     self.logged_in_person = get_person_from_config()
     if self.reviews:
         for r in self.reviews:
             pkgversion = self._parent.app_details.version
             review = UIReview(r, pkgversion, self.logged_in_person,
                               self.useful_votes)
             self.vbox.pack_start(review, True, True, 0)
     return
Пример #3
0
 def _retrieve_votes_from_server(self):
     LOG.debug("_retrieve_votes_from_server started")
     user = get_person_from_config()
     
     if not user:
         LOG.warn("Could not get usefulness from server, no username in config file")
         return False
     
     # run the command and add watcher
     spawn_helper = SpawnHelper()
     spawn_helper.connect("data-available", self._on_usefulness_data)
     spawn_helper.run_generic_piston_helper(
         "RatingsAndReviewsAPI", "get_usefulness", username=user)
    def _retrieve_votes_from_server(self):
        LOG.debug("_retrieve_votes_from_server started")
        user = get_person_from_config()

        if not user:
            LOG.warn("Could not get usefulness from server, no username "
                "in config file")
            return False

        # run the command and add watcher
        spawn_helper = SpawnHelper()
        spawn_helper.connect("data-available", self._on_usefulness_data)
        spawn_helper.run_generic_piston_helper(
            "RatingsAndReviewsAPI", "get_usefulness", username=user)
Пример #5
0
 def _retrieve_votes_from_server(self):
     LOG.debug("_retrieve_votes_from_server started")
     user = get_person_from_config()
     
     if not user:
         LOG.warn("Could not get usefulness from server, no username in config file")
         return False
     
     # run the command and add watcher
     cmd = [os.path.join(
             softwarecenter.paths.datadir, PistonHelpers.GET_USEFUL_VOTES),
            "--username", user, 
           ]
     spawn_helper = SpawnHelper()
     spawn_helper.connect("data-available", self._on_usefulness_data)
     spawn_helper.run(cmd)
Пример #6
0
 def _retrieve_votes_from_server(self):
     LOG.debug("_retrieve_votes_from_server started")
     user = get_person_from_config()
     
     if not user:
         LOG.warn("Could not get usefulness from server, no username in config file")
         return False
     
     # run the command and add watcher
     cmd = [os.path.join(
             softwarecenter.paths.datadir, PistonHelpers.GET_USEFUL_VOTES),
            "--username", user, 
           ]
     spawn_helper = SpawnHelper()
     spawn_helper.connect("data-available", self._on_usefulness_data)
     spawn_helper.run(cmd)
Пример #7
0
    def __init__(self, parent):
        GObject.GObject.__init__(self)
        self.set_spacing(12)
        self.logged_in_person = get_person_from_config()

        self._parent = parent
        # this is a list of review data (softwarecenter.backend.reviews.Review)
        self.reviews = []
        # global review stats, this includes ratings in different languages
        self.global_review_stats = None
        # usefulness stuff
        self.useful_votes = UsefulnessCache()
        self.logged_in_person = None

        label = Gtk.Label()
        label.set_markup('<big><b>%s</b></big>' % _("Reviews"))
        label.set_use_markup(True)
        label.set_alignment(0, 0.5)

        self.header = Gtk.HBox()
        self.header.set_spacing(StockEms.MEDIUM)
        self.new_review = Gtk.Button(_('Write your own review'))

        inner_vb = Gtk.VBox()
        inner_vb.pack_start(label, False, False, 0)
        inner_vb.pack_start(self.new_review, False, False, StockEms.SMALL)

        self.header.pack_start(inner_vb, False, False, 0)
        self.pack_start(self.header, False, False, 0)

        self.vbox = Gtk.VBox()
        self.vbox.set_spacing(24)
        self.pack_start(self.vbox, True, True, 0)

        self.no_network_msg = None

        self.new_review.connect('clicked', lambda w: self.emit('new-review'))


        # ensure network state updates
        watcher = get_network_watcher()
        watcher.connect(
            "changed", lambda w,s: self._on_network_state_change())

        self.show_all()
        return
Пример #8
0
 def _fill(self):
     """ take the review data object from self.reviews and build the
         UI vbox out of them
     """
     self.logged_in_person = get_person_from_config()
     is_first_for_version = None
     if self.reviews:
         previous_review = None
         for r in self.reviews:
             pkgversion = self._parent.app_details.version
             if previous_review:
                 is_first_for_version = previous_review.version != r.version
             else:
                 is_first_for_version = True
             previous_review = r
             review = UIReview(r, pkgversion, self.logged_in_person,
                               self.useful_votes, is_first_for_version)
             review.show_all()
             self.vbox.pack_start(review, True, True, 0)
Пример #9
0
 def _fill(self):
     """ take the review data object from self.reviews and build the
         UI vbox out of them
     """
     self.logged_in_person = get_person_from_config()
     is_first_for_version = None
     if self.reviews:
         previous_review = None
         for r in self.reviews:
             pkgversion = self._parent.app_details.version
             if previous_review:
                 is_first_for_version = previous_review.version != r.version
             else:
                 is_first_for_version = True
             previous_review = r
             review = UIReview(r, pkgversion, self.logged_in_person,
                 self.useful_votes, is_first_for_version)
             review.show_all()
             self.vbox.pack_start(review, True, True, 0)
Пример #10
0
    def __init__(self, parent):
        Gtk.VBox.__init__(self)
        self.set_spacing(12)
        self.logged_in_person = get_person_from_config()

        self._parent = parent
        # this is a list of review data (softwarecenter.backend.reviews.Review)
        self.reviews = []
        # global review stats, this includes ratings in different languages
        self.global_review_stats = None
        # usefulness stuff
        self.useful_votes = UsefulnessCache()
        self.logged_in_person = None

        # add header label
        label = Gtk.Label()
        label.set_markup('<big><b>%s</b></big>' % _("Reviews"))
        label.set_padding(6, 6)
        label.set_use_markup(True)
        label.set_alignment(0, 0.5)
        self.header = Gtk.HBox()
        self.header.pack_start(label, False, False, 0)

        # header
        self.header.set_spacing(StockEms.MEDIUM)

        # review sort method
        self.sort_combo = Gtk.ComboBoxText()
        self._current_sort = 0
        for sort_method in ReviewSortMethods.REVIEW_SORT_LIST_ENTRIES:
            self.sort_combo.append_text(_(sort_method))
        self.sort_combo.set_active(self._current_sort)
        self.sort_combo.connect('changed', self._on_sort_method_changed)
        self.header.pack_end(self.sort_combo, False, False, 3)

        # change language
        self.review_language = Gtk.ComboBox()
        cell = Gtk.CellRendererText()
        self.review_language.pack_start(cell, True)
        self.review_language.add_attribute(cell, "text", COL_LANGNAME)
        self.review_language_model = Gtk.ListStore(str, str)
        for lang in get_languages():
            self.review_language_model.append((langcode_to_name(lang), lang))
        self.review_language_model.append((_('Any language'), 'any'))
        self.review_language.set_model(self.review_language_model)
        self.review_language.set_active(0)
        self.review_language.connect(
            "changed", self._on_different_review_language_clicked)
        self.header.pack_end(self.review_language, False, True, 0)

        self.pack_start(self.header, False, False, 0)
        self.reviews_info_hbox = Gtk.HBox()
        self.new_review = Link(_('Write your own review'))
        self.new_review.connect('clicked', lambda w: self.emit('new-review'))
        self.reviews_info_hbox.pack_start(self.new_review, False, False,
                                          StockEms.SMALL)
        self.pack_start(self.reviews_info_hbox, True, True, 0)
        # this is where the reviews end up
        self.vbox = Gtk.VBox()
        self.vbox.set_spacing(24)
        self.pack_end(self.vbox, True, True, 0)

        # ensure network state updates
        self.no_network_msg = None
        watcher = get_network_watcher()
        watcher.connect("changed",
                        lambda w, s: self._on_network_state_change())

        self.show_all()
Пример #11
0
 def test_save_person_to_config(self):
     from softwarecenter.utils import (save_person_to_config,
                                       get_person_from_config)
     save_person_to_config("meep")
     self.assertEqual(get_person_from_config(), "meep")
Пример #12
0
    def test_save_person_to_config(self):
        from softwarecenter.utils import save_person_to_config, get_person_from_config

        save_person_to_config("meep")
        self.assertEqual(get_person_from_config(), "meep")
Пример #13
0
    def __init__(self, parent):
        Gtk.VBox.__init__(self)
        self.set_spacing(12)
        self.logged_in_person = get_person_from_config()

        self._parent = parent
        # this is a list of review data (softwarecenter.backend.reviews.Review)
        self.reviews = []
        # global review stats, this includes ratings in different languages
        self.global_review_stats = None
        # usefulness stuff
        self.useful_votes = UsefulnessCache()
        self.logged_in_person = None

        # add header label
        label = Gtk.Label()
        label.set_markup('<big><b>%s</b></big>' % _("Reviews"))
        label.set_padding(6, 6)
        label.set_use_markup(True)
        label.set_alignment(0, 0.5)
        self.header = Gtk.HBox()
        self.header.pack_start(label, False, False, 0)

        # header
        self.header.set_spacing(StockEms.MEDIUM)

        # review sort method
        self.sort_combo = Gtk.ComboBoxText()
        self._current_sort = 0
        for sort_method in ReviewSortMethods.REVIEW_SORT_LIST_ENTRIES:
            self.sort_combo.append_text(_(sort_method))
        self.sort_combo.set_active(self._current_sort)
        self.sort_combo.connect('changed', self._on_sort_method_changed)
        self.header.pack_end(self.sort_combo, False, False, 3)

        # change language
        self.review_language = Gtk.ComboBox()
        cell = Gtk.CellRendererText()
        self.review_language.pack_start(cell, True)
        self.review_language.add_attribute(cell, "text", COL_LANGNAME)
        self.review_language_model = Gtk.ListStore(str, str)
        for lang in get_languages():
            self.review_language_model.append((langcode_to_name(lang), lang))
        self.review_language_model.append((_('Any language'), 'any'))
        self.review_language.set_model(self.review_language_model)
        self.review_language.set_active(0)
        self.review_language.connect(
            "changed", self._on_different_review_language_clicked)
        self.header.pack_end(self.review_language, False, True, 0)

        self.pack_start(self.header, False, False, 0)
        self.reviews_info_hbox = Gtk.HBox()
        self.new_review = Link(_('Write your own review'))
        self.new_review.connect('clicked', lambda w: self.emit('new-review'))
        self.reviews_info_hbox.pack_start(
            self.new_review, False, False, StockEms.SMALL)
        self.pack_start(self.reviews_info_hbox, True, True, 0)
        # this is where the reviews end up
        self.vbox = Gtk.VBox()
        self.vbox.set_spacing(24)
        self.pack_end(self.vbox, True, True, 0)

        # ensure network state updates
        self.no_network_msg = None
        watcher = get_network_watcher()
        watcher.connect(
            "changed", lambda w, s: self._on_network_state_change())

        self.show_all()