当前位置: 首页>>代码示例>>Python>>正文


Python OrangeButton.set_sensitive方法代码示例

本文整理汇总了Python中kano.gtk3.buttons.OrangeButton.set_sensitive方法的典型用法代码示例。如果您正苦于以下问题:Python OrangeButton.set_sensitive方法的具体用法?Python OrangeButton.set_sensitive怎么用?Python OrangeButton.set_sensitive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kano.gtk3.buttons.OrangeButton的用法示例。


在下文中一共展示了OrangeButton.set_sensitive方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TermsAndConditions

# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import set_sensitive [as 别名]
class TermsAndConditions(Gtk.Box):
    __gsignals__ = {
        't-and-cs-clicked': (GObject.SIGNAL_RUN_FIRST, None, ())
    }

    def __init__(self):
        Gtk.Box.__init__(self)

        self.checkbutton = Gtk.CheckButton()
        self.checkbutton.get_style_context().add_class('get_data_checkbutton')
        self.checkbutton.set_margin_left(30)

        self.tc_button = OrangeButton(_("I agree to the terms and conditions"))
        self.tc_button.connect('clicked', self._emit_t_and_c_signal)

        self.pack_start(self.checkbutton, False, False, 0)
        self.pack_start(self.tc_button, False, False, 0)

    def is_checked(self):
        return self.checkbutton.get_active()

    def _emit_t_and_c_signal(self, widget):
        self.emit('t-and-cs-clicked')

    def disable_all(self):
        self.checkbutton.set_sensitive(False)
        self.tc_button.set_sensitive(False)

    def enable_all(self):
        self.checkbutton.set_sensitive(True)
        self.tc_button.set_sensitive(True)
开发者ID:KanoComputing,项目名称:kano-profile,代码行数:33,代码来源:TermsAndConditions.py

示例2: TermsAndConditions

# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import set_sensitive [as 别名]
class TermsAndConditions(Gtk.Box):
    __gsignals__ = {
        't-and-cs-clicked': (GObject.SIGNAL_RUN_FIRST, None, ())
    }

    def __init__(self):
        Gtk.Box.__init__(self)

        self.checkbutton = Gtk.CheckButton()
        self.checkbutton.get_style_context().add_class("get_data_checkbutton")
        self.checkbutton.set_size_request(50, 50)
        self.checkbutton.set_margin_left(30)

        self.tc_button = OrangeButton(_("I agree to the terms and conditions"))
        self.tc_button.connect("clicked", self._emit_t_and_c_signal)

        tc_label = self.tc_button.label
        tc_label.set_max_width_chars(20)
        tc_label.set_line_wrap(True)

        self.pack_start(self.checkbutton, False, False, 0)
        self.pack_start(self.tc_button, False, False, 0)

    def is_checked(self):
        return self.checkbutton.get_active()

    def _emit_t_and_c_signal(self, widget):
        self.emit("t-and-cs-clicked")

    def disable_all(self):
        self.checkbutton.set_sensitive(False)
        self.tc_button.set_sensitive(False)

    def enable_all(self):
        self.checkbutton.set_sensitive(True)
        self.tc_button.set_sensitive(True)
开发者ID:japonophile,项目名称:kano-profile,代码行数:38,代码来源:TermsAndConditions.py

示例3: PageControl

# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import set_sensitive [as 别名]
class PageControl(Gtk.Alignment):

    __gsignals__ = {
        'back-button-clicked': (GObject.SIGNAL_RUN_FIRST, None, ()),
        'next-button-clicked': (GObject.SIGNAL_RUN_FIRST, None, ())
    }

    def __init__(self,
                 num_of_pages=3,
                 selected_page=1,
                 back_text=_("BACK"),
                 next_text=_("NEXT")):

        Gtk.Alignment.__init__(self, xalign=0.5, xscale=0)
        self.num_of_pages = num_of_pages
        self.selected = selected_page

        self._box = Gtk.Box()
        self.add(self._box)

        # The back button has subtly different styling to the next button
        # When the back button is disabled, it goes invisible, while
        # the NEXT button goes grey.
        self._back_button = OrangeButton(back_text)
        self._back_button.connect('clicked', self.back_button_clicked)
        attach_cursor_events(self._back_button)

        self._next_button = OrangeButton(next_text)
        self._next_button.connect('clicked', self.next_button_clicked)
        attach_cursor_events(self._next_button)

        self.dot_box = Gtk.Box()
        self._create_progress_dots(self.selected)
        self._box.pack_start(self._back_button, False, False, 40)
        self._box.pack_start(self.dot_box, False, False, 0)
        self._box.pack_start(self._next_button, False, False, 40)

        if self.selected == 1:
            self._back_button.set_sensitive(False)
        if self.selected == self.num_of_pages:
            self._next_button.set_sensitive(False)

        # self.connect('next-button-clicked', self.select_dot)
        # self.connect('back-button-clicked', self.select_dot)

    @property
    def back_button(self):
        return self._back_button

    @property
    def next_button(self):
        return self._next_button

    def disable_buttons(self):
        self._next_button.set_sensitive(False)
        self._back_button.set_sensitive(False)

    def enable_buttons(self):
        self._next_button.set_sensitive(True)
        self._back_button.set_sensitive(True)

    def enable_next(self):
        self._next_button.set_sensitive(True)

    def enable_back(self):
        self._back_button.set_sensitive(True)

    def disable_next(self):
        self._next_button.set_sensitive(False)

    def disable_back(self):
        self._back_button.set_sensitive(False)

    def set_back_button_text(self, text):
        self._back_button.set_label(text)

    def set_next_button_text(self, text):
        self._next_button.set_label(text)

    def get_back_button(self):
        return self._back_button

    def get_next_button(self):
        return self._next_button

    # TODO: these are expanding to fill the parent container.
    def _create_progress_dots(self, index):
        '''Index is a number from1 to 3, and represents which is
        the selected dot (i.e selected page number)
        '''

        logger.debug("Creating dots")

        for child in self.dot_box.get_children():
            self.dot_box.remove(child)

        for i in range(self.num_of_pages):
            if i + 1 == index:
                dot = self.selected_dot()
                dot.set_margin_left(3)
