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


Python buttons.KanoButton类代码示例

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


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

示例1: slide2

    def slide2(self):
        self.clear_window()
        fixed = Gtk.Fixed()

        pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
            self.media_path("world-slide.png"),
            1000,
            678
        )
        image = Gtk.Image.new_from_pixbuf(pixbuf)
        title = Gtk.Label("Kano World")
        title.get_style_context().add_class("title")
        desc = Gtk.Label(
            "Show off and share your creations to friends\n" +
            "family and other Kano users on Kano World.\n\n" +
            "Why not check it out now by clicking on the\n" +
            "icon to see what people have made today."
        )
        desc.get_style_context().add_class("description")

        next_button = KanoButton("LET'S GO")
        next_button.connect("clicked", Gtk.main_quit)

        fixed.put(image, 0, 0)
        fixed.put(title, 415, 370)
        fixed.put(desc, 310, 420)
        fixed.put(next_button, 440, 580)

        self.add(fixed)

        self.show_all()
开发者ID:KanoComputing,项目名称:kano-init-flow,代码行数:31,代码来源:main.py

示例2: __init__

    def __init__(self, win, char_creator):
        Gtk.EventBox.__init__(self)

        self._win = win

        # Should this be inherited, passed as a variable, or global?
        # Could be a member variable in window.
        # self.char_creator = self._win.get_char_creator()
        self.char_creator = char_creator
        self._win.pack_in_main_content(self.char_creator)
        self.char_creator.reset_selected_menu_items()

        save_changes_button = KanoButton(_("Save changes").upper())
        save_changes_button.connect("clicked", self.save_changes)

        discard_changes_button = OrangeButton(_("Discard").upper())
        discard_changes_button.connect("clicked", self.discard)
        discard_changes_button.set_margin_left(100)
        empty_label = Gtk.Label("")

        button_box = Gtk.ButtonBox()
        button_box.pack_start(discard_changes_button, False, False, 0)
        button_box.pack_start(save_changes_button, False, False, 0)
        button_box.pack_start(empty_label, False, False, 0)

        self._win.pack_in_bottom_bar(button_box)
        self._win.show_all()

        # Hide all the pop ups
        self.char_creator._hide_pop_ups()
开发者ID:andreiconstantinescu,项目名称:kano-profile,代码行数:30,代码来源:character_screens.py

示例3: __init__

    def __init__(self, stage, overscan_ctl, next_cb):
        super(Window2, self).__init__()

        add_class(self, 'overscan-window')

        head_img = Gtk.Image.new_from_file(stage.media_path('hint2.png'))
        box = Gtk.VBox()
        self.add(box)

        box.pack_start(head_img, False, False, 0)

        heading = Gtk.Label('Use UP and DOWN keys')
        heading.set_margin_top(25)
        heading.set_margin_bottom(25)
        add_class(heading, 'notebook-heading')
        box.pack_start(heading, False, False, 0)

        label_copy = 'Stretch or shrink your screen, until the white lines'
        text1 = Gtk.Label(label_copy)
        text1.set_margin_bottom(5)
        add_class(text1, 'notebook-text')
        box.pack_start(text1, False, False, 0)

        text2 = Gtk.Label('are lined up with the edges')
        text2.set_margin_bottom(25)
        add_class(text2, 'notebook-text')
        box.pack_start(text2, False, False, 0)

        buttons = Gtk.HBox(halign=Gtk.Align.CENTER)
        buttons.set_margin_bottom(25)
        done = KanoButton('DONE', color='green')
        buttons.pack_start(done, False, False, 0)
        done.connect('clicked', cb_wrapper, next_cb)

        box.pack_start(buttons, False, False, 0)
开发者ID:KanoComputing,项目名称:kano-init-flow,代码行数:35,代码来源:main.py

示例4: slide1

    def slide1(self):
        fixed = Gtk.Fixed()

        pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
            self.media_path("apps-slide.png"),
            1000,
            678
        )
        image = Gtk.Image.new_from_pixbuf(pixbuf)
        title1 = Gtk.Label("Get Started")
        title1.get_style_context().add_class("title")
        title2 = Gtk.Label("Apps")
        title2.get_style_context().add_class("title")
        desc = Gtk.Label(
            "Create and play with\n" +
            "Kano's Apps to make and save your\n" +
            "own code masterpieces, from games\n" +
            "and minecraft world, to art and music pieces..."
        )
        desc.get_style_context().add_class("description")

        next_button = KanoButton("NEXT")
        next_button.connect("clicked", self.slide2_wrapper)

        fixed.put(image, 0, 0)
        fixed.put(title1, 460, 40)
        fixed.put(title2, 60, 400)
        fixed.put(desc, 60, 450)
        fixed.put(next_button, 460, 580)

        self.add(fixed)

        self.show_all()
