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


Python ScrolledWindow.set_size_request方法代码示例

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


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

示例1: __init__

# 需要导入模块: from kano.gtk3.scrolled_window import ScrolledWindow [as 别名]
# 或者: from kano.gtk3.scrolled_window.ScrolledWindow import set_size_request [as 别名]
    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:,项目名称:,代码行数:35,代码来源:

示例2: __init__

# 需要导入模块: from kano.gtk3.scrolled_window import ScrolledWindow [as 别名]
# 或者: from kano.gtk3.scrolled_window.ScrolledWindow import set_size_request [as 别名]
    def __init__(self, parser):

        # for some reason, this is not being obeyed
        self.item_width = 55
        self.item_height = 50

        self._signal_name = 'category_item_selected'
        self._parser = parser

        # Initialise self._items
        self._items = {}

        # Save the order of the categories so we can use it outside
        self.categories = self._parser.list_available_categories()
        SelectMenu.__init__(self, self.categories, self._signal_name)

        # Add the scrollbar for the category menu
        sw = ScrolledWindow()
        sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        # Set the scrollbar to the left
        sw.set_placement(Gtk.CornerType.TOP_RIGHT)
        sw.apply_styling_to_widget()
        sw.set_size_request(-1, 364)
        self.add(sw)

        self._vertbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        sw.add(self._vertbox)

        # The menu is one item by 7 items
        self.set_size_request(self.item_width, 7 * self.item_height)
        self._pack_buttons()
开发者ID:KanoComputing,项目名称:kano-profile,代码行数:33,代码来源:CategoryMenu.py

示例3: setup_application_widgets

# 需要导入模块: from kano.gtk3.scrolled_window import ScrolledWindow [as 别名]
# 或者: from kano.gtk3.scrolled_window.ScrolledWindow import set_size_request [as 别名]
    def setup_application_widgets(self):
        screen = Gdk.Screen.get_default()
        width = screen.get_width()
        height = screen.get_height()

        self.terminal = TerminalUi()
        fg_color = Gdk.Color.parse("#ffffff")[1]
        bg_color = Gdk.Color.parse("#262626")[1]
        self.terminal.set_colors(fg_color, bg_color, [])
        self.terminal.set_margin_top(10)
        self.terminal.set_margin_left(10)
        self.terminal.set_margin_right(10)

        self.spellbook = Spellbook()

        self.story = Storybook(
            width / 2 - 40,
            height - self.spellbook.HEIGHT - 2 * 44 - 10
        )
        self.story.set_margin_top(10)
        self.story.set_margin_left(10)
        self.story.set_margin_right(10)

        story_sw = ScrolledWindow()
        story_sw.apply_styling_to_screen()
        story_sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        story_sw.add(self.story)

        left_background = Gtk.EventBox()
        left_background.get_style_context().add_class("story_background")
        right_background = Gtk.EventBox()
        right_background.get_style_context().add_class("terminal_background")

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.add(vbox)

        hbox = Gtk.Box()

        vbox.pack_start(hbox, False, False, 0)
        vbox.pack_start(self.spellbook, False, False, 0)
        hbox.pack_start(left_background, False, False, 0)
        hbox.pack_start(right_background, False, False, 0)

        left_background.add(story_sw)
        right_background.add(self.terminal)

        # Allow for margin on bottom and top bar.
        self.terminal.set_size_request(
            width / 2 - 20, height - self.spellbook.HEIGHT - 2 * 44 - 20
        )
        story_sw.set_size_request(
            width / 2 - 20, height - self.spellbook.HEIGHT - 2 * 44 - 10
        )

        self.run_server()
开发者ID:RangerDan,项目名称:terminal-quest,代码行数:57,代码来源:MainWindow.py

示例4: __add_scrolled_window

