Exemple #1
0
        def __init__(self, parent, services, media):

            wx.Panel.__init__(self, parent)

            self._services = services

            self._media = media

            self._service_keys_to_controls = {}
            self._service_keys_to_original_ratings_states = {}

            rows = []

            for service in self._services:

                name = service.GetName()

                service_key = service.GetServiceKey()

                (rating_state,
                 rating) = ClientRatings.GetNumericalStateFromMedia(
                     self._media, service_key)

                control = ClientGUICommon.RatingNumericalDialog(
                    self, service_key)

                if rating_state != ClientRatings.SET:

                    control.SetRatingState(rating_state)

                else:

                    control.SetRating(rating)

                self._service_keys_to_controls[service_key] = control
                self._service_keys_to_original_ratings_states[service_key] = (
                    rating_state, rating)

                rows.append((name + ': ', control))

            gridbox = ClientGUICommon.WrapInGrid(self, rows, expand_text=True)

            self.SetSizer(gridbox)
Exemple #2
0
    def __init__(self, parent):

        PanelPredicateSystem.__init__(self, parent)

        #

        local_like_services = HydrusGlobals.client_controller.GetServicesManager(
        ).GetServices((HC.LOCAL_RATING_LIKE, ), randomised=False)

        self._like_checkboxes_to_info = {}

        self._like_rating_ctrls = []

        gridbox_like = wx.FlexGridSizer(0, 4)

        gridbox_like.AddGrowableCol(0, 1)

        for service in local_like_services:

            name = service.GetName()
            service_key = service.GetServiceKey()

            rated_checkbox = wx.CheckBox(self, label='rated')
            not_rated_checkbox = wx.CheckBox(self, label='not rated')
            rating_ctrl = ClientGUICommon.RatingLikeDialog(self, service_key)

            self._like_checkboxes_to_info[rated_checkbox] = (service_key,
                                                             ClientRatings.SET)
            self._like_checkboxes_to_info[not_rated_checkbox] = (
                service_key, ClientRatings.NULL)
            self._like_rating_ctrls.append(rating_ctrl)

            gridbox_like.AddF(wx.StaticText(self, label=name), CC.FLAGS_MIXED)
            gridbox_like.AddF(rated_checkbox, CC.FLAGS_MIXED)
            gridbox_like.AddF(not_rated_checkbox, CC.FLAGS_MIXED)
            gridbox_like.AddF(rating_ctrl, CC.FLAGS_MIXED)

        #

        local_numerical_services = HydrusGlobals.client_controller.GetServicesManager(
        ).GetServices((HC.LOCAL_RATING_NUMERICAL, ), randomised=False)

        self._numerical_checkboxes_to_info = {}

        self._numerical_rating_ctrls_to_info = {}

        gridbox_numerical = wx.FlexGridSizer(0, 5)

        gridbox_numerical.AddGrowableCol(0, 1)

        for service in local_numerical_services:

            name = service.GetName()
            service_key = service.GetServiceKey()

            rated_checkbox = wx.CheckBox(self, label='rated')
            not_rated_checkbox = wx.CheckBox(self, label='not rated')
            choice = wx.Choice(self, choices=['>', '<', '=', u'\u2248'])
            rating_ctrl = ClientGUICommon.RatingNumericalDialog(
                self, service_key)

            choice.Select(2)

            self._numerical_checkboxes_to_info[rated_checkbox] = (
                service_key, ClientRatings.SET)
            self._numerical_checkboxes_to_info[not_rated_checkbox] = (
                service_key, ClientRatings.NULL)
            self._numerical_rating_ctrls_to_info[rating_ctrl] = choice

            gridbox_numerical.AddF(wx.StaticText(self, label=name),
                                   CC.FLAGS_MIXED)
            gridbox_numerical.AddF(rated_checkbox, CC.FLAGS_MIXED)
            gridbox_numerical.AddF(not_rated_checkbox, CC.FLAGS_MIXED)
            gridbox_numerical.AddF(choice, CC.FLAGS_MIXED)
            gridbox_numerical.AddF(rating_ctrl, CC.FLAGS_MIXED)

        #

        vbox = wx.BoxSizer(wx.VERTICAL)

        vbox.AddF(gridbox_like, CC.FLAGS_EXPAND_SIZER_BOTH_WAYS)
        vbox.AddF(gridbox_numerical, CC.FLAGS_EXPAND_SIZER_BOTH_WAYS)

        self.SetSizer(vbox)