开发者ID:KanoComputing,项目名称:kano-init-flow,代码行数:33,代码来源:main.py

示例5: __init__

    def __init__(self, size_x=400, size_y=150):
        Gtk.Grid.__init__(self)

        self.set_row_spacing(10)
        self.set_column_spacing(10)

        scroll = ScrolledWindow()
        scroll.set_size_request(size_x, size_y)
        scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)

        self.edit_list_store = Gtk.ListStore(str)
        self.edit_list = Gtk.TreeView(self.edit_list_store)
        self.edit_list.set_headers_visible(False)

        renderer = Gtk.CellRendererText()
        renderer.set_property('editable', True)
        renderer.connect('edited', self._item_edited_handler)
        renderer.connect('editing-started', self._item_edit_started)
        renderer.connect('editing-canceled', self._item_edit_canceled)
        column = Gtk.TreeViewColumn(cell_renderer=renderer, text=0)
        self.edit_list.append_column(column)

        self._add_btn = KanoButton(_("ADD"))
        self._add_btn.connect('button-release-event', self.add)
        self._rm_btn = KanoButton(_("REMOVE"))
        self._set_rm_btn_state()
        self._rm_btn.connect('button-release-event', self.rm)

        scroll.add_with_viewport(self.edit_list)

        self.attach(scroll, 0, 0, 2, 1)
        self.attach(self._add_btn, 0, 1, 1, 1)
        self.attach(self._rm_btn, 1, 1, 1, 1)
开发者ID:,项目名称:,代码行数:33,代码来源:

示例6: Template

class Template(Gtk.Box):

    def __init__(
        self,
        title,
        description,
        button_text,
        is_plug=False,
        back_btn=False
    ):

        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)

        self.title = Heading(title, description, is_plug, back_btn)
        self.title.container.set_margin_bottom(0)
        self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.align = Gtk.Alignment(xscale=0, yscale=0, xalign=0.5, yalign=0.3)
        self.align.add(self.box)
        self.kano_button = KanoButton(button_text)
        self.kano_button.pack_and_align()
        self.kano_button.align.set_padding(0, 30, 0, 0)

        self.pack_start(self.title.container, False, False, 0)
        self.pack_start(self.align, True, True, 0)
        self.pack_end(self.kano_button.align, False, False, 0)

    def set_prev_callback(self, cb):
        self.title.set_prev_callback(cb)
开发者ID:,项目名称:,代码行数:28,代码来源:

示例7: KanoButtonBox

class KanoButtonBox(Gtk.Box):

    def __init__(self, kano_button_text, orange_text="", orange_text_2=""):

        Gtk.Box.__init__(self)
        self.kano_button = KanoButton(kano_button_text)

        if not orange_text == "":
            self.orange_button = OrangeButton(orange_text)
            self.pack_start(self.orange_button, False, False, 0)
            self.pack_start(self.kano_button, False, False, 0)

            if orange_text_2 == "":
                # The empty label is to centre the kano_button
                label = Gtk.Label("    ")
                self.pack_start(label, False, False, 0)
            else:
                self.orange_button2 = OrangeButton(orange_text_2)
                self.pack_start(self.orange_button2, False, False, 0)
        else:
            self.pack_start(self.kano_button, False, False, 0)

    def get_kano_button(self):
        return self.kano_button

    def set_kano_button_cb(self, cb, args=[]):
        self.kano_button.connect('button-release-event', cb, args)

    def set_orange_button_cb(self, cb, args=[]):
        self.orange_button.connect('button-release-event', cb, args)

    def set_orange_button2_cb(self, cb, args=None):
        self.orange_button2.connect('button-release-event', cb, args)
开发者ID:,项目名称:,代码行数:33,代码来源:

示例8: __init__

    def __init__(self, img_path, title, description):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)

        if img_path:
            self.image = Gtk.Image.new_from_file(img_path)
            self.pack_start(self.image, False, False, 0)
        self.heading = Heading(title, description)

        icon_path = os.path.join(MEDIA_DIR, "play-sound.png")
        self.kano_button = KanoButton(text="PLAY SOUND", color="blue",
                                      icon_filename=icon_path)
        self.kano_button.pack_and_align()
        self.kano_button.set_margin_top(10)
        self.pack_start(self.heading.container, False, False, 0)
        self.pack_start(self.kano_button.align, False, False, 0)

        button_box = Gtk.ButtonBox(spacing=15)
        button_box.set_layout(Gtk.ButtonBoxStyle.CENTER)

        self.yes_button = KanoButton("YES")
        self.yes_button.set_sensitive(False)
        self.no_button = KanoButton("NO", color="red")
        self.no_button.set_sensitive(False)
        button_box.pack_start(self.yes_button, False, False, 0)
        button_box.pack_start(self.no_button, False, False, 0)
        button_box.set_margin_bottom(5)

        self.pack_start(button_box, False, False, 15)