# 需要导入模块: from kano.gtk3.scrolled_window import ScrolledWindow [as 别名]
# 或者: from kano.gtk3.scrolled_window.ScrolledWindow import set_size_request [as 别名]
    def __add_scrolled_window(self):
        text = Gtk.TextView()
        text.get_buffer().set_text(self.scrolled_text)
        text.set_wrap_mode(Gtk.WrapMode.WORD)
        text.set_editable(False)

        scrolledwindow = ScrolledWindow()
        scrolledwindow.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scrolledwindow.add_with_viewport(text)
        scrolledwindow.set_size_request(400, 200)
        scrolledwindow.apply_styling_to_widget(wide=False)

        return scrolledwindow
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:15,代码来源:kano_dialog.py

示例5: activate

# 需要导入模块: from kano.gtk3.scrolled_window import ScrolledWindow [as 别名]
# 或者: from kano.gtk3.scrolled_window.ScrolledWindow import set_size_request [as 别名]
def activate(_win):
    project_list = ProjectList()

    scrolledwindow = ScrolledWindow()
    scrolledwindow.apply_styling_to_widget()
    scrolledwindow.add_with_viewport(project_list.background)
    scrolledwindow.set_size_request(734, 404)

    _box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
    _box.pack_start(scrolledwindow, False, False, 0)

    _win.pack_in_main_content(_box)
    _win.show_all()
开发者ID:japonophile,项目名称:kano-profile,代码行数:15,代码来源:projects.py

示例6: __init__

# 需要导入模块: from kano.gtk3.scrolled_window import ScrolledWindow [as 别名]
# 或者: from kano.gtk3.scrolled_window.ScrolledWindow import set_size_request [as 别名]
    def __init__(self, category, avatar_parser):
        logger.debug(
            "Initialising pop up menu with category {}".format(category))

        self.top_bar_height = 50

        # Size of the selected icon
        self.button_width = 42
        self.button_height = 42

        self._category = category
        self._parser = avatar_parser
        if self._category == self._parser.char_label:
            self._signal_name = 'character_selected'
        else:
            self._signal_name = 'pop_up_item_selected'
        self._border_path = self._parser.get_selected_border(self._category)
        self._hover_path = self._parser.get_hover_border(self._category)

        obj_names = self._parser.list_avail_objs(self._category)
        SelectMenu.__init__(self, obj_names, self._signal_name)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.add(vbox)

        # Grid which the buttons are packed into
        self._grid = Gtk.Grid()

        # pack the grid into a sw of a specified height
        sw = ScrolledWindow()
        sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        sw.apply_styling_to_widget()
        sw.add(self._grid)
        sw.set_size_request(152, 294)

        # Labels the category
        top_bar = self._create_top_bar()
        vbox.pack_start(top_bar, False, False, 0)
        vbox.pack_start(sw, False, False, 10)

        self._pack_items()
        self.show_all()
开发者ID:KanoComputing,项目名称:kano-profile,代码行数:44,代码来源:PopUpItemMenu.py

示例7: _create_main_box

# 需要导入模块: from kano.gtk3.scrolled_window import ScrolledWindow [as 别名]
# 或者: from kano.gtk3.scrolled_window.ScrolledWindow import set_size_request [as 别名]
    def _create_main_box(self, network_list):
        '''Show the screen with the different WiFi networks
        '''

        heading = Heading(
            _("Connect to WiFi"),
            _("Choose a network"),
            self._win.is_plug(),
            back_btn=False
        )

        # This box is to pack everything in the window
        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        # For now, pack the network into a scrolled window
        sw = ScrolledWindow()
        sw.apply_styling_to_widget()
        sw.set_size_request(-1, 215)
        sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)

        self._network_box = self._create_network_box(network_list)
        sw.add(self._network_box)

        # Pack the scrolled window into an event box to give the illusion of a
        # border
        sw_border = self._add_border_to_widget(sw)
        sw_border.set_margin_right(30)
        sw_border.set_margin_left(30)
        sw_border.set_margin_bottom(20)
        sw_border.set_margin_top(10)

        # Then pack all the elements into the vbox
        vbox.pack_start(heading.container, False, False, 0)
        vbox.pack_start(sw_border, False, False, 0)

        # Pack in the refresh connect buttons
        button_box = self._create_refresh_connect_buttons()
        vbox.pack_end(button_box, False, False, 30)

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