#.........这里部分代码省略.........
开发者ID:KanoComputing,项目名称:kano-profile,代码行数:103,代码来源:PageControl.py

示例4: ParentalConfig

# 需要导入模块: from kano.gtk3.buttons import OrangeButton [as 别名]
# 或者: from kano.gtk3.buttons.OrangeButton import set_sensitive [as 别名]

#.........这里部分代码省略.........
            (
                Gtk.Label("Medium Settings"),
                Gtk.Label("Use safe DNS servers to filter all traffic")
            ),
            (
                Gtk.Label("High Settings"),
                Gtk.Label("Enable all filters and restrict search engine access")
            ),
            (
                Gtk.Label("Ultimate Settings"),
                Gtk.Label("Only allow access to Kano World activities")
            )
        ]

        self.blacklist_button = OrangeButton("Configure allowed/blocked")
        self.blacklist_button.connect("button-press-event",
                                      self.go_to_blacklist)

        self._value_change_handler(self.parental_level)

        parental_level_grid = Gtk.Grid()
        parental_level_grid.attach(self.parental_level, 0, 0, 1, 7)
        parental_level_grid.attach(self._parental_labels[3][0], 1, 0, 1, 1)
        parental_level_grid.attach(self._parental_labels[3][1], 1, 1, 1, 1)
        parental_level_grid.attach(self._parental_labels[2][0], 1, 2, 1, 1)
        parental_level_grid.attach(self._parental_labels[2][1], 1, 3, 1, 1)
        parental_level_grid.attach(self._parental_labels[1][0], 1, 4, 1, 1)
        parental_level_grid.attach(self._parental_labels[1][1], 1, 5, 1, 1)
        parental_level_grid.attach(self._parental_labels[0][0], 1, 6, 1, 1)
        parental_level_grid.attach(self._parental_labels[0][1], 1, 7, 1, 1)

        self.box.set_spacing(20)
        self.box.pack_start(parental_level_grid, False, False, 0)
        self.box.pack_start(self.blacklist_button, False, False, 0)

        self.win = win
        self.win.set_main_widget(self)

        self.set_prev_callback(self.go_to_advanced)
        self.win.change_prev_callback(self.win.go_to_home)
        self.win.top_bar.enable_prev()

        self.kano_button.connect('button-release-event', self.apply_changes)
        self.kano_button.connect('key-release-event', self.apply_changes)
        self.win.show_all()

    def go_to_advanced(self, widget):
        from kano_settings.set_advanced import SetAdvanced

        self.win.clear_win()
        SetAdvanced(self.win)

    def apply_changes(self, button, event):
        pw_dialog = ParentalPasswordDialog(self.win)
        if not pw_dialog.verify():
            return

        level = self.parental_level.get_value()
        set_parental_level(level)
        set_setting('Parental-level', level)

        # track which parental control level people use
        track_data("parental-control-level-changed", {
            "level": level
        })

        if level == 3.0:
            # If on the highest parental control, prompt user to relaunch
            # the browser
            kdialog = KanoDialog(
                title_text='Settings',
                description_text=("If any browsers are open, please relaunch "
                                  "them for this setting to take effect"),
                parent_window=self.win
            )
            kdialog.run()

        else:
            # Only reboot for the lower parental controls
            common.need_reboot = True

        self.win.go_to_home()

    def go_to_blacklist(self, button, event):
        self.win.clear_win()
        AllowedSites(self.win)

    def _value_change_handler(self, gtk_range):
        for level, (title, desc) in enumerate(self._parental_labels):
            style_title = title.get_style_context()
            style_desc = desc.get_style_context()
            if gtk_range.get_value() == level:
                style_title.add_class('parental_activated')
                style_desc.add_class('parental_desc_activated')
                self.blacklist_button.set_sensitive(not level == 3.0)
            else:
                style_title.remove_class('parental_activated')
                style_title.add_class('normal_label')
                style_desc.remove_class('parental_desc_activated')
                style_desc.add_class('normal_label')
开发者ID:gvsurenderreddy,项目名称:kano-settings,代码行数:104,代码来源:parental_config.py


注:本文中的kano.gtk3.buttons.OrangeButton.set_sensitive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。