开发者ID:JMassapina,项目名称:kano-init-flow,代码行数:28,代码来源:audio_screen.py

示例9: third_scroll

    def third_scroll(self):
        self._clear()

        heading = Gtk.Label('New quest')
        add_class(heading, 'scroll-heading')

        world = Gtk.Image.new_from_file(self._stage.media_path('world.png'))

        copy = [
            "Journey to Kano World",
        ]
        text_widgets = self._get_text_widgets(copy)

        button = KanoButton('OK', color='orange')
        button.connect('clicked', cb_wrapper, self._stage._ctl.next_stage)

        heading.set_margin_top(35)
        self._vbox.pack_start(heading, False, False, 0)

        world.set_margin_top(35)
        self._vbox.pack_start(world, False, False, 0)

        text_widgets[0].set_margin_top(40)
        for w in text_widgets:
            self._vbox.pack_start(w, False, False, 0)

        button.set_margin_top(40)
        button.set_margin_left(80)
        button.set_margin_right(80)
        self._vbox.pack_start(button, False, False, 0)

        self.show_all()
开发者ID:KanoComputing,项目名称:kano-init-flow,代码行数:32,代码来源:main.py

示例10: first_scroll

    def first_scroll(self):
        self._clear()
        copy = [
            "Quests are a series of tasks that you",
            "can complete on your Kano to get",
            "great rewards."
        ]
        text_widgets = self._get_text_widgets(copy)

        img_path = self._stage.media_path('chest-closed.png')
        chest = Gtk.Image.new_from_file(img_path)

        button = KanoButton('NEXT', color='orange')
        button.connect('clicked', cb_wrapper, self.second_scroll)

        text_widgets[0].set_margin_top(30)
        for w in text_widgets:
            self._vbox.pack_start(w, False, False, 0)

        chest.set_margin_top(60)
        self._vbox.pack_start(chest, False, False, 0)

        button.set_margin_top(70)
        button.set_margin_left(80)
        button.set_margin_right(80)
        self._vbox.pack_start(button, False, False, 0)

        self.show_all()
开发者ID:KanoComputing,项目名称:kano-init-flow,代码行数:28,代码来源:main.py

示例11: second_scroll

    def second_scroll(self):
        self._clear()
        ticks = Gtk.Image.new_from_file(self._stage.media_path('ticks.png'))

        copy = [
            "Complete all of the ticks in a",
            "quest to unlock rewards."
        ]
        text_widgets = self._get_text_widgets(copy)

        chest = Gtk.Image.new_from_file(self._stage.media_path('chest-open.png'))

        button = KanoButton('NEXT', color='orange')
        button.connect('clicked', cb_wrapper, self.third_scroll)

        ticks.set_margin_top(20)
        self._vbox.pack_start(ticks, False, False, 0)

        text_widgets[0].set_margin_top(40)
        for w in text_widgets:
            self._vbox.pack_start(w, False, False, 0)

        chest.set_margin_top(35)
        self._vbox.pack_start(chest, False, False, 0)

        button.set_margin_top(40)
        button.set_margin_left(80)
        button.set_margin_right(80)
        self._vbox.pack_start(button, False, False, 0)

        self.show_all()
开发者ID:KanoComputing,项目名称:kano-init-flow,代码行数:31,代码来源:main.py

示例12: NewUserView

class NewUserView(Gtk.Grid):

    def __init__(self, greeter):
        Gtk.Grid.__init__(self)

        self.get_style_context().add_class('password')
        self.set_row_spacing(12)

        self.greeter = greeter

        title = Heading(_('Add new account'),
                        _('Login with Kano World\n'
                          'or create a new account.'))
        self.attach(title.container, 0, 0, 1, 1)

        # the 2 push buttons
        self.login_btn = KanoButton(_('Kano World'))
        self.login_btn.connect('clicked', self._login_button_pressed)
        self.attach(self.login_btn, 0, 1, 1, 1)

        self.newuser_btn = KanoButton(_('New Account'))
        self.newuser_btn.connect('clicked', self._new_user_reboot)
        self.attach(self.newuser_btn, 0, 2, 1, 1)

    def _login_button_pressed(self, event=None, button=None):
        win = self.get_toplevel()
        win.go_to_login_with_kw()

    def _new_user_reboot(self, event=None, button=None):
        '''
        Schedules kano-init to create a new user from scratch on next reboot,
        then performs the actual reboot
        '''
        confirm = KanoDialog(
            title_text=_('Are you sure you want to create a new account?'),
            description_text=_('A reboot will be required'),
            button_dict=[
                {
                    'label': _('Cancel').upper(),
                    'color': 'red',
                    'return_value': False
                },
                {
                    'label': _('Create').upper(),
                    'color': 'green',
                    'return_value': True
                }
            ])
        confirm.dialog.set_position(Gtk.WindowPosition.CENTER_ALWAYS)

        if confirm.run():
            os.system("sudo kano-init schedule add-user")
            LightDM.restart()