示例8: __setup_application_widgets

# 需要导入模块: from kano.gtk3.scrolled_window import ScrolledWindow [as 别名]
# 或者: from kano.gtk3.scrolled_window.ScrolledWindow import set_size_request [as 别名]
    def __setup_application_widgets(self):
        screen = Gdk.Screen.get_default()

        self.__spellbook = Spellbook(is_caps_lock_on=self.__is_caps_lock_on)

        width = screen.get_width()
        height = screen.get_height()
        terminal_width, terminal_height = width / 2 - 20, height - self.__spellbook.HEIGHT - 2 * 44 - 20
        story_width, story_height = width / 2 - 20, height - self.__spellbook.HEIGHT - 2 * 44 - 10
        self.__terminal = TerminalUi(terminal_width, terminal_height)
        self.__story = Storybook(story_width, story_height)

        self.hbox = Gtk.Box()

        story_sw = ScrolledWindow()
        story_sw.apply_styling_to_screen()
        story_sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        story_sw.add(self.__story)
        story_sw.set_size_request(story_width, story_height)

        left_background = Gtk.EventBox()
        left_background.get_style_context().add_class("story_background")
        left_background.add(story_sw)

        right_background = Gtk.EventBox()
        right_background.get_style_context().add_class("terminal_background")

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.add(vbox)

        vbox.pack_start(self.hbox, False, False, 0)
        vbox.pack_start(self.__spellbook, False, False, 0)
        self.hbox.pack_start(left_background, False, False, 0)
        self.hbox.pack_start(right_background, False, False, 0)

        right_background.add(self.__terminal)
开发者ID:KanoComputing,项目名称:terminal-quest,代码行数:38,代码来源:MainWindow.py

示例9: UserListView

# 需要导入模块: from kano.gtk3.scrolled_window import ScrolledWindow [as 别名]
# 或者: from kano.gtk3.scrolled_window.ScrolledWindow import set_size_request [as 别名]
class UserListView(Gtk.Grid):
    HEIGHT = 250
    WIDTH = 1  # not important

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

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

        title = Heading(_('Select Account'),
                        _('Log in to which account?'))
        self.attach(title.container, 0, 0, 2, 1)

        self.scrolled_window = ScrolledWindow()
        self.scrolled_window.set_size_request(self.WIDTH, self.HEIGHT)
        self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.box.set_spacing(10)
        self.box.set_margin_left(10)
        self.box.set_margin_right(10)
        self.scrolled_window.add(self.box)
        self.attach(self.scrolled_window, 0, 1, 2, 1)

        self.last_username = get_last_user()
        self._populate()

        self.add_account_btn = OrangeButton(_('Add Account'))
        self.add_account_btn.connect('clicked', self._btn_add_account_pressed)
        self.attach(self.add_account_btn, 0, 2, 1, 1)

        self.shutdown_btn = OrangeButton(_('Shutdown'))
        self.shutdown_btn.connect('clicked', self._btn_shutdown_pressed)
        self.attach(self.shutdown_btn, 1, 2, 1, 1)

    def _populate(self):
        # Populate list
        user_list = KanoUserList()
        for user_name in user_list.get_users():
            logger.debug('adding user {}'.format(user_name))
            self.add_item(user_name)

    def add_item(self, username):
        user = User(username)
        self.box.pack_start(user, False, False, 0)
        if username == self.last_username:
            user.grab_focus()

    def _btn_add_account_pressed(self, event=None, button=None):
        logger.debug('opening new user dialog')
        win = self.get_toplevel()
        win.go_to_newuser()

    def _btn_shutdown_pressed(self, event=None, button=None):
        shutdown_dialog = KanoDialog(title_text='Shutting down..',
                                     description_text='Are you sure you want to shutdown your Kano now?',
                                     button_dict=[
                                         {
                                             'label': _('Cancel').upper(),
                                             'color': 'green',
                                             'return_value': False
                                         },
                                         {
                                             'label': _('SHUTDOWN').upper(),
                                             'color': 'orange',
                                             'return_value': True
                                         }
                                     ])
        shutdown_dialog.dialog.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
        poweroff = shutdown_dialog.run()

        if poweroff:
            LightDM.shutdown()