开发者ID:comuri,项目名称:kano-greeter,代码行数:53,代码来源:newuser_view.py

示例13: __init__

    def __init__(self, title, description, buttons, is_plug=False, img_path=None):
        super(Template, self).__init__(orientation=Gtk.Orientation.VERTICAL)
        self._focus_widget = None

        heading = Heading(
            title,
            description,
            is_plug,
            back_btn=False
        )
        bbox = Gtk.ButtonBox()
        bbox.set_spacing(20)
        bbox.set_layout(Gtk.ButtonBoxStyle.CENTER)
        bbox.set_margin_right(10)
        bbox.set_margin_left(10)

        for b in buttons:
            label = b["label"]

            if not label:
                gtk_button = Gtk.Label()

            else:
                button_type = b["type"]
                callback = b["callback"]

                if button_type == "KanoButton":
                    color = b["color"]
                    gtk_button = KanoButton(label, color=color)
                elif button_type == "OrangeButton":
                    gtk_button = OrangeButton(label)

                gtk_button.connect("clicked", callback)
            bbox.pack_start(gtk_button, False, False, 0)

            if "focus" in b:
                self._focus_widget = gtk_button

        self.pack_start(heading.container, False, False, 0)
        heading.container.set_margin_right(15)
        heading.container.set_margin_left(15)

        if img_path:
            image = Gtk.Image.new_from_file(img_path)

        if is_plug:
            self.pack_start(image, False, False, 10)
            self.pack_start(bbox, False, False, 30)
        else:
            self.pack_start(image, False, False, 20)
            self.pack_end(bbox, False, False, 30)

        self.show_all()
开发者ID:KanoComputing,项目名称:kano-settings,代码行数:53,代码来源:Template.py

示例14: __init__

    def __init__(self, win, title, description, original_overscan=None):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)

        self.kano_button = KanoButton("APPLY CHANGES")
        self.kano_button.connect("button-release-event", self.apply_changes)
        self.kano_button.pack_and_align()

        self.heading = Heading(title, description)
        self.pack_start(self.heading.container, False, False, 0)

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

        self.win.top_bar.enable_prev()

        # Launch pipe for the overscan c code
        launch_pipe()

        self.overscan_values = get_overscan_status()
        self.original_overscan = original_overscan

        # Pass original overscan values between the classes
        # If original_overscan hasn't been generated yet, get it from current overscan status
        # Alternatively, maybe read this from a file in future
        if original_overscan is None:
            self.original_overscan = get_overscan_status()

        # Reset button
        self.reset_button = OrangeButton()
        reset_image = Gtk.Image().new_from_file(common.media + "/Icons/reset.png")
        self.reset_button.set_image(reset_image)
        self.reset_button.connect("button_press_event", self.reset)
开发者ID:gvsurenderreddy,项目名称:kano-settings,代码行数:32,代码来源:set_display.py

示例15: _create_refresh_connect_buttons

    def _create_refresh_connect_buttons(self):
        '''Create the buttons used for the refresh button and the
        to connect to a network, and pack them into a button box.
        Returns the button box.
        '''

        self._connect_btn = KanoButton(_("CONNECT"))
        self._connect_btn.pack_and_align()
        self.connect_handler = self._connect_btn.connect(
            'clicked', self._first_time_connect
        )
        self._connect_btn.set_sensitive(False)
        self._refresh_btn = self._create_refresh_button()

        # For now, show both connect and refresh buttons
        buttonbox = Gtk.ButtonBox()
        buttonbox.set_layout(Gtk.ButtonBoxStyle.CENTER)
        buttonbox.set_spacing(10)
        buttonbox.pack_start(self._refresh_btn, False, False, 0)
        buttonbox.pack_start(self._connect_btn.align, False, False, 0)

        if self._win.is_plug():
            self._skip_btn = WhiteButton(_("Skip"))
            buttonbox.pack_start(self._skip_btn, False, False, 0)
            self._skip_btn.connect('clicked', self.skip)
        else:
            blank_label = Gtk.Label("")
            buttonbox.pack_start(blank_label, False, False, 0)

        return buttonbox
开发者ID:KanoComputing,项目名称:kano-settings,代码行数:30,代码来源:NetworkScreen.py


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