开发者ID:comuri,项目名称:kano-greeter,代码行数:74,代码来源:user_list.py

示例10: show_results

# 需要导入模块: from kano.gtk3.scrolled_window import ScrolledWindow [as 别名]
# 或者: from kano.gtk3.scrolled_window.ScrolledWindow import set_size_request [as 别名]
def show_results(msg_upgraded, msg_added, msg_removed, debian_err_packages,
                 appstate_after_nonclean, python_ok, python_err):

    # Create Gtk textiew with markdown
    text_view = Gtk.TextView()
    text_view.set_margin_top(10)
    text_view.set_margin_bottom(20)
    text_view.set_margin_left(20)
    text_view.set_margin_right(20)
    text_buffer = text_view.get_buffer()
    bold_tag = text_buffer.create_tag("bold", weight=Pango.Weight.BOLD)

    scrolled_window = ScrolledWindow()
    scrolled_window.apply_styling_to_widget()
    scrolled_window.add_with_viewport(text_view)
    scrolled_window.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
    scrolled_window.set_size_request(400, 200)

    result_dialog = kano_dialog.KanoDialog("Update result", "",
                                           widget=scrolled_window,
                                           global_style=True)
    result_dialog.dialog.set_icon_name("kano-updater")
    result_dialog.dialog.set_title("Kano Updater")

    if msg_upgraded:
        text = "\nApps upgraded:\n"
        add_text_to_end(text_buffer, text, bold_tag)
        add_text_to_end(text_buffer, msg_upgraded)

    if msg_added:
        text = "\nApps added:\n"
        add_text_to_end(text_buffer, text, bold_tag)
        add_text_to_end(text_buffer, msg_added)

    if msg_removed:
        text = "\nApps removed:\n"
        add_text_to_end(text_buffer, text, bold_tag)
        add_text_to_end(text_buffer, msg_removed)

    if debian_err_packages:
        text = "\nApps with errors:\n"
        add_text_to_end(text_buffer, text, bold_tag)
        msg_error = "{}\n".format('\n'.join(debian_err_packages))
        add_text_to_end(text_buffer, msg_error)

    if appstate_after_nonclean:
        text = "\nApps with non-clean state:\n"
        add_text_to_end(text_buffer, text, bold_tag)

        non_clean_list = '\n'.join(appstate_after_nonclean.iterkeys())
        msg_non_clean_list = non_clean_list + "\n"
        add_text_to_end(text_buffer, msg_non_clean_list)

    if python_ok:
        text = "\nPython modules upgraded:\n"
        add_text_to_end(text_buffer, text, bold_tag)

        python_modules = "{}\n".format('\n'.join(python_ok))
        add_text_to_end(text_buffer, python_modules)

    if python_err:
        text = "\nPython modules with error:\n"
        add_text_to_end(text_buffer, text, bold_tag)

        err_list = '\n'.join(python_err)
        msg_python_err = err_list + "\n"
        add_text_to_end(text_buffer, msg_python_err)

    if not (msg_upgraded or msg_added or msg_removed or debian_err_packages or
            appstate_after_nonclean or python_ok or python_err):
        add_text_to_end(text_buffer, "No updates needed this time.", bold_tag)

    result_dialog.run()
    while Gtk.events_pending():
        Gtk.main_iteration()
开发者ID:carriercomm,项目名称:kano-updater,代码行数:77,代码来源:dialogs.